pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files Moved the checkdir_package subr...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/6574c16bd3de
branches:  trunk
changeset: 498236:6574c16bd3de
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Wed Aug 17 11:28:12 2005 +0000

description:
Moved the checkdir_package subroutine directly before the main subroutine
to reduce the number of necessary forward declarations. Subsequently,
removed those forward declarations.

diffstat:

 pkgtools/pkglint/files/pkglint.pl |  183 +++++++++++++++++--------------------
 1 files changed, 86 insertions(+), 97 deletions(-)

diffs (223 lines):

diff -r 62a18ebdfbb8 -r 6574c16bd3de pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Wed Aug 17 10:55:22 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Wed Aug 17 11:28:12 2005 +0000
@@ -11,7 +11,7 @@
 # Freely redistributable.  Absolutely no warranty.
 #
 # From Id: portlint.pl,v 1.64 1998/02/28 02:34:05 itojun Exp
-# $NetBSD: pkglint.pl,v 1.240 2005/08/17 10:55:22 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.241 2005/08/17 11:28:12 rillig Exp $
 #
 # This version contains lots of changes necessary for NetBSD packages
 # done by:
@@ -368,17 +368,6 @@
 my $seen_Makefile_common;
 my $pkgname;
 
-sub checkfile_DESCR($$);
-sub checkfile_distinfo($$);
-sub checkfile_extra($$);
-sub checkfile_package_Makefile($$$$);
-sub checkfile_MESSAGE($$);
-sub checkfile_patches_patch($$);
-sub checkfile_PLIST($$);
-
-sub checkdir_category($);
-sub checkdir_package($);
-
 sub checkperms($);
 sub readmakefile($$$$);
 sub checkextra($$);
@@ -550,88 +539,6 @@
        return $predefined_sites;
 }
 
-sub checkdir_package($) {
-       my ($dir) = @_;
-
-       my ($whole, $lines, $have_distinfo, $have_patches);
-
-       $pkgdir                 = ".";
-       $filesdir               = "files";
-       $patchdir               = "patches";
-       $distinfo_file          = "distinfo";
-       $scriptdir              = "scripts";
-       $seen_USE_PKGLOCALEDIR  = false;
-       $seen_Makefile_common   = false;
-       $pkgname                = undef;
-
-       # we need to handle the Makefile first to get some variables
-       if (!load_package_Makefile($dir, "${dir}/Makefile", \$whole, \$lines)) {
-               log_error("${dir}/Makefile", NO_LINE_NUMBER, "Cannot be read.");
-               return;
-       }
-
-       my @files = <${dir}/*>;
-       if ($pkgdir ne ".") {
-               push(@files, <${dir}/${pkgdir}/*>);
-       }
-       push(@files, <${dir}/${filesdir}/*>);
-       push(@files, <${dir}/${patchdir}/*>);
-       if ($distinfo_file ne "distinfo") {
-               push(@files, "${dir}/${distinfo_file}");
-       }
-       $have_distinfo = false;
-       $have_patches = false;
-       foreach my $f (@files) {
-               if      ($f =~ qr"(?:work[^/]*|~|\.orig|\.rej)$") {
-                       if ($opt_warn_workdir) {
-                               log_warning($f, NO_LINE_NUMBER, "Should be cleaned up before committing the package.");
-                       }
-
-               } elsif (!-f $f) {
-                       # We don't have a check for non-regular files yet.
-
-               } elsif ($f eq "${dir}/Makefile") {
-                       $opt_check_Makefile and checkfile_package_Makefile($dir, $f, $whole, $lines);
-
-               } elsif ($f =~ qr"/buildlink3.mk$") {
-                       $opt_check_bl3 and checkfile_buildlink3_mk($dir, $f);
-
-               } elsif ($f =~ qr"/DESCR[^/]*$") {
-                       checkfile_DESCR($dir, $f);
-
-               } elsif ($f =~ qr"/distinfo$") {
-                       $have_distinfo = true;
-                       $opt_check_distinfo and checkfile_distinfo($dir, $f);
-
-               } elsif ($f =~ qr"/MESSAGE[^/]*$") {
-                       $opt_check_MESSAGE and checkfile_MESSAGE($dir, $f);
-
-               } elsif ($f =~ qr"/PLIST[^/]*$") {
-                       $opt_check_PLIST and checkfile_PLIST($dir, $f);
-
-               } elsif ($f =~ qr"/patches/patch-[-A-Za-z0-9]*$") {
-                       $have_patches = true;
-                       $opt_check_patches and checkfile_patches_patch($dir, $f);
-
-               } elsif (-T $f) {
-                       $opt_check_extra and checkfile_extra($dir, $f);
-
-               } else {
-                       log_warning($f, NO_LINE_NUMBER, "Unexpectedly found a binary file.");
-               }
-       }
-
-       if ($opt_check_distinfo && $opt_check_patches) {
-               if ($have_patches && ! $have_distinfo) {
-                       log_warning("$dir/$distinfo_file", NO_LINE_NUMBER, "File not found. Please run '$conf_make makepatchsum'.");
-               }
-       }
-
-       if (grep { $_ !~ qr"/CVS$" } <$dir/scripts/*>) {
-               log_warning("$dir/scripts", NO_LINE_NUMBER, "This directory and its contents are deprecated! Please call the script(s) explicitly from the corresponding target(s) in the pkg's 
Makefile.");
-       }
-}
-
 sub is_committed($) {
        my ($fname) = @_;
        my ($basename, $entries);
@@ -2292,7 +2199,89 @@
        }
 }
 
-sub check_directory($) {
+sub checkdir_package($) {
+       my ($dir) = @_;
+
+       my ($whole, $lines, $have_distinfo, $have_patches);
+
+       $pkgdir                 = ".";
+       $filesdir               = "files";
+       $patchdir               = "patches";
+       $distinfo_file          = "distinfo";
+       $scriptdir              = "scripts";
+       $seen_USE_PKGLOCALEDIR  = false;
+       $seen_Makefile_common   = false;
+       $pkgname                = undef;
+
+       # we need to handle the Makefile first to get some variables
+       if (!load_package_Makefile($dir, "${dir}/Makefile", \$whole, \$lines)) {
+               log_error("${dir}/Makefile", NO_LINE_NUMBER, "Cannot be read.");
+               return;
+       }
+
+       my @files = <${dir}/*>;
+       if ($pkgdir ne ".") {
+               push(@files, <${dir}/${pkgdir}/*>);
+       }
+       push(@files, <${dir}/${filesdir}/*>);
+       push(@files, <${dir}/${patchdir}/*>);
+       if ($distinfo_file ne "distinfo") {
+               push(@files, "${dir}/${distinfo_file}");
+       }
+       $have_distinfo = false;
+       $have_patches = false;
+       foreach my $f (@files) {
+               if      ($f =~ qr"(?:work[^/]*|~|\.orig|\.rej)$") {
+                       if ($opt_warn_workdir) {
+                               log_warning($f, NO_LINE_NUMBER, "Should be cleaned up before committing the package.");
+                       }
+
+               } elsif (!-f $f) {
+                       # We don't have a check for non-regular files yet.
+
+               } elsif ($f eq "${dir}/Makefile") {
+                       $opt_check_Makefile and checkfile_package_Makefile($dir, $f, $whole, $lines);
+
+               } elsif ($f =~ qr"/buildlink3.mk$") {
+                       $opt_check_bl3 and checkfile_buildlink3_mk($dir, $f);
+
+               } elsif ($f =~ qr"/DESCR[^/]*$") {
+                       checkfile_DESCR($dir, $f);
+
+               } elsif ($f =~ qr"/distinfo$") {
+                       $have_distinfo = true;
+                       $opt_check_distinfo and checkfile_distinfo($dir, $f);
+
+               } elsif ($f =~ qr"/MESSAGE[^/]*$") {
+                       $opt_check_MESSAGE and checkfile_MESSAGE($dir, $f);
+
+               } elsif ($f =~ qr"/PLIST[^/]*$") {
+                       $opt_check_PLIST and checkfile_PLIST($dir, $f);
+
+               } elsif ($f =~ qr"/patches/patch-[-A-Za-z0-9]*$") {
+                       $have_patches = true;
+                       $opt_check_patches and checkfile_patches_patch($dir, $f);
+
+               } elsif (-T $f) {
+                       $opt_check_extra and checkfile_extra($dir, $f);
+
+               } else {
+                       log_warning($f, NO_LINE_NUMBER, "Unexpectedly found a binary file.");
+               }
+       }
+
+       if ($opt_check_distinfo && $opt_check_patches) {
+               if ($have_patches && ! $have_distinfo) {
+                       log_warning("$dir/$distinfo_file", NO_LINE_NUMBER, "File not found. Please run '$conf_make makepatchsum'.");
+               }
+       }
+
+       if (grep { $_ !~ qr"/CVS$" } <$dir/scripts/*>) {
+               log_warning("$dir/scripts", NO_LINE_NUMBER, "This directory and its contents are deprecated! Please call the script(s) explicitly from the corresponding target(s) in the pkg's 
Makefile.");
+       }
+}
+
+sub checkdir($) {
        my ($dir) = @_;
 
        if (-f "${dir}/../mk/bsd.pkg.mk") {
@@ -2324,10 +2313,10 @@
 
        if (@ARGV) {
                foreach my $dir (@ARGV) {
-                       check_directory($dir);
+                       checkdir($dir);
                }
        } else {
-               check_directory(".");
+               checkdir(".");
        }
 
        if ($opt_debug) {



Home | Main Index | Thread Index | Old Index