View previous topic :: View next topic |
Author |
Message |
wolfman_za n00b
Joined: 09 Sep 2002 Posts: 4 Location: Johannesburg, South Africa
|
Posted: Sat Nov 02, 2002 4:09 pm Post subject: Script to find Injected packages |
|
|
Sometimes when doing an emerge world you might not want to install all the newer packages, especially larger binary packages when you are using a 56k modem like me.
Or sometimes a package you want to emerge depends on a package that you dont want to install.
In these cases you run :
Code: | emerge --inject mypackage |
This will fool portage into thinking that the package is installed.
The problem arrises when trying to find out which packages are truly installed and which are only injected. I have checked gentoolkit and portage and as far as I can tell no such a utility exists yet, thus this simple script:
Code: |
#!/usr/bin/python
#
# findinject - query portage package system to find injected packages
#
# Copyright (c) Stephan Buys (aka wolfman_za) <sbproxy@icon.co.za>
# This program is distributed under the terms of GPL version 2.
#
import os
import os.path
# The idea here is to check if the package directory only contains the
# COUNTER file. If this is the case we assume that this is an injected
# package
def is_inject(arg,dirname,names):
content = os.listdir(dirname)
if len(content) == 1:
if (names[0] == 'COUNTER'):
print dirname[arg:]
portage_db_dir = '/var/db/pkg'
os.path.walk(portage_db_dir,is_inject,len(portage_db_dir)+1)
|
It will list the packages that were only injected, thus allowing you to use the inject facility without worrying about keeping track of injected packages.
[ed] Updated script to not display portage db path |
|
Back to top |
|
|
jonaswidarsson Apprentice
Joined: 16 Jan 2004 Posts: 273 Location: Göteborg, Sweden
|
Posted: Fri Jul 09, 2004 12:48 pm Post subject: |
|
|
Thank you!
It worked very fine for me! |
|
Back to top |
|
|
tomk Bodhisattva
Joined: 23 Sep 2003 Posts: 7221 Location: Sat in front of my computer
|
Posted: Fri Jul 09, 2004 4:28 pm Post subject: Re: Script to find Injected packages |
|
|
wolfman_za wrote: | Or sometimes a package you want to emerge depends on a package that you dont want to install. |
You shouldn't inject packages if they are a dependency of another package. It's a dependency because the other package needs it to run properly. _________________ Search | Read | Answer | Report | Strip |
|
Back to top |
|
|
verbatim Apprentice
Joined: 13 Mar 2003 Posts: 223
|
Posted: Fri Jul 09, 2004 4:43 pm Post subject: Re: Script to find Injected packages |
|
|
tomk wrote: | You shouldn't inject packages if they are a dependency of another package. It's a dependency because the other package needs it to run properly. |
This isn't always true though. For example, the gnome package contains a few dependencies you can inject rather than install (epiphany, gedit, etc). As long as you know what you're doing, you're fine. |
|
Back to top |
|
|
jonaswidarsson Apprentice
Joined: 16 Jan 2004 Posts: 273 Location: Göteborg, Sweden
|
Posted: Fri Jul 09, 2004 7:52 pm Post subject: |
|
|
I second that.
You must inject xfree to use KDE if you run x.org instead of xfree.
I've never done that, but I think it works that way. |
|
Back to top |
|
|
intgr Apprentice
Joined: 23 Jun 2004 Posts: 225 Location: Earth, Sol, Milky Way
|
Posted: Sat Jul 10, 2004 8:22 am Post subject: equery/etcat |
|
|
I think the ability to list injected packages should be integrated with equery/etcat in one form or another. |
|
Back to top |
|
|
59729 Apprentice
Joined: 21 Jun 2004 Posts: 279
|
Posted: Sat Jul 10, 2004 11:10 am Post subject: |
|
|
I agree
Also I think that --inject is necessary, when emerging mod_php it listed an older hard masked version of gcc as dependency, And I didnt want to unmask/downgrade so the only way I could think of was injecting that package and another package using that version of gcc as a dependency.. if there exist a better way please correct me |
|
Back to top |
|
|
blob2004 n00b
Joined: 12 Jul 2004 Posts: 59
|
Posted: Mon Jul 12, 2004 5:10 pm Post subject: script failed for me |
|
|
I tried the script given, but got error messages:
root@ws-5130 jerryb # ./inject
./inject: line 10: import: command not found
./inject: line 11: import: command not found
./inject: line 16: syntax error near unexpected token `('
./inject: line 16: `def is_inject(arg,dirname,names):' |
|
Back to top |
|
|
Gherald2 Guru
Joined: 02 Jul 2003 Posts: 326 Location: Madison, WI USA
|
Posted: Mon Jul 12, 2004 6:15 pm Post subject: |
|
|
Sounds like you might have omited:
Make sure you copy that first line into the script... _________________ Unregistered Linux User #17598363 |
|
Back to top |
|
|
blob2004 n00b
Joined: 12 Jul 2004 Posts: 59
|
Posted: Mon Jul 12, 2004 7:15 pm Post subject: |
|
|
Yeah that was it! (blank line as first line). deleted it, it ran fine |
|
Back to top |
|
|
|