Compare commits

...

2 Commits

Author SHA1 Message Date
John McQuah 79dbac7647 pkgmeek: add some pattern-matching functions
(for better pkgmk compatibility)
2023-11-16 23:56:53 +00:00
John McQuah 9f5096eb27 prtwash: use stricter regex to identify latest built package 2023-11-16 23:54:02 +00:00
2 changed files with 17 additions and 3 deletions

View File

@ -349,6 +349,21 @@ check_pkg_mtime() { # can be called even if some sources are missing
[ "$PKGMK_MTIME_ONLY" = "yes" ] && info "$msg"; return $utd
}
get_basename() {
echo "${1##*/}"
}
get_filename() {
local ABSOLUTE=""
[ "$1" = "-a" ] && { ABSOLUTE=1; shift; }
if [[ $1 =~ ^(http|https|ftp|file)://.*/(.+) ]]; then
echo "$PKGMK_SOURCE_DIR/${BASH_REMATCH[2]}"
else
[ "$ABSOLUTE" ] && echo "$PKGMK_ROOT/$1" || echo "$1"
fi
}
fetch_url() {
local u="$1"; local h="$2"; local finished=0; local giturl tag CLONE_ARGS
local SAVE_AS REPO OCONTINUE OOUT; local m=0

View File

@ -156,7 +156,7 @@ sub keeplist { # remember to pop off the last two elements for regex purposes
push(@keepers, $ki);
}
}
push (@keepers, "$name#$version.*\.pkg\.tar\.$compression_mode");
push (@keepers, "$name#$version-$release\.pkg\.tar\.$compression_mode");
push (@keepers, "$name#.*\.pkg\.tar\.$compression_mode");
return @keepers;
}
@ -192,7 +192,7 @@ sub do_wash {
foreach my $f (sort(readdir(DIR))) {
next if ($f eq '.' or $f eq '..');
if ($iswanted{$f} or ($options{pkgtoo}==0)*($f =~ /$currbuild/)
or ($options{oldver}==0)*($f =~ /$allbuilds/)*($f !~ /$currbuild/)) {
or ($options{oldver}==0)*($f =~ /$allbuilds/)*($f !~ /$currbuild/)) {
print "... keeping file $port/$f.\n" unless $options{quiet} == 1;
} else {
remove ("$port/$f");
@ -214,7 +214,6 @@ sub getportdirs { # returns scalar references to two arrays
$line =~ s/^prtdir\s+//; #remove the leading directive
$line =~ s/#.*$//; #strip inline comments like this one
$line =~ s/\s+//g; #collapse all whitespace, even if in a path!
#(not that we ever put spaces or commas in repo names anyway)
if ( $line !~ /:/ ) {
push @basedirs, $line if (-d $line);
} else {