Skip to content
Browse files

Check whether version of createrepo is older than 0.4.6 (Francois Auc…

…amp)
  • Loading branch information...
1 parent 1028802 commit 8f3ebff7bb55e790f55f9645b70a3921e8eff59f @dagwieers committed May 14, 2007
Showing with 35 additions and 4 deletions.
  1. +1 −1 ChangeLog
  2. +1 −0 TODO
  3. +33 −3 mrepo
View
2 ChangeLog
@@ -8,7 +8,7 @@
- Added 5Server and 5Client products to gensystemid (Oliver Falk)
- Added rhel5s.conf and rhel5c.conf (Oliver Falk)
- Added amd64 as alias for x86_64 to accomodate Sun's Java packages (Tom G. Christensen)
-- Option -f/--force now rewrites apt release files (Tom G. Christensen)
+- Check whether version of createrepo is older than 0.4.6 (Francois Aucamp)
* 0.8.4 - Sint-Jacobsplein - released 13/12/2006
- Renamed Yam to mrepo (Matthew Hannigan)
View
1 TODO
@@ -28,6 +28,7 @@ contact me as well. :) Send an email to: Dag Wieers <dag@wieers.com>
+ Complain when a required tool is not available
+ Add URPMI and Red Carpet support (help needed)
+ Add YaST/YOU support (both for mirroring as providing metadata, seems impossible ?)
++ Update Apt release info transparantly when mrepo config changes (Tom G. Christensen)
### Reporting utility
+ Logwatch configuration for mrepo
View
36 mrepo
@@ -695,6 +695,25 @@ class Repo:
"Create a repomd repository"
if not cf.cmd['createrepo']:
raise mrepoGenerateException('Command createrepo is not found. Skipping.')
+
+ ### Find the createrepo version we are using (due to groupfile usage changes)
+ createrepo_version = None
+ groupfilename = 'RPMS.%s/comps.xml' % self.name
+ try:
+ sys.path.append("/usr/share/createrepo")
+ import genpkgmetadata
+ createrepo_version = genpkgmetadata.__version__
+ sys.path.remove("/usr/share/createrepo")
+ del genpkgmetadata
+ except:
+ pass
+
+ ### If version < 0.4.6, then use the old createrepo behaviour
+ if not createrepo_version:
+ error(0, '%s: Version of createrepo could not be found. Assuming newer than 0.4.6.' % self.dist.nick)
+ elif vercmp(createrepo_version, '0.4.6') < 0:
+ groupfilename = 'comps.xml'
+
opts = ' ' + cf.createrepooptions
if op.force:
opts = ' --pretty'
@@ -715,7 +734,7 @@ class Repo:
groupfile = os.path.join(cf.srcdir, self.dist.nick, self.name + '-comps.xml')
if os.path.isfile(groupfile):
symlink(groupfile, os.path.join(self.wwwdir, 'comps.xml'))
- repoopts = repoopts + ' --groupfile "RPMS.%s/comps.xml"' % self.name
+ repoopts = repoopts + ' --groupfile "%s"' % groupfilename
info(2, '%s: Create repomd repository for %s' % (self.dist.nick, self.name))
ret = run('%s %s %s' % (cf.cmd['createrepo'], repoopts, self.wwwdir))
if ret:
@@ -754,7 +773,7 @@ class Repo:
### Write out /srcdir/nick/base/release
releasefile = os.path.join(self.dist.dir, 'base', 'release')
- if op.force or not os.path.exists(releasefile):
+ if not os.path.exists(releasefile):
open(releasefile, 'w').write(
'Origin: %s\n'\
'Label: %s\n'\
@@ -769,7 +788,7 @@ class Repo:
### Write out /srcdir/nick/base/release.repo
releasefile = os.path.join(self.dist.dir, 'base', 'release.'+ self.name)
- if op.force or not os.path.exists(releasefile):
+ if not os.path.exists(releasefile):
open(releasefile, 'w').write(
'Archive: %s\n'\
'Component: %s\n'\
@@ -939,6 +958,17 @@ def distsort(a, b):
def reposort(a, b):
return cmp(a.name, b.name)
+def vercmp(a, b):
+ al = a.split('.')
+ bl = b.split('.')
+ minlen = min(len(al), len(bl))
+ for i in range(1, minlen):
+ if cmp(al[i], bl[i]) < 0:
+ return -1
+ elif cmp(al[i], bl[i]) > 0:
+ return 1
+ return 0
+
def symlinkglob(str, *targets):
"Symlink files to multiple targets"
for file in glob.glob(str):

0 comments on commit 8f3ebff

Please sign in to comment.
Something went wrong with that request. Please try again.