Newer
Older
#!/bin/sh
# Usage:
# - define exp_srcpkg to the expected source package name
# - define srcdir to $(dirname $0)
# - source this
current_testing=buster
if [ -z "$exp_srcpkg" ]
then
echo "Do not call this script directly, use the build-thunderbird or build-firefox scripts"
exit 1
fi
srcpkg=$(dpkg-parsechangelog -S Source 2> /dev/null)
if [ -z "$srcpkg" ]
then
echo "This script is only meant to be run from a Debian source directory"
exit 1
fi
# Check that package matches called script
if [ "$srcpkg" != $exp_srcpkg ]
then
echo This script is only meant to be run from a $exp_srcpkg Debian source directory
exit 1
fi
# Get package version
version=$(dpkg-parsechangelog -S Version)
mainversion=${version%%.*}
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
# drop any previous hypra patch list
sed -i -e '/^# hypra/,$d' debian/patches/series
# drop any previous hypra changelog
case $version in
*+hypra*)
version=${version%+hypra*}
sed -i -e "1,/^$/d" -e "1,/^$/d" -e "1,/^$/d" debian/changelog
;;
*) ;;
esac
# check for patch series file
if [ ! -f "$srcdir/series-$mainversion" ]
then
echo We need to update the patch series to version $mainversion
exit 2
fi
dist=$(dpkg-parsechangelog -S Distribution)
# start new changelog entry
dch --newversion $version+hypra$(cat "$srcdir/version") "Hypra-patched upload"
# start patch series
echo "# hypra" >> debian/patches/series
# feed patches
for i in $(cat "$srcdir/series-$mainversion")
do
# Avoid commented patches
case $i in
\#*) continue ;;
*) ;;
esac
cp -f "$srcdir/patches-$mainversion/$i" debian/patches/
echo "$i" >> debian/patches/series
dch "$(head -n 1 "debian/patches/$i")"
done
# Drop spurious distribution name bits
case $dist in
*-security)
dist=${dist%-security}
;;
*)
;;
esac
builddist=$dist
case $dist in
unstable)
# We want to build unstable in a testing chroot
builddist=$current_testing
;;
*)
;;
esac
dch -r -D $dist ""
# create or update pbuilder chroot
basetgz=/var/cache/pbuilder/base-$builddist.tgz
if [ ! -f $basetgz ]
then
if ! sudo pbuilder create --distribution $builddist --basetgz $basetgz --othermirror "deb http://security.debian.org/debian-security $builddist/updates main" ; then
echo "couldn't create chroot"
exit 1
fi
if ! sudo pbuilder update --basetgz $basetgz ; then
echo "couldn't update chroot"
exit 1
fi
fi
DEB_BUILD_OPTIONS="nocheck noddebs parallel=64" pdebuild --debbuildopts -B -- --basetgz "$basetgz"