pkgsrc-Changes archive

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

CVS commit: pkgsrc/pkgtools/lintpkgsrc/files



Module Name:    pkgsrc
Committed By:   rillig
Date:           Tue Aug 16 19:15:43 UTC 2022

Modified Files:
        pkgsrc/pkgtools/lintpkgsrc/files: lintpkgsrc.pl

Log Message:
lintpkgsrc: don't chdir unnecessarily

Previously, combining the options '-u' and '-E relative-path' did not
work.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl
diff -u pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.100 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.101
--- pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.100        Tue Aug 16 19:07:53 2022
+++ pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl      Tue Aug 16 19:15:43 2022
@@ -1,5 +1,5 @@
 #!@PERL5@
-# $NetBSD: lintpkgsrc.pl,v 1.100 2022/08/16 19:07:53 rillig Exp $
+# $NetBSD: lintpkgsrc.pl,v 1.101 2022/08/16 19:15:43 rillig Exp $
 
 # Written by David Brownlee <abs%netbsd.org@localhost>.
 #
@@ -1007,8 +1007,10 @@ sub parse_makefile_pkgsrc($file) {
 
 
 sub chdir_or_fail($dir) {
+       my $prev_dir = getcwd() or die;
        debug("chdir: $dir");
        chdir($dir) or fail("Cannot chdir($dir): $!\n");
+       return $prev_dir;
 }
 
 sub load_pkgdb_from_cache($fname) {
@@ -1196,8 +1198,7 @@ sub scan_pkgsrc_distfiles_vs_distinfo($p
                }
 
                verbose("checksum mismatches\n");
-               my $prev_cwd = getcwd() or die;
-               chdir_or_fail($pkgdistdir);
+               my $prev_dir = chdir_or_fail($pkgdistdir);
                foreach my $sum (keys %sumfiles) {
                        if ($sum eq 'Size') {
                                foreach my $file (@{$sumfiles{$sum}}) {
@@ -1231,7 +1232,7 @@ sub scan_pkgsrc_distfiles_vs_distinfo($p
                        waitpid($pid, 0) || fail "xargs digest $sum";
                        waitpid($pid2, 0) || fail 'pipe write to xargs';
                }
-               chdir_or_fail($prev_cwd);
+               chdir_or_fail($prev_dir);
        }
 
        sort keys %unref_distfiles;
@@ -1404,10 +1405,9 @@ sub remove_orphaned_distfiles($dldistfil
        }
 
        if ($opt{r}) {
-               chdir_or_fail("$pkgdistdir");
                verbose("Unlinking 'orphaned' distfiles\n");
                foreach my $distfile (@orphan) {
-                       unlink($distfile)
+                       unlink("$pkgdistdir/$distfile")
                }
        }
 }
@@ -1431,10 +1431,9 @@ sub remove_parented_distfiles($dldistfil
        }
 
        if ($opt{r}) {
-               chdir_or_fail("$pkgdistdir");
                verbose("Unlinking 'parented' distfiles\n");
                foreach my $distfile (@parent) {
-                       unlink($distfile);
+                       unlink("$pkgdistdir/$distfile");
                }
        }
 }
@@ -1588,8 +1587,9 @@ sub check_outdated_installed_packages($p
                    or fail('Cannot determine ' . $pkgver->pkgbase . ' directory');
 
                print "$pkgsrcdir/$pkgpath\n";
-               chdir_or_fail("$pkgsrcdir/$pkgpath");
+               my $prev_dir = chdir_or_fail("$pkgsrcdir/$pkgpath");
                system("$conf_make fetch-list | sh");
+               chdir_or_fail($prev_dir);
        }
 }
 



Home | Main Index | Thread Index | Old Index