Compare commits

..

No commits in common. "c749f5c595fd275f2c9bd931b27c9e702dccea5e" and "79dbac7647f9ad42bea906b279a8a09d0b0856ff" have entirely different histories.

5 changed files with 31 additions and 62 deletions

View File

@ -48,18 +48,13 @@ will remove all outdated packages and sources.
.SH CONFIGURATION
\fBoldfiles\fP looks for the file /etc/oldfiles.conf (if present) that contains
a list of files that should be kept. The format is a simple list of filenames
(full path required). For example, if you share a directory of built packages
among other CRUX machines using \fBpkg\-get\fP(1) and \fBportspage\fP(1), you can
put something like the following into /etc/oldfiles.conf so that
the metadata files and html index will be omitted from the output.
(full path required), e.g.:
.PP
.nf
.fam C
/usr/pkgmk/packages/PKGREPO
/usr/pkgmk/packages/PKGDEPS
/usr/pkgmk/packages/PKGREAD
/usr/pkgmk/packages/PKGINST
/usr/pkgmk/packages/index.html
/usr/sources/someport-1.3.tar.gz
/usr/packages/someport#1.3.pkg.tar.gz
/usr/packages/index.html
.fam T
.fi

View File

@ -29,6 +29,6 @@ affected ports using
.B prt\-get update \-fr
(see \fBprt\-get\fP(8) for more detailed examples).
.SH AUTHORS
Jukka Heino <jukka@karsikkopuu.net>, John McQuah <jmcquah@disroot.org>
Jukka Heino <jukka@karsikkopuu.net>
.SH SEE ALSO
\fBprt\-cache\fP(8), \fBprt\-get\fP(8), \fBPkgfile\fP(5), \fBrevdep\fP(1)

View File

@ -41,14 +41,11 @@ if ( $options{"-p"} + $options{"-s"} + $options{"-l"} == 0 ) {
# Read pkgmk.conf
open CONFIG, "/etc/pkgmk.conf" or die "Could not open /etc/pkgmk.conf";
while (<CONFIG>) {
$srcdir = $1 if m/^PKGMK_SOURCE_DIR=(.*)\n/;
$pkgdir = $1 if m/^PKGMK_PACKAGE_DIR=(.*)\n/;
$compress = $1 if m/^PKGMK_COMPRESSION_MODE=(.*)\n/;
$srcdir = $1 if m/^PKGMK_SOURCE_DIR="(.*)"\n/;
$pkgdir = $1 if m/^PKGMK_PACKAGE_DIR="(.*)"\n/;
$compress = $1 if m/^PKGMK_COMPRESSION_MODE="(.*)"\n/;
}
close CONFIG;
$srcdir =~ s/"//g;
$pkgdir =~ s/"//g;
$compress =~ s/"//g;
# Check if dirs are specified / exists
if ( $options{"-p"} ) {
@ -105,7 +102,7 @@ foreach (split('\n', `prt-get printf "%p:%n:%v:%r:%i\n"`)) {
open SIGNATURES, "$path/$name/.signature" or next;
while (<SIGNATURES>) {
m/^SHA256\s\((.+)\)\s.+\n/;
if ($1 && ($1 ne "Pkgfile") && ($1 ne ".footprint")) {
if ($1 && !($1 =~ "Pkgfile") && !($1 =~ ".footprint")) {
$wanted{$srcdir}{$1} = 1;
}
}
@ -123,11 +120,11 @@ foreach (split('\n', `prt-get printf "%p:%n:%v:%r:%i\n"`)) {
# Keep user-specified files
if ( -f "/etc/oldfiles.conf") {
my $k;
my $keep;
open KEEPME, "/etc/oldfiles.conf" or die "Could not open /etc/oldfiles.conf";
while ($k = <KEEPME>) {
chomp($k);
$keepme{$k} = 1;
while ($keep = <KEEPME>) {
chomp($keep);
$keepme{$keep} = 1;
}
}
close KEEPME;

View File

@ -12,7 +12,6 @@
#
PRT_GET=prt-cache
RECHECK=1
if [ $UID = 0 ]; then
PKGRM=pkgrm
@ -33,29 +32,35 @@ if [ ! -f "$CONF" ]; then
touch "$CONF"
fi
while [ $RECHECK = 1 ] ; do
echo
echo "(Re-)checking packages for orphans..."
echo "Checking packages for orphans..."
while true ; do
RECHECK=0
mapfile -t orphans < <(comm -23 <($PRT_GET listorphans | sort) \
orphans=$(comm -23 <($PRT_GET listorphans | sort) \
<(cat <(find "$BASE" -maxdepth 1 -type d -printf "%f\n") "$CONF" \
| sort -u) )
| sort -u) | tr '\n' ' ')
for PACKAGE in ${orphans[@]}; do
echo
$PRT_GET info "$PACKAGE"
$PRT_GET info $PACKAGE
echo
echo -n "Uninstall $PACKAGE? (y/N) "
read -r ANSWER
read ANSWER
if [ "$ANSWER" = "y" ] ; then
$PKGRM "$PACKAGE"
$PKGRM $PACKAGE
RECHECK=1
else
echo "$PACKAGE" >> "$CONF"
echo $PACKAGE >> "$CONF"
fi
done
if [ "$RECHECK" = "0" ] ; then
exit 0
fi
echo
echo "Re-checking packages for new orphans..."
done

View File

@ -41,13 +41,13 @@ my @basedirs = @{$bldirs[0]}; my @localports = @{$bldirs[1]};
get_locked_and_aliased();
if (($action !~ /^(fsearch|isinst|current|sync)$/) and ($osearch{cache}==0)) {
if (($action !~ /^(fsearch|isinst|current)$/) and ($osearch{cache}==0)) {
@allports = list_ports();
fill_hashes_from_pkgfiles();
}
if ($osearch{cache}==1) { fill_hashes_from_cache(); }
if ($action !~ /^(search|dsearch|fsearch|info|dup|ls|readme|cat|sync)$/) {
if ($action !~ /^(search|dsearch|fsearch|info|dup|ls|readme|cat)$/) {
open (DB, "$altroot$pkgdb") or die "Could not open package database!\n";
local $/="";
while (<DB>) { $V_INST{$1} = $2 if m/^(.*)\n(.*)\n/; }
@ -75,7 +75,6 @@ if ($action eq "path") { @results = find_port_by_name($query[0],1,1,0);
} elsif ($action eq "install") { @results = up_inst(@query);
} elsif ($action eq "dup") { $ind=find_dups(@query);
} elsif ($action eq "remove") { $ind=uninstall(@query);
} elsif ($action eq "sync") { sync(@query);
} elsif ($action =~ /^(isinst|current|sysup)$/) { ($ind, @results) = port_diff($1,@query);
} elsif ($action =~ /(.*)diff$/) { ($ind, @results) = port_diff($1);
} elsif ($action =~ /^list(.*)/) { @results = list_ports($1);
@ -203,7 +202,7 @@ while (my $arg = shift) {
} elsif ($arg =~ /^(lock|unlock|listlocked|current|isinst)$/) { $action = $1;
} elsif ($arg =~ /^(diff|quickdiff|printf|listinst|listorphans)$/) {
$action = $1; $odepends{tree} = 0;
} elsif ($arg =~ /^(depends|quickdep|dup|dependent|sync)$/) { $action = $1;
} elsif ($arg =~ /^(depends|quickdep|dup|dependent)$/) { $action = $1;
} elsif ($arg eq "deptree") { $action = $arg; $odepends{tree} = 1;
} elsif ($arg =~ /^(readme|cat|edit|ls|help|version|cache)$/) { $action = $1;
} elsif ($arg eq "--tree") { $odepends{tree} = 1;
@ -298,33 +297,6 @@ while (<PORTS>) { chomp;
return \@basedirs, \@localports;
}
sub sync {
my $sup_path = "/etc/ports";
my @OPT_COLLECTIONS=@_; my @drivers;
opendir(my $drv, "$sup_path/drivers") or return;
foreach my $d (sort(readdir($drv))) {
next if ($d =~ /^\./) or (! -x "$sup_path/drivers/$d");
push @drivers, $d;
}
closedir($drv);
if ($#OPT_COLLECTIONS >= 0) { # Update selected collections
foreach my $coll (@OPT_COLLECTIONS) {
if (! glob("$sup_path/$coll.*")) {
print("$coll not configured in $sup_path!\n"); next;
}
foreach my $suffix (@drivers) {
system("$sup_path/drivers/$suffix","$sup_path/$coll.$suffix") if (-f "$sup_path/$coll.$suffix");
}
}
} else { # Update all collections
foreach my $driver (@drivers) {
while (my $active = glob("$sup_path/*.$driver")) {
system("$sup_path/drivers/$driver",$active);
}
}
}
}
sub find_dups {
my %seen; my $format=shift; my @dupinfo; my @info1; my $dupstr; my @hits;
foreach my $pp (@allports) { my $pn = (split /\//, $pp)[-1]; $seen{$pn}++; }