| |
@@ -235,13 +235,101 @@
|
| |
_make_ancient(path, self.conf.excludes, self.previous, self.logger)
|
| |
|
| |
|
| |
+ class MetadataOld_c:
|
| |
+ def __init__(self, logger):
|
| |
+ self.args = [ 'createrepo_c', '--update', '-q' ]
|
| |
+ self.previous = None
|
| |
+ self.logger = logger
|
| |
+ self.excludes = []
|
| |
+ self.ancient = False
|
| |
+
|
| |
+ def set_ancient(self, ancient):
|
| |
+ self.ancient = ancient
|
| |
+
|
| |
+ def set_cachedir(self, path):
|
| |
+ self.args.append('-c')
|
| |
+ self.args.append(path)
|
| |
+
|
| |
+ def set_comps(self, comps):
|
| |
+ self.args.append('-g')
|
| |
+ self.args.append(comps)
|
| |
+
|
| |
+ def set_excludes(self, excludes):
|
| |
+ self.args.append('-x')
|
| |
+ self.args.append(excludes)
|
| |
+ self.excludes.append(excludes)
|
| |
+
|
| |
+ def set_database(self, db):
|
| |
+ self.args.append('-d')
|
| |
+
|
| |
+ def set_compress_type(self, compress_type):
|
| |
+ self.args.append('--compress-type')
|
| |
+ self.args.append(compress_type)
|
| |
+
|
| |
+ def set_hash(self, hashtype):
|
| |
+ # Sorry, can't do that here.
|
| |
+ #pass
|
| |
+
|
| |
+ ## YES, we can do that here.
|
| |
+ self.args.append('--checksum')
|
| |
+ self.args.append(hashtype)
|
| |
+
|
| |
+ def set_skipstat(self, skip):
|
| |
+ if skip:
|
| |
+ self.args.append('--skip-stat')
|
| |
+
|
| |
+ def set_delta(self, deltapaths, max_delta_rpm_size, max_delta_rpm_age, delta_workers):
|
| |
+ # Sorry, can't do that here.
|
| |
+ ## We still can not do that here.
|
| |
+ pass
|
| |
+
|
| |
+ def set_previous(self, previous):
|
| |
+ self.previous = previous
|
| |
+
|
| |
+ def set_distro_tags(self, distro_tags):
|
| |
+ # Sorry, can't do that here.
|
| |
+ #pass
|
| |
+ ## YES, we can do that here.
|
| |
+ self.args.append('--distro')
|
| |
+ self.args.append(distro_tags)
|
| |
+
|
| |
+ def set_content_tags(self, content_tags):
|
| |
+ # Sorry, can't do that here.
|
| |
+ #pass
|
| |
+ ## YES, we can do that here.
|
| |
+ self.args.append('--content')
|
| |
+ self.args.append(content_tags)
|
| |
+
|
| |
+ def run(self, path):
|
| |
+ self.args.append(path)
|
| |
+ if self.previous:
|
| |
+ try:
|
| |
+ shutil.copytree("%s/repodata" %(self.previous,), "%s/repodata" % (path,))
|
| |
+ except OSError:
|
| |
+ self.logger.error("Couldn't copy repodata from %s" % (self.previous,))
|
| |
+ pid = os.fork()
|
| |
+ if not pid:
|
| |
+ os.execv("/usr/bin/createrepo_c", self.args)
|
| |
+ else:
|
| |
+ (p, status) = os.waitpid(pid, 0)
|
| |
+ if self.ancient:
|
| |
+ _make_ancient(path, self.excludes, self.previous, self.logger)
|
| |
+
|
| |
+
|
| |
class Metadata:
|
| |
|
| |
def __init__(self, logger):
|
| |
- if usenew:
|
| |
- self.obj = MetadataNew(logger)
|
| |
+ if repo_c:
|
| |
+ if usenew:
|
| |
+ # For now use the old createcrepo api
|
| |
+ self.obj = MetadataNew(logger)
|
| |
+ else:
|
| |
+ self.obj = MetadataOld_c(logger)
|
| |
else:
|
| |
- self.obj = MetadataOld(logger)
|
| |
+ if usenew:
|
| |
+ self.obj = MetadataNew(logger)
|
| |
+ else:
|
| |
+ self.obj = MetadataOld(logger)
|
| |
|
| |
def set_ancient(self, ancient):
|
| |
self.obj.set_ancient(ancient)
|
| |