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";
}
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
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
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?
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');
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].", week ".$sub);
+ else
+ $tpl->setVariable('month_text', $months[$month - 1]);
$tpl->parse('month');
$prevyear = $year;
}