Subject: pkg_notify patch
To: None <tech-pkg@NetBSD.org>
From: None <bedis@bedis.eu>
List: tech-pkg
Date: 06/29/2006 16:52:28
Hi,

I write a patch for pkg_notify which correct a bug when pkg_version is a date (format "YYYYMMDD"): the function is_beta return this special format as beta in some case... which make pkg_notify to say that 20031012 is more recent as 20041004 ...

I added a test to check if the path of package really exist in pkgsrc.
(or if you type the DIR/PKG without error...)

diff -Naur pkg_notify.old pkg_notify
--- pkg_notify.old      2006-06-28 23:42:40.000000000 +0200
+++ pkg_notify  2006-06-29 10:36:40.000000000 +0200
@@ -108,6 +108,10 @@
 }

 sub is_beta {
+       # If date, not considered as beta
+       if ($_[0] =~ /[0-9]{4}[0-1][0-9][0-3][0-9]/) {
+               return (0);
+       }
        if ($_[0] =~ /00[0-9]+00/) {
                return (1);
        }
@@ -503,9 +507,12 @@

        $pkgpath = "$pkgsrcbase/$pkg/";

+       if (!-d $pkgpath) {
+               die "Error: $pkgpath is not a directory!!!\n";
+       }
+
        $pkgname = `cd $pkgpath && $make show-var VARNAME=PKGNAME`;
        chomp($pkgname);
-
        $pkgversion = $pkgname;
        $pkgversion =~ s/(.+)\-([0-9a-z_\.]+)$/$2/;
        $pkgname = $1;

Please test it and tell me if there's something wrong.
If you have any comments, remarks, etc...