prt-auf: rename the built package after a footprint mismatch, to prevent false reports of 'up-to-date'

This commit is contained in:
John McQuah 2023-03-27 15:34:56 -04:00
parent b75ee0be7f
commit 287e853171

View File

@ -420,7 +420,7 @@ sub get_pkgfile_fields {
elsif (s/^# URL:\s*(.*)/$1/) { $url = $_; }
elsif (s/^version=(.*)/$1/) { $Version = $_; }
elsif (s/^release=(.*)/$1/) { $Release = $_; }
elsif (s/^# Depends on:\s*(.*)/$1/) { $Dependencies = $_; }
elsif (s/^# Depends (O|o)n:\s*(.*)/$2/) { $Dependencies = $_; }
elsif (s/^# (Optional|Nice to have):\s*(.*)/$2/) { $SoftDeps = $_; }
elsif (s/^# Maintainer:\s*(.*)/$1/) { $maintainer = $_; }
else {}
@ -760,7 +760,9 @@ sub up_inst { # returns scalar references to five arrays
$pvars{'%v'} = $1 if ( $V_REPO{$t} =~ m/(.+)-[0-9]+$/ );
$pvars{'%r'} = $1 if ( $V_REPO{$t} =~ m/-([0-9]+)$/ );
$builtpkg{$t} = ($PKG_DIR) ? "$PKG_DIR/$t#$pvars{'%v'}-$pvars{'%r'}.pkg.tar.$COMPRESSION" : "$pvars{'%p'}/$t#$pvars{'%v'}-$pvars{'%r'}.pkg.tar.$COMPRESSION";
$builtpkg{$t} =~ s/\$name/$t/g; $builtpkg{$t} =~ s/\$\{name\}/$t/g;
$builtpkg{$t} =~ s/uuiName/$t/g;
$builtpkg{$t} =~ s/uuiVer/$pvars{'%v'}/g;
$builtpkg{$t} =~ s/uuiRel/$pvars{'%r'}/g;
$mkcmd{$t} = "$PKGMK -d $opkg{$t}";
$addcmd{$t} = "$PKGADD -u $builtpkg{$t}";
if ($olog{write} eq "enabled") {
@ -806,6 +808,8 @@ sub up_inst { # returns scalar references to five arrays
}
unlink($logfile{$t}) if (($logfile{$t}) and
($olog{rm_on_success} eq "yes") );
} elsif ( ($not_ok{$t}) and (-f "$builtpkg{$t}") ) {
system("mv $builtpkg{$t} $builtpkg{$t}.CHECKME");
}
if (($ok{$t}) and (-f "$pdirs{$t}/post-install")
and ($opkg{runscripts} eq "yes")) {
@ -829,21 +833,18 @@ sub up_inst { # returns scalar references to five arrays
}
sub parse_pkgmk_conf {
my $CONF="/etc/pkgmk.conf"; my $COMPRESSION; my $PKG_DIR="";
my @pkgmkVars;
my $heredoc = "bash -c 'name=uuiName; version=uuiVer;";
$heredoc .= "release=uuiRel; source /etc/pkgmk.conf; ";
$heredoc .= "printf \"%s\\t%s\" \"\$PKGMK_PACKAGE_DIR\" ";
$heredoc .= "\$PKGMK_COMPRESSION_MODE;'";
open (CF,$CONF) or return;
while (<CF>) {
$COMPRESSION=$1 if m/^PKGMK_COMPRESSION_MODE=(.*)/;
$PKG_DIR=$1 if m/^PKGMK_PACKAGE_DIR=(.*)/;
open (CF,"-|",$heredoc) or return;
while (<CF>) { @pkgmkVars = split /\t/;
} close (CF);
if ($COMPRESSION) {
$COMPRESSION =~ s/#(.*)$//; # remove same-line comments like this one
$COMPRESSION =~ s/"//g; # remove double-quotes (thanks jaeger!)
} else { $COMPRESSION = "gz"; }
$PKG_DIR =~ s/"//g;
return $COMPRESSION, $PKG_DIR;
my $COMPRESSION = ($pkgmkVars[1] eq "") ? "gz" : $pkgmkVars[1];
return $COMPRESSION, $pkgmkVars[0];
}
sub port_ls {