Logging patch from jbowes
This commit is contained in:
parent
a8cd5699bb
commit
ddd183386c
3
Authors
3
Authors
@ -5,4 +5,5 @@ Jesse Keating <jkeating at redhat dot com>
|
|||||||
Contributors:
|
Contributors:
|
||||||
|
|
||||||
Will Woods <wwoods at redhat dot com>
|
Will Woods <wwoods at redhat dot com>
|
||||||
sien Ita Essien <essien at wazobialinux dot com>
|
Essien Ita Essien <essien at wazobialinux dot com>
|
||||||
|
James Bowes <jbowes at redhat dot com>
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
* Wed Feb 14 2007 Jesse Keating <jkeating@redhat.com>
|
||||||
|
- Add logging patch from jbowes
|
||||||
|
|
||||||
* Tue Feb 13 2007 Jesse Keating <jkeating@redhat.com>
|
* Tue Feb 13 2007 Jesse Keating <jkeating@redhat.com>
|
||||||
- Fix part of the patch from Essien
|
- Fix part of the patch from Essien
|
||||||
- Add Contributors to the Authors file
|
- Add Contributors to the Authors file
|
||||||
|
@ -21,6 +21,7 @@ class Gather(yum.YumBase):
|
|||||||
def __init__(self, config, pkglist):
|
def __init__(self, config, pkglist):
|
||||||
# Create a yum object to use
|
# Create a yum object to use
|
||||||
yum.YumBase.__init__(self)
|
yum.YumBase.__init__(self)
|
||||||
|
self.config = config
|
||||||
self.doConfigSetup(fn=config.get('default', 'yumconf'), debuglevel=6, errorlevel=6, root="/tmp")
|
self.doConfigSetup(fn=config.get('default', 'yumconf'), debuglevel=6, errorlevel=6, root="/tmp")
|
||||||
self.cleanMetadata() # clean metadata that might be in the cache from previous runs
|
self.cleanMetadata() # clean metadata that might be in the cache from previous runs
|
||||||
self.cleanSqlite() # clean metadata that might be in the cache from previous runs
|
self.cleanSqlite() # clean metadata that might be in the cache from previous runs
|
||||||
@ -39,12 +40,21 @@ class Gather(yum.YumBase):
|
|||||||
self.doSackSetup(arches)
|
self.doSackSetup(arches)
|
||||||
self.doSackFilelistPopulate()
|
self.doSackFilelistPopulate()
|
||||||
self.logger = yum.logging.getLogger("yum.verbose.pungi")
|
self.logger = yum.logging.getLogger("yum.verbose.pungi")
|
||||||
self.config = config
|
|
||||||
self.pkglist = pkglist
|
self.pkglist = pkglist
|
||||||
self.polist = []
|
self.polist = []
|
||||||
self.srpmlist = []
|
self.srpmlist = []
|
||||||
self.resolved_deps = {} # list the deps we've already resolved, short circuit.
|
self.resolved_deps = {} # list the deps we've already resolved, short circuit.
|
||||||
|
|
||||||
|
def doLoggingSetup(self, debuglevel, errorlevel):
|
||||||
|
logdir = os.path.join(self.config.get('default', 'destdir'), 'logs')
|
||||||
|
if not os.path.exists(logdir):
|
||||||
|
os.makedirs(logdir)
|
||||||
|
logfile = os.path.join(logdir, 'log.txt')
|
||||||
|
yum.logging.basicConfig(level=yum.logging.INFO, filename=logfile)
|
||||||
|
|
||||||
|
def doFileLogSetup(self, uid, logfile):
|
||||||
|
pass
|
||||||
|
|
||||||
def _provideToPkg(self, req): #this is stolen from Anaconda
|
def _provideToPkg(self, req): #this is stolen from Anaconda
|
||||||
bestlist = None
|
bestlist = None
|
||||||
(r, f, v) = req
|
(r, f, v) = req
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
import commands
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
sys.path.append('/usr/lib/anaconda-runtime')
|
sys.path.append('/usr/lib/anaconda-runtime')
|
||||||
@ -19,6 +21,8 @@ import splittree
|
|||||||
import shutil
|
import shutil
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
log = logging.getLogger("pypungi.pungi")
|
||||||
|
|
||||||
class Pungi:
|
class Pungi:
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
self.config = config
|
self.config = config
|
||||||
@ -67,13 +71,15 @@ class Pungi:
|
|||||||
self.config.get('default', 'version'), '%s %s' % (self.config.get('default', 'product_name'),
|
self.config.get('default', 'version'), '%s %s' % (self.config.get('default', 'product_name'),
|
||||||
self.config.get('default', 'version')), self.config.get('default', 'product_path'),
|
self.config.get('default', 'version')), self.config.get('default', 'product_path'),
|
||||||
bugurl, self.topdir)
|
bugurl, self.topdir)
|
||||||
os.system('/usr/lib/anaconda-runtime/buildinstall %s' % args)
|
res = commands.getoutput('/usr/lib/anaconda-runtime/buildinstall %s' % args)
|
||||||
|
log.info("Result from buildinstall %s: %s" % (args, res))
|
||||||
self.writeinfo('tree: %s' % self.mkrelative(self.topdir))
|
self.writeinfo('tree: %s' % self.mkrelative(self.topdir))
|
||||||
|
|
||||||
def doPackageorder(self):
|
def doPackageorder(self):
|
||||||
os.system('/usr/lib/anaconda-runtime/pkgorder %s %s %s > %s' % (self.topdir, self.config.get('default', 'arch'),
|
res = commands.getoutput('/usr/lib/anaconda-runtime/pkgorder %s %s %s > %s' % (self.topdir, self.config.get('default', 'arch'),
|
||||||
self.config.get('default', 'product_path'), os.path.join(self.workdir,
|
self.config.get('default', 'product_path'), os.path.join(self.workdir,
|
||||||
'pkgorder-%s' % self.config.get('default', 'arch'))))
|
'pkgorder-%s' % self.config.get('default', 'arch'))))
|
||||||
|
log.info("Result from pkgorder: %s" % res)
|
||||||
|
|
||||||
def doGetRelnotes(self):
|
def doGetRelnotes(self):
|
||||||
docsdir = os.path.join(self.workdir, 'docs')
|
docsdir = os.path.join(self.workdir, 'docs')
|
||||||
@ -96,10 +102,10 @@ class Pungi:
|
|||||||
pkgname = pkg.rsplit('-', 2)[0]
|
pkgname = pkg.rsplit('-', 2)[0]
|
||||||
for relnoterpm in relnoterpms:
|
for relnoterpm in relnoterpms:
|
||||||
if pkgname == relnoterpm:
|
if pkgname == relnoterpm:
|
||||||
output = os.system("pushd %s; rpm2cpio %s |cpio -imud; popd" %
|
res = commands.getoutput("pushd %s; rpm2cpio %s |cpio -imud; popd" %
|
||||||
(docsdir,
|
(docsdir,
|
||||||
os.path.join(self.topdir, self.config.get('default', 'product_path'), pkg)))
|
os.path.join(self.topdir, self.config.get('default', 'product_path'), pkg)))
|
||||||
|
log.info("Result from rpm2cpio: %s" % res)
|
||||||
# Walk the tree for our files
|
# Walk the tree for our files
|
||||||
for dirpath, dirname, filelist in os.walk(docsdir):
|
for dirpath, dirname, filelist in os.walk(docsdir):
|
||||||
for filename in filelist:
|
for filename in filelist:
|
||||||
@ -174,7 +180,8 @@ class Pungi:
|
|||||||
mediaid = discinfo[0].rstrip('\n')
|
mediaid = discinfo[0].rstrip('\n')
|
||||||
args = '-g %s --baseurl=media://%s --outputdir=%s-disc1 --basedir=%s-disc1 --split %s-disc?' % \
|
args = '-g %s --baseurl=media://%s --outputdir=%s-disc1 --basedir=%s-disc1 --split %s-disc?' % \
|
||||||
(os.path.join(self.topdir, 'repodata', 'comps.xml'), mediaid, self.topdir, self.topdir, self.topdir)
|
(os.path.join(self.topdir, 'repodata', 'comps.xml'), mediaid, self.topdir, self.topdir, self.topdir)
|
||||||
os.system('/usr/bin/createrepo %s' % args)
|
res = commands.getoutput('/usr/bin/createrepo %s' % args)
|
||||||
|
log.info("Result from createrepo %s: %s" %(args, res))
|
||||||
|
|
||||||
def doCreateIsos(self):
|
def doCreateIsos(self):
|
||||||
anaruntime = '/usr/lib/anaconda-runtime/boot'
|
anaruntime = '/usr/lib/anaconda-runtime/boot'
|
||||||
@ -202,16 +209,19 @@ class Pungi:
|
|||||||
bootargs = '' # clear out any existing bootargs
|
bootargs = '' # clear out any existing bootargs
|
||||||
|
|
||||||
isofile = os.path.join(self.isodir, isoname)
|
isofile = os.path.join(self.isodir, isoname)
|
||||||
os.system('mkisofs %s %s %s -o %s %s' % (mkisofsargs,
|
res = commands.getoutput('mkisofs %s %s %s -o %s %s' % (mkisofsargs,
|
||||||
volname,
|
volname,
|
||||||
bootargs,
|
bootargs,
|
||||||
isofile,
|
isofile,
|
||||||
os.path.join('%s-disc%s' % (self.topdir, disc))))
|
os.path.join('%s-disc%s' % (self.topdir, disc))))
|
||||||
|
log.info("Result from mkisofs: %s" % res)
|
||||||
# implant md5 for mediacheck on all but source arches
|
# implant md5 for mediacheck on all but source arches
|
||||||
if not self.config.get('default', 'arch') == 'source':
|
if not self.config.get('default', 'arch') == 'source':
|
||||||
os.system('/usr/lib/anaconda-runtime/implantisomd5 %s' % isofile)
|
res = commands.getoutput('/usr/lib/anaconda-runtime/implantisomd5 %s' % isofile)
|
||||||
|
log.info("Result from implantisomd5: %s" % res)
|
||||||
# shove the sha1sum into a file
|
# shove the sha1sum into a file
|
||||||
os.system('cd %s; sha1sum %s >> SHA1SUM' % (self.isodir, isoname))
|
res = commands.getoutput('cd %s; sha1sum %s >> SHA1SUM' % (self.isodir, isoname))
|
||||||
|
log.info("Result from sha1sum: %s" % res)
|
||||||
# keep track of the CD images we've written
|
# keep track of the CD images we've written
|
||||||
isolist.append(self.mkrelative(isofile))
|
isolist.append(self.mkrelative(isofile))
|
||||||
# Write out a line describing the CD set
|
# Write out a line describing the CD set
|
||||||
@ -247,13 +257,16 @@ class Pungi:
|
|||||||
bootargs = '' # clear out any existing bootargs
|
bootargs = '' # clear out any existing bootargs
|
||||||
|
|
||||||
isofile = os.path.join(self.isodir, isoname)
|
isofile = os.path.join(self.isodir, isoname)
|
||||||
os.system('mkisofs %s %s %s -o %s %s' % (mkisofsargs,
|
res = commands.getoutput('mkisofs %s %s %s -o %s %s' % (mkisofsargs,
|
||||||
volname,
|
volname,
|
||||||
bootargs,
|
bootargs,
|
||||||
isofile,
|
isofile,
|
||||||
self.topdir))
|
self.topdir))
|
||||||
os.system('cd %s; sha1sum %s >> SHA1SUM' % (self.isodir, isoname))
|
log.info("Result from mkisofs: %s" % res)
|
||||||
os.system('/usr/lib/anaconda-runtime/implantisomd5 %s' % isofile)
|
res = commands.getoutput('cd %s; sha1sum %s >> SHA1SUM' % (self.isodir, isoname))
|
||||||
|
log.info("Result from sha1sum: %s" % res)
|
||||||
|
res = commands.getoutput('/usr/lib/anaconda-runtime/implantisomd5 %s' % isofile)
|
||||||
|
log.info("Result from implantisomd5: %s" % res)
|
||||||
|
|
||||||
shutil.move(os.path.join(self.config.get('default', 'destdir'), '.discinfo-%s' % self.config.get('default', 'arch')), discinfofile)
|
shutil.move(os.path.join(self.config.get('default', 'destdir'), '.discinfo-%s' % self.config.get('default', 'arch')), discinfofile)
|
||||||
|
|
||||||
@ -268,12 +281,13 @@ class Pungi:
|
|||||||
|
|
||||||
# Now make rescue images
|
# Now make rescue images
|
||||||
if not self.config.get('default', 'arch') == 'source':
|
if not self.config.get('default', 'arch') == 'source':
|
||||||
os.system('/usr/lib/anaconda-runtime/mk-rescueimage.%s %s %s %s %s' % (
|
res = commands.getoutput('/usr/lib/anaconda-runtime/mk-rescueimage.%s %s %s %s %s' % (
|
||||||
self.config.get('default', 'arch'),
|
self.config.get('default', 'arch'),
|
||||||
self.topdir,
|
self.topdir,
|
||||||
self.workdir,
|
self.workdir,
|
||||||
self.config.get('default', 'iso_basename'),
|
self.config.get('default', 'iso_basename'),
|
||||||
self.config.get('default', 'product_path')))
|
self.config.get('default', 'product_path')))
|
||||||
|
log.info("Result from mk-resueimage: %s" % res)
|
||||||
|
|
||||||
# write the iso
|
# write the iso
|
||||||
volname = '"%s %s %s Rescue"' % (self.config.get('default', 'product_name'), self.config.get('default', 'version'),
|
volname = '"%s %s %s Rescue"' % (self.config.get('default', 'product_name'), self.config.get('default', 'version'),
|
||||||
@ -289,14 +303,15 @@ class Pungi:
|
|||||||
else:
|
else:
|
||||||
bootargs = '' # clear out any existing bootargs
|
bootargs = '' # clear out any existing bootargs
|
||||||
|
|
||||||
os.system('mkisofs %s %s %s -o %s/%s %s' % (mkisofsargs,
|
res = commands.getoutput('mkisofs %s %s %s -o %s/%s %s'
|
||||||
volname,
|
% (mkisofsargs, volname, bootargs, self.isodir, isoname,
|
||||||
bootargs,
|
os.path.join(self.workdir, "%s-rescueimage"
|
||||||
self.isodir,
|
% self.config.get('default', 'arch'))))
|
||||||
isoname,
|
log.info("Result from mkisofs: %s" % res)
|
||||||
os.path.join(self.workdir, "%s-rescueimage" % self.config.get('default', 'arch'))))
|
|
||||||
|
|
||||||
os.system('cd %s; sha1sum %s >> SHA1SUM' % (self.isodir, isoname))
|
res = commands.getoutput('cd %s; sha1sum %s >> SHA1SUM'
|
||||||
|
% (self.isodir, isoname))
|
||||||
|
log.info("Result from sha1sum: %s" % res)
|
||||||
|
|
||||||
# Do some clean up
|
# Do some clean up
|
||||||
dirs = os.listdir(self.archdir)
|
dirs = os.listdir(self.archdir)
|
||||||
|
Loading…
Reference in New Issue
Block a user