diff options
| author | B. Watson <urchlay@slackware.uk> | 2026-08-30 03:32:46 -0400 |
|---|---|---|
| committer | B. Watson <urchlay@slackware.uk> | 2026-08-30 03:32:46 -0400 |
| commit | 16c12ae5e1c07bb67ddef8927aecbe1bf28bd707 (patch) | |
| tree | 0c56c417c833de6f2f58cb50ef59a9dd9d20c452 /findpkgconflicts.pl | |
| parent | c6135590f169a27815702bde727db320a92495f2 (diff) | |
| download | sbostuff-master.tar.gz | |
Diffstat (limited to 'findpkgconflicts.pl')
| -rwxr-xr-x | findpkgconflicts.pl | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/findpkgconflicts.pl b/findpkgconflicts.pl new file mode 100755 index 0000000..1446f1b --- /dev/null +++ b/findpkgconflicts.pl @@ -0,0 +1,63 @@ +#!/usr/bin/perl -w + +($SELF = $0) =~ s,.*/,,; + +sub usage() { + print <<EOF; +Usage: $SELF [-s] + +Finds conflicting files in Slackware packages. + +Options: + -s Ignore 3rd-party packages (core Slackware only). + -a Include aaa_* packages and openssl-solibs (normally ignored). +EOF +} + +$slackware_only = 0; +$ignore_aaa = 1; + +for(@ARGV) { + last unless defined; + /^-s$/ && do { $slackware_only++; next; }; + /^-a$/ && do { $ignore_aaa = 0; next; }; + /^(?:-h|--help)$/ && do { usage(); }; + die "Unknown argument '$_', try --help.\n"; +} + +$pkgdir = $ENV{PACKAGE_DIR} || "/var/log/packages"; + +chdir $pkgdir or die "$!\n"; + +$conflicts = $files = $packages = 0; + +for $pkg (<*>) { + next if ($ignore_aaa && $pkg =~ /^(?:aaa_|openssl-solibs-)/); + next if ($slackware_only && $pkg !~ /(?:\d|slack[\d.]+)$/); + my $fh; + if(!open $fh, '<', $pkg) { + warn "can't read $pkg: $!\n"; + next; + } + $packages++; + while(<$fh>) { + last if /^FILE LIST:/; + } + while(<$fh>) { + chomp; + next if m{/$}; + next if m{^install/}; + push @{$files{$_}}, $pkg; + $files++; + } + close $fh; +} + +for(sort keys %files) { + my @pkgs = @{$files{$_}}; + next unless @pkgs > 1; + $conflicts++; + print "$_:\n\t" . join("\n\t", @pkgs) . "\n"; +} + +print "\n== Found $conflicts conflicts in $files files (in $packages packages)\n"; |
