aboutsummaryrefslogtreecommitdiff
path: root/find_installed_removed
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-09-19 21:01:14 -0400
committerB. Watson <urchlay@slackware.uk>2026-09-19 21:01:14 -0400
commit8eda2b1779a788247a7a92141d477ee51d7e0ae3 (patch)
tree015e4b7cf43d8173b70c6208cdff23fc00f420cb /find_installed_removed
parentf052fb1ee3f5b3e757bd5e8bc1a5aef8116dc6ce (diff)
downloadsbo-maintainer-tools-8eda2b1779a788247a7a92141d477ee51d7e0ae3.tar.gz
find_installed_removed: added.
Diffstat (limited to 'find_installed_removed')
-rwxr-xr-xfind_installed_removed57
1 files changed, 57 insertions, 0 deletions
diff --git a/find_installed_removed b/find_installed_removed
new file mode 100755
index 0000000..ad088cc
--- /dev/null
+++ b/find_installed_removed
@@ -0,0 +1,57 @@
+#!/usr/bin/perl -w
+
+($SELF = $0) =~ s,.*/,,;
+if(@ARGV) {
+ print <<EOF;
+$SELF - find installed SBo packages that are not in the SBo repo
+
+Usage: $SELF
+
+Output is a list of installed SBo packages that are not listed on the
+SBo site. Usually this means the builds were removed from the repo,
+but if you are a SBo developer, it could also find builds that you
+never got around to submitting to SBo.
+
+Exit status is 0 (success) if no removed packages are installed
+(if there is no output), or 1 (failure) if any removed packages are
+installed.
+
+By default, the 15.0 repo is searched, but you can export
+SLACKVER in the environment to check a different version.
+
+To use an alternate package database directory (other than
+/var/log/packages), set PKGDIR in the environment.
+EOF
+ exit 0;
+}
+
+# TODO: get this from /etc/slackware-version or /etc/os-release
+$SLACKVER = $ENV{SLACKVER} || "15.0";
+
+# use the .gz version, saves a lot of bandwidth
+$URL = "https://slackbuilds.org/slackbuilds/$SLACKVER/SLACKBUILDS.TXT.gz";
+
+$PKGDIR = $ENV{PKGDIR} || "/var/log/packages";
+chdir $PKGDIR || die "can't cd to $PKGDIR: $!\n";
+
+for(<*_SBo>) {
+ my $r = reverse;
+ my @a = split /-/, $r, 4;
+ my $pkg = reverse $a[3];
+ $installed{$pkg}++;
+}
+
+open my $pipe, "wget -qO- $URL | gzip -dc |" or die $!;
+while(<$pipe>) {
+ chomp;
+ next unless m{^SLACKBUILD NAME: (.*)$};
+ $in_repo{$1}++;
+}
+close $pipe;
+
+$count = 0;
+for(sort keys %installed) {
+ $count++, print "$_\n" unless $in_repo{$_};
+}
+
+exit ($count != 0);