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: rename pkg to pk...
details: https://anonhg.NetBSD.org/pkgsrc/rev/8a868698fc1c
branches: trunk
changeset: 382722:8a868698fc1c
user: rillig <rillig%pkgsrc.org@localhost>
date: Wed Aug 03 20:14:16 2022 +0000
description:
lintpkgsrc: rename pkg to pkgbase and ver to pkgversion
The word 'pkg' has too many meanings to be useful in identifiers; use
the standard terminology instead.
diffstat:
pkgtools/lintpkgsrc/files/lintpkgsrc.pl | 36 +++++++++++++++++---------------
pkgtools/lintpkgsrc/files/t/packages.t | 8 +++---
2 files changed, 23 insertions(+), 21 deletions(-)
diffs (161 lines):
diff -r 1a7777293f13 -r 8a868698fc1c pkgtools/lintpkgsrc/files/lintpkgsrc.pl
--- a/pkgtools/lintpkgsrc/files/lintpkgsrc.pl Wed Aug 03 20:04:34 2022 +0000
+++ b/pkgtools/lintpkgsrc/files/lintpkgsrc.pl Wed Aug 03 20:14:16 2022 +0000
@@ -1,6 +1,6 @@
#!@PERL5@
-# $NetBSD: lintpkgsrc.pl,v 1.46 2022/08/03 20:04:34 rillig Exp $
+# $NetBSD: lintpkgsrc.pl,v 1.47 2022/08/03 20:14:16 rillig Exp $
# Written by David Brownlee <abs%netbsd.org@localhost>.
#
@@ -39,13 +39,13 @@
return $self;
}
-sub pkg($) {
+sub pkgbase($) {
my ($self) = @_;
$self->{pkgbase};
}
-sub ver($) {
+sub pkgversion($) {
my ($self) = @_;
$self->{pkgversion};
@@ -54,7 +54,7 @@
sub pkgname($) {
my ($self) = @_;
- $self->pkg . '-' . $self->ver;
+ $self->pkgbase . '-' . $self->pkgversion;
}
sub var($$$) {
@@ -74,8 +74,8 @@
sub store($) {
my ($self) = @_;
- my $name = $self->pkg;
- my $ver = $self->ver;
+ my $name = $self->pkgbase;
+ my $ver = $self->pkgversion;
$name =~ /\s/ and die "cannot store package name '$name'\n";
$ver =~ /\s/ and die "cannot store package version '$ver'\n";
@@ -105,7 +105,7 @@
return $self;
}
-sub pkg($) {
+sub pkgbase($) {
my ($self) = @_;
$self->{pkgbase};
@@ -134,7 +134,7 @@
if (@_ > 1) {
return $pkgvers->{$pkgversion};
}
- return sort { $b->ver cmp $a->ver } values %{$pkgvers};
+ return sort { $b->pkgversion cmp $a->pkgversion } values %{$pkgvers};
}
sub latestver($) {
@@ -205,7 +205,7 @@
if (defined $pkgbase) {
return $self->{$pkgbase};
} else {
- return sort { $a->pkg cmp $b->pkg } values %{$self};
+ return sort { $a->pkgbase cmp $b->pkgbase } values %{$self};
}
}
@@ -979,12 +979,12 @@
if (@pkgvers = $pkglist->pkgver($matchpkgname)) {
foreach my $pkgver (@pkgvers) {
if ($test eq '-') {
- if ($pkgver->ver eq $matchver) {
+ if ($pkgver->pkgversion eq $matchver) {
$matchver = undef;
last;
}
} else {
- if (pkgversioncmp($pkgver->ver, $test, $matchver)) {
+ if (pkgversioncmp($pkgver->pkgversion, $test, $matchver)) {
$matchver = undef;
last;
}
@@ -1008,7 +1008,9 @@
} elsif ($regex = glob2regex($matchpkgname)) {
foreach my $pkg ($pkglist->pkgs) {
- ($pkg->pkg() =~ /$regex/) && push(@pkgnames, $pkg->pkg());
+ if ($pkg->pkgbase =~ /$regex/) {
+ push(@pkgnames, $pkg->pkgbase);
+ }
}
}
@@ -1682,9 +1684,9 @@
scan_pkgsrc_makefiles($pkgsrcdir);
open(TABLE, '>', $tmpfile) or fail("Cannot write '$tmpfile': $!");
foreach my $pkgver ($pkglist->pkgver) {
- print TABLE $pkgver->pkg . "\t"
+ print TABLE $pkgver->pkgbase . "\t"
. $pkgver->var('dir') . "\t"
- . $pkgver->ver . "\n";
+ . $pkgver->pkgversion . "\n";
}
close(TABLE) or fail("close('$tmpfile'): $!");
rename($tmpfile, $fname)
@@ -1716,8 +1718,8 @@
print "\nREQUIRED details for packages that could be updated:\n";
foreach my $pkgver (@update) {
- print $pkgver->pkg . ':';
- if (open(PKGINFO, 'pkg_info -R ' . $pkgver->pkg . '|')) {
+ print $pkgver->pkgbase . ':';
+ if (open(PKGINFO, 'pkg_info -R ' . $pkgver->pkgbase . '|')) {
my ($list);
while (<PKGINFO>) {
@@ -1738,7 +1740,7 @@
foreach my $pkgver (@update) {
my $pkgpath = $pkgver->var('dir');
defined($pkgpath)
- or fail('Cannot determine ' . $pkgver->pkg . ' directory');
+ or fail('Cannot determine ' . $pkgver->pkgbase . ' directory');
print "$pkgsrcdir/$pkgpath\n";
chdir_or_fail("$pkgsrcdir/$pkgpath");
diff -r 1a7777293f13 -r 8a868698fc1c pkgtools/lintpkgsrc/files/t/packages.t
--- a/pkgtools/lintpkgsrc/files/t/packages.t Wed Aug 03 20:04:34 2022 +0000
+++ b/pkgtools/lintpkgsrc/files/t/packages.t Wed Aug 03 20:14:16 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: packages.t,v 1.5 2022/08/03 19:22:34 rillig Exp $
+# $NetBSD: packages.t,v 1.6 2022/08/03 20:14:16 rillig Exp $
use strict;
use warnings;
@@ -12,8 +12,8 @@
sub test_pkgver() {
my $pkgver = PkgVer->new('base', '1.0nb4');
- ok($pkgver->pkg , 'base');
- ok($pkgver->ver , '1.0nb4');
+ ok($pkgver->pkgbase , 'base');
+ ok($pkgver->pkgversion , '1.0nb4');
ok($pkgver->pkgname , 'base-1.0nb4');
}
@@ -40,7 +40,7 @@
# The versioned packages are sorted in decreasing alphabetical order.
my @pkgvers = $pkglist->pkgver('pkgbase');
- ok(join(', ', map { $_->ver } @pkgvers), '2.0, 1.5, 1.10, 1.0');
+ ok(join(', ', map { $_->pkgversion } @pkgvers), '2.0, 1.5, 1.10, 1.0');
ok($pkgvers[0], $pkgbase_2_0);
ok($pkgvers[3], $pkgbase_1_0);
}
Home |
Main Index |
Thread Index |
Old Index