Page 1 of 1

removing a programm and all no longer needed deps

Posted: 10 Aug 2013, 15:03
by Rava
Hi,
since I use viewnior as my image viewer program, I want to kick out the XFCe viewer, ristretto. Now, what would be the best approach to find all libraries and other dependencies that are only mandatory to ristretto, and create a new module 003-xfce module with everything else (including viewnior), but ristretto and dependencies mandatory to only risttetto removed?

By myself, I would remove everything from this list:

Code: Select all

guest@porteus:/mnt/live/memory/images$ find . 2>/dev/null |grep ristretto 
./003-xfce.xzm/usr/bin/ristretto
./003-xfce.xzm/usr/share/applications/ristretto.desktop
./003-xfce.xzm/usr/share/icons/hicolor/16x16/apps/ristretto.png
./003-xfce.xzm/usr/share/icons/hicolor/48x48/apps/ristretto.png
./003-xfce.xzm/usr/share/icons/hicolor/scalable/apps/ristretto.svg
./003-xfce.xzm/var/log/packages/ristretto-0.6.3-x86_64-1Ahau
and everything listed in /var/log/packages/ristretto-0.6.3-x86_64-1Ahau, but that might probably keep some libraries that are no longer needed...

How would I use the script removepkg here? This would remove the program from the running system, but how would that help me create a new, ristretto free 003-xfce module?

Re: removing a programm and all no longer needed deps

Posted: 12 Aug 2013, 14:29
by Ahau
I am pretty sure that there are no dependencies in the xfce module that are there just for ristretto, so I think you can stick to that package. I would accomplish it with the following:

Code: Select all

cd /tmp
cp /mnt/sdXY/porteus/base/003-xfce.xzm .
mkdir xfce
xzm2dir 003-xfce.xzm xfce
ROOT=/tmp/xfce removepkg ristretto
(ignore all of the warning messages, they are there because I've stripped files from the original package)
dir2xzm xfce 003-xfce.xzm
cp 003-xfce.xzm /mnt/sdXY/porteus/base/
The only thing here that should be new for you is setting the ROOT variable prior to launching removepkg. This just tells it to remove ristretto using the specified location as if it's the system root.

Re: removing a programm and all no longer needed deps

Posted: 13 Aug 2013, 12:53
by fanthom
run porteus in 'Always Fresh' mode and use this script which shows which packages are required to run certain application.
mind that this script tracks direct binary dependencies only (python, perl, functional deps are not supported):

Code: Select all

#!/bin/bash
# Porteus dependency resolver.
# Author: <fanthom@porteus.org>

if [ -z "$1" ]; then
    echo "please provide package name as an argument"
    echo "example: $0 MPlayer-1.1.1-x86_64-ftm"
fi

pkg=/var/log/packages/$1

test -e $pkg || { echo "$pkg does nto exist, exiting..."; exit; }

# Cleanup:
rm -rf /tmp/packages.txt /tmp/packages.tmp /tmp/deps.txt

# Run ldd against all executables and libraries
if [ `uname -m` = "x86_64" ]; then
    for a in `fgrep -A9999 './' $pkg | tail -n +2`; do
	ldd /$a 2>/dev/null | egrep -v 'statically linked|ld-linux-x86-64.so.2|linux-vdso.so.1|not a' | awk '{print$1}' >> /tmp/depsfull.tmp
    done
else
    for a in `fgrep -A9999 './' $pkg | tail -n +2`; do
	ldd /$a 2>/dev/null | egrep -v 'statically linked|ld-linux.so.2|linux-gate.so.1|not a' | awk '{print$1}' >> /tmp/depsfull.tmp
    done
fi

# Trim down the generated file depsfull.tmp:
cat /tmp/depsfull.tmp 2>/dev/null | sort -u > /tmp/deps.txt
rm -f /tmp/depsfull.tmp

# Match libs to the packages:
cd /var/log/packages
for x in `cat /tmp/deps.txt`; do grep /$x * | cut -d: -f1 | head -n1 >> /tmp/packages.tmp; done
cat /tmp/packages.tmp 2>/dev/null | sort -u > /tmp/packages.txt
rm -f /tmp/packages.tmp

# Display list of packages:
echo "dependencies list:"
cat /tmp/packages.txt
save it as 'porteus-dep-resolver' and run like in this example:

Code: Select all

porteus-dep-resolver lxterminal-0.1.11-x86_64-1ftm
now you should get the list (done on porteus-2.0):

Code: Select all

dependencies list:
aaa_elflibs-14.0-x86_64-1ftm
atk-2.4.0-x86_64-1
bzip2-1.0.6-x86_64-1
cairo-1.10.2-x86_64-2
cxxlibs-6.0.17-x86_64-1
fontconfig-2.9.0-x86_64-1
freetype-2.4.11-x86_64-1_slack14.0
gdk-pixbuf2-2.26.1-x86_64-2
glib2-2.32.4-x86_64-1
gtk+2-2.24.10-x86_64-2
libX11-1.5.0-x86_64-1
libXau-1.0.7-x86_64-1
libXcomposite-0.4.3-x86_64-1
libXcursor-1.1.13-x86_64-1
libXdamage-1.1.3-x86_64-1
libXdmcp-1.1.1-x86_64-1
libXext-1.3.1-x86_64-1
libXfixes-5.0-x86_64-1
libXi-1.6.1-x86_64-1
libXinerama-1.1.2-x86_64-1
libXrandr-1.3.2-x86_64-1
libXrender-0.9.7-x86_64-1
libffi-3.0.11-x86_64-1
libpng-1.4.12-x86_64-1
libxcb-1.8.1-x86_64-1
ncurses-5.9-x86_64-1
pango-1.30.1-x86_64-1
pixman-0.26.2-x86_64-1
vte-0.28.2-x86_64-2
once you figure out which packages looks suspicious (i would never remove libpng, gtk+, etc) you can run:

Code: Select all

removepkg lxterminal vte
at the end you need to run 'slackyd -d' to make sure that removed packages are not needed by other applications.

Re: removing a programm and all no longer needed deps

Posted: 20 Aug 2013, 19:17
by Rava
Fanthom, your script gives me this error:

Code: Select all

/var/log/packages/ristretto does nto exist, exiting...
... And it should read "does not exist"

Re: removing a programm and all no longer needed deps

Posted: 20 Aug 2013, 19:49
by fanthom
@Rava
'risetto' is not enough - you need to provide full package name. you could have 2 versions or more installed and script would not know which one to resolve.

Re: removing a programm and all no longer needed deps

Posted: 20 Aug 2013, 21:57
by Rava
Okay... looking it up in /var/log/packages/ gave me this:

Code: Select all

3-x86_64-1Ahau
dependencies list:
aaa_elflibs-14.0-x86_64-1ftm
atk-2.4.0-x86_64-1
bzip2-1.0.6-x86_64-1
cairo-1.10.2-x86_64-2
cxxlibs-6.0.17-x86_64-1
dbus-1.4.20-x86_64-4_slack14.0
dbus-glib-0.98-x86_64-1
fontconfig-2.9.0-x86_64-1
freetype-2.4.11-x86_64-1_slack14.0
gdk-pixbuf2-2.26.1-x86_64-2
glib2-2.32.4-x86_64-1
gtk+2-2.24.10-x86_64-2
libICE-1.0.8-x86_64-1
libSM-1.2.1-x86_64-1
libX11-1.5.0-x86_64-1
libXau-1.0.7-x86_64-1
libXcomposite-0.4.3-x86_64-1
libXcursor-1.1.13-x86_64-1
libXdamage-1.1.3-x86_64-1
libXdmcp-1.1.1-x86_64-1
libXext-1.3.1-x86_64-1
libXfixes-5.0-x86_64-1
libXi-1.6.1-x86_64-1
libXinerama-1.1.2-x86_64-1
libXrandr-1.3.2-x86_64-1
libXrender-0.9.7-x86_64-1
libexif-0.6.21-x86_64-1
libffi-3.0.11-x86_64-1
libpng-1.4.12-x86_64-1
libxcb-1.8.1-x86_64-1
libxfce4ui-4.10.0-x86_64-1Ahau
libxfce4util-4.10.1-x86_64-1Ahau
pango-1.30.1-x86_64-1
pixman-0.26.2-x86_64-1
startup-notification-0.12-x86_64-1
util-linux-2.21.2-x86_64-5
xcb-util-0.3.8-x86_64-1
xfconf-4.10.0-x86_64-1Ahau
zlib-1.2.6-x86_64-1
Me thinks all are needed for other programs, yes?

Or not? What's gdk-pixbuf2-2.26.1-x86_64-2 for?

Re: removing a programm and all no longer needed deps

Posted: 20 Aug 2013, 22:36
by donald
The Gdk Pixbuf is a toolkit for image loading and pixel buffer manipulation
- Image loading and saving facilities.
- Fast scaling and compositing of pixbufs.
- Simple animation loading (ie. animated GIFs)
It is used by GTK+ 2 to load and manipulate images.

Re: removing a programm and all no longer needed deps

Posted: 20 Aug 2013, 22:44
by Rava
Okay, so, then, GIMP, viewnior and mtpaint are using it as well?

Re: removing a programm and all no longer needed deps

Posted: 21 Aug 2013, 13:39
by donald
GTK+, or the GIMP Toolkit for creating graphical user interfaces
libraries that GTK+ depends on are: GLib, GdkPixbuf, Pango, and ATK.
I suggest: better not touch
viewnior and mtpaint > no clue