#! /bin/sh force=false prep=false rel=false enough=false until $enough; do case $1 in -f | --force) force=:; shift;; -p | --prep) prep=:; shift;; -r | --release) rel=:; shift;; "") cat >&2 << EOF usage: branch [extra [gnu [rel]]] as in 2.6.31 .10 2 0 for 2.6.31 .10-gnu2_0loongsonlibre args may be preceded by --prep, --force, and/or --release EOF exit 1 ;; *) enough=true;; esac done branch=$1 extra=$2 libre=$3 rev=${4-0}loongsonlibre case $extra in "" | -rc*) extra0=.0$extra;; *) extra0=$extra;; esac branchdir=$1 librebase=$branch$extra-gnu$libre srcbase=linux-libre-$librebase.tar.xz pub=../pool buildnorev=$branch$extra0-gnu$libre buildid=${buildnorev}_${rev} srctree=linux-$buildid xsrctree=linux-$branch$extra srclink=linux-unpatched-source-${buildid}_mipsel.tar.xz patches=linux-patches-${buildid}_mipsel.tar.xz buildtb=linux-build-${buildid}_mipsel.tar.xz svnbase=`svn info | sed -n 's,^URL: \(.*\)/branches,\1,p'` svnbranches=$svnbase/branches svntags=$svnbase/tags PATH=/usr/lib/ccache:$PATH set -e -x exec > $srctree.log : further output on $srctree.log exec 2>&1 test -d $branchdir/.svn test -f $pub/debuginfo/$srcbase test ! -h $srclink || $rel || $force test ! -f $patches || $rel || $force test ! -f $buildtb || $rel || $force test ! -d $srctree || $rel || $force test ! -d $xsrctree || $rel || $force for f in $pub/*$buildid*; do test -f $f || test -d $f || continue $force rm -f $f done $rel || { rm -rf $srctree $xsrctree $srclink $patches $buildtb || : ln -s $pub/debuginfo/$srcbase $srclink ln $pub/debuginfo/$srcbase.sign $srclink.sign tar -xf $srclink --use=xz if $prep; then rm $srclink $srclink.sign srctree=$xsrctree ln -s ../$branchdir $srctree/.patches else test -d $xsrctree mv $xsrctree $srctree tar -cvf $patches -C $branchdir --use=xz --exclude=.svn . mkdir $srctree/.patches tar -C $srctree/.patches -xf $patches --use=xz fi ln -s .patches $srctree/patches cd $srctree quilt push config.patch make-kpkg --rootcmd fakeroot --initrd --revision $rev debian if quilt next; then quilt push -a fi find .pc -perm 000 -print0 | xargs --no-run-if-empty -0 chmod 400 if $prep; then make oldconfig quilt refresh exit fi mv debian `pwd`.debian make-kpkg --rootcmd fakeroot --initrd --revision $rev \ --overlay-dir `pwd`.debian \ kernel-image kernel-headers kernel-doc kernel-source rm -rf `pwd`.debian cd .. tar -cf $buildtb -C $srctree --use=xz --exclude=debian/linux-*$buildnorev . echo build is done, type ^C to stop, or Enter to move, commit and tag $buildid read proceed } # $rel rm -f $pub/*$buildid*.deb $pub/debuginfo/*$buildid*.tar.xz $srclink || : ln -s $srcbase $pub/debuginfo/$srclink mv *$buildid*.tar.xz* $pub/debuginfo mv *$buildid*.deb $pub cd $branchdir && svn commit -m "$buildid" && svn cp -m "$buildid" $svnbranches/$branchdir $svntags/$buildid && cd .. || { status=$? echo failed to commit or tag $buildid >&2 exit $status }