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