diff options
| author | B. Watson <urchlay@slackware.uk> | 2026-09-19 21:01:14 -0400 |
|---|---|---|
| committer | B. Watson <urchlay@slackware.uk> | 2026-09-19 21:01:14 -0400 |
| commit | 8eda2b1779a788247a7a92141d477ee51d7e0ae3 (patch) | |
| tree | 015e4b7cf43d8173b70c6208cdff23fc00f420cb | |
| parent | f052fb1ee3f5b3e757bd5e8bc1a5aef8116dc6ce (diff) | |
| download | sbo-maintainer-tools-8eda2b1779a788247a7a92141d477ee51d7e0ae3.tar.gz | |
find_installed_removed: added.
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | NEWS | 2 | ||||
| -rwxr-xr-x | find_installed_removed | 57 |
3 files changed, 60 insertions, 1 deletions
@@ -14,7 +14,7 @@ MAN1DIR=$(MANDIR)/man1 DOCDIR=$(PREFIX)/doc/$(PROJ)-$(VERSION) DOCS=README QUICKSTART TODO pre-commit-sbolint NEWS CREDITS -SCRIPTS=sbopkglint sbolint sbofixinfo sbodl explodepkg.sbopkglint find_installed_orphans +SCRIPTS=sbopkglint sbolint sbofixinfo sbodl explodepkg.sbopkglint find_installed_orphans find_installed_removed all: @echo "Use 'make install PREFIX=<path>' to install $(PROJ)." @@ -4,6 +4,8 @@ user-visible changes between releases. New in 0.9.9: ============= +New tools added: find_installed_orphans and find_installed_removed. + sbolint: - Having multiple *.SlackBuild files is now an error. - doinst.sh should not use chmod. This is a note rather than 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); |
