- Add a cache dir for pungi (/var/cache/pungi) and a cli option to override
- Fix some typos - Handle cache dir not being on same file system
This commit is contained in:
parent
666fb84064
commit
b8b7d763f9
@ -1,5 +1,6 @@
|
|||||||
* Sun Aug 26 2007 Jesse Keating <jkeating@redhat.com>
|
* Sun Aug 26 2007 Jesse Keating <jkeating@redhat.com>
|
||||||
- Add better support for %packages syntax using native pykickstart
|
- Add better support for %packages syntax using native pykickstart
|
||||||
|
- Add a cache dir for pungi (/var/cache/pungi) and a cli option to override
|
||||||
|
|
||||||
* Sat Aug 25 2007 Jesse Keating <jkeating@redhat.com>
|
* Sat Aug 25 2007 Jesse Keating <jkeating@redhat.com>
|
||||||
- Use a kickstart file as input now (for cdsize and package manifest)
|
- Use a kickstart file as input now (for cdsize and package manifest)
|
||||||
|
5
pungi
5
pungi
@ -54,13 +54,14 @@ def main():
|
|||||||
config.set('default', 'relnotedirre', relnotedirre)
|
config.set('default', 'relnotedirre', relnotedirre)
|
||||||
config.set('default', 'relnotepkgs', relnotepkgs)
|
config.set('default', 'relnotepkgs', relnotepkgs)
|
||||||
config.set('default', 'product_path', 'Packages')
|
config.set('default', 'product_path', 'Packages')
|
||||||
config.set('default', 'cachedir', '/srv/pungi/cache') # needs to be handled better
|
config.set('default', 'cachedir', '/var/cache/pungi')
|
||||||
|
|
||||||
# set configs from cli options
|
# set configs from cli options
|
||||||
config.set('default', 'name', opts.name)
|
config.set('default', 'name', opts.name)
|
||||||
config.set('default', 'version', opts.ver)
|
config.set('default', 'version', opts.ver)
|
||||||
config.set('default', 'flavor', opts.flavor)
|
config.set('default', 'flavor', opts.flavor)
|
||||||
config.set('default', 'destdir', opts.destdir)
|
config.set('default', 'destdir', opts.destdir)
|
||||||
|
config.set('default', 'cachedir', opts.cachedir)
|
||||||
config.set('default', 'bugurl', opts.bugurl)
|
config.set('default', 'bugurl', opts.bugurl)
|
||||||
config.set('default', 'discs', opts.discs)
|
config.set('default', 'discs', opts.discs)
|
||||||
|
|
||||||
@ -156,6 +157,8 @@ if __name__ == '__main__':
|
|||||||
help='the flavor of your distribution spin (optional)')
|
help='the flavor of your distribution spin (optional)')
|
||||||
parser.add_option("--destdir", default=".", dest="destdir",
|
parser.add_option("--destdir", default=".", dest="destdir",
|
||||||
help='destination directory (defaults to current directory)')
|
help='destination directory (defaults to current directory)')
|
||||||
|
parser.add_option("--cachedir", default="/var/cache/pungi", dest="cachedir",
|
||||||
|
help='package cache directory (defaults to /var/cache/pungi)')
|
||||||
parser.add_option("--bugurl", default="http://bugzilla.redhat.com", dest="bugurl",
|
parser.add_option("--bugurl", default="http://bugzilla.redhat.com", dest="bugurl",
|
||||||
help='the url for your bug system (defaults to http://bugzilla.redhat.com)')
|
help='the url for your bug system (defaults to http://bugzilla.redhat.com)')
|
||||||
parser.add_option("--discs", default='1', dest="discs",
|
parser.add_option("--discs", default='1', dest="discs",
|
||||||
|
@ -30,6 +30,7 @@ A tool to create anaconda based installation trees/isos of a set of rpms.
|
|||||||
%install
|
%install
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
|
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
|
||||||
|
%{__install} -d $RPM_BUILD_ROOT/var/cache/pungi
|
||||||
|
|
||||||
|
|
||||||
%clean
|
%clean
|
||||||
@ -44,6 +45,7 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{python_sitelib}/pypungi
|
%{python_sitelib}/pypungi
|
||||||
%{_bindir}/pungi
|
%{_bindir}/pungi
|
||||||
%{_datadir}/pungi
|
%{_datadir}/pungi
|
||||||
|
/var/cache/pungi
|
||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
@ -197,11 +197,11 @@ class Gather(pypungi.PungiBase):
|
|||||||
packages.extend(groupobj.mandatory_packages.keys())
|
packages.extend(groupobj.mandatory_packages.keys())
|
||||||
|
|
||||||
# Add the default packages unless we don't want them
|
# Add the default packages unless we don't want them
|
||||||
if group.include == 1
|
if group.include == 1:
|
||||||
packages.extend(groupobj.default_packages.keys())
|
packages.extend(groupobj.default_packages.keys())
|
||||||
|
|
||||||
# Add the optional packages if we want them
|
# Add the optional packages if we want them
|
||||||
if group.include == 2
|
if group.include == 2:
|
||||||
packages.extend(groupobj.default_packages.keys())
|
packages.extend(groupobj.default_packages.keys())
|
||||||
packages.extend(groupobj.optional_packages.keys())
|
packages.extend(groupobj.optional_packages.keys())
|
||||||
|
|
||||||
@ -325,7 +325,15 @@ class Gather(pypungi.PungiBase):
|
|||||||
target = os.path.join(pkgdir, os.path.basename(remote))
|
target = os.path.join(pkgdir, os.path.basename(remote))
|
||||||
if os.path.exists(target):
|
if os.path.exists(target):
|
||||||
os.remove(target) # avoid traceback after interrupted download
|
os.remove(target) # avoid traceback after interrupted download
|
||||||
os.link(local, target)
|
try:
|
||||||
|
os.link(local, target)
|
||||||
|
except OSError, e:
|
||||||
|
if e.errno == 18:
|
||||||
|
# Can't hardlink cross file systems
|
||||||
|
shutil.copy2(local, target)
|
||||||
|
else:
|
||||||
|
self.logger.error('Got an error linking from cache: %s' % e)
|
||||||
|
raise OSError, e
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Disable cache otherwise things won't download
|
# Disable cache otherwise things won't download
|
||||||
@ -336,9 +344,18 @@ class Gather(pypungi.PungiBase):
|
|||||||
# do a little dance for file:// repos...
|
# do a little dance for file:// repos...
|
||||||
path = repo.getPackage(pkg)
|
path = repo.getPackage(pkg)
|
||||||
if not os.path.exists(local) or not os.path.samefile(path, local):
|
if not os.path.exists(local) or not os.path.samefile(path, local):
|
||||||
shutil.copy2(path, local)
|
shutil.copy2(local, path)
|
||||||
|
|
||||||
|
try:
|
||||||
|
os.link(local, os.path.join(pkgdir, os.path.basename(remote)))
|
||||||
|
except OSError, e:
|
||||||
|
if e.errno == 18:
|
||||||
|
# Can't hardlink cross file systems
|
||||||
|
shutil.copy2(local, os.path.join(pkgdir, os.path.basename(remote)))
|
||||||
|
else:
|
||||||
|
self.logger.error('Got an error linking from cache: %s' % e)
|
||||||
|
raise OSError, e
|
||||||
|
|
||||||
os.link(local, os.path.join(pkgdir, os.path.basename(remote)))
|
|
||||||
|
|
||||||
self.logger.info('Finished downloading packages.')
|
self.logger.info('Finished downloading packages.')
|
||||||
|
|
||||||
@ -425,7 +442,16 @@ class Gather(pypungi.PungiBase):
|
|||||||
if os.path.exists(os.path.join(pkgdir, os.path.basename(remote))) and self.verifyCachePkg(pkg, os.path.join(pkgdir, os.path.basename(remote))):
|
if os.path.exists(os.path.join(pkgdir, os.path.basename(remote))) and self.verifyCachePkg(pkg, os.path.join(pkgdir, os.path.basename(remote))):
|
||||||
self.logger.debug("%s already exists in tree and appears to be complete" % local)
|
self.logger.debug("%s already exists in tree and appears to be complete" % local)
|
||||||
else:
|
else:
|
||||||
os.link(local, os.path.join(pkgdir, os.path.basename(remote)))
|
try:
|
||||||
|
os.link(local, os.path.join(pkgdir, os.path.basename(remote)))
|
||||||
|
except OSError, e:
|
||||||
|
if e.errno == 18:
|
||||||
|
# Can't hardlink cross file systems
|
||||||
|
shutil.copy2(local, os.path.join(pkgdir, os.path.basename(remote)))
|
||||||
|
else:
|
||||||
|
self.logger.error('Got an error linking from cache: %s' % e)
|
||||||
|
raise OSError, e
|
||||||
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Disable cache otherwise things won't download
|
# Disable cache otherwise things won't download
|
||||||
@ -436,6 +462,15 @@ class Gather(pypungi.PungiBase):
|
|||||||
# do a little dance for file:// repos...
|
# do a little dance for file:// repos...
|
||||||
path = repo.getPackage(pkg)
|
path = repo.getPackage(pkg)
|
||||||
if not os.path.exists(local) or not os.path.samefile(path, local):
|
if not os.path.exists(local) or not os.path.samefile(path, local):
|
||||||
shutil.copy2(path, local)
|
shutil.copy2(local, path)
|
||||||
|
|
||||||
|
try:
|
||||||
|
os.link(local, os.path.join(pkgdir, os.path.basename(remote)))
|
||||||
|
except OSError, e:
|
||||||
|
if e.errno == 18:
|
||||||
|
# Can't hardlink cross file systems
|
||||||
|
shutil.copy2(local, target)
|
||||||
|
else:
|
||||||
|
self.logger.error('Got an error linking from cache: %s' % e)
|
||||||
|
raise OSError, e
|
||||||
|
|
||||||
os.link(local, os.path.join(pkgdir, os.path.basename(remote)))
|
|
||||||
|
Loading…
Reference in New Issue
Block a user