pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/url2pkg/files pkgtools/url2pkg: refactor code...
details: https://anonhg.NetBSD.org/pkgsrc/rev/82d0d1942796
branches: trunk
changeset: 401197:82d0d1942796
user: rillig <rillig%pkgsrc.org@localhost>
date: Fri Sep 13 05:38:27 2019 +0000
description:
pkgtools/url2pkg: refactor code for determining WRKSRC into separate sub
diffstat:
pkgtools/url2pkg/files/url2pkg.pl | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
diffs (53 lines):
diff -r f63c37cd121d -r 82d0d1942796 pkgtools/url2pkg/files/url2pkg.pl
--- a/pkgtools/url2pkg/files/url2pkg.pl Fri Sep 13 05:19:27 2019 +0000
+++ b/pkgtools/url2pkg/files/url2pkg.pl Fri Sep 13 05:38:27 2019 +0000
@@ -1,5 +1,5 @@
#! @PERL5@
-# $NetBSD: url2pkg.pl,v 1.70 2019/09/12 18:23:00 rillig Exp $
+# $NetBSD: url2pkg.pl,v 1.71 2019/09/13 05:38:27 rillig Exp $
#
# Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -333,8 +333,8 @@
push(@dep_lines, [ $1, $2, $3 || ">=0", $4 || "" ]);
} elsif ($line =~ qr"^var\t(\S+)\t(.+)$") {
$main::update_vars{$1} = $2;
- } else {
- printf STDERR "url2pkg: unknown dependency line: %s\n", $line;
+ } elsif ($line ne "") {
+ printf STDERR "url2pkg: info: unknown dependency line: %s\n", $line;
}
}
@@ -716,15 +716,8 @@
}
}
-sub adjust_package_from_extracted_distfiles($) {
- my ($url) = @_;
-
- chomp($abs_wrkdir = `$make show-var VARNAME=WRKDIR`);
-
- #
- # Determine the value of WRKSRC.
- #
-
+# sets $abs_wrksrc depending on $abs_wrkdir and the files found there.
+sub determine_wrksrc() {
my @files = ();
opendir(WRKDIR, $abs_wrkdir) or die;
while (defined(my $f = readdir(WRKDIR))) {
@@ -746,7 +739,13 @@
((@files > 1) ? " # More than one possibility -- please check manually." : "")));
$abs_wrksrc = $abs_wrkdir;
}
+}
+sub adjust_package_from_extracted_distfiles($) {
+ my ($url) = @_;
+
+ chomp($abs_wrkdir = `$make show-var VARNAME=WRKDIR`);
+ determine_wrksrc();
chomp(@wrksrc_files = `cd "$abs_wrksrc" && find * -type f -print`);
chomp(@wrksrc_dirs = `cd "$abs_wrksrc" && find * -type d -print`);
Home |
Main Index |
Thread Index |
Old Index