summaryrefslogtreecommitdiffstats
path: root/lemote/gnewsense/branches/build
blob: 337f37466195020bb1154f89196c469e28790602 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#! /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

branchdir=$1
librebase=$branch$extra-gnu$libre
srcbase=linux-libre-$librebase.tar.bz2
pub=../pool
buildnorev=$branch${extra:-.0}-gnu$libre
buildid=${buildnorev}_${rev}
srctree=linux-$buildid
xsrctree=linux-$branch$extra
srclink=linux-unpatched-source-${buildid}_mipsel.tar.bz2
patches=linux-patches-${buildid}_mipsel.tar.bz2
buildtb=linux-build-${buildid}_mipsel.tar.bz2
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/$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/$srcbase $srclink
tar -xf $srclink --use=bzip2
if $prep; then
  rm $srclink
  srctree=$xsrctree
  ln -s ../$branchdir $srctree/.patches
else
  test -d $xsrctree
  mv $xsrctree $srctree

  tar -cvf $patches -C $branchdir --use=bzip2 --exclude=.svn .

  mkdir $srctree/.patches
  tar -C $srctree/.patches -xf $patches --use=bzip2
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
  false
fi

make-kpkg --rootcmd fakeroot --initrd --revision $rev \
  kernel-image kernel-headers kernel-doc kernel-source
cd ..

tar -cf $buildtb -C $srctree --use=bzip2 --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/*$buildid*.tar.bz2 $srclink || :
ln -s $srcbase $pub/$srclink
mv $buildtb $pub/debuginfo/
mv *$buildid*.deb *$buildid*.tar.bz2 $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
} 
OpenPOWER on IntegriCloud