Hi, everyone.
 
This pungi's patch is able to create easily CD/DVD that inclde update RPM packages (exclude old PRM packages automatically).
Apply a patch and add line below to yum.conf.f7.i386 .
#-------------------------
exclude=*debuginfo*

[fedorai-update]
name=Fedora 7 - update
baseurl=http://[mirror site URL]/fedora/updates/7/i386/
enabled=1
gpgcheck=0
#-------------------------
 
Example of execution.
#pungi -c /etc/pungi/f7-fedora.i386
 
We can create a DVD that use a new kernel package and update packages.
And to rebuilt anaconda installer that use a new kernel.
 
Have a nice day!
Best regards.
 
 
 
--- /usr/lib/python2.5/site-packages/pypungi/gather.py 2007-05-26 07:15:48.000000000 +0900
+++ /usr/lib/python2.5/site-packages/pypungi/gather.py.new 2007-06-16 07:14:07.000000000 +0900
@@ -387,3 +387,54 @@
                 shutil.copy2(path, local)
 
             os.link(local, os.path.join(pkgdir, os.path.basename(remote)))
+
+
+    # Add removeOldPackages 20070616 Pochi_ken <pochi_ken@hotmail.com>
+    def removeOldPackages(self):
+        """Cycle through the check of rpms and
+           update the package objects and delete the old package objects."""
+
+        pkgdir = os.path.join! (self.config.get('default', 'destdir'),
+                              self.config.get('default', 'version'),
+                              self.config.get('default', 'flavor'),
+                              self.config.get('default', 'arch'),
+                              self.config.get('default', 'osdir'),
+            &nb! sp;          ! ; & nbsp;     self.config.get('default', 'product_path'))
+        local = self.config.get('default','cachedir') + '/'
+        localfiles = os.listdir(local)
+        trot = yum.rpmUtils.transaction.initReadOnlyTransaction()
+        rpmlst = []
+        for filename in localfiles:
+            rpmfile = local + filename
+            try:
+                hdr = yum.rpmUtils.miscutils.hdrFromPackage(trot, rpmfile)
+                rpmlst.append((rpmfile, hdr))
+       !          self.logger.info("Reading header info from %s" % rpmfile)
+            except:
+                self.logger.info("Could not read header info in %s" % rpmfile)
+        rpmlst.sort()
+        c = 0
+        oldrpmlst = []
+        while (c < (len(rpmlst)-1)):
+            i = 1
+            while (i < 5):
+                cRPMpkg = yum.rpmUtils.miscutils.pkgTupleFromHeader(rpmlst[c][1])
+         &nbs! p;      nRPMpkg = yum.rpmUtils.miscut! ils.pkgT upleFromHeader(rpmlst[c+i][1])
+                if (cRPMpkg[0] == nRPMpkg[0]) and (cRPMpkg[1] == nRPMpkg[1]):
+                    cRPMEVR = cRPMpkg[2:]
+                    nRPMEVR = nRPMpkg[2:]
+                    if yum.rpmUtils.miscutils.compareEVR(nRPMEVR, cRPMEVR) == 1:
+                        oldrpmlst.append(rpmlst[c][0])
+                    else:
+      !                   oldrpmlst.append(rpmlst[c+i][0])
+                        rpmlst.pop(c+i)
+                        c = c-1
+                i = i+1
+                if ((c+i) > (len(rpmlst)-1)):
+                    i = 5
+            c = c+1
+        for filename in oldrpmlst:
+     ! ;       self.logger.info("Old pa! ckage %s is removed." % filename)
+            os.remove(filename)
+            os.remove(os.path.join(pkgdir, os.path.basename(filename)))
+    # END removeOldPackage
--- /usr/bin/pungi 2007-05-31 01:30:29.000000000 +0900
+++ /usr/bin/pungi.new 2007-06-13 22:21:15.000000000 +0900
@@ -101,13 +101,17 @@
 
     # Actually do work.
     if not config.get('default', 'arch') == 'source':
+        mygather = pypungi.gather.Gather(config, pkglist)
         if opts.do_all or opts.do_gather:
-            mygather = pypungi.gather.Gather(config, pkglist)
             mygather.getPackageObjec! ts()
             mygather.downloadPackages()
-            if config.getboolean('default', 'getsource'):
-                mygather.getSRPMList()
-                mygather.downloadSRPMs()
+
+        if opts.do_all or opts.do_remove:
+            mygather.removeOldPackages()
+
+        if config.getboolean('default', 'getsource'):
+            mygather.getSRPMList()
+            mygather.downloadSRPMs()
 
      &! nbsp;  mypungi = pypungi.pungi.Pungi(config)
 @@ -153 ,6 +157,8 @@
           help="Enable ALL stages")
         parser.add_option("-G", action="store_true", default=False, dest="do_gather",
           help="Flag to enable processing the Gather stage")
+        parser.add_option("-R", action="store_true", default=False, dest="do_remove",
+          help="Flag to enable processing the Remove stage")
         parser.add_option("-B", action="store_true", default=False, dest="do_buildinstall",
           help="Flag to enable processing the BuildInstall stage")
         parser.add_option("-P", action="store_true", default=False, dest="do_packageorder",
@@ -164,7 ! +170,7 @@
 
 
         (opts, args) = parser.parse_args()
-        if opts.do_gather or opts.do_buildinstall or opts.do_packageorder or opts.do_splittree or opts.do_createiso:
+        if opts.do_gather or opts.do_remove or opts.do_buildinstall or opts.do_packageorder or opts.do_splittree or opts.do_createiso:
             opts.do_all = False
         if len(sys.argv) < 2:
             parser.print_help()



Windows Vista ついに発売! さらに詳しく