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-2011 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 do _not_
21 # need to have the nightly builds APT repository in your
22 # /etc/apt/sources.list since we fetch the Sources list manually,
23 # parse it with grep-dctrl and fetch the source package with dget.
28 # Create the file ~/.conkeror-nightlybuildrc and write at least two
29 # lines like the following into it:
31 # WORKDIR=/path/to/the/directory/where/the/builds/should/happen
32 # CONTACT=you@example.com
34 # Example ~/.conkeror-nightlybuildrc similar to the one used for the
35 # initial builds on http://noone.org/conkeror-nightly-debs/:
38 # WORKDIR=$HOME/conkeror.nightly
39 # CONTACT=abe+conkeror-nightly@noone.org
42 # UPLOAD_SSH_KEY=~/.ssh/id_rsa.conkeror-nightly
43 # UPLOAD_SSH_HOST=noone.org
45 # UPLOAD_SSH_DIR=http/htdocs/conkeror-nightly
48 # Example ~/.conkeror-nightlybuildrc similar to the one used for
49 # binary-only builds of conkeror-spawn-process-helper on
50 # http://noone.org/conkeror-nightly-debs/:
53 # WORKDIR=$HOME/conkeror.nightly
54 # CONTACT=abe+conkeror-nightly@noone.org
57 # UPLOAD_SSH_KEY=~/.ssh/id_rsa.conkeror-nightly
58 # UPLOAD_SSH_HOST=noone.org
60 # UPLOAD_SSH_DIR=http/htdocs/conkeror-nightly
62 # BINARY_ONLY_BUILD=yes
63 # SOURCES_LIST_URL=http://noone.org/conkeror-nightly-debs/dists/lenny/main/source/Sources.gz
65 # I think the remaining variable names are quite self-explaining. If
66 # not, look at this script's source code (you're doing that already
67 # ;-) and see where they're used. It's not too hard, the script is
68 # fairly small and straight forward. ;-)
70 # Bail out on any error.
73 # Check for the the config file and read it
74 RCFILE
=$HOME/.conkeror-nightlybuildrc
75 if [ ! -s $RCFILE ]; then
76 echo "$RCFILE does not exist or is empty"
81 # Check if a working directory is defined. Bail out if not.
82 if [ -z "$WORKDIR" ]; then
83 echo '$WORKDIR must be defined in '$RCFILE
87 # Check if a contact is defined. Set a dummy value if not.
88 if [ -z "$CONTACT" ]; then
89 CONTACT
=package-builder-has-not-set-contact-address@example.com
92 # Check if $WORKDIR exists, otherwise create it.
93 if [ ! -d "$WORKDIR" ]; then
97 # Define places and version number
98 MASTERDIR
=$WORKDIR/MASTER
99 BUILDDIR
=$WORKDIR/BUILD
101 ZULUTIME
=`date -u +%y%m%d%H%M`
109 # If we just rebuild a nightly snapshot for a new architecture, we
110 # fetch the list of source packages, extract the file name of the
111 # conkeror package out of it and download the appropriate conkeror
112 # source package with dget.
113 if [ "$BINARY_ONLY_BUILD" = "yes" ]; then
116 # Download Sources file
117 SOURCEENC
="${SOURCES_LIST_URL##*.}"
118 if [ -n "$SOURCEENC" ]; then
119 SOURCESTMPENC
=`mktemp`
120 wget
-O $SOURCESTMPENC "$SOURCES_LIST_URL";
121 if [ "$SOURCEENC" = "gz" ]; then
122 zcat
$SOURCESTMPENC > $SOURCESTMP
123 elif [ "$SOURCEENC" = "bz2" ]; then
124 bzcat
$SOURCESTMPENC > $SOURCESTMP
126 echo Unsupported suffix
$SOURCEENC in "$SOURCES_LIST_URL" 1>&2
129 rm -vf $SOURCESTMPENC
131 wget
-O $SOURCESTMP "$SOURCES_LIST_URL";
134 # Find package in Sources file
136 grep-dctrl
-S conkeror
$SOURCESTMP | sort-dctrl
-k Version
:v
- | \
137 grep-dctrl
-s Checksums-Sha256
,Directory conkeror
- > $INFOTMP
140 # Calculate source package URL
141 BASE_URL
="`echo \"$SOURCES_LIST_URL\" | sed -e 's:/dists/.*$::'`"
142 POOL_DIR
="`grep '^Directory:' $INFOTMP | awk '{print $2}'`"
143 DSC
="${BASE_URL}/${POOL_DIR}/`grep '\.dsc$' $INFOTMP | awk '{print $3}'`"
145 # Download source package
149 # Determine the correct version
150 RELEASE
="`gpg < \"${DSC##*/}\" 2>&1 | grep-dctrl -s Version conkeror - | \
152 VERSION
="`echo \"$RELEASE\" | sed -e 's/-.*$//'`"
153 DATEDIR
="$BUILDDIR/conkeror-$VERSION"
157 # Check if MASTER directory exists, if not, create it (untested code!)
159 if [ ! -d $MASTERDIR ]; then
160 git clone git
://repo.or.cz
/conkeror.git
$MASTERDIR
167 # Determine the correct version
168 VERSION
=`grep ^Version= $MASTERDIR/application.ini | \
169 sed -e 's/^Version=//;s/\(pre\)/~~\1/;s/\(rc\|b\|a\)/~\1/'`+git
$ZULUTIME
170 RELEASE
="$VERSION-~nightly1"
171 DATEDIR
="$BUILDDIR/conkeror-$VERSION"
173 # Copy tree into build environment
174 cp -priv $MASTERDIR $DATEDIR
178 tar cvzf conkeror_
$VERSION.orig.
tar.gz
--exclude=.git conkeror-
$VERSION
180 # Add an appropriate changelog entry
182 mv changelog changelog.tmp
184 echo "conkeror ($RELEASE) UNRELEASED; urgency=low
186 * Automatically built package based on the state of
187 http://repo.or.cz/w/conkeror.git at $DATE
189 -- Conkeror Nightly Build <$CONTACT> $DATE
191 cat changelog.tmp
>> changelog
195 # Set the right options for debuild (signed vs unsigned packages)
196 DEBUILDOPTIONS
='-uc -us'
197 if [ ! -z "$SIGNKEY" ]; then
198 DEBUILDOPTIONS
="-k$SIGNKEY"
203 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)(?:$|/.*$)'
208 if [ "$UPLOAD" = "yes" ]; then
209 if [ "$BINARY_ONLY_BUILD" = "yes" ]; then
210 scp
-i $UPLOAD_SSH_KEY -p *build
*deb
*changes \
211 $UPLOAD_SSH_USER@
$UPLOAD_SSH_HOST:$UPLOAD_SSH_DIR
212 if [ "$USE_REPREPRO" = "yes" ]; then
213 ssh -i $UPLOAD_SSH_KEY $UPLOAD_SSH_USER@
$UPLOAD_SSH_HOST \
214 "cd $UPLOAD_SSH_DIR; reprepro -v includedeb lenny" *.deb
"; reprepro -v includedeb sid" *.deb
";"
217 scp
-i $UPLOAD_SSH_KEY -p *build
*deb
*changes
*dsc
*gz \
218 $UPLOAD_SSH_USER@
$UPLOAD_SSH_HOST:$UPLOAD_SSH_DIR
220 if [ "$USE_REPREPRO" = "yes" ]; then
221 ssh -i $UPLOAD_SSH_KEY $UPLOAD_SSH_USER@
$UPLOAD_SSH_HOST \
222 "cd $UPLOAD_SSH_DIR; reprepro -v includedeb lenny" *.deb
"; reprepro -v includedeb sid" *.deb
"; reprepro -v includedsc lenny " *.dsc
"; reprepro -v includedsc sid " *.dsc
";"