pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_notify Updated pkg_notify to 0.4.3



details:   https://anonhg.NetBSD.org/pkgsrc/rev/5833a4642330
branches:  trunk
changeset: 554724:5833a4642330
user:      imil <imil%pkgsrc.org@localhost>
date:      Wed Feb 18 21:23:21 2009 +0000

description:
Updated pkg_notify to 0.4.3

Changes since 0.4.2:
- added -c list-file (seb@)
- no more MASTER_SITES, using files/ instead
- removed README in favor of a man page
- corrected pkglint(1) warning about multi-line SUBST_SED

OK'd by cube@

diffstat:

 pkgtools/pkg_notify/Makefile              |   40 +-
 pkgtools/pkg_notify/PLIST                 |    5 +-
 pkgtools/pkg_notify/distinfo              |    5 -
 pkgtools/pkg_notify/files/pkg_notify      |  668 ++++++++++++++++++++++++++++++
 pkgtools/pkg_notify/files/pkg_notify.1    |   72 +++
 pkgtools/pkg_notify/files/pkg_notify.list |   33 +
 6 files changed, 800 insertions(+), 23 deletions(-)

diffs (truncated from 877 to 300 lines):

diff -r 3d23b9b059bb -r 5833a4642330 pkgtools/pkg_notify/Makefile
--- a/pkgtools/pkg_notify/Makefile      Wed Feb 18 21:23:07 2009 +0000
+++ b/pkgtools/pkg_notify/Makefile      Wed Feb 18 21:23:21 2009 +0000
@@ -1,12 +1,13 @@
-# $NetBSD: Makefile,v 1.11 2008/06/12 02:14:42 joerg Exp $
+# $NetBSD: Makefile,v 1.12 2009/02/18 21:23:21 imil Exp $
 #
 
-DISTNAME=      pkg_notify-0.4.2
+DISTNAME=      pkg_notify-0.4.3
 CATEGORIES=    pkgtools
-MASTER_SITES=  http://imil.net/NetBSD/
+MASTER_SITES=  # none
+DISTFILES=     # none
 
 MAINTAINER=    imil%gcu.info@localhost
-HOMEPAGE=      http://imil.net/wp/
+HOMEPAGE=      # none
 COMMENT=       Notifies package maintainer when a new version is available
 
 DEPENDS+=      p5-libwww>=5.76:../../www/p5-libwww
@@ -14,29 +15,38 @@
 PKG_INSTALLATION_TYPES=        overwrite pkgviews
 PKG_DESTDIR_SUPPORT=   user-destdir
 
+NO_CHECKSUM=           yes
 NO_BUILD=              yes
 NO_CONFIGURE=          yes
 USE_TOOLS+=            perl:run
-WRKSRC=                        ${WRKDIR}/pkg_notify
+WRKSRC=                        ${WRKDIR}
 
-EXAMPLEDIR=            ${PREFIX}/share/examples/${PKGBASE}
-CONF_FILES=            ${EXAMPLEDIR}/${PKGBASE}.list \
+EGDIR=                 ${PREFIX}/share/examples/${PKGBASE}
+CONF_FILES=            ${EGDIR}/${PKGBASE}.list \
                        ${PKG_SYSCONFDIR}/${PKGBASE}.list
 
+.include "../../mk/bsd.prefs.mk"
+
 SUBST_CLASSES+=                        pkg_notify
-SUBST_MESSAGE.pkg_notify=      Setting up hardcoded path.
 SUBST_STAGE.pkg_notify=                post-patch
 SUBST_FILES.pkg_notify=                pkg_notify
-SUBST_SED.pkg_notify=          -e 's|/usr/pkgsrc|${PKGSRCDIR}|'        \
-                               -e 's|/usr/pkg|${LOCALBASE}|g'          \
-                               -e 's|/usr/bin/make|${MAKE}|g'          \
-                               -e 's|/usr/pkg/bin/perl|${PERL5}|g'
+SUBST_FILES.pkg_notify+=       pkg_notify.1
+SUBST_SED.pkg_notify=          -e 's|@PKGSRCDIR@|${PKGSRCDIR}|'
+SUBST_SED.pkg_notify+=         -e 's|@PREFIX@|${PREFIX}|g'
+SUBST_SED.pkg_notify+=         -e 's|@MAKE@|${MAKE:Q}|g'
+SUBST_SED.pkg_notify+=         -e 's|@PERL@|${PERL5:Q}|g'
+SUBST_SED.pkg_notify+=         -e 's|@PKG_SYSCONFDIR@|${PKG_SYSCONFDIR}|g'
 
-INSTALLATION_DIRS=     bin ${EXAMPLEDIR} share/doc/pkg_notify
+INSTALLATION_DIRS=     bin ${EGDIR} ${PKGMANDIR}/man1
+
+do-extract:
+       cd ${FILESDIR} &&       \
+       ${CP} pkg_notify pkg_notify.list pkg_notify.1 ${WRKSRC}
 
 do-install:
        ${INSTALL_SCRIPT} ${WRKSRC}/pkg_notify ${DESTDIR}${PREFIX}/bin
-       ${INSTALL_DATA} ${WRKSRC}/pkg_notify.list ${DESTDIR}${EXAMPLEDIR}
-       ${INSTALL_DATA} ${WRKSRC}/README ${DESTDIR}${PREFIX}/share/doc/pkg_notify
+       ${INSTALL_DATA} ${WRKSRC}/pkg_notify.list ${DESTDIR}${EGDIR}
+       ${INSTALL_MAN} ${WRKSRC}/pkg_notify.1   \
+               ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
 
 .include "../../mk/bsd.pkg.mk"
diff -r 3d23b9b059bb -r 5833a4642330 pkgtools/pkg_notify/PLIST
--- a/pkgtools/pkg_notify/PLIST Wed Feb 18 21:23:07 2009 +0000
+++ b/pkgtools/pkg_notify/PLIST Wed Feb 18 21:23:21 2009 +0000
@@ -1,6 +1,5 @@
-@comment $NetBSD: PLIST,v 1.3 2005/01/14 10:04:01 jmmv Exp $
+@comment $NetBSD: PLIST,v 1.4 2009/02/18 21:23:21 imil Exp $
 bin/pkg_notify
-share/doc/pkg_notify/README
 share/examples/pkg_notify/pkg_notify.list
+man/man1/pkg_notify.1
 @dirrm share/examples/pkg_notify
-@dirrm share/doc/pkg_notify
diff -r 3d23b9b059bb -r 5833a4642330 pkgtools/pkg_notify/distinfo
--- a/pkgtools/pkg_notify/distinfo      Wed Feb 18 21:23:07 2009 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-$NetBSD: distinfo,v 1.4 2005/02/24 12:28:30 agc Exp $
-
-SHA1 (pkg_notify-0.4.2.tar.gz) = 67e7b2216d046abdb9179c67f5ce2a661570b105
-RMD160 (pkg_notify-0.4.2.tar.gz) = 43646e4c9c5004a762c823041f4a4290b262607f
-Size (pkg_notify-0.4.2.tar.gz) = 5741 bytes
diff -r 3d23b9b059bb -r 5833a4642330 pkgtools/pkg_notify/files/pkg_notify
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/pkg_notify/files/pkg_notify      Wed Feb 18 21:23:21 2009 +0000
@@ -0,0 +1,668 @@
+#! @PERL@
+
+# pkgsrc version upgrade notifier
+# covered by the revised BSD license
+# iMil <imil%gcu.info@localhost>
+#
+# Create the /usr/pkg/etc/pkg_notify.list file containing the package list
+# you want to be informed on, following this format :
+#
+# $ cat /usr/pkg/etc/pkg_notify.list
+# wip/foo
+# net/bar
+# www/foobar-devel
+#
+# OR invoke pkg_notify with the package following :
+#
+# $ pkg_notify category/package
+#
+# $Id: pkg_notify,v 1.1 2009/02/18 21:23:21 imil Exp $
+
+use Net::FTP;
+use LWP::UserAgent;
+use HTTP::Request::Common;
+use Getopt::Std;
+
+use strict;
+
+# those three are replaced by Makefile
+my $make = "@MAKE@";
+my $pkgsrcbase = "@PKGSRCDIR@";
+my $localbase = "@PREFIX@";
+
+my $conf = "@PKG_SYSCONFDIR@/pkg_notify.list";
+
+################################################################################
+
+my $extract_sufx = "";
+my $distname = "";
+my $pkgname = "";
+my $version = "";
+my $pkgversion = "";
+my $dist = "";
+my $pkgpath = "";
+
+my $SF_NET= "sourceforge.net";
+
+my $nicearc;
+my $go_subdirs;
+my $pathvers;
+
+my $debug = 0;
+
+my $subvers = "";
+
+# create an alpha to num mapping
+my %alnum = map { $_ => ord($_) - ord('a') + 1 } ('a' .. 'z');
+
+sub dot_strip {
+    my $out = $_[0];
+    # clean extremities from dots
+    $out =~ s/^[\.\-_]+//;
+    $out =~ s/[\.\-_]+$//;
+
+    return ($out);
+}
+
+sub beta_strip {
+       my $out = $_[0];
+
+       # handle beta - alpha - pre...
+       if ($out =~ /(.*[0-9])([\-\_\.]?)(pre|alpha|beta|gamma|rc)([0-9]*.*)/i) {
+               my $pre = $1;
+               my $dev = lc $3;
+               # remember real versionning
+               $subvers = "$2$3";
+               my $post = $4;
+               # replace pre|alpha|beta... with equiv nums
+               $dev =~ s/([a-z]).*/$alnum{$1}/;
+               $out = $pre.".00".$dev."00.".$post;
+       }
+
+       return ($out);
+}
+
+sub ext_strip {
+       # cleanup versions :
+       # blah-1.2.3-blah
+       # 1.2.3[.-_]pkg -> 1.2.3
+       # devel-1.2.3 -> 1.2.3
+       my $out = $_[0];
+
+       # version has no chars, should be fine
+       if ($out !~ /[a-z]/) {
+               return ($out);
+       }
+
+       if ($out =~ /^[a-z\-\._]+([0-9\-\._]+)[a-z\-\._]+$/i) {
+       # strip (qwerty-)1.2.3(-qwerty)
+               $out = $1;
+       } elsif ($out =~ /^([0-9\-\._]+)[\-\._][a-z]+/i) {
+       # strip 1.2.3(-qwerty)
+               $out = $1;
+       } elsif ($out =~ /[a-z]+[\-\._]+([0-9\-\._]+)$/i) {
+       # strip (qwerty-)1.2.3
+               $out = $1;
+       }
+
+       return ($out);
+}
+
+sub is_beta {
+       if ($_[0] =~ /00[0-9]+00/) {
+               return (1);
+       }
+       return (0);
+}
+
+sub find_version {
+       my @ls = @_;
+       my $lastvers = "";
+       my $realdist = "";
+
+       foreach (@ls) {
+               my $line = $_;
+               my $wasbad = 0;
+
+               if ($line =~ /([^0-9a-z]$dist|^$dist)([^\/\"<>\@]+)$extract_sufx/) {
+
+                       $realdist = $dist.$2.$extract_sufx;
+                       my $lsvers = $2;
+
+                       # replace alpha|beta|... with .0[num]0.
+                       $lsvers = beta_strip($lsvers);
+
+                       # strip any extension left (bin, pkg, src, devel-...)
+                       if ($nicearc) {
+                               $lsvers = ext_strip($lsvers);
+                       } else {
+                               # remember archive was bad for next loop
+                               $wasbad = 1;
+                       }
+
+                       # with beta/alpha/... numbered, archive may be nice
+                       if (($lsvers !~ /[^0-9\.\-\_]/i) && 
+                               ($version !~ /[^0-9\.\-\_]/i)) {
+                               $nicearc = 1;
+                       }
+
+                       # replace every dot-like char (-_) with dots
+                       $lsvers = dot_strip($lsvers);
+
+                       my $display_lsvers;
+                       if ($subvers ne "") {
+                               # archive has an alpha / beta / ...
+                               $display_lsvers = $lsvers;
+                               $display_lsvers =~ s/(\.00[0-9]+00)/$subvers/;
+                               $subvers = "";
+                       } else {
+                               $display_lsvers = $lsvers;
+                       }
+
+                       # replace [-_] with dot
+                       $lsvers =~ s/[\-\_]/./g;
+                       $version =~ s/[\-\_]/./g;
+
+                       # replace remaining chars
+                       # ex: 3.14a -> 3.14.1, i -> 9
+                       $lsvers = lc $lsvers;
+                       $lsvers =~ s/([a-z])/.$alnum{$1}/g;
+                       # numberify official version
+                       $version = lc $version;
+                       $version =~ s/([a-z])/.$alnum{$1}/g;
+
+                       # uniq .'s
+                       $lsvers =~ s/\.+/./g;
+                       $version =~ s/\.+/./g;
+
+if ($debug) {
+       print "comparing $lsvers against $version (nicearc: $nicearc)\n";
+}
+
+                       if (($lsvers ne $lastvers) && # already seen
+                               # if it's not a nicearc, do basic string comparison
+                               # if it is a nicearc, finest / int comparison
+                               (($lsvers gt $version) | $nicearc)) {
+
+                               my $greater = 0;
+
+                               if ($nicearc) { # nice archive, has at least major.minor
+
+                                       my @pkg_version = split(/[\.\-_]/, $version);
+                                       my @ls_version = split(/[\.\-_]/, $lsvers);
+
+                                       my $i = 0;
+                                       foreach (@ls_version) {
+
+                                               # package version has this member
+                                               if (defined($pkg_version[$i])) {
+
+                                                       my $member = $_;
+
+                                                       # empty member
+                                                       if ($member =~ /^$/) {
+                                                               last;



Home | Main Index | Thread Index | Old Index