Hi, the reason I decided to rewrite it to objects is that more functions call the printMatchingPkgs(), which before used the glob.glob calls, listing directories each time it was called and building the pkgs list. The speed patch builds the list of packages only one time in the beggining, so the function needs to have it sent as an argument, but when I was doing it this simple way, I found out, I have to rewrite more functions arguments list, and then many function calls (or use a global variable, yuck :(), that's why I rewrote almost the whole thing. Is it that bad? 'Cause making just the "necessary" changes to the functions looks worse in my opinion. But I can do it that way, if it's better, or using the global variable... -- Martin Gracik Software Engineer Email: mgracik@xxxxxxxxxx Tel.: +420 532 294 148 Red Hat Czech s.r.o., Purkyňova 99/71, 612 45, Brno, Czech Republic IC: 27690016 ----- Original Message ----- From: "Joel Granados" <jgranado@xxxxxxxxxx> To: "Discussion of Development and Customization of the Red Hat Linux Installer" <anaconda-devel-list@xxxxxxxxxx> Sent: Tuesday, February 17, 2009 7:01:29 PM GMT +01:00 Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna Subject: Re: [PATCH] Rewrote parts of the pkgorder script (#451083) On Fri, Feb 13, 2009 at 03:37:23PM +0100, Martin Gracik wrote: > Improved the speed by removing unecessary glob.glob calls. > Removed unneeded imports. > Rewrote the functions to use more object oriented approach. Remember to put the bug number on the commit message for rhel5 bugs. > --- > scripts/pkgorder | 221 +++++++++++++++++++++++++++++------------------------ > 1 files changed, 121 insertions(+), 100 deletions(-) > > diff --git a/scripts/pkgorder b/scripts/pkgorder > index 7722718..6322fb2 100755 > --- a/scripts/pkgorder > +++ b/scripts/pkgorder > @@ -9,13 +9,14 @@ > # You should have received a copy of the GNU Library Public License > # along with this program; if not, write to the Free Software > # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. > -import os.path > -import glob > + > +import os > +import sys > +import shutil > +import fnmatch > + . . . > - usage() > + usage() > sys.exit(1) > - > (toppath, arch, product) = args > - config = createConfig(toppath) > - > + > # Boo. > if arch == "i386": > arch = "i686" > + > + pkgs = Packages(toppath, product) > > # print out kernel related packages first > - printMatchingPkgs("kernel-*") > + pkgs.printMatching("kernel-*") > > - testpath = "/tmp/pkgorder-%d" %(os.getpid(),) > - os.system("mkdir -p %s/var/lib/rpm" %(testpath,)) > + testpath = "/tmp/pkgorder-%d" % (os.getpid(),) > + os.system("mkdir -p %s/var/lib/rpm" % (testpath,)) > > - ds = PackageOrderer(arch=arch) > - ds.setup(fn=config, excludes=options.excludeList, root = testpath) > + ds = PackageOrderer(pkgs=pkgs, arch=arch) > + ds.createConfig(toppath) > + ds.setup(root=testpath, excludes=options.excludeList) > > - addGroups(ds, ["core", "base", "text-internet"]) > + ds.addGroups(["core", "base", "text-internet"]) > > # hack, hack, hack... make sure iscsi ends up on disc1 (#208832) > - printMatchingPkgs("iscsi-*") > + pkgs.printMatching("iscsi-*") > > - addGroups(ds, ["base-x", "dial-up", > - "graphical-internet", "editors", > - "graphics", "gnome-desktop", "sound-and-video", > - "printing"]) > + ds.addGroups(["base-x", "dial-up", > + "graphical-internet", "editors", > + "graphics", "gnome-desktop", "sound-and-video", > + "printing"]) > > - addGroups(ds, ["office", "engineering-and-scientific", > - "authoring-and-publishing", "games"]) > + ds.addGroups(["office", "engineering-and-scientific", > + "authoring-and-publishing", "games"]) > > - addGroups(ds, ["web-server", "ftp-server", "sql-server", > - "mysql", "server-cfg", "dns-server", > - "smb-server", "admin-tools"]) > + ds.addGroups(["web-server", "ftp-server", "sql-server", > + "mysql", "server-cfg", "dns-server", > + "smb-server", "admin-tools"]) > > - addGroups(ds, ["kde-desktop", "development-tools", "development-libs", > - "gnome-software-development", "eclipse", > - "x-software-development", > - "java-development", "kde-software-development", > - "mail-server", "network-server", "legacy-network-server"]) > + ds.addGroups(["kde-desktop", "development-tools", "development-libs", > + "gnome-software-development", "eclipse", > + "x-software-development", > + "java-development", "kde-software-development", > + "mail-server", "network-server", "legacy-network-server"]) > > - addGroups(ds, ["news-server", "legacy-software-development"]) > + ds.addGroups(["news-server", "legacy-software-development"]) > > - #Everthing else but kernels > + # Everything else but kernels > for po in ds.pkgSack.returnPackages(): > if po.pkgtup not in ds._installed.returnPackages(): > if po.name.find("kernel") == -1: > member = ds.tsInfo.addInstall(po) > > ds.resolveDeps() > - processTransaction(ds) > - os.unlink(config) > + ds.processTransaction() > + ds.unlinkConfig() > shutil.rmtree(testpath) > + > -- > 1.6.0.6 > > _______________________________________________ > Anaconda-devel-list mailing list > Anaconda-devel-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/anaconda-devel-list from a quick look it all looks good. but I think the addition of object are much more needed in rawhide (pungi). You can bother f13 with that :) I would only add the necessary changes for rhel (no object changes) regards -- Joel Andres Granados Brno, Czech Republic, Red Hat. _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list