Re: [Cooker] That obsoletes thing...
Andi Payn [EMAIL PROTECTED] writes: I wrote a quick python hack to look for any current packages that obsolete any other current package. I've included it at the end of this email. Unfortunately, I think it would take just about forever for me to run it (~5000 urpmf calls). Anyone who can run it faster, I'll be your best friend and love you forever and ever and all that stuff You'll probably have to change line 6 (where I set urpmflags to select the right media), but that's about it. Oh, and ignore the tmpnam warnings; there's no other good alternative without python-expect or -pexpect. Just don't run two copies at once. Also, I have a few questions: 1. Is there a faster way to do this than running urpmf ~5000 times? Yes, using perl-URPM will to it nicely, look at distriblint packages from Olivier Thauvin for example. 2. Does running urpmf ~5000 times go out to the internet ~5000 times? No, it only uses local copy of hdlist. 3. Would it help if I did this in perl (because we have a perl-URPM but not a python-URPM)? Yes, it will do the equivalent of one urpmf (hdlist loaded once) and everything else will be very fast. 4. Would anyone besides me want a python-URPM? (This would obviously take some time, but I'd be happy to look into it.) If anyone want to do it. ... --- CUT HERE --- #!/usr/bin/env python import sys import os urpmflags = --media main-cooker,contrib-cooker def readfile(fname): return file(fname).readlines() print Getting list of packages..., pkgsfname = os.tmpnam() os.system(urpmq %s --list %s % (urpmflags, pkgsfname)) The same, this results is immediat (a simple foreach (@{$urpm-{deplist}}) { print $_-name.\n; } pkgs = readfile(pkgsfname) pkgcount = len(pkgs) print pkgcount obsoletes = [] provides = {} print This may take a while... pkgfname = os.tmpnam() for i in range(pkgcount): pkg = pkgs[i] print \rprocessing #%4d/%4d: %s... % (i, pkgcount, pkg), os.system(urpmf %s --provides --obsoletes %s %s % (urpmflags, pkg.strip(), pkgfname)) Such a command does not read hdlist but synthesis, so your script will be a bit more faster. provobs = readfile(pkgfname) for line in provobs: ptv = line.strip().split(':') if len(ptv) == 3: package, tag, virtual = ptv if tag == 'obsoletes': obsoletes.append([virtual, package]) elif tag == 'provides': if not provides.has_key(virtual): provides[virtual] = [] provides[virtual].append(package) print \r, for obsolete in obsoletes: virtual, pkgo = obsolete if provides.has_key(virtual): for pkgp in provides[virtual]: if pkgp != pkgo: print %s obsoletes %s, provided by %s % (pkgo, virtual, pkgp) print And there you go François.
[Cooker] That obsoletes thing...
I wrote a quick python hack to look for any current packages that obsolete any other current package. I've included it at the end of this email. Unfortunately, I think it would take just about forever for me to run it (~5000 urpmf calls). Anyone who can run it faster, I'll be your best friend and love you forever and ever and all that stuff You'll probably have to change line 6 (where I set urpmflags to select the right media), but that's about it. Oh, and ignore the tmpnam warnings; there's no other good alternative without python-expect or -pexpect. Just don't run two copies at once. Also, I have a few questions: 1. Is there a faster way to do this than running urpmf ~5000 times? 2. Does running urpmf ~5000 times go out to the internet ~5000 times? 3. Would it help if I did this in perl (because we have a perl-URPM but not a python-URPM)? 4. Would anyone besides me want a python-URPM? (This would obviously take some time, but I'd be happy to look into it.) 5. Is there actually no python-expect or python-pexpect? Would anyone besides me want it? (This would take a few minutes.) 6. While I'm at it, does anyone want any other python packages? For my own use, I've packaged up python-{rational,cRat,fpconst,indices,xoltar,xzip,Itpl,logging} and would be happy to share them (or, for that matter, describe them) if there's any potential interest. I'd be happy to similarly package up any common python modules --- CUT HERE --- #!/usr/bin/env python import sys import os urpmflags = --media main-cooker,contrib-cooker def readfile(fname): return file(fname).readlines() print Getting list of packages..., pkgsfname = os.tmpnam() os.system(urpmq %s --list %s % (urpmflags, pkgsfname)) pkgs = readfile(pkgsfname) pkgcount = len(pkgs) print pkgcount obsoletes = [] provides = {} print This may take a while... pkgfname = os.tmpnam() for i in range(pkgcount): pkg = pkgs[i] print \rprocessing #%4d/%4d: %s... % (i, pkgcount, pkg), os.system(urpmf %s --provides --obsoletes %s %s % (urpmflags, pkg.strip(), pkgfname)) provobs = readfile(pkgfname) for line in provobs: ptv = line.strip().split(':') if len(ptv) == 3: package, tag, virtual = ptv if tag == 'obsoletes': obsoletes.append([virtual, package]) elif tag == 'provides': if not provides.has_key(virtual): provides[virtual] = [] provides[virtual].append(package) print \r, for obsolete in obsoletes: virtual, pkgo = obsolete if provides.has_key(virtual): for pkgp in provides[virtual]: if pkgp != pkgo: print %s obsoletes %s, provided by %s % (pkgo, virtual, pkgp) print And there you go
Re: [Cooker] That obsoletes thing...
I will run it now. Austin -- Austin Acton Hon.B.Sc. Synthetic Organic Chemist, Teaching Assistant Department of Chemistry, York University, Toronto MandrakeClub Volunteer (www.mandrakeclub.com) homepage: www.groundstate.ca
Re: [Cooker] That obsoletes thing...
On Friday 04 July 2003 10:37, Austin wrote: I will run it now. Austin I'm an idiot. I can do this all just by processing the synthesis files, with no calls to urpm*, can't I Never mind. I'll have a new script shortly. And I should be able to run it myself and report the results.