cpt

Carbs Packaging Tools
git clone git://git.carbslinux.org/cpt
Log | Files | Refs | README | LICENSE

commit 6f155af3ffff889fd329f0a47f28b775e1b1f0d2
parent ed8c5401c1d24a4978847f821c479ce405ee04c1
Author: Cem Keylan <cem@ckyln.com>
Date:   Mon,  5 Oct 2020 10:32:46 +0300

cpt-orphans: add tool to print orphaned packages.

Diffstat:
Acontrib/cpt-orphans | 27+++++++++++++++++++++++++++
1 file changed, 27 insertions(+), 0 deletions(-)

diff --git a/contrib/cpt-orphans b/contrib/cpt-orphans @@ -0,0 +1,27 @@ +#!/bin/sh -e +# Print orphaned packages. + +trap 'rm -f $CPT_TMPDIR/packages-$$' EXIT + +cd "$CPT_ROOT/var/db/cpt/installed" + +# Get base packages. +[ -f "$CPT_ROOT/etc/cpt-base" ] && while read -r pkg _; do + case "$pkg" in ''|\#*) continue; esac + base=" $pkg $base" +done < "$CPT_ROOT/etc/cpt-base" + +# Make a list of packages, but remove the base. +for pkg in *; do + case "$base" in *" $pkg "*) continue; esac + printf '%s\n' "$pkg" +done > "${CPT_TMPDIR:=/tmp}/packages-$$" + +# List dependencies. +cat ./*/depends | + +# Remove make dependencies. +while read -r dep make; do [ "$make" ] || printf '%s\n' "$dep"; done | sort -u | + +# Remove dependencies from the list and print. +comm -23 "$CPT_TMPDIR/packages-$$" -