From 5478237fc5dab4de7bd675d3fce56e370ecb6ac0 Mon Sep 17 00:00:00 2001
From: James Troup <james@nocrew.org>
Date: Thu, 8 Feb 2007 00:47:58 +0000
Subject: [PATCH] [rmurray] Use 'vars' variables more in config and scripts.

---
 ChangeLog                     |  8 ++++++++
 config/debian/cron.daily      | 10 +++++-----
 scripts/debian/mkfilesindices | 14 ++++++++------
 3 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c35c46b5..b9e57031 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-02-08  Ryan Murray  <rmurray@debian.org>
+
+	* config/debian/cron.daily: use $base instead of hardcoding path
+	name.
+
+	* scripts/debian/mkfilesindices: source 'vars' file and use it's
+	variables instead of hardcoding path names.
+
 2007-02-08  James Troup  <james@nocrew.org>
 
 	* dak/process_unchecked.py (check_signed_by_key): new function to
diff --git a/config/debian/cron.daily b/config/debian/cron.daily
index 292a9afd..08825252 100755
--- a/config/debian/cron.daily
+++ b/config/debian/cron.daily
@@ -34,7 +34,7 @@ EOF
 ################################################################################
 
 echo "Creating pre-daily-cron-job backup of projectb database..."
-pg_dump projectb > /org/ftp.debian.org/backup/dump_$(date +%Y.%m.%d-%H:%M:%S)
+pg_dump projectb > $base/backup/dump_$(date +%Y.%m.%d-%H:%M:%S)
 
 ################################################################################
 
@@ -119,7 +119,7 @@ cd $scriptsdir
 ./mkchecksums
 #
 # Fetch bugs information before unchecked processing is allowed again.
-/org/ftp.debian.org/testing/britney bugs
+$base/testing/britney allowdaklock bugs || true
 rm -f $NOTICE
 ssh buildd@buildd /org/wanna-build/trigger.daily
 
@@ -129,9 +129,9 @@ echo Archive maintenance finished at $(date +%X)
 ################################################################################
 
 echo "Creating post-daily-cron-job backup of projectb database..."
-POSTDUMP=/org/ftp.debian.org/backup/dump_$(date +%Y.%m.%d-%H:%M:%S)
+POSTDUMP=$base/backup/dump_$(date +%Y.%m.%d-%H:%M:%S)
 pg_dump projectb > $POSTDUMP
-(cd /org/ftp.debian.org/backup; ln -sf $POSTDUMP current)
+(cd $base/backup; ln -sf $POSTDUMP current)
 
 ################################################################################
 
@@ -161,7 +161,7 @@ TS=$(($TS+1)); echo Archive maintenance timestamp $TS: $(date +%X)
 
 ulimit -m 90000 -d 90000 -s 10000 -v 90000
 
-run-parts --report /org/ftp.debian.org/scripts/distmnt
+run-parts --report $base/scripts/distmnt
 
 echo Daily cron scripts successful.
 
diff --git a/scripts/debian/mkfilesindices b/scripts/debian/mkfilesindices
index 8bc57e30..c5ac1d9e 100755
--- a/scripts/debian/mkfilesindices
+++ b/scripts/debian/mkfilesindices
@@ -1,8 +1,10 @@
 #!/bin/sh -e
 
+export SCRIPTVARS=/org/ftp.debian.org/dak/config/debian/vars
+. $SCRIPTVARS
 umask 002
 
-cd /org/ftp.debian.org/ftp/indices/files/components
+cd $base/ftp/indices/files/components
 
 ARCHLIST=$(tempfile)
 
@@ -22,7 +24,7 @@ echo "Generating sources list..."
 
 (
   sed -n 's/|$//p' $ARCHLIST
-  cd /org/ftp.debian.org/ftp
+  cd $base/ftp
   find ./dists -maxdepth 1 \! -type d
   find ./dists \! -type d | grep "/source/"
 ) | sort -u | gzip -9 > source.list.gz
@@ -33,7 +35,7 @@ ARCHES=$( (<$ARCHLIST sed -n 's/^.*|//p'; echo amd64) | grep . | sort -u)
 for a in $ARCHES; do
   (sed -n "s/|$a$//p" $ARCHLIST
 
-   cd /org/ftp.debian.org/ftp;
+   cd $base/ftp
    find ./dists -maxdepth 1 \! -type d
    find ./dists \! -type d | grep -E "(proposed-updates.*_$a.changes$|/main/disks-$a/|/main/installer-$a/|/Contents-$a|/binary-$a/)"
    if echo X sparc mips mipsel hppa X | grep -q " $a "; then
@@ -52,9 +54,9 @@ suite_list () {
 
 printf 'SELECT id, suite_name FROM suite\n' | psql -F' ' -At projectb |
   while read id suite; do
-    [ -e /org/ftp.debian.org/ftp/dists/$suite ] || continue
+    [ -e $base/ftp/dists/$suite ] || continue
     (
-     (cd /org/ftp.debian.org/ftp;
+     (cd $base/ftp
       distname=$(cd dists; readlink $suite || echo $suite)
       find ./dists/$distname \! -type d
       for distdir in ./dists/*; do 
@@ -67,7 +69,7 @@ printf 'SELECT id, suite_name FROM suite\n' | psql -F' ' -At projectb |
 
 echo "Finding everything on the ftp site to generate sundries $(date +"%X")..."
 
-(cd /org/ftp.debian.org/ftp; find . \! -type d \! -name 'Archive_Maintenance_In_Progress' | sort) >$ARCHLIST
+(cd $base/ftp; find . \! -type d \! -name 'Archive_Maintenance_In_Progress' | sort) >$ARCHLIST
 
 rm -f sundries.list
 zcat *.list.gz | cat - *.list | sort -u | 
-- 
2.39.5