pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_notify/files Indent.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/c7c5f4dc011d
branches:  trunk
changeset: 351887:c7c5f4dc011d
user:      wiz <wiz%pkgsrc.org@localhost>
date:      Wed Aug 31 21:15:01 2016 +0000

description:
Indent.

diffstat:

 pkgtools/pkg_notify/files/pkg_notify |  884 +++++++++++++++++-----------------
 1 files changed, 442 insertions(+), 442 deletions(-)

diffs (truncated from 1053 to 300 lines):

diff -r 1b551406c27f -r c7c5f4dc011d pkgtools/pkg_notify/files/pkg_notify
--- a/pkgtools/pkg_notify/files/pkg_notify      Wed Aug 31 20:28:38 2016 +0000
+++ b/pkgtools/pkg_notify/files/pkg_notify      Wed Aug 31 21:15:01 2016 +0000
@@ -16,7 +16,7 @@
 #
 # $ pkg_notify category/package
 #
-# $Id: pkg_notify,v 1.2 2014/02/02 10:19:41 wiz Exp $
+# $Id: pkg_notify,v 1.3 2016/08/31 21:15:01 wiz Exp $
 
 use Net::FTP;
 use LWP::UserAgent;
@@ -65,225 +65,225 @@
 }
 
 sub beta_strip {
-       my $out = $_[0];
+    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;
-       }
+    # 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);
+    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];
+    # 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);
-       }
+    # version has no chars, should be fine
+    if ($out !~ /[a-z]/) {
+       return ($out);
+    }
 
-       if ($out =~ /^[a-z\-\._]+([0-9\-\._]+)[a-z\-\._]+$/i) {
+    if ($out =~ /^[a-z\-\._]+([0-9\-\._]+)[a-z\-\._]+$/i) {
        # strip (qwerty-)1.2.3(-qwerty)
-               $out = $1;
-       } elsif ($out =~ /^([0-9\-\._]+)[\-\._][a-z]+/i) {
+       $out = $1;
+    } elsif ($out =~ /^([0-9\-\._]+)[\-\._][a-z]+/i) {
        # strip 1.2.3(-qwerty)
-               $out = $1;
-       } elsif ($out =~ /[a-z]+[\-\._]+([0-9\-\._]+)$/i) {
+       $out = $1;
+    } elsif ($out =~ /[a-z]+[\-\._]+([0-9\-\._]+)$/i) {
        # strip (qwerty-)1.2.3
-               $out = $1;
-       }
+       $out = $1;
+    }
 
-       return ($out);
+    return ($out);
 }
 
 sub is_beta {
-       if ($_[0] =~ /00[0-9]+00/) {
-               return (1);
-       }
-       return (0);
+    if ($_[0] =~ /00[0-9]+00/) {
+       return (1);
+    }
+    return (0);
 }
 
 sub find_version {
-       my @ls = @_;
-       my $lastvers = "";
-       my $realdist = "";
+    my @ls = @_;
+    my $lastvers = "";
+    my $realdist = "";
+
+    foreach (@ls) {
+       my $line = $_;
+       my $wasbad = 0;
+
+       if ($line =~ /([^0-9a-z]$dist|^$dist)([^\/\"<>\@]+)$extract_sufx/) {
 
-       foreach (@ls) {
-               my $line = $_;
-               my $wasbad = 0;
+           $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;
+           }
 
-               if ($line =~ /([^0-9a-z]$dist|^$dist)([^\/\"<>\@]+)$extract_sufx/) {
+           # 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);
 
-                       $realdist = $dist.$2.$extract_sufx;
-                       my $lsvers = $2;
+           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 alpha|beta|... with .0[num]0.
-                       $lsvers = beta_strip($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;
 
-                       # strip any extension left (bin, pkg, src, devel-...)
-                       if ($nicearc) {
-                               $lsvers = ext_strip($lsvers);
-                       } else {
-                               # remember archive was bad for next loop
-                               $wasbad = 1;
-                       }
+           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 = $_;
 
-                       # 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);
+                           # empty member
+                           if ($member =~ /^$/) {
+                               last;
+                           }
+                           # archive version has non-num in it, can't compare
+                           if ($member =~ /[^0-9]/) {
+                               last;
+                           }
+                           # is this member greater that pkg_version equiv ?
+                           if ($member > $pkg_version[$i]) {
+                               # if member is beta, version is >
+                               if (is_beta($member) && 
+                                   !is_beta($pkg_version[$i])) {
+                                   last;
+                               }
+                               $greater = 1;
+                               last;
+                           }
 
-                       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;
+                           # local package has a superior version, end
+                           if ($pkg_version[$i] > $member) {
+                               # if version is beta, member is >
+                               if (!is_beta($member) &&
+                                   is_beta($pkg_version[$i])) {
+                                   $greater = 1;
+                               }
+                               last;
+                           }
+
+                       } else { # package version don't have this sub-number
+                           if (!is_beta($_)) { # avoid beta versions
+                               # aka 1.1.1beta !> 1.1.1
+                               $greater = 1;
+                           }
+                           last;
                        }
 
-                       # 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 = $_;
+                       $i++; # increment version member
+                   } # foreach
 
-                                                       # empty member
-                                                       if ($member =~ /^$/) {
-                                                               last;



Home | Main Index | Thread Index | Old Index