Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Script to find Injected packages
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
wolfman_za
n00b
n00b


Joined: 09 Sep 2002
Posts: 4
Location: Johannesburg, South Africa

PostPosted: Sat Nov 02, 2002 4:09 pm    Post subject: Script to find Injected packages Reply with quote

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
View user's profile Send private message
jonaswidarsson
Apprentice
Apprentice


Joined: 16 Jan 2004
Posts: 273
Location: Göteborg, Sweden

PostPosted: Fri Jul 09, 2004 12:48 pm    Post subject: Reply with quote

Thank you!
It worked very fine for me!
Back to top
View user's profile Send private message
tomk
Bodhisattva
Bodhisattva


Joined: 23 Sep 2003
Posts: 7221
Location: Sat in front of my computer

PostPosted: Fri Jul 09, 2004 4:28 pm    Post subject: Re: Script to find Injected packages Reply with quote

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
View user's profile Send private message
verbatim
Apprentice
Apprentice


Joined: 13 Mar 2003
Posts: 223

PostPosted: Fri Jul 09, 2004 4:43 pm    Post subject: Re: Script to find Injected packages Reply with quote

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
View user's profile Send private message
jonaswidarsson
Apprentice
Apprentice


Joined: 16 Jan 2004
Posts: 273
Location: Göteborg, Sweden

PostPosted: Fri Jul 09, 2004 7:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
intgr
Apprentice
Apprentice


Joined: 23 Jun 2004
Posts: 225
Location: Earth, Sol, Milky Way

PostPosted: Sat Jul 10, 2004 8:22 am    Post subject: equery/etcat Reply with quote

I think the ability to list injected packages should be integrated with equery/etcat in one form or another.
Back to top
View user's profile Send private message
59729
Apprentice
Apprentice


Joined: 21 Jun 2004
Posts: 279

PostPosted: Sat Jul 10, 2004 11:10 am    Post subject: Reply with quote

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
View user's profile Send private message
blob2004
n00b
n00b


Joined: 12 Jul 2004
Posts: 59

PostPosted: Mon Jul 12, 2004 5:10 pm    Post subject: script failed for me Reply with quote

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
View user's profile Send private message
Gherald2
Guru
Guru


Joined: 02 Jul 2003
Posts: 326
Location: Madison, WI USA

PostPosted: Mon Jul 12, 2004 6:15 pm    Post subject: Reply with quote

Sounds like you might have omited:

Code:
#!/usr/bin/python


Make sure you copy that first line into the script...
_________________
Unregistered Linux User #17598363
Back to top
View user's profile Send private message
blob2004
n00b
n00b


Joined: 12 Jul 2004
Posts: 59

PostPosted: Mon Jul 12, 2004 7:15 pm    Post subject: Reply with quote

Yeah that was it! (blank line as first line). deleted it, it ran fine
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