Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
pye - "pick your emerge" script
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4, 5, 6  Next  
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
dr_strange
Guru
Guru


Joined: 16 Apr 2002
Posts: 480
Location: Cambridge, UK

PostPosted: Sat Mar 13, 2004 9:04 am    Post subject: Reply with quote

Then again, if I say

pye app-emacs/ecb

I get the following output:

Code:



These are the packages that I would merge, in order:

Calculating dependencies  ...done!
0): [ebuild  N    ] app-editors/emacs-21.3-r2 
1): [ebuild  N    ] app-emacs/elib-1.0 
2): [ebuild  N    ] app-emacs/speedbar-0.14_beta4 
3): [ebuild  N    ] app-emacs/eieio-0.17 
4): [ebuild  N    ] app-emacs/semantic-1.4.4-r1 
5): [ebuild  N    ] app-emacs/jde-2.3.3 
6): [ebuild  N    ] app-emacs/ecb-2.21 


Enter the numbers of packages you want to emerge or unmerge (in case of prune), comma-separated (you can also specify ranges, like 1,4-8,12 etc.). Alternatively, you can specify packages to be excluded from the list; for this, start your first item with an ! (e.g. !2,4,8). For all packages write 'a'. If you want to quit, press q:



So it appears to work?
_________________
shine on,

dr_strange

Set the Controls for the Heart of Gentoo
http://magenta.linuxforum.hu
Back to top
View user's profile Send private message
pem725
n00b
n00b


Joined: 26 Sep 2002
Posts: 68
Location: Tucson, AZ USA

PostPosted: Sat Mar 13, 2004 2:43 pm    Post subject: Reply with quote

dr_strange,

Right, I see the problem with my earlier message. Where I run into trouble is when I run

Code:
pye world


If I run this and select all and single, it goes through the entire emerge but leaves all my app-emacs packages untouched because of the problem with identical names between app-emacs and app-xemacs. Since I rely on emacs for a great deal of my work, it would be nice to be able to use pye to update the packages. For now, I am happy with pye as it is and I will just emerge my emacs progs individually with just a simple emerge command.

Thanks again for your script and recent reply.
_________________
Cheers,
Patrick

Do the community a favor and answer a few stranded messages. I'm off to answer one now...thanks to gentoo!
Back to top
View user's profile Send private message
GODnyc
n00b
n00b


Joined: 08 Feb 2004
Posts: 7
Location: Yonkers

PostPosted: Sun Mar 14, 2004 9:51 pm    Post subject: Paused output? Reply with quote

First off, let me congratulate you on your wonderful work.
Last night I began an emerge -e world to recompile my system with new CFLAGS, only to awken to a failed emerge. I had completely forgotten about a problem with DCTC and the sys-libs/db-4.1.[whatever] dependancy. Hopping on #gentoo someone pointed me to your pye script, but I have one problem with it: I can't read all the output.
After issuing pye --resume (which performed beautifully, aside from the output scroll, hehe) I was presented a list of !210! packages, needless to say, I couldn't read the first few. My buffer only goes back to the 13th entry, I'm missing the first 12... and I can only assume the 1st is the failing package.

I initially planed on using "emerge --resume --skipfirst," but when I issued an "emerge -pv --resume --skipfirst" it appeared as though the package I wanted to be skipped wasn't the first package in the --resume tree; so I turned to pick your emerge :D.

Perhaps an script option like --pause=[number] that allows the user to specify the number of lines to output before pausing? If I wasn't bogged down with midterms I would learn python and try writing it for you. But, alas, I've got a lot of work to do... wow... I really do, crap, I need to get going!
_________________
"Gentoo is to linux what linux is to windows." - O.O.G.
"Sticks and stones may break your bones, but my words will destroy your mind." - O.O.G.
Back to top
View user's profile Send private message
dr_strange
Guru
Guru


Joined: 16 Apr 2002
Posts: 480
Location: Cambridge, UK

PostPosted: Sun Mar 14, 2004 10:21 pm    Post subject: Reply with quote

Well... I haven't encounered this prob yet, yesterday I tried the pye prune option, it gave me some 915 packs, and I could go back to the first no prob. But I will think of your suggestion.
_________________
shine on,

dr_strange

Set the Controls for the Heart of Gentoo
http://magenta.linuxforum.hu
Back to top
View user's profile Send private message
zsoltika
l33t
l33t


Joined: 13 Nov 2003
Posts: 634
Location: Budapest, Hungary

PostPosted: Wed Mar 17, 2004 6:23 am    Post subject: pye.py fails when a package name is ambigous Reply with quote

I think I'm using the latest version of this great script (I firrst tried it 3 days ago).
Until now everything went flawless - as I mentioned it's a great script! javascript:emoticon(':D')

But today I just
Code:
emerge sync
-ed,
and then the
Code:
pye.py -uUD world

gave me this:
Code:

/home/bzs #: pye.py -uUD world
One moment...

These are the packages that I would merge, in order:

Calculating world dependencies  ...done!
0): [ebuild     U ] sys-fs/devfsd-1.3.25-r8 [1.3.25-r5]
1): [ebuild     U ] net-www/netscape-flash-6.0.81 [6.0.79]
2): [ebuild  N    ] sys-kernel/gentoo-sources-2.4.26_rc3
3): [ebuild     U ] dev-java/ant-1.6.1-r1 [1.6.1]
4): [ebuild     U ] dev-java/ant-optional-1.6.1-r1 [1.6.1]


So I excluded the kernel (with !2), and then try the "mass" emerge but I got the following message:
Code:

I'm about to emerge the following packages: devfsd netscape-flash ant ant-optional
Is this correct? Choose an option: m(ass-emerge)/s(tep-emerge)/n(o)/h(elp)/q(uit): m

Calculating dependencies |

!!! The short ebuild name "ant" is ambiguous.  Please specify
!!! one of the following fully-qualified ebuild names instead:

    app-vim/ant
    dev-java/ant


Could You improve your script? javascript:emoticon(':D')
And cheers from Hungary to dr_strange javascript:emoticon(':D')
Back to top
View user's profile Send private message
dr_strange
Guru
Guru


Joined: 16 Apr 2002
Posts: 480
Location: Cambridge, UK

PostPosted: Wed Mar 17, 2004 8:28 am    Post subject: Reply with quote

Szia!

Yes, as you are not the first to observe this problem, I will change the script so that the package list also contains categories.
_________________
shine on,

dr_strange

Set the Controls for the Heart of Gentoo
http://magenta.linuxforum.hu
Back to top
View user's profile Send private message
dr_strange
Guru
Guru


Joined: 16 Apr 2002
Posts: 480
Location: Cambridge, UK

PostPosted: Wed Mar 17, 2004 10:08 pm    Post subject: Reply with quote

Okay, I - hopefully - fixed the ambiguous packagename issue. It is up as 0.8.3
Please test it and tell me if something's wrong.
_________________
shine on,

dr_strange

Set the Controls for the Heart of Gentoo
http://magenta.linuxforum.hu
Back to top
View user's profile Send private message
pem725
n00b
n00b


Joined: 26 Sep 2002
Posts: 68
Location: Tucson, AZ USA

PostPosted: Sun Mar 21, 2004 11:44 pm    Post subject: Reply with quote

dr_strange,

I now get the error...

Quote:

Traceback (most recent call last):
File "/usr/bin/pye", line 168, in ?
merged = mergethis(elem)
File "/usr/bin/pye", line 42, in mergethis
package = package.split("/")[1]
IndexError: list index out of range



After I try to run the script (version 0.8.3). What do you suspect is happening? BTW, it worked like a charm before I updated the pye script except for the package ambiguity problem. Any ideas?

Thanks in advance....

Whoops, a bit more information is necessary. I used the command:

Code:

pye world


and it emerged the first app but then returned the error above. I also tried it with a single package:

Code:

pye fetchyahoo


and it emerged the package but then returned the error above. Hope this is a bit clearer.
_________________
Cheers,
Patrick

Do the community a favor and answer a few stranded messages. I'm off to answer one now...thanks to gentoo!
Back to top
View user's profile Send private message
dr_strange
Guru
Guru


Joined: 16 Apr 2002
Posts: 480
Location: Cambridge, UK

PostPosted: Mon Mar 22, 2004 6:58 am    Post subject: Reply with quote

Thanks for the info, I'll look into it when I get home later today.
_________________
shine on,

dr_strange

Set the Controls for the Heart of Gentoo
http://magenta.linuxforum.hu
Back to top
View user's profile Send private message
stick_figure
n00b
n00b


Joined: 22 Jan 2004
Posts: 38
Location: Palo Alto, CA

PostPosted: Thu Mar 25, 2004 11:36 pm    Post subject: Useful Reply with quote

This is really useful. Shouldn't someone add it to a package like esearch? esync was added in that way.
_________________
If someone drops a fort on Will, he makes a reflex save.
Back to top
View user's profile Send private message
neenee
Veteran
Veteran


Joined: 20 Jul 2003
Posts: 1786

PostPosted: Thu Apr 29, 2004 9:51 pm    Post subject: Reply with quote

i had the following error message after emerging
the first package of pye -e world (step by step):

Code:
 Traceback (most recent call last):
   File "/sbin/pye", line 168, in ?
     merged = mergethis(elem)
   File "/sbin/pye", line 42, in mergethis
     package = package.split("/")[1]
 IndexError: list index out of range


i found a workaround, which is to specify the range
instead of selecing the 'a' (all) option; it seeme pye
did not like to calculate the range by itself or some-
thing.
_________________
proud to be a scout and a chronic penguin hugger
Legion of Lore - site
Back to top
View user's profile Send private message
dr_strange
Guru
Guru


Joined: 16 Apr 2002
Posts: 480
Location: Cambridge, UK

PostPosted: Fri Apr 30, 2004 7:31 am    Post subject: Reply with quote

Thanks for that, I'll look into it.

I am currently trying to spice up pye with some sqlite backend and some extended info capabilities; I'll see if anything worthwhile comes out.

If there is anybody here interested and familiar with pyGtk pyGnome programming, please PM me, I have an idea I'd like to explore. Thanks.
_________________
shine on,

dr_strange

Set the Controls for the Heart of Gentoo
http://magenta.linuxforum.hu
Back to top
View user's profile Send private message
dr_strange
Guru
Guru


Joined: 16 Apr 2002
Posts: 480
Location: Cambridge, UK

PostPosted: Sun May 02, 2004 7:15 pm    Post subject: Reply with quote

neenee wrote:
i had the following error message after emerging
the first package of pye -e world (step by step):

Code:
 Traceback (most recent call last):
   File "/sbin/pye", line 168, in ?
     merged = mergethis(elem)
   File "/sbin/pye", line 42, in mergethis
     package = package.split("/")[1]
 IndexError: list index out of range


i found a workaround, which is to specify the range
instead of selecing the 'a' (all) option; it seeme pye
did not like to calculate the range by itself or some-
thing.


I hope I have fixed this; the new version is up on my site. Please try it.
_________________
shine on,

dr_strange

Set the Controls for the Heart of Gentoo
http://magenta.linuxforum.hu
Back to top
View user's profile Send private message
neenee
Veteran
Veteran


Joined: 20 Jul 2003
Posts: 1786

PostPosted: Mon May 03, 2004 6:43 pm    Post subject: Reply with quote

it seems to work now - good job :wink:
_________________
proud to be a scout and a chronic penguin hugger
Legion of Lore - site
Back to top
View user's profile Send private message
Donovan
Tux's lil' helper
Tux's lil' helper


Joined: 08 Feb 2003
Posts: 97
Location: Halifax, NS, Canada

PostPosted: Wed May 05, 2004 12:53 pm    Post subject: Pye (as of May 5) Reply with quote

Hi, first off, great script!

Some rough edges I've noticed... If one asks for help while being prompted if the packages are correct, they are shown the help, and then asked to entered the numbers all over again...

Code:
I'm about to unmerge the following package(s):  x11-themes/noia x11-themes/noia-warm x11-plugins/gkrellm-leds
Is this correct? Choose an option: u(nmerge)/n(o)/h(elp)/q(uit): h

Available options:
m - passes packages to be emerged as a list to emerge
s - emerges packages one by one, emerge not interrupted if a package fails
u - unmerges package(s) if prune was given as argument to pye
h - this help
q - quit without emerging

Enter the numbers of packages you want to emerge or unmerge (in case of prune), comma-separated (you can also specify ranges, like 1,4-8,12 etc.). Alternatively, you can specify packages to be excluded from the list; for this, start your first item with an ! (e.g. !2,4,8). For all packages write 'a'. If you want to quit, press q: u
Traceback (most recent call last):
  File "/usr/bin/pye", line 144, in ?
    packlist.append(pkgdict[eval(num)][0]+"/"+pkgdict[eval(num)][1])
  File "<string>", line 0, in ?
NameError: name 'u' is not defined


Ouch, well, that can be avoided in the future, continuing on... I spy with pye prune I've got two versions of a utility installed...I'm thinking pye won't specify the specific package version to emerge...

Code:
--8<--
659):  x11-plugins/gkrellm-leds-0.6.1
660):  x11-plugins/gkrellm-leds-0.8.1
--8<--
I'm about to unmerge the following package(s):  x11-plugins/gkrellm-leds
Is this correct? Choose an option: u(nmerge)/n(o)/h(elp)/q(uit): u


 x11-plugins/gkrellm-leds
    selected: 0.6.1 0.8.1
   protected: none
     omitted: none
--8<--


Arragh :)

Whether you're interested in tweaking things like that or not, I thought I'd mention it... If Python wasn't new to me, I'd have a look, lol :)

...Dono
_________________
Gentoo Linux * DirecTivo * Who needs heaven?
Back to top
View user's profile Send private message
dr_strange
Guru
Guru


Joined: 16 Apr 2002
Posts: 480
Location: Cambridge, UK

PostPosted: Wed May 05, 2004 2:44 pm    Post subject: Reply with quote

good catches, thanx; will be back with a fix, hopefully soon:-)
_________________
shine on,

dr_strange

Set the Controls for the Heart of Gentoo
http://magenta.linuxforum.hu
Back to top
View user's profile Send private message
fwerner
n00b
n00b


Joined: 27 Mar 2003
Posts: 46
Location: Germany / Freiburg

PostPosted: Fri May 28, 2004 6:22 pm    Post subject: Reply with quote

please read this thread
https://forums.gentoo.org/viewtopic.php?t=171464&highlight=portage+package+keywords

the -U flag is very dangerous as it breaks dependencies. use -uD instead

another thing: putting all in the world file is a bad thing (as already mentioned)

besides that: good work :-)

greetz
f.
Back to top
View user's profile Send private message
dr_strange
Guru
Guru


Joined: 16 Apr 2002
Posts: 480
Location: Cambridge, UK

PostPosted: Fri May 28, 2004 6:55 pm    Post subject: Reply with quote

it's totally up to the user what flags he/she uses with pye; the script only has -p built in
_________________
shine on,

dr_strange

Set the Controls for the Heart of Gentoo
http://magenta.linuxforum.hu
Back to top
View user's profile Send private message
fwerner
n00b
n00b


Joined: 27 Mar 2003
Posts: 46
Location: Germany / Freiburg

PostPosted: Fri May 28, 2004 6:59 pm    Post subject: Reply with quote

dr_strange wrote:
it's totally up to the user what flags he/she uses with pye; the script only has -p built in


ok then excuse my mistake.....

i only saw the -U flag in your first version printed here :-)

i have an automated update script which contains depclean, and a deep update so U would mean hell to me....

f.
Back to top
View user's profile Send private message
stahlsau
Guru
Guru


Joined: 09 Jan 2004
Posts: 565
Location: WildWestwoods

PostPosted: Sat May 29, 2004 10:17 am    Post subject: Reply with quote

hi,
imho, if you call just "pye", the script calls "emerge -Up world", and when you agree it does "emerge -U world", right?

If that´s right, it´s maybe the wrong way, ´cause -U can really break some things. (for me, it did once - so i looked for this option in your script before running it ;-))
For me, i changed it to -uD, so i get the up- AND downgrades AND the dependencies.
_________________
Join the adopt an unanswered post initiative today
Back to top
View user's profile Send private message
dr_strange
Guru
Guru


Joined: 16 Apr 2002
Posts: 480
Location: Cambridge, UK

PostPosted: Mon May 31, 2004 8:56 am    Post subject: Reply with quote

stahlsau wrote:
hi,
imho, if you call just "pye", the script calls "emerge -Up world", and when you agree it does "emerge -U world", right?

If that´s right, it´s maybe the wrong way, ´cause -U can really break some things. (for me, it did once - so i looked for this option in your script before running it ;-))
For me, i changed it to -uD, so i get the up- AND downgrades AND the dependencies.


No, pye anything just runs emerge -p anything; you should add any other flags yourself.
_________________
shine on,

dr_strange

Set the Controls for the Heart of Gentoo
http://magenta.linuxforum.hu
Back to top
View user's profile Send private message
hepta_sean
Apprentice
Apprentice


Joined: 27 Apr 2004
Posts: 246
Location: Berlin, Germany

PostPosted: Sun Jun 06, 2004 9:06 pm    Post subject: Reply with quote

Hello!

Great script! Thanks for that!

FYI, I encountered a few problems fixed by the following patch:

Code:
--- pye-0.8.3.1 2004-06-06 21:51:23.026847992 +0200
+++ pye-0.8.3.1-hepta   2004-06-06 22:38:41.767293848 +0200
@@ -22,11 +22,9 @@
     a = be.find("]")+2
     newbe = be[a:]
     newbe = newbe.lstrip()
-    b = newbe.find("[")
+    b = newbe.find(" ")
     if b == -1:
-        b = newbe.find(" ")
-        if b == -1:
-            b = newbe.find("\n")
+      b = newbe.find("\n")
     newbe = newbe[:b]
     newestbe = newbe.strip()
     ki = portage.catpkgsplit(newestbe)

I ran into a problem with using "--verbose", where the check for "[" matched with the "[1]" referencing the overlay, from which the ebuild is taken. Then catpkgsplit somehow failed and I got an "Specific key requires an operator" error. So I just took out the check for "[".

Are there really any cases, where that one is needed? AFAICS the cat-pkg-ver string is followed by either " " or "\n" in all output variants of emerge -p.

Code:
@@ -36,7 +34,7 @@
 
 def mergethis(package):
     """Merge given package and return True if successful."""
-    os.system("emerge %s" % package)
+    os.system("emerge --oneshot %s" % package)
     global pkgdict
     package = package.split("/")[1]
     vartree = portage.vartree()

I noticed that pye clutters the world file, because the args given to pye are only used for the -p cycle determining the packages to merge, not for the actual merge. Therefore the packages for things like pye --oneshot <some packages>, as well as pye --update --deep world are all emerged directly and added to the world.

The quickfix for this is to just hardwire "--oneshot" so pye never adds anything to the world.

Code:
@@ -76,7 +74,7 @@
         
 arg = sys.argv[1:]
 if arg == []:
-    arg = ['-U', 'world']
+    arg = ['-uD', 'world']
 if "--help" in arg or "-h" in arg:
     usage()
 if arg[0] in ['sync', 'rsync']:

This is the point of fwerner and stahlsau above: pye defaults to "-U", which could with some evidence be considered harmful. See this post.

Code:
@@ -180,7 +178,7 @@
     sys.stdout.write(green("Check /var/log/emerge for details. Exiting.\n\n"))
     sys.exit(0)
 elif yesno == 'm':
-    os.system("emerge %s" % packstring)
+    os.system("emerge --oneshot %s" % packstring)
 elif prune and yesno == 'u':
     os.system("emerge unmerge %s" % packstring)
 else:

Same as above.

Regards,
sean

EDIT: I've found another problem: Your script just gives category and package to emerge, because of this code (similar ones for the other options):
Code:
    elif emergethis in ['a', 'all']:
        packlist = [v[0]+"/"+v[1] for v in pkgdict.values()]


But, if I want to emerge another version, but the latest one (for example for SLOTted packages, I ran into this with gtk-), the version needs to be given to emerge. So I changed it to:
Code:
    elif emergethis in ['a', 'all']:
        packlist = ["="+v[0]+"/"+v[1]+"-"+v[2]+"-"+v[3] for v in pkgdict.values()]


The latest version of my modifications can be found here, if you're interested.

Note: I suppose, this breaks step-emerge, 'cause mergethis relies on the package only containing category and version. But, isn't it broken anyways? It just checks the intended version (which it calculates, so we're not even sure, if it is the one, the user has chosen) against the installed version. So for remerges of the same version it would return True, wether the emerge failed or not. I don't know much about Python, but couldn't you just check the exit code of emerge?
Back to top
View user's profile Send private message
slestak
Tux's lil' helper
Tux's lil' helper


Joined: 13 Jun 2003
Posts: 115

PostPosted: Thu Jun 10, 2004 6:12 pm    Post subject: Reply with quote

I threw this together to keep a handle on progess of mass emerges. Thought Id post it, in case its helpful. I run it in a watch loop.

Code:

#!/bin/bash
tail -n40 /var/log/emerge.log |egrep "(emerge|sucess|termina)"
Back to top
View user's profile Send private message
dr_strange
Guru
Guru


Joined: 16 Apr 2002
Posts: 480
Location: Cambridge, UK

PostPosted: Thu Jun 10, 2004 7:08 pm    Post subject: Reply with quote

hepta_sean, thanx a bunch for the patches, I will investigate them (when I sober out:-)) and include.
_________________
shine on,

dr_strange

Set the Controls for the Heart of Gentoo
http://magenta.linuxforum.hu
Back to top
View user's profile Send private message
BlindSpy
Apprentice
Apprentice


Joined: 20 Mar 2004
Posts: 263

PostPosted: Thu Jun 10, 2004 8:15 pm    Post subject: Reply with quote

this is an awesome script - i cant wait to get home from work and try it out =)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6  Next
Page 4 of 6

 
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