]> git.decadent.org.uk Git - dak.git/blob - config/debian/dinstall.functions
Add changelog generation code in dinstall
[dak.git] / config / debian / dinstall.functions
1 # -*- mode:sh -*-
2 # Timestamp. Used for dinstall stat graphs
3 function ts() {
4         echo "Archive maintenance timestamp ($1): $(date +%H:%M:%S)"
5 }
6
7 # Cleanup actions
8 function cleanup() {
9         rm -f ${LOCK_DAILY}
10         rm -f ${LOCK_ACCEPTED}
11 }
12
13 # If we error out this one is called, *FOLLOWED* by cleanup above
14 function onerror() {
15     ERRDATE=$(date "+%Y.%m.%d-%H:%M:%S")
16
17     subject="ATTENTION ATTENTION!"
18     if [ "${error}" = "false" ]; then
19         subject="${subject} (continued)"
20     else
21         subject="${subject} (interrupted)"
22     fi
23     subject="${subject} dinstall error at ${ERRDATE} in ${STAGEFILE} - (Be quiet, Brain, or I'll stab you with a Q-tip)"
24
25     cat "${STAGEFILE}.log" | mail -s "${subject}" -a "X-Debian: DAK" cron@ftp-master.debian.org
26 }
27
28 ########################################################################
29 # the actual dinstall functions follow                                 #
30 ########################################################################
31
32 # pushing merkels QA user, part one
33 function merkel1() {
34     log "Telling merkels QA user that we start dinstall"
35     ssh -2 -i ~dak/.ssh/push_merkel_qa  -o BatchMode=yes -o SetupTimeOut=90 -o ConnectTimeout=90 qa@qa.debian.org sleep 1
36 }
37
38 # Create the postgres dump files
39 function pgdump_pre() {
40     log "Creating pre-daily-cron-job backup of $PGDATABASE database..."
41     pg_dump > $base/backup/dump_pre_$(date +%Y.%m.%d-%H:%M:%S)
42 }
43
44 function pgdump_post() {
45     log "Creating post-daily-cron-job backup of $PGDATABASE database..."
46     cd $base/backup
47     POSTDUMP=$(date +%Y.%m.%d-%H:%M:%S)
48     pg_dump > $base/backup/dump_$POSTDUMP
49     #pg_dumpall --globals-only > $base/backup/dumpall_$POSTDUMP
50     ln -sf $base/backup/dump_$POSTDUMP current
51     #ln -sf $base/backup/dumpall_$POSTDUMP currentall
52 }
53
54 # Load the dak-dev projectb
55 function pgdakdev() {
56     # Make sure to unset any possible psql variables so we don't drop the wrong
57     # f****** database by accident
58     local PGDATABASE
59     unset PGDATABASE
60     local PGHOST
61     unset PGHOST
62     local PGPORT
63     unset PGPORT
64     local PGUSER
65     unset PGUSER
66     cd $base/backup
67     echo "drop database projectb" | psql -p 5434 template1
68         #cat currentall | psql -p 5433 template1
69     createdb -p 5434 -T template1 projectb
70     fgrep -v '\connect' current | psql -p 5434 projectb
71 }
72
73 # Updating various files
74 function updates() {
75     log "Updating Bugs docu, Mirror list and mailing-lists.txt"
76     cd $configdir
77     $scriptsdir/update-bugdoctxt
78     $scriptsdir/update-mirrorlists
79     $scriptsdir/update-mailingliststxt
80     $scriptsdir/update-pseudopackages.sh
81 }
82
83 # Process (oldstable)-proposed-updates "NEW" queue
84 function punew_do() {
85     date -u -R >> REPORT
86     dak process-policy $1 | tee -a REPORT | mail -e -s "NEW changes in $1" debian-release@lists.debian.org
87     echo >> REPORT
88 }
89 function punew() {
90     log "Doing automated p-u-new processing"
91     cd "${queuedir}/p-u-new"
92     punew_do "$1"
93 }
94 function opunew() {
95     log "Doing automated o-p-u-new processing"
96     cd "${queuedir}/o-p-u-new"
97     punew_do "$1"
98 }
99
100 # The first i18n one, syncing new descriptions
101 function i18n1() {
102     log "Synchronizing i18n package descriptions"
103     # First sync their newest data
104     cd ${scriptdir}/i18nsync
105     rsync -aq --delete --delete-after ddtp-sync:/does/not/matter . || true
106
107     # Now check if we still know about the packages for which they created the files
108     # is the timestamp signed by us?
109     if $(gpgv --keyring /srv/ftp-master.debian.org/s3kr1t/dot-gnupg/pubring.gpg timestamp.gpg timestamp); then
110         # now read it. As its signed by us we are sure the content is what we expect, no need
111         # to do more here. And we only test -d a directory on it anyway.
112         TSTAMP=$(cat timestamp)
113         # do we have the dir still?
114         if [ -d ${scriptdir}/i18n/${TSTAMP} ]; then
115             # Lets check!
116             if ${scriptsdir}/ddtp-i18n-check.sh . ${scriptdir}/i18n/${TSTAMP}; then
117                 # Yay, worked, lets copy around
118                 for dir in squeeze sid; do
119                     if [ -d dists/${dir}/ ]; then
120                         cd dists/${dir}/main/i18n
121                         rsync -aq --delete --delete-after  . ${ftpdir}/dists/${dir}/main/i18n/.
122                     fi
123                     cd ${scriptdir}/i18nsync
124                 done
125             else
126                 echo "ARRRR, bad guys, wrong files, ARRR"
127                 echo "Arf, Arf, Arf, bad guys, wrong files, arf, arf, arf" | mail -s "Don't you kids take anything. I'm watching you. I've got eye implants in the back of my head." debian-l10n-devel@lists.alioth.debian.org
128             fi
129         else
130             echo "ARRRR, missing the timestamp ${TSTAMP} directory, not updating i18n, ARRR"
131             echo "Arf, Arf, Arf, missing the timestamp ${TSTAMP} directory, not updating i18n, arf, arf, arf" | mail -s "Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way." debian-l10n-devel@lists.alioth.debian.org
132         fi
133     else
134         echo "ARRRRRRR, could not verify our timestamp signature, ARRR. Don't mess with our files, i18n guys, ARRRRR."
135         echo "Arf, Arf, Arf, could not verify our timestamp signature, arf. Don't mess with our files, i18n guys, arf, arf, arf" | mail -s "You can't keep blaming yourself. Just blame yourself once, and move on." debian-l10n-devel@lists.alioth.debian.org
136     fi
137 }
138
139 function cruft() {
140     log "Checking for cruft in overrides"
141     dak check-overrides
142 }
143
144 function dominate() {
145     log "Removing obsolete source and binary associations"
146     dak dominate
147 }
148
149 function filelist() {
150     log "Generating file lists for apt-ftparchive"
151     dak generate-filelist
152 }
153
154 function fingerprints() {
155     log "Not updating fingerprints - scripts needs checking"
156
157     log "Updating fingerprints"
158     dak import-keyring -L /srv/keyring.debian.org/keyrings/debian-keyring.gpg
159
160     OUTFILE=$(mktemp)
161     dak import-keyring --generate-users "%s" /srv/keyring.debian.org/keyrings/debian-maintainers.gpg >"${OUTFILE}"
162
163     if [ -s "${OUTFILE}" ]; then
164         /usr/sbin/sendmail -odq -oi -t -f envelope@ftp-master.debian.org <<EOF
165 From: Debian FTP Masters <ftpmaster@ftp-master.debian.org>
166 To: <debian-project@lists.debian.org>
167 Subject: Debian Maintainers Keyring changes
168 Content-Type: text/plain; charset=utf-8
169 MIME-Version: 1.0
170
171 The following changes to the debian-maintainers keyring have just been activated:
172
173 $(cat $OUTFILE)
174
175 Debian distribution maintenance software,
176 on behalf of the Keyring maintainers
177
178 EOF
179     fi
180     rm -f "$OUTFILE"
181 }
182
183 function overrides() {
184     log "Writing overrides into text files"
185     cd $overridedir
186     dak make-overrides
187
188     # FIXME
189     rm -f override.sid.all3
190     for i in main contrib non-free main.debian-installer; do cat override.sid.$i >> override.sid.all3; done
191 }
192
193 function mpfm() {
194     log "Generating package / file mapping"
195     dak make-pkg-file-mapping | bzip2 -9 > $base/ftp/indices/package-file.map.bz2
196 }
197
198 function packages() {
199     log "Generating Packages and Sources files"
200     cd $configdir
201     GZIP='--rsyncable' ; export GZIP
202     #apt-ftparchive generate apt.conf
203     dak generate-packages-sources
204 }
205
206 function pdiff() {
207     log "Generating pdiff files"
208     dak generate-index-diffs
209 }
210
211 function release() {
212     log "Generating Release files"
213     dak generate-releases
214 }
215
216 function dakcleanup() {
217     log "Cleanup old packages/files"
218     dak clean-suites -m 10000
219     dak clean-queues
220 }
221
222 function buildd_dir() {
223     # Rebuilt the buildd dir to avoid long times of 403
224     log "Regenerating the buildd incoming dir"
225     STAMP=$(date "+%Y%m%d%H%M")
226     make_buildd_dir
227 }
228
229 function mklslar() {
230     cd $ftpdir
231
232     FILENAME=ls-lR
233
234     log "Removing any core files ..."
235     find -type f -name core -print0 | xargs -0r rm -v
236
237     log "Checking permissions on files in the FTP tree ..."
238     find -type f \( \! -perm -444 -o -perm +002 \) -ls
239     find -type d \( \! -perm -555 -o -perm +002 \) -ls
240
241     log "Checking symlinks ..."
242     symlinks -rd .
243
244     log "Creating recursive directory listing ... "
245     rm -f .${FILENAME}.new
246     TZ=UTC ls -lR > .${FILENAME}.new
247
248     if [ -r ${FILENAME}.gz ] ; then
249         mv -f ${FILENAME}.gz ${FILENAME}.old.gz
250         mv -f .${FILENAME}.new ${FILENAME}
251         rm -f ${FILENAME}.patch.gz
252         zcat ${FILENAME}.old.gz | diff -u - ${FILENAME} | gzip --rsyncable -9cfn - >${FILENAME}.patch.gz
253         rm -f ${FILENAME}.old.gz
254     else
255         mv -f .${FILENAME}.new ${FILENAME}
256     fi
257
258     gzip --rsyncable -9cfN ${FILENAME} >${FILENAME}.gz
259     rm -f ${FILENAME}
260 }
261
262 function mkmaintainers() {
263     log 'Creating Maintainers index ... '
264
265     cd $indices
266     dak make-maintainers ${scriptdir}/masterfiles/pseudo-packages.maintainers | \
267         sed -e "s/~[^  ]*\([   ]\)/\1/"  | \
268         awk '{printf "%-20s ", $1; for (i=2; i<=NF; i++) printf "%s ", $i; printf "\n";}' > .new-maintainers
269
270     if ! cmp -s .new-maintainers Maintainers || [ ! -f Maintainers ]; then
271             log "installing Maintainers ... "
272             mv -f .new-maintainers Maintainers
273             gzip --rsyncable -9v <Maintainers >.new-maintainers.gz
274             mv -f .new-maintainers.gz Maintainers.gz
275     else
276         rm -f .new-maintainers
277     fi
278 }
279
280 function mkuploaders() {
281     log 'Creating Uploaders index ... '
282
283     cd $indices
284     dak make-maintainers -u ${scriptdir}/masterfiles/pseudo-packages.maintainers | \
285         sed -e "s/~[^  ]*\([   ]\)/\1/"  | \
286         awk '{printf "%-20s ", $1; for (i=2; i<=NF; i++) printf "%s ", $i; printf "\n";}' > .new-uploaders
287
288     if ! cmp -s .new-uploaders Uploaders || [ ! -f Uploaders ]; then
289             log "installing Uploaders ... "
290             mv -f .new-uploaders Uploaders
291             gzip --rsyncable -9v <Uploaders >.new-uploaders.gz
292             mv -f .new-uploaders.gz Uploaders.gz
293     else
294         rm -f .new-uploaders
295     fi
296 }
297
298 function copyoverrides() {
299     log 'Copying override files into public view ...'
300
301     for ofile in $copyoverrides ; do
302             cd $overridedir
303             chmod g+w override.$ofile
304
305             cd $indices
306
307             newofile=override.$ofile.gz
308             rm -f .newover-$ofile.gz
309             pc="`gzip 2>&1 -9nv <$overridedir/override.$ofile >.newover-$ofile.gz`"
310         if ! cmp -s .newover-$ofile.gz $newofile || [ ! -f $newofile ]; then
311                     log "   installing new $newofile $pc"
312                     mv -f .newover-$ofile.gz $newofile
313                     chmod g+w $newofile
314         else
315                     rm -f .newover-$ofile.gz
316             fi
317     done
318 }
319
320 function mkfilesindices() {
321     umask 002
322     cd $base/ftp/indices/files/components
323
324     ARCHLIST=$(tempfile)
325
326     log "Querying $PGDATABASE..."
327     echo 'SELECT l.path, f.filename, a.arch_string FROM location l JOIN files f ON (f.location = l.id) LEFT OUTER JOIN (binaries b JOIN architecture a ON (b.architecture = a.id)) ON (f.id = b.file)' | psql -At | sed 's/|//;s,^/srv/ftp-master.debian.org/ftp,.,' | sort >$ARCHLIST
328
329     includedirs () {
330         perl -ne 'print; while (m,/[^/]+$,) { $_=$`; print $_ . "\n" unless $d{$_}++; }'
331     }
332     poolfirst () {
333         perl -e '@nonpool=(); while (<>) { if (m,^\./pool/,) { print; } else { push @nonpool, $_; } } print for (@nonpool);'
334     }
335
336     log "Generating sources list"
337     (
338         sed -n 's/|$//p' $ARCHLIST
339         cd $base/ftp
340         find ./dists -maxdepth 1 \! -type d
341         find ./dists \! -type d | grep "/source/"
342     ) | sort -u | gzip --rsyncable -9 > source.list.gz
343
344     log "Generating arch lists"
345
346     ARCHES=$( (<$ARCHLIST sed -n 's/^.*|//p'; echo amd64) | grep . | grep -v all | sort -u)
347     for a in $ARCHES; do
348         (sed -n "s/|$a$//p" $ARCHLIST
349             sed -n 's/|all$//p' $ARCHLIST
350
351             cd $base/ftp
352             find ./dists -maxdepth 1 \! -type d
353             find ./dists \! -type d | grep -E "(proposed-updates.*_$a.changes$|/main/disks-$a/|/main/installer-$a/|/Contents-$a|/binary-$a/)"
354         ) | sort -u | gzip --rsyncable -9 > arch-$a.list.gz
355     done
356
357     log "Generating suite lists"
358
359     suite_list () {
360         printf 'SELECT DISTINCT l.path, f.filename FROM (SELECT sa.source AS source FROM src_associations sa WHERE sa.suite = %d UNION SELECT b.source AS source FROM bin_associations ba JOIN binaries b ON (ba.bin = b.id) WHERE ba.suite = %d) s JOIN dsc_files df ON (s.source = df.source) JOIN files f ON (df.file = f.id) JOIN location l ON (f.location = l.id)\n' $1 $1 | psql -F' ' -A -t
361
362         printf 'SELECT l.path, f.filename FROM bin_associations ba JOIN binaries b ON (ba.bin = b.id) JOIN files f ON (b.file = f.id) JOIN location l ON (f.location = l.id) WHERE ba.suite = %d\n' $1 | psql -F' ' -A -t
363     }
364
365     printf 'SELECT id, suite_name FROM suite\n' | psql -F' ' -At |
366     while read id suite; do
367         [ -e $base/ftp/dists/$suite ] || continue
368         (
369             (cd $base/ftp
370                 distname=$(cd dists; readlink $suite || echo $suite)
371                 find ./dists/$distname \! -type d
372                 for distdir in ./dists/*; do
373                     [ "$(readlink $distdir)" != "$distname" ] || echo $distdir
374                 done
375             )
376             suite_list $id | tr -d ' ' | sed 's,^/srv/ftp-master.debian.org/ftp,.,'
377         ) | sort -u | gzip --rsyncable -9 > suite-${suite}.list.gz
378     done
379
380     log "Finding everything on the ftp site to generate sundries"
381     (cd $base/ftp; find . \! -type d \! -name 'Archive_Maintenance_In_Progress' | sort) >$ARCHLIST
382
383     rm -f sundries.list
384     zcat *.list.gz | cat - *.list | sort -u |
385     diff - $ARCHLIST | sed -n 's/^> //p' > sundries.list
386
387     log "Generating files list"
388
389     for a in $ARCHES; do
390         (echo ./project/trace; zcat arch-$a.list.gz source.list.gz) |
391         cat - sundries.list dists.list project.list docs.list indices.list |
392         sort -u | poolfirst > ../arch-$a.files
393     done
394
395     (cd $base/ftp/
396             for dist in sid squeeze; do
397                     find ./dists/$dist/main/i18n/ \! -type d | sort -u | gzip --rsyncable -9 > $base/ftp/indices/files/components/translation-$dist.list.gz
398             done
399     )
400
401     (cat ../arch-i386.files ../arch-amd64.files; zcat suite-proposed-updates.list.gz ; zcat translation-sid.list.gz ; zcat translation-squeeze.list.gz) |
402     sort -u | poolfirst > ../typical.files
403
404     rm -f $ARCHLIST
405     log "Done!"
406 }
407
408 function mkchecksums() {
409     dsynclist=$dbdir/dsync.list
410     md5list=$indices/md5sums
411
412     log -n "Creating md5 / dsync index file ... "
413
414     cd "$ftpdir"
415     ${bindir}/dsync-flist -q generate $dsynclist --exclude $dsynclist --md5
416     ${bindir}/dsync-flist -q md5sums $dsynclist | gzip -9n --rsyncable > ${md5list}.gz
417     ${bindir}/dsync-flist -q link-dups $dsynclist || true
418 }
419
420 function mirror() {
421     log "Regenerating \"public\" mirror/ hardlink fun"
422     DATE_SERIAL=$(date +"%Y%m%d01")
423     FILESOAPLUS1=$(awk '/serial/ { print $3+1 }' ${TRACEFILE} )
424     if [ "$DATE_SERIAL" -gt "$FILESOAPLUS1" ]; then
425         SERIAL="$DATE_SERIAL"
426     else
427         SERIAL="$FILESOAPLUS1"
428     fi
429     date -u > ${TRACEFILE}
430     echo "Using dak v1" >> ${TRACEFILE}
431     echo "Running on host: $(hostname -f)" >> ${TRACEFILE}
432     echo "Archive serial: ${SERIAL}" >> ${TRACEFILE}
433     cd ${mirrordir}
434     rsync -aH --link-dest ${ftpdir} --delete --delete-after --ignore-errors ${ftpdir}/. .
435 }
436
437 function expire() {
438     log "Expiring old database dumps..."
439     cd $base/backup
440     $scriptsdir/expire_dumps -d . -p -f "dump_*"
441 }
442
443 function transitionsclean() {
444     log "Removing out of date transitions..."
445     cd $base
446     dak transitions -c -a
447 }
448
449 function reports() {
450     # Send a report on NEW/BYHAND packages
451     log "Nagging ftpteam about NEW/BYHAND packages"
452     dak queue-report | mail -e -s "NEW and BYHAND on $(date +%D)" ftpmaster@ftp-master.debian.org
453     # and one on crufty packages
454     log "Sending information about crufty packages"
455     dak cruft-report > $webdir/cruft-report-daily.txt
456     dak cruft-report -s experimental >> $webdir/cruft-report-daily.txt
457     cat $webdir/cruft-report-daily.txt | mail -e -s "Debian archive cruft report for $(date +%D)" ftpmaster@ftp-master.debian.org
458 }
459
460 function dm() {
461     log "Updating DM html page"
462     $scriptsdir/dm-monitor >$webdir/dm-uploaders.html
463 }
464
465 function bts() {
466     log "Categorizing uncategorized bugs filed against ftp.debian.org"
467     dak bts-categorize
468 }
469
470 function merkel2() {
471     # Push dak@merkel so it syncs the projectb there. Returns immediately, the sync runs detached
472     log "Trigger merkel/flotows $PGDATABASE sync"
473     ssh -2 -o BatchMode=yes -o SetupTimeOut=30 -o ConnectTimeout=30 -i ~/.ssh/push_merkel_projectb dak@merkel.debian.org sleep 1
474     # Also trigger flotow, the ftpmaster test box
475     ssh -2 -o BatchMode=yes -o SetupTimeOut=30 -o ConnectTimeout=30 -i ~/.ssh/push_flotow_projectb dak@flotow.debconf.org sleep 1
476 }
477
478 function merkel3() {
479     # Push dak@merkel to tell it to sync the dd accessible parts. Returns immediately, the sync runs detached
480     log "Trigger merkels dd accessible parts sync"
481     ssh -2 -o BatchMode=yes -o SetupTimeOut=30 -o ConnectTimeout=30 -i ~/.ssh/push_merkel_ddaccess dak@merkel.debian.org sleep 1
482 }
483
484 function mirrorpush() {
485     log "Starting the mirrorpush"
486     date -u > /srv/ftp.debian.org/web/mirrorstart
487     echo "Using dak v1" >> /srv/ftp.debian.org/web/mirrorstart
488     echo "Running on host $(hostname -f)" >> /srv/ftp.debian.org/web/mirrorstart
489     sudo -H -u archvsync /home/archvsync/runmirrors > ~dak/runmirrors.log 2>&1 &
490 }
491
492 function i18n2() {
493     log "Exporting package data foo for i18n project"
494     STAMP=$(date "+%Y%m%d%H%M")
495     mkdir -p ${scriptdir}/i18n/${STAMP}
496     cd ${scriptdir}/i18n/${STAMP}
497     dak control-suite -l stable > lenny
498     dak control-suite -l testing > squeeze
499     dak control-suite -l unstable > sid
500     echo "${STAMP}" > timestamp
501     gpg --secret-keyring /srv/ftp-master.debian.org/s3kr1t/dot-gnupg/secring.gpg --keyring /srv/ftp-master.debian.org/s3kr1t/dot-gnupg/pubring.gpg --no-options --batch --no-tty --armour --default-key 55BE302B --detach-sign -o timestamp.gpg timestamp
502     rm -f md5sum
503     md5sum * > md5sum
504     cd ${webdir}/
505     ln -sfT ${scriptdir}/i18n/${STAMP} i18n
506
507     cd ${scriptdir}
508     find ./i18n -mindepth 1 -maxdepth 1 -mtime +2 -not -name "${STAMP}" -type d -print0 | xargs --no-run-if-empty -0 rm -rf
509 }
510
511 function stats() {
512     log "Updating stats data"
513     cd $configdir
514     $scriptsdir/update-ftpstats $base/log/* > $base/misc/ftpstats.data
515     R --slave --vanilla < $base/misc/ftpstats.R
516     dak stats arch-space > $webdir/arch-space
517     dak stats pkg-nums > $webdir/pkg-nums
518 }
519
520 function aptftpcleanup() {
521     log "Clean up apt-ftparchive's databases"
522     cd $configdir
523     apt-ftparchive -q clean apt.conf
524 }
525
526 function compress() {
527     log "Compress old psql backups"
528     cd $base/backup/
529     find -maxdepth 1 -mindepth 1 -type f -name 'dump_pre_*' -mtime +2 -print0 | xargs -0 --no-run-if-empty rm
530
531     find -maxdepth 1 -mindepth 1 -type f -name 'dump_*' \! -name '*.bz2' \! -name '*.gz' -mmin +720 |
532     while read dumpname; do
533         echo "Compressing $dumpname"
534         bzip2 -9fv "$dumpname"
535     done
536     find -maxdepth 1 -mindepth 1 -type f -name "dumpall_*" \! -name '*.bz2' \! -name '*.gz' -mmin +720 |
537     while read dumpname; do
538         echo "Compressing $dumpname"
539         bzip2 -9fv "$dumpname"
540     done
541     finddup -l -d $base/backup
542 }
543
544 function logstats() {
545     $masterdir/tools/logs.py "$1"
546 }
547
548 # save timestamp when we start
549 function savetimestamp() {
550         NOW=`date "+%Y.%m.%d-%H:%M:%S"`
551         echo ${NOW} > "${dbdir}/dinstallstart"
552 }
553
554 function maillogfile() {
555     cat "$LOGFILE" | mail -s "Log for dinstall run of ${NOW}" cron@ftp-master.debian.org
556 }
557
558 function renamelogfile() {
559     if [ -f "${dbdir}/dinstallstart" ]; then
560         NOW=$(cat "${dbdir}/dinstallstart")
561 #        maillogfile
562         mv "$LOGFILE" "$logdir/dinstall_${NOW}.log"
563         logstats "$logdir/dinstall_${NOW}.log"
564         bzip2 -9 "$logdir/dinstall_${NOW}.log"
565     else
566         error "Problem, I don't know when dinstall started, unable to do log statistics."
567         NOW=`date "+%Y.%m.%d-%H:%M:%S"`
568 #        maillogfile
569         mv "$LOGFILE" "$logdir/dinstall_${NOW}.log"
570         bzip2 -9 "$logdir/dinstall_${NOW}.log"
571     fi
572 }
573
574 function testingsourcelist() {
575     dak ls -s testing -f heidi -r .| egrep 'source$' > ${webdir}/testing.list
576 }
577
578 # do a last run of process-unchecked before dinstall is on.
579 function process_unchecked() {
580     log "Processing the unchecked queue"
581     UNCHECKED_WITHOUT_LOCK="-p"
582     do_unchecked
583     sync_debbugs
584 }
585
586 # do a run of newstage only before dinstall is on.
587 function newstage() {
588     log "Processing the newstage queue"
589     UNCHECKED_WITHOUT_LOCK="-p"
590     do_newstage
591 }
592
593 # Function to update a "statefile" telling people what we are doing
594 # (more or less).
595 #
596 # This should be called with the argument(s)
597 #  - Status name we want to show.
598 #
599 function state() {
600     RIGHTNOW="$(date -u +"%a %b %d %T %Z %Y (%s)")"
601     cat >"${DINSTALLSTATE}" <<EOF
602 Dinstall start: ${DINSTALLBEGIN}
603 Current action: ${1}
604 Action start: ${RIGHTNOW}
605 EOF
606 }
607
608 # extract changelogs and stuff
609 function changelogs() {
610     log "Extracting changelogs"
611     dak make-changelog -e
612     cd ${exportpublic}/changelogs
613     rsync -aHW --delete --delete-after --ignore-errors ${exportdir}/changelogs/. .
614 }