Make the whole thing work for weekly archives too (cf. pgsql-tr-genel)
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Sun, 22 Mar 2009 01:15:18 +0000 (01:15 +0000)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Sun, 22 Mar 2009 01:15:18 +0000 (01:15 +0000)
git-svn-id: file:///Users/dpage/pgweb/svn-repo/trunk@2439 8f5c7a92-453e-0410-a47f-ad33c8a6b003

archives/bin/list_dates.pl
archives/bin/mk-mhonarc
archives/html/list_index.php

index dc93cbee3d968268324728358c14c6d7019fad65..6b9c07dc53f61ac663ec8acb14d0a682f618ae7a 100755 (executable)
@@ -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";
 }
index 5c336c428cdc55da0244408b286eb62243ed1ad0..aaf058e42c62b2c8284a1e96e9f2ff6c508aab40 100755 (executable)
@@ -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?
index fdd76963635505d4f605717b3ac6e9450da5fe68..8041fbc9c72395e52ef10a10d6b94c310f2aee4b 100644 (file)
@@ -23,7 +23,10 @@ $f = fopen("months", 'r');
 if ($f) {
        $prevyear = 0;
        while ($line = fgets($f)) {
-               list ($year, $month) = sscanf($line, "%s %s");
+               /* some lists have weekly archives; the "months" file will have 
+                * 3 columns in that case 
+                */
+               list ($year, $month, $sub) = sscanf($line, "%s %s %s");
                $month = rtrim($month);
 
                $tpl->setCurrentBlock('month');
@@ -33,7 +36,10 @@ if ($f) {
                else $yeartext = $year;
                $tpl->setVariable('year_text', $yeartext);
                $tpl->setVariable('month', $month);
-               $tpl->setVariable('month_text', $months[$month - 1]);
+               if (isset($sub)) 
+                 $tpl->setVariable('month_text', $months[$month - 1].",&nbsp;week&nbsp;".$sub);
+               else
+                 $tpl->setVariable('month_text', $months[$month - 1]);
                $tpl->parse('month');
                $prevyear = $year;
        }