summaryrefslogtreecommitdiff
path: root/archives/bin
diff options
context:
space:
mode:
authorAlvaro Herrera2009-03-22 01:15:18 +0000
committerAlvaro Herrera2009-03-22 01:15:18 +0000
commit61518c6bb98c86ad2c4b1ffc2f5740c15fa840d7 (patch)
tree559942f3515aa42b7e7cf2e1408a1484d4fb6c11 /archives/bin
parent734b0daf8ee77c7f5328fe03693dbede81ee2dac (diff)
Make the whole thing work for weekly archives too (cf. pgsql-tr-genel)
git-svn-id: file:///Users/dpage/pgweb/svn-repo/trunk@2439 8f5c7a92-453e-0410-a47f-ad33c8a6b003
Diffstat (limited to 'archives/bin')
-rwxr-xr-xarchives/bin/list_dates.pl6
-rwxr-xr-xarchives/bin/mk-mhonarc29
2 files changed, 26 insertions, 9 deletions
diff --git a/archives/bin/list_dates.pl b/archives/bin/list_dates.pl
index dc93cbee..6b9c07dc 100755
--- a/archives/bin/list_dates.pl
+++ b/archives/bin/list_dates.pl
@@ -14,10 +14,12 @@ sub sortfiles {
sort { $b cmp $a } @_;
}
+# note that we need to cope with weekly archives too (seventh digit)
sub wanted {
return unless /^$list/;
- /$list.(\d{4})(\d{2})/;
+ /$list.(\d{4})(\d{2})(\d?)/;
$year = $1;
$month = $2;
- print "$year $month\n";
+ $sub = $3 if defined $3;
+ print "$year $month $sub\n";
}
diff --git a/archives/bin/mk-mhonarc b/archives/bin/mk-mhonarc
index 5c336c42..aaf058e4 100755
--- a/archives/bin/mk-mhonarc
+++ b/archives/bin/mk-mhonarc
@@ -37,16 +37,32 @@ else
force=0
fi
-$ARCHIVES_BIN/generate-list-descriptions
+# $ARCHIVES_BIN/generate-list-descriptions
process_one_mbox() {
- local path mbox ymon year month ydashm rcfile doit gzipped
- path=$1
+ local listdir path mbox ymon year month ydashm rcfile doit gzipped
+ listdir=$1
mbox=$2
+ path=$listdir/$mbox
ymon=${mbox##*.} # extract yyyymm
+ # Some lists have weekly archives, so we'd get something like 2009032 here
+ # Split the week number for later
+ if /usr/bin/test -l $ymon -gt 6; then
+ submbox=${ymon##??????}
+ ymon=${ymon%%?}
+ else
+ submbox=
+ fi
+ echo mbox = $mbox submbox = $submbox ymon = $ymon
year=${ymon%%??} # extract yyyy
month=${ymon##????} # extract mm
- ydashm=${year}-${month} # construct yyyy-mm
+ if [ -z "$submbox" ]; then
+ ydashm=${year}-${month} # construct yyyy-mm
+ else
+ ydashm=${year}-${month}-${submbox} # yyyy-mm-s
+ fi
+
+ echo "processing one mbox: $listdir $mbox"
if [ "$ymon" -le 200607 ]; then
rcfile=$ARCHIVES_BIN/resource-2006-07
@@ -97,7 +113,7 @@ process_one_mbox() {
mkdir mbox
fi
gzipped=mbox/${list}.${ydashm}.gz
- if [ `basename $path` != `basename $path .gz` ]; then
+ if [ `basename $mbox` != `basename $mbox .gz` ]; then
cp $path $gzipped
else
gzip $path -f -c > $gzipped
@@ -142,10 +158,9 @@ for list in `ls $MAJORDOMO_FILES`; do
cd $list
for mbox in `ls --reverse $listdir`; do
- path=$listdir/$mbox
mbox=${mbox%%.gz} # remove possible trailing .gz
- process_one_mbox $path $mbox
+ process_one_mbox $listdir $mbox
done
# XXX maybe this can be done better with mod_rewrite?