3 # Script for nightly builds of conkeror .debs
5 # Inspired by an idea of Nicholas A. Zigarovich <nick@servo.cc>
6 # Code by Axel Beckert <abe@deuxchevaux.org>
8 # Copyright (C) 2009, 2010 Axel Beckert <abe@deuxchevaux.org>
10 # Needs the following Debian packages and their dependencies installed
11 # (besides "required" packages like coreutils and conkeror build
12 # dependencies) to work: devscripts, git-core
14 # If you want to use all features of this script, you need also the
15 # following packages: gnupg, openssh-client, dctrl-tools, gzip, bzip2
17 # And on the machine hosting the APT repository, you'll need the
20 # If you do only binary rebuilds for other architectures, you need to
21 # have the nightly builds APT repository in your /etc/apt/sources.list
22 # because we fetch the source package with
27 # Create the file ~/.conkeror-nightlybuildrc and write at least two
28 # lines like the following into it:
30 # WORKDIR=/path/to/the/directory/where/the/builds/should/happen
31 # CONTACT=you@example.com
33 # Example ~/.conkeror-nightlybuildrc similar to the one used for the
34 # initial builds on http://noone.org/conkeror-nightly-debs/:
37 # WORKDIR=$HOME/conkeror.nightly
38 # CONTACT=abe+conkeror-nightly@noone.org
41 # UPLOAD_SSH_KEY=~/.ssh/id_rsa.conkeror-nightly
42 # UPLOAD_SSH_HOST=noone.org
44 # UPLOAD_SSH_DIR=http/htdocs/conkeror-nightly
47 # Example ~/.conkeror-nightlybuildrc similar to the one used for
48 # binary-only builds of conkeror-spawn-process-helper on
49 # http://noone.org/conkeror-nightly-debs/:
52 # WORKDIR=$HOME/conkeror.nightly
53 # CONTACT=abe+conkeror-nightly@noone.org
56 # UPLOAD_SSH_KEY=~/.ssh/id_rsa.conkeror-nightly
57 # UPLOAD_SSH_HOST=noone.org
59 # UPLOAD_SSH_DIR=http/htdocs/conkeror-nightly
61 # BINARY_ONLY_BUILD=yes
62 # SOURCES_LIST_URL=http://noone.org/conkeror-nightly-debs/dists/lenny/main/source/Sources.gz
64 # I think the remaining variable names are quite self-explaining. If
65 # not, look at this script's source code (you're doing that already
66 # ;-) and see where they're used. It's not too hard, the script is
67 # fairly small and straight forward. ;-)
69 # Bail out on any error.
72 # Check for the the config file and read it
73 RCFILE
=$HOME/.conkeror-nightlybuildrc
74 if [ ! -s $RCFILE ]; then
75 echo "$RCFILE does not exist or is empty"
80 # Check if a working directory is defined. Bail out if not.
81 if [ -z "$WORKDIR" ]; then
82 echo '$WORKDIR must be defined in '$RCFILE
86 # Check if a contact is defined. Set a dummy value if not.
87 if [ -z "$CONTACT" ]; then
88 CONTACT
=package-builder-has-not-set-contact-address@example.com
91 # Check if $WORKDIR exists, otherwise create it.
92 if [ ! -d "$WORKDIR" ]; then
96 # Define places and version number
97 MASTERDIR
=$WORKDIR/MASTER
98 BUILDDIR
=$WORKDIR/BUILD
108 # If we just rebuild a nightly snapshot for a new architecture, we
109 # fetch the list of source packages, extract the file name of the
110 # conkeror package out of it and download the appropriate conkeror
111 # source package with dget.
112 if [ "$BINARY_ONLY_BUILD" = "yes" ]; then
115 # Download Sources file
116 SOURCEENC
="${SOURCES_LIST_URL##*.}"
117 if [ -n "$SOURCEENC" ]; then
118 SOURCESTMPENC
=`mktemp`
119 wget
-O $SOURCESTMPENC "$SOURCES_LIST_URL";
120 if [ "$SOURCEENC" = "gz" ]; then
121 zcat
$SOURCESTMPENC > $SOURCESTMP
122 elif [ "$SOURCEENC" = "bz2" ]; then
123 bzcat
$SOURCESTMPENC > $SOURCESTMP
125 echo Unsupported suffix
$SOURCEENC in "$SOURCES_LIST_URL" 1>&2
128 rm -vf $SOURCESTMPENC
130 wget
-O $SOURCESTMP "$SOURCES_LIST_URL";
133 # Find package in Sources file
135 grep-dctrl
-S conkeror
$SOURCESTMP | sort-dctrl
-k Version
:v
- | \
136 grep-dctrl
-s Checksums-Sha256
,Directory conkeror
- > $INFOTMP
139 # Calculate source package URL
140 BASE_URL
="`echo \"$SOURCES_LIST_URL\" | sed -e 's:/dists/.*$::'`"
141 POOL_DIR
="`grep '^Directory:' $INFOTMP | awk '{print $2}'`"
142 DSC
="${BASE_URL}/${POOL_DIR}/`grep '\.dsc$' $INFOTMP | awk '{print $3}'`"
144 # Download source package
148 # Determine the correct version
149 RELEASE
="`gpg < \"${DSC##*/}\" 2>&1 | grep-dctrl -s Version conkeror - | \
151 VERSION
="`echo \"$RELEASE\" | sed -e 's/-.*$//'`"
152 DATEDIR
="$BUILDDIR/conkeror-$VERSION"
156 # Check if MASTER directory exists, if not, create it (untested code!)
158 if [ ! -d $MASTERDIR ]; then
159 git clone git
://repo.or.cz
/conkeror.git
$MASTERDIR
166 # Determine the correct version
167 VERSION
=`grep ^Version= $MASTERDIR/application.ini | \
168 sed -e 's/^Version=//'`+git
`date +%y%m%d`
169 RELEASE
="$VERSION-~nightlybuild$UNIXTIME"
170 DATEDIR
="$BUILDDIR/conkeror-$VERSION"
172 # Copy tree into build environment
173 cp -priv $MASTERDIR $DATEDIR
177 tar cvzf conkeror_
$VERSION.orig.
tar.gz
--exclude=.git conkeror-
$VERSION
179 # Add an appropriate changelog entry
181 mv changelog changelog.tmp
183 echo "conkeror ($RELEASE) UNRELEASED; urgency=low
185 * Automatically built package based on the state of
186 http://repo.or.cz/w/conkeror.git at $DATE
188 -- Conkeror Nightly Build <$CONTACT> $DATE
190 cat changelog.tmp
>> changelog
194 # Set the right options for debuild (signed vs unsigned packages)
195 DEBUILDOPTIONS
='-uc -us'
196 if [ ! -z "$SIGNKEY" ]; then
197 DEBUILDOPTIONS
="-k$SIGNKEY"
202 debuild
$DEBUILDOPTIONS $WHATTOBUILD -i'(?:^|/).*~$|(?:^|/)\.#.*$|(?:^|/)\..*\.swp$|(?:^|/),,.*(?:$|/.*$)|(?:^|/)(?:DEADJOE|\.cvsignore|\.arch-inventory|\.bzrignore|\.gitignore|\.hgignore)$|(?:^|/)(?:CVS|RCS|\.deps|\{arch\}|\.arch-ids|\.svn|\.hg|_darcs|\.git|\.shelf|_MTN|\.bzr(?:\.backup|tags)|update\.sh)(?:$|/.*$)'
207 if [ "$UPLOAD" = "yes" ]; then
208 if [ "$BINARY_ONLY_BUILD" = "yes" ]; then
209 scp
-i $UPLOAD_SSH_KEY -p *build
*deb
*changes \
210 $UPLOAD_SSH_USER@
$UPLOAD_SSH_HOST:$UPLOAD_SSH_DIR
211 if [ "$USE_REPREPRO" = "yes" ]; then
212 ssh -i $UPLOAD_SSH_KEY $UPLOAD_SSH_USER@
$UPLOAD_SSH_HOST \
213 "cd $UPLOAD_SSH_DIR; reprepro -v includedeb lenny" *.deb
"; reprepro -v includedeb sid" *.deb
";"
216 scp
-i $UPLOAD_SSH_KEY -p *build
*deb
*changes
*dsc
*gz \
217 $UPLOAD_SSH_USER@
$UPLOAD_SSH_HOST:$UPLOAD_SSH_DIR
219 if [ "$USE_REPREPRO" = "yes" ]; then
220 ssh -i $UPLOAD_SSH_KEY $UPLOAD_SSH_USER@
$UPLOAD_SSH_HOST \
221 "cd $UPLOAD_SSH_DIR; reprepro -v includedeb lenny" *.deb
"; reprepro -v includedeb sid" *.deb
"; reprepro -v includedsc lenny " *.dsc
"; reprepro -v includedsc sid " *.dsc
";"