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: Sat Aug 13 10:51:28 UTC 2022
Modified Files:
pkgsrc/pkgtools/lintpkgsrc/files: lintpkgsrc.pl
pkgsrc/pkgtools/lintpkgsrc/files/t: packages.t
Log Message:
lintpkgsrc: cleanup: rename cache subroutines to be more expressive
It was easily possible to confuse scan_pkgsrc_makefiles with
load_pkgsrc_makefiles, so rename the latter to load_pkgdb_from_cache.
To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl
cvs rdiff -u -r1.13 -r1.14 pkgsrc/pkgtools/lintpkgsrc/files/t/packages.t
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.84 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.85
--- pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.84 Sat Aug 13 10:41:21 2022
+++ pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl Sat Aug 13 10:51:28 2022
@@ -1,6 +1,6 @@
#!@PERL5@
-# $NetBSD: lintpkgsrc.pl,v 1.84 2022/08/13 10:41:21 rillig Exp $
+# $NetBSD: lintpkgsrc.pl,v 1.85 2022/08/13 10:51:28 rillig Exp $
# Written by David Brownlee <abs%netbsd.org@localhost>.
#
@@ -1019,7 +1019,7 @@ sub chdir_or_fail($dir) {
chdir($dir) or fail("Cannot chdir($dir): $!\n");
}
-sub load_pkgsrc_makefiles($fname) {
+sub load_pkgdb_from_cache($fname) {
open(STORE, '<', $fname)
or die("Cannot read pkgsrc store from $fname: $!\n");
my ($pkgver);
@@ -1042,21 +1042,16 @@ sub load_pkgsrc_makefiles($fname) {
# Generate pkgname->category/pkg mapping, optionally check DEPENDS
#
sub scan_pkgsrc_makefiles($pkgsrcdir) {
- my (@categories);
-
- if ($pkgdb) {
- # Already done
- return;
- }
+ return if defined $pkgdb; # Already done.
if ($opt{I}) {
- load_pkgsrc_makefiles($opt{I});
+ load_pkgdb_from_cache($opt{I});
return;
}
$pkgdb = PkgDb->new();
- @categories = list_pkgsrc_categories($pkgsrcdir);
+ my @categories = list_pkgsrc_categories($pkgsrcdir);
verbose('Scan Makefiles: ');
if (!$opt{L}) {
@@ -1223,12 +1218,13 @@ sub scan_pkgsrc_distfiles_vs_distinfo($p
}
chdir_or_fail('/'); # Do not want to stay in $pkgdistdir
}
- (sort keys %bad_distfiles);
+
+ sort keys %bad_distfiles;
}
-sub store_pkgsrc_makefiles($db, $fname) {
+sub store_pkgdb_in_cache($db, $fname) {
open(STORE, '>', $fname)
- or die("Cannot save pkgsrc store to $fname: $!\n");
+ or die("Cannot save package data to $fname: $!\n");
foreach my $pkgver ($db->pkgvers_all) {
my $pkgbase = $pkgver->pkgbase;
my $pkgversion = $pkgver->pkgversion;
@@ -1249,7 +1245,7 @@ sub store_pkgsrc_makefiles($db, $fname)
}
}
close(STORE)
- or die("Cannot save pkgsrc store to $fname: $!\n");
+ or die("Cannot save package data to $fname: $!\n");
}
# Remember to update manual page when modifying option list
@@ -1656,7 +1652,7 @@ sub main() {
if ($opt{E}) {
scan_pkgsrc_makefiles($pkgsrcdir);
- store_pkgsrc_makefiles($pkgdb, $opt{E});
+ store_pkgdb_in_cache($pkgdb, $opt{E});
}
}
Index: pkgsrc/pkgtools/lintpkgsrc/files/t/packages.t
diff -u pkgsrc/pkgtools/lintpkgsrc/files/t/packages.t:1.13 pkgsrc/pkgtools/lintpkgsrc/files/t/packages.t:1.14
--- pkgsrc/pkgtools/lintpkgsrc/files/t/packages.t:1.13 Fri Aug 12 20:53:01 2022
+++ pkgsrc/pkgtools/lintpkgsrc/files/t/packages.t Sat Aug 13 10:51:28 2022
@@ -1,4 +1,4 @@
-# $NetBSD: packages.t,v 1.13 2022/08/12 20:53:01 rillig Exp $
+# $NetBSD: packages.t,v 1.14 2022/08/13 10:51:28 rillig Exp $
use strict;
use warnings;
@@ -117,7 +117,7 @@ sub test_store_order() {
$pkgbase_1_15->var('COMMENT', 'Version 1.15');
my $tmpfile = File::Temp->new();
- store_pkgsrc_makefiles($pkgdb, $tmpfile->filename);
+ store_pkgdb_in_cache($pkgdb, $tmpfile->filename);
my $stored = read_file($tmpfile->filename);
# XXX: 1.3nb4 should be sorted before 1.15.
Home |
Main Index |
Thread Index |
Old Index