pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/lintpkgsrc/files lintpkgsrc: cleanup: rename ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/b1bf891f2343
branches: trunk
changeset: 383154:b1bf891f2343
user: rillig <rillig%pkgsrc.org@localhost>
date: Sat Aug 13 10:51:28 2022 +0000
description:
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.
diffstat:
pkgtools/lintpkgsrc/files/lintpkgsrc.pl | 26 +++++++++++---------------
pkgtools/lintpkgsrc/files/t/packages.t | 4 ++--
2 files changed, 13 insertions(+), 17 deletions(-)
diffs (98 lines):
diff -r 34cd2c9fbb8f -r b1bf891f2343 pkgtools/lintpkgsrc/files/lintpkgsrc.pl
--- a/pkgtools/lintpkgsrc/files/lintpkgsrc.pl Sat Aug 13 10:41:21 2022 +0000
+++ b/pkgtools/lintpkgsrc/files/lintpkgsrc.pl Sat Aug 13 10:51:28 2022 +0000
@@ -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 @@
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 @@
# 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 @@
}
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 @@
}
}
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 @@
if ($opt{E}) {
scan_pkgsrc_makefiles($pkgsrcdir);
- store_pkgsrc_makefiles($pkgdb, $opt{E});
+ store_pkgdb_in_cache($pkgdb, $opt{E});
}
}
diff -r 34cd2c9fbb8f -r b1bf891f2343 pkgtools/lintpkgsrc/files/t/packages.t
--- a/pkgtools/lintpkgsrc/files/t/packages.t Sat Aug 13 10:41:21 2022 +0000
+++ b/pkgtools/lintpkgsrc/files/t/packages.t Sat Aug 13 10:51:28 2022 +0000
@@ -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 @@
$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