summaryrefslogtreecommitdiffstats
path: root/lemote/gnewsense/branches/build
blob: 6fca576c550422dbfe89c3907884bf205b3328a1 (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
123
124
125
126
127
128
129
130
131
132
#! /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
} 
OpenPOWER on IntegriCloud