#!/bin/sh # $Id: update-recent-releases,v 1.13 2021/02/04 16:32:02 ineiev Exp $ # Public domain. Originally written by Karl Berry, January 2013. # This script is run (more than daily) from gnun@fencepost cron. # # Construct list of recent GNU releases from info-gnu archives. The # idea is to keep two .html files, one named "lastmonth.html" for the # previous month's announcements and one named YYYY-MM.html for the # current month's. When a new month rolls in, current becomes previous, # naturally. # # We extract out the list of announcements from the full web pages to be # SSIncluded in http://www.gnu.org/software/recent-releases.html. # # The very first time it is run in a given hierarchy, it is necessary to # set up lastmonth.html by hand and a dummy YYYY-MM.html. # # We assume GNU date and a decent sed. if test $# -gt 0; then www_software_dir=$1 else mydir=`dirname $0` # WWW/server/source www_software_dir=`cd $mydir/../../software/ && pwd` fi cd $www_software_dir || exit 1 www_software_dir=`pwd` var_dir="$www_software_dir/recent-releases-tmp" if test $# -gt 1; then var_dir=$2 fi # Need to work in tmp dir. test -d "$var_dir" || mkdir "$var_dir" cd "$var_dir" || exit 1 wget="wget -q" info_gnu=http://lists.gnu.org/archive/html/info-gnu lastmonth=`date +%Y-%m -d "$(date +%Y-%m-15) -1 month"` thismonth=`date +%Y-%m` $wget $info_gnu/$thismonth/index.html -O $thismonth.html.new if test -f $lastmonth.html; then # First run in a new month. echo "$0: seems $thismonth is a new month, resetting lastmonth=$lastmonth." mv $lastmonth.html lastmonth.html # static name fi if test -s $thismonth.html.new; then touch $thismonth.html # Continuing on in current month. See if we have anything new. if cmp -s $thismonth.html $thismonth.html.new; then echo "$0: no changes, goodbye." rm -f $thismonth.html.new exit 0 fi echo "$0: new releases in $thismonth, merging." diff $thismonth.html $thismonth.html.new else echo "$0: no releases in this month yet." exit 0 fi mv $thismonth.html.new $thismonth.html # Given html info-gnu archive file in $1 and month reference in $2, get # rid of the leading and trailing junk, remove the anchors, and fix the # href's. Output to stdout. # fix_month () { infile=$1 month=$2 sed -e '1,/