Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Simple but useful control of packages files
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Kolokoltsev
n00b
n00b


Joined: 25 Nov 2008
Posts: 5

PostPosted: Tue Nov 25, 2008 1:42 am    Post subject: Simple but useful control of packages files Reply with quote

Hi all. An idea is to observe an installed files of each package in separate fs tree. To see where all it's files are installed (in real fs), and not to see files and directories that dont belong to the package you are not interested. It could be very usefoul for just installed packages, for example if you dont remember where could be it's config files, or even main executable )
We have an utility for observing package files. It is a part of app-portage/gentoolkit and it's name is "equery". But where to create a file system? We don't want to put any rubish in the root fs, and also it is not interesting to create a new partition for such thing. But... - thanks linux, we can create a new fs inside of any file... so :
_______________________________________________
dd if=/dev/sda of=/etc/portage/portagefs count=209715
mke2fs /etc/portage/portagefs
mount -o loop /etc/portage/portagefs /tmp/portagefs
_______________________________________________
..."count=209715" is nearly 100Mb

And a simple bash script for creating a dublicates (or images) of installed packages:

#!/bin/bash
if [ ! -d /tmp/portagefs/lost\+found ]; then
echo "Portage fs is not mounted"
exit 0
fi

if [ ! ${1} ]; then
echo "The only parameter is an exact package name"
fi

if [ ! `equery -q list -e ${1}` ]; then
echo "Package ${1} is not installed yet"
exit 0
fi

if [ ! -d /tmp/portagefs/${1} ]; then
mkdir /tmp/portagefs/${1}
fi


for path in $( equery files ${1} ); do
if [ -d $path ]; then
if [ ! -d /tmp/portagefs/${1}${path} ]; then
mkdir -v /tmp/portagefs/${1}${path}
fi
else
if [ ! -f /tmp/portagefs/${1}${path} ]; then
ln -sv ${path} /tmp/portagefs/${1}${path}
fi
fi
done
______________________________________________________________

So now you just run this script with the name of the package you want to observe, and
in the /tmp/portagefs will appear it's tree with symlinks. Then - any filemanager wil hellp you
to find a lot of interesting files from your package, about what you even didn't know ))))\

Finally I've just placed a commands into <Start button(IceWM button)>->Menu->Programs like
"krusader --left /etc/portagefs/opera/". (krusader is my filemanager)

Which solutions do you use for package control, viewing package trees etc. ?
Back to top
View user's profile Send private message
timeBandit
Bodhisattva
Bodhisattva


Joined: 31 Dec 2004
Posts: 2719
Location: here, there or in transit

PostPosted: Tue Nov 25, 2008 1:46 am    Post subject: Reply with quote

Moved from Installing Gentoo to Gentoo Chat.
Not about Gentoo installation, not a support question, so moved here.
_________________
Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others.
Back to top
View user's profile Send private message
notHerbert
Advocate
Advocate


Joined: 11 Mar 2008
Posts: 2228
Location: 45N 73W

PostPosted: Tue Nov 25, 2008 3:23 am    Post subject: Reply with quote

Very interesting. I tried your recipe
Code:
./pkgtree.sh eix
mkdir: created directory `/tmp/portagefs/eix/etc'
`/tmp/portagefs/eix/etc/eixrc' -> `/etc/eixrc'
mkdir: created directory `/tmp/portagefs/eix/usr'
mkdir: created directory `/tmp/portagefs/eix/usr/bin'
`/tmp/portagefs/eix/usr/bin/diff-eix' -> `/usr/bin/diff-eix'
`/tmp/portagefs/eix/usr/bin/eix' -> `/usr/bin/eix'
`/tmp/portagefs/eix/usr/bin/eix-sync' -> `/usr/bin/eix-sync'
`/tmp/portagefs/eix/usr/bin/eix-test-obsolete' -> `/usr/bin/eix-test-obsolete'
`/tmp/portagefs/eix/usr/bin/functions-eix.sh' -> `/usr/bin/functions-eix.sh'
`/tmp/portagefs/eix/usr/bin/update-eix' -> `/usr/bin/update-eix'
`/tmp/portagefs/eix/usr/bin/update-eix-layman' -> `/usr/bin/update-eix-layman'
`/tmp/portagefs/eix/usr/bin/update-eix-remote' -> `/usr/bin/update-eix-remote'
mkdir: created directory `/tmp/portagefs/eix/usr/share'
mkdir: created directory `/tmp/portagefs/eix/usr/share/doc'
mkdir: created directory `/tmp/portagefs/eix/usr/share/doc/eix-0.13.3-r1'
`/tmp/portagefs/eix/usr/share/doc/eix-0.13.3-r1/AUTHORS.bz2' -> `/usr/share/doc/eix-0.13.3-r1/AUTHORS.bz2'
`/tmp/portagefs/eix/usr/share/doc/eix-0.13.3-r1/ChangeLog.bz2' -> `/usr/share/doc/eix-0.13.3-r1/ChangeLog.bz2'
`/tmp/portagefs/eix/usr/share/doc/eix-0.13.3-r1/format.txt.bz2' -> `/usr/share/doc/eix-0.13.3-r1/format.txt.bz2'
mkdir: created directory `/tmp/portagefs/eix/usr/share/man'
mkdir: created directory `/tmp/portagefs/eix/usr/share/man/man1'
`/tmp/portagefs/eix/usr/share/man/man1/eix.1.bz2' -> `/usr/share/man/man1/eix.1.bz2'


I like to use qlist ( from app-portage/portage-utils )
Code:
qlist eix
/etc/eixrc
/usr/bin/diff-eix
/usr/bin/eix
/usr/bin/eix-sync
/usr/bin/eix-test-obsolete
/usr/bin/functions-eix.sh
/usr/bin/update-eix
/usr/bin/update-eix-layman
/usr/bin/update-eix-remote
/usr/share/doc/eix-0.13.3-r1/AUTHORS.bz2
/usr/share/doc/eix-0.13.3-r1/ChangeLog.bz2
/usr/share/doc/eix-0.13.3-r1/format.txt.bz2
/usr/share/man/man1/eix.1.bz2
Back to top
View user's profile Send private message
Kenji Miyamoto
Veteran
Veteran


Joined: 28 May 2005
Posts: 1452
Location: Looking over your shoulder.

PostPosted: Tue Nov 25, 2008 4:49 am    Post subject: Reply with quote

Doesn't Mac OS X do this to a degree? It seems to work pretty well for them, too.
_________________
[ Kawa-kun, new and improved!! ]

Alex Libman seems to be more of an anarchist than a libertarian.
Back to top
View user's profile Send private message
Kolokoltsev
n00b
n00b


Joined: 25 Nov 2008
Posts: 5

PostPosted: Tue Nov 25, 2008 10:14 pm    Post subject: Additional Reply with quote

I forgot to say about fstab..., so to mount this "virtual" fs each time you're entering in to the system - add line into /etc/fstab:
Code:
/etc/portage/portagefs  /tmp/portagefs  ext2            loop            0 0

... about "Doesn't Mac OS X do this to a degree?" -
I don't know - never tryed MacOS, but an idea is such simple, that it could work everywhere... with a minor changes of course.
Back to top
View user's profile Send private message
timeBandit
Bodhisattva
Bodhisattva


Joined: 31 Dec 2004
Posts: 2719
Location: here, there or in transit

PostPosted: Tue Nov 25, 2008 10:27 pm    Post subject: Reply with quote

I'm intrigued by this but feel I'm still missing something. What does this offer that qlist and quickpkg do not? With qlist I can see all the files and directories created by installing a package, as notHerbert demonstrated. With quickpkg I can easily create a tarball of only the files in package foo, which is equivalent to tar czf foo.tgz -C /tmp/portagefs/foo . using this method.

Is there some other benefit I've overlooked? :?:
_________________
Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others.
Back to top
View user's profile Send private message
shickapooka800
Guru
Guru


Joined: 05 Dec 2004
Posts: 304
Location: no

PostPosted: Wed Nov 26, 2008 5:45 am    Post subject: Reply with quote

how about instead of count=wierd number, use count=1 bs=1k seek=100k
Back to top
View user's profile Send private message
Kolokoltsev
n00b
n00b


Joined: 25 Nov 2008
Posts: 5

PostPosted: Wed Nov 26, 2008 7:50 pm    Post subject: Reply with quote

Well, correct. You can use qlist or equery or any other console utility with grep. It works pretty good, and I'm not speaking to forget such instruments. If you know what you are looking for - it is better and faster to speak thrue console. The main benefit of my propose is close to "mousekiller" solution. Will tell much clear. For example, I have IceWM, and can orgenaize in it's main menu about 10-20 folders for each GUI program that are in use. There not such a lot of keys, and defenetely there is a place for one more interactive utilitie - package tree.
In IceWM "proframs" file it looks like
Code:

prog "LaTeX tree" krusader_user-16x16.xpm krusader --left /tmp/portagefs/texlive-latex


So it is possible to have a quick (2 mouse cklicks) link from the worktable, that will open fs tree for the package in the left panel of GUI file manager program.
Well, I DO RESPECT CONSOLE. But even there are famous midnight commander, just becouse of quick browsing of fs tree. Just to look for something... or else ))) An idea in this topic is just one more thing that can rize a work speed. Not for all tasks with packages trees, but only for such that could be faster than with console. The main for me - is a quickly browse for something that I know should be in the package, but I don't have any ideas where it can be, and what is it's name. For quick browsing 8)

Hope this is a complete explanation for
Quote:
I'm intrigued by this but feel I'm still missing something. What does this offer that qlist and quickpkg do not?
But maybe you will find any others usefoul advantages of an idea )

About
Code:

count=1 bs=1k seek=100k

Yes, it is much better for topic, thanks. When I wrote dd it was faster to 100*1024^2/512 than to browse it's man ))))


Last edited by Kolokoltsev on Wed Nov 26, 2008 8:54 pm; edited 1 time in total
Back to top
View user's profile Send private message
Kolokoltsev
n00b
n00b


Joined: 25 Nov 2008
Posts: 5

PostPosted: Wed Nov 26, 2008 8:43 pm    Post subject: Reply with quote

So, in two words the difference is like between "ls" command and "mc". Sometimes it is faster to ls, but sometimes it is better to use midnight. One more example: I want to find an icon for the worktable.
It is posslible to:

(don't remember the console command, but shure it's package name where with word "magick")
Code:
emerge --search magick

now I know it's name is "imagemagick"
Quote:
qlist imagemagick | grep "bin"

now I know it's utilitiy name is "display"
Quote:
display `qlist kdpf | grep ".png"`

Oh yeah! I forgot to compile into imagemagick support for compressed png files! ))))) ... with xpm it works fine )

or...

1. two clicks in menu for kpdf package tree
2. Ctrl+S to find *.png
3. See that all icons are nearly in the same dir, so jumping there
4. Browsing them with previw tool (one right klick) - ...it supports a lots of formats )

So here is the difference )
Back to top
View user's profile Send private message
Kolokoltsev
n00b
n00b


Joined: 25 Nov 2008
Posts: 5

PostPosted: Wed Nov 26, 2008 9:07 pm    Post subject: Reply with quote

Quote:
quickpkg

This is for packageing, quite usefoul but not for just looking on files. I'm making symlinks - they don't eat disk space. So here is no script simplification.
Back to top
View user's profile Send private message
notHerbert
Advocate
Advocate


Joined: 11 Mar 2008
Posts: 2228
Location: 45N 73W

PostPosted: Wed Nov 26, 2008 10:53 pm    Post subject: Reply with quote

Okay, so I run
Code:
rox /tmp/portagefs/kpdf


And I can browse the package files with mouse clicks. Very cool. 8) :P
Back to top
View user's profile Send private message
timeBandit
Bodhisattva
Bodhisattva


Joined: 31 Dec 2004
Posts: 2719
Location: here, there or in transit

PostPosted: Thu Nov 27, 2008 1:46 am    Post subject: Reply with quote

Browsing the filesystem by package...cool indeed. That was the angle I didn't see. Thanks! :)

...and therefore,
Moved from Gentoo Chat to Documentation, Tips & Tricks.
_________________
Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others.


Last edited by timeBandit on Thu Nov 27, 2008 1:53 am; edited 1 time in total
Back to top
View user's profile Send private message
Bones McCracker
Veteran
Veteran


Joined: 14 Mar 2006
Posts: 1611
Location: U.S.A.

PostPosted: Mon Mar 16, 2009 3:19 am    Post subject: Reply with quote

Isn't this the idea behind one of the major features of Rox (application directories)?
http://roscidus.com/desktop/AppDirs
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum