pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files Reindented the whole program to...
details: https://anonhg.NetBSD.org/pkgsrc/rev/754d7a4ca7be
branches: trunk
changeset: 513048:754d7a4ca7be
user: rillig <rillig%pkgsrc.org@localhost>
date: Fri May 19 23:38:12 2006 +0000
description:
Reindented the whole program to fit my personal taste.
diffstat:
pkgtools/pkglint/files/lintpkgsrc.pl | 2626 +++++++++++++++++----------------
1 files changed, 1336 insertions(+), 1290 deletions(-)
diffs (truncated from 2909 to 300 lines):
diff -r 129793bbcf78 -r 754d7a4ca7be pkgtools/pkglint/files/lintpkgsrc.pl
--- a/pkgtools/pkglint/files/lintpkgsrc.pl Fri May 19 23:01:02 2006 +0000
+++ b/pkgtools/pkglint/files/lintpkgsrc.pl Fri May 19 23:38:12 2006 +0000
@@ -1,6 +1,6 @@
-#!@PERL@
+#! @PERL@
-# $NetBSD: lintpkgsrc.pl,v 1.110 2006/02/12 18:35:59 rillig Exp $
+# $NetBSD: lintpkgsrc.pl,v 1.111 2006/05/19 23:38:12 rillig Exp $
# Written by David Brownlee <abs%netbsd.org@localhost>.
#
@@ -38,14 +38,16 @@
$ENV{PATH} .= ":/bin:/usr/bin:/sbin:/usr/sbin:${conf_prefix}/sbin:${conf_prefix}/bin";
-if (! getopts('BDE:I:K:LM:OP:RSVdg:himopru', \%opt) || $opt{h} ||
- ! ( defined($opt{d}) || defined($opt{g}) || defined($opt{i}) ||
- defined($opt{m}) || defined($opt{o}) ||
- defined($opt{p}) || defined($opt{r}) || defined($opt{u}) ||
- defined($opt{B}) || defined($opt{D}) || defined($opt{R}) ||
- defined($opt{O}) || defined($opt{S}) || defined($opt{V}) ||
- defined($opt{E})))
- { usage_and_exit(); }
+if (!getopts('BDE:I:K:LM:OP:RSVdg:himopru', \%opt)
+ || $opt{h}
+ || !(defined($opt{d}) || defined($opt{g}) || defined($opt{i}) ||
+ defined($opt{m}) || defined($opt{o}) || defined($opt{p}) ||
+ defined($opt{r}) || defined($opt{u}) || defined($opt{B}) ||
+ defined($opt{D}) || defined($opt{R}) || defined($opt{O}) ||
+ defined($opt{S}) || defined($opt{V}) || defined($opt{E}))) {
+
+ usage_and_exit();
+}
$| = 1;
# Horrible kludge to ensure we have a value for testing in conditionals, but
@@ -54,1332 +56,1369 @@
get_default_makefile_vars(); # $default_vars
-if ($opt{D} && @ARGV)
- {
- foreach my $file (@ARGV)
- {
- if ( -d $file)
- { $file .= "/Makefile"; }
- if (! -f $file)
- { fail("No such file: $file"); }
- my($pkgname, $vars);
- ($pkgname, $vars) = parse_makefile_pkgsrc($file);
- $pkgname ||= 'UNDEFINED';
- print "$file -> $pkgname\n";
- foreach my $varname (sort keys %{$vars})
- { print "\t$varname = $vars->{$varname}\n"; }
-# if ($opt{d})
-# { pkgsrc_check_depends(); }
+if ($opt{D} && @ARGV) {
+ foreach my $file (@ARGV) {
+ if ( -d $file) {
+ $file .= "/Makefile";
+ }
+ if (! -f $file) {
+ fail("No such file: $file");
+ }
+ my ($pkgname, $vars) = parse_makefile_pkgsrc($file);
+ $pkgname ||= 'UNDEFINED';
+ print "$file -> $pkgname\n";
+ foreach my $varname (sort keys %{$vars}) {
+ print "\t$varname = $vars->{$varname}\n";
+ }
+ #if ($opt{d}) {
+ # pkgsrc_check_depends();
+ #}
}
- exit;
- }
+ exit;
+}
-# main
- {
- my($pkgsrcdir, $pkgdistdir);
+sub main() {
+ my($pkgsrcdir, $pkgdistdir);
- $pkgsrcdir = $default_vars->{PKGSRCDIR};
- $pkgdistdir = $default_vars->{DISTDIR};
+ $pkgsrcdir = $default_vars->{PKGSRCDIR};
+ $pkgdistdir = $default_vars->{DISTDIR};
- if ($opt{r} && !$opt{o} && !$opt{m} && !$opt{p})
- { $opt{o} = $opt{m} = $opt{p} = 1; }
- if ($opt{o} || $opt{m})
- {
- my(@baddist);
+ if ($opt{r} && !$opt{o} && !$opt{m} && !$opt{p}) {
+ $opt{o} = $opt{m} = $opt{p} = 1;
+ }
+ if ($opt{o} || $opt{m}) {
+ my(@baddist);
- @baddist = scan_pkgsrc_distfiles_vs_distinfo($pkgsrcdir, $pkgdistdir,
- $opt{o}, $opt{m});
- if ($opt{r})
- {
- verbose("Unlinking 'bad' distfiles\n");
- foreach my $distfile (@baddist)
- { unlink("$pkgdistdir/$distfile"); }
- }
+ @baddist = scan_pkgsrc_distfiles_vs_distinfo(
+ $pkgsrcdir, $pkgdistdir, $opt{o}, $opt{m});
+ if ($opt{r}) {
+ verbose("Unlinking 'bad' distfiles\n");
+ foreach my $distfile (@baddist) {
+ unlink("$pkgdistdir/$distfile");
+ }
+ }
}
- # List BROKEN packages
- if ($opt{B})
- {
- scan_pkgsrc_makefiles($pkgsrcdir);
- foreach my $pkgver ($pkglist->pkgver)
- {
- $pkgver->var('BROKEN') || next;
- print $pkgver->pkgname.': '.$pkgver->var('BROKEN')."\n";
- }
+ # List BROKEN packages
+ if ($opt{B}) {
+ scan_pkgsrc_makefiles($pkgsrcdir);
+ foreach my $pkgver ($pkglist->pkgver) {
+ $pkgver->var('BROKEN') || next;
+ print $pkgver->pkgname.': '.$pkgver->var('BROKEN')."\n";
+ }
}
- # List obsolete or NO_BIN_ON_FTP/RESTRICTED prebuilt packages
- #
- if ($opt{p} || $opt{O} || $opt{R} || $opt{V})
- {
- if ($opt{V})
- {
- my($vuln) = "$pkgdistdir/pkg-vulnerabilities";
- if (! open(VULN, $vuln))
- { fail("Unable to open '$vuln': $!"); }
- while (<VULN>)
- {
- s/#.*//;
- if ( /([^*?[]+)(<|>|<=|>=)(\d\S+)/ )
- {
- my($pkg, $cmp, $ver) = ($1, $2, $3);
- push(@{$vuln{$pkg}},"$cmp $ver");
- }
+ # List obsolete or NO_BIN_ON_FTP/RESTRICTED prebuilt packages
+ #
+ if ($opt{p} || $opt{O} || $opt{R} || $opt{V}) {
+ if ($opt{V}) {
+ my ($vuln) = "$pkgdistdir/pkg-vulnerabilities";
+
+ if (!open(VULN, $vuln)) {
+ fail("Unable to open '$vuln': $!");
+ }
+ while (<VULN>) {
+ s/#.*//;
+ if (/([^*?[]+)(<|>|<=|>=)(\d\S+)/) {
+ my ($pkg, $cmp, $ver) = ($1, $2, $3);
+ push(@{$vuln{$pkg}},"$cmp $ver");
+ }
+ }
+ close(VULN);
}
- close(VULN);
- }
- if ($opt{p} || $opt{O} || $opt{R} || $opt{V})
- { scan_pkgsrc_makefiles($pkgsrcdir); }
- @prebuilt_pkgdirs = ($default_vars->{PACKAGES});
- %prebuilt_pkgdir_cache = ();
- while (@prebuilt_pkgdirs)
- { find(\&check_prebuilt_packages, shift @prebuilt_pkgdirs); }
- if ($opt{r})
- {
- verbose("Unlinking listed prebuiltpackages\n");
- foreach my $pkgfile (@matched_prebuiltpackages)
- { unlink($pkgfile); }
- }
+
+ if ($opt{p} || $opt{O} || $opt{R} || $opt{V}) {
+ scan_pkgsrc_makefiles($pkgsrcdir);
+ }
+ @prebuilt_pkgdirs = ($default_vars->{PACKAGES});
+ %prebuilt_pkgdir_cache = ();
+
+ while (@prebuilt_pkgdirs) {
+ find(\&check_prebuilt_packages, shift @prebuilt_pkgdirs);
+ }
+
+ if ($opt{r}) {
+ verbose("Unlinking listed prebuiltpackages\n");
+ foreach my $pkgfile (@matched_prebuiltpackages) {
+ unlink($pkgfile);
+ }
+ }
}
- if ($opt{S})
- {
- my(%in_subdir);
+ if ($opt{S}) {
+ my(%in_subdir);
+
+ foreach my $cat (list_pkgsrc_categories($pkgsrcdir)) {
+ my $vars = parse_makefile_vars("$pkgsrcdir/$cat/Makefile");
- foreach my $cat (list_pkgsrc_categories($pkgsrcdir))
- {
- my($vars) = parse_makefile_vars("$pkgsrcdir/$cat/Makefile");
- if (! $vars->{SUBDIR})
- { print "Warning - no SUBDIR for $cat\n"; next; }
- foreach my $pkgdir (split(/\s+/, $vars->{SUBDIR}))
- { $in_subdir{"$cat/$pkgdir"} = 1; }
- }
+ if (!$vars->{SUBDIR}) {
+ print "Warning - no SUBDIR for $cat\n";
+ next;
+ }
+ foreach my $pkgdir (split(/\s+/, $vars->{SUBDIR})) {
+ $in_subdir{"$cat/$pkgdir"} = 1;
+ }
+ }
- scan_pkgsrc_makefiles($pkgsrcdir);
- foreach my $pkgver ($pkglist->pkgver)
- {
- if (!defined $in_subdir{$pkgver->var('dir')})
- { print $pkgver->var('dir').": Not in SUBDIR\n"; }
- }
+ scan_pkgsrc_makefiles($pkgsrcdir);
+ foreach my $pkgver ($pkglist->pkgver) {
+ if (!defined $in_subdir{$pkgver->var('dir')}) {
+ print $pkgver->var('dir').": Not in SUBDIR\n";
+ }
+ }
}
- if ($opt{g})
- {
- my($tmpfile);
-
- $tmpfile = "$opt{g}.tmp.$$";
+ if ($opt{g}) {
+ my $tmpfile = "$opt{g}.tmp.$$";
- scan_pkgsrc_makefiles($pkgsrcdir);
- if (!open(TABLE, ">$tmpfile"))
- { fail("Unable to write '$tmpfile': $!"); }
- foreach my $pkgver ($pkglist->pkgver)
- {
- print TABLE $pkgver->pkg."\t".$pkgver->var('dir')."\t".
+ scan_pkgsrc_makefiles($pkgsrcdir);
+ if (!open(TABLE, ">$tmpfile")) {
+ fail("Unable to write '$tmpfile': $!");
+ }
+ foreach my $pkgver ($pkglist->pkgver) {
+ print TABLE $pkgver->pkg."\t".$pkgver->var('dir')."\t".
$pkgver->ver."\n";
- }
- if (!close(TABLE))
- { fail("Error while writing '$tmpfile': $!"); }
- if (!rename($tmpfile, $opt{g}))
- { fail("Error in rename('$tmpfile','$opt{g}'): $!"); }
+ }
+ if (!close(TABLE)) {
+ fail("Error while writing '$tmpfile': $!");
+ }
+ if (!rename($tmpfile, $opt{g})) {
+ fail("Error in rename('$tmpfile','$opt{g}'): $!");
+ }
+ }
+
+ if ($opt{d}) {
+ scan_pkgsrc_makefiles($pkgsrcdir);
+ pkgsrc_check_depends();
}
- if ($opt{d})
- {
- scan_pkgsrc_makefiles($pkgsrcdir);
- pkgsrc_check_depends();
- }
- if ($opt{i} || $opt{u})
- {
- my(@pkgs, @update);
+ if ($opt{i} || $opt{u}) {
+ my(@pkgs, @update);
- @pkgs = list_installed_packages();
- scan_pkgsrc_makefiles($pkgsrcdir);
+ @pkgs = list_installed_packages();
Home |
Main Index |
Thread Index |
Old Index