Re: [PATCH] Rewrote parts of the pkgorder script (#451083)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux