wip/TODO maintainence

Aleksey Cheusov <[email protected]>
Newsgroups gmane.os.netbsd.devel.pkgsrc.wip.general
Message-ID <[email protected]>
Below is the script that simplifies maintainence of wip/TODO file.
It requires wip/runawk and wip/awk-pkgsrc-dewey and
works like the following:

    0 cheusov>check_wip_TODO
    No wip/chromium. What to do?
    No wip/gnome-commander. What to do?
    No wip/mpich2. What to do?
    No wip/ortp. What to do?
    No wip/rezound. What to do?
    No wip/sflphone. What to do?
    No wip/tripwire. What to do?
    No wip/ufraw. What to do?
    No wip/vinagre. What to do?
    wip/aircrack-ng is already up-to-date (1.0 vs. 1.0 )
    wip/bakery is already up-to-date (2.6.3 vs. 2.6.3 )
    wip/bubbros is already up-to-date (1.6 vs. 1.6 )
    wip/ccrypt is already up-to-date (1.9 vs. 1.9 )
    wip/cdogs is already up-to-date (0.4 vs. 0.4 )
    wip/firebird is already up-to-date (2.1.1nb2 vs. 2.0.3 )
    wip/gajim is already up-to-date (0.12.1 vs. 0.12 )
    wip/gallery is already up-to-date (1.5.10 vs. 1.5.10 )
    wip/geant is already up-to-date (4.9.2 vs. 4.9.2 )
    wip/grass is already up-to-date (6.3.0nb1 vs. 6.2.3 )
    wip/grisbi is already up-to-date (0.5.9 vs. 0.5.8 )
    wip/icecat is already up-to-date (3.5.3 vs. 3.5.3 )
    wip/libgdata is already up-to-date (0.4.0 vs. 0.4.0 )
    wip/libpthread-stubs is already up-to-date (1.0nb6 vs. 0.2 )
    wip/pdnsd is already up-to-date (1.2.7 vs. 1.2.7 )
    wip/sendmailX is already up-to-date (0.0.0.0nb3 vs. 0.0.0.0 )
    wip/swftools is already up-to-date (0.9.0 vs. 0.9.0 )
    wip/xmonad is already up-to-date (0.8.1 vs. 0.8 )
    0 cheusov>

It can realatively easily be adapted to support MUCH BIGGER doc/TODO.

#!/bin/sh

export LC_ALL=C
PKGSRCDIR=${PKGSRCDIR:-/usr/pkgsrc}
TODO_fn=${TODO_fn:-${PKGSRCDIR}/wip/TODO}
BMAKE=${BMAKE:-make}

get_pkgs_tobeupdated (){
    awk '
    /^Suggested.*updates/, /^Suggested ready to import packages/ {
	if ($1 == "o") print $2
    }' $TODO_fn | sort
}

pkgs=`get_pkgs_tobeupdated "$@"`

tobeupdated=''
for i in $pkgs; do
    pkgbase=`echo $i | sed 's|-[^-]*$||'`
    if test -d ${PKGSRCDIR}/wip/$pkgbase; then
	tobeupdated="$tobeupdated $i"
    else
	echo "No wip/$pkgbase. What to do?" 1>&2
    fi
done

get_pkgname (){
    ( cd $PKGSRCDIR/$1 && $BMAKE show-var VARNAME=PKGNAME; )
}

uptodate (){
    runawk -f pkgsrc-dewey.awk -v b1="$1" -v b2="$2" -e '
    BEGIN {
	pkgbase=b1
	sub(/-[^-]*$/, "", pkgbase)
	sub(/.*-/, "", b1)
	sub(/.*-/, "", b2)
	if (dewey_test(b1, b2, ">=") ){
	    print "wip/" pkgbase " is already up-to-date (" b1 " vs. " b2 " )" > "/dev/stderr"
	}
    }
    '
}

for i in $tobeupdated; do
    pkgpath=wip/`echo $i | sed 's|-[^-]*$||'`
    act_pkgname=`get_pkgname $pkgpath`
#    echo $i $act_pkgname
    uptodate $act_pkgname $i
done

-- 
Best regards, Aleksey Cheusov.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.