diff -du /tmp/old-mash/config.py mash/config.py --- /tmp/old-mash/config.py 2009-08-06 11:23:50.000000000 +0200 +++ mash/config.py 2009-08-06 08:29:41.000000000 +0200 @@ -41,6 +41,7 @@ repoviewurl = config.Option('http://localhost/%(arch)s') repoviewtitle = config.Option('"Mash - %(arch)s"') distros = [] + repo_outputdir = config.Option('""') class MashDistroConfig(config.BaseConfig): name = config.Option() @@ -65,6 +66,7 @@ use_repoview = config.BoolOption(False) repoviewurl = config.Inherit(MashConfig.repoviewurl) repoviewtitle = config.Inherit(MashConfig.repoviewtitle) + repo_outputdir = config.Inherit(MashConfig.repo_outputdir) def readMainConfig(conf): config = MashConfig() @@ -79,14 +81,14 @@ for section in config.parser.sections(): if section == 'defaults': continue - + thisdistro = MashDistroConfig() thisdistro.populate(parser, section) thisdistro.keys = map(string.lower, thisdistro.keys) if len(thisdistro.keys) == 0: thisdistro.keys = [''] config.distros.append(thisdistro) - + if os.path.isdir(config.configdir): for file in glob.glob('%s/*.mash' % config.configdir): thisdistro = MashDistroConfig() diff -du /tmp/old-mash/__init__.py mash/__init__.py --- /tmp/old-mash/__init__.py 2009-08-06 11:23:26.000000000 +0200 +++ mash/__init__.py 2009-08-06 09:05:10.000000000 +0200 @@ -91,11 +91,11 @@ self.logger.setLevel(logging.DEBUG) self.logger.propagate = False - def _makeMetadata(self, path, repocache, arch, comps = False, repoview = True): + def _makeMetadata(self, path, repo_output_dir, repocache, arch, comps = False, repoview = True): conf = createrepo.MetaDataConfig() conf.cachedir = repocache conf.update = True - conf.outputdir = path + conf.outputdir = repo_output_dir conf.directory = path conf.quiet = True # Requires: createrepo >= 0.9.4 @@ -109,6 +109,7 @@ conf.groupfile = self.config.compsfile if self.config.debuginfo_path == os.path.join(self.config.rpm_path, 'debug'): conf.excludes.append("debug/*") + repomatic = createrepo.MetaDataGenerator(conf) repomatic.doPkgMetadata() repomatic.doRepoMetadata() @@ -189,6 +190,8 @@ def _write_files(list, path, repo_path, comps = False, repocache = None, arch = None): self.logger.info("Writing out files for %s..." % (path,)) os.makedirs(path) + if not os.path.exists(repo_path): + os.makedirs(repo_path) pid = os.fork() if pid: @@ -197,7 +200,7 @@ _install(pkg, path) self.logger.info("Running createrepo for %s..." % (path,)) - status = self._makeMetadata(repo_path, repocache, arch, comps) + status = self._makeMetadata(path, repo_path, repocache, arch, comps) def _get_reference(pkg, builds_hash): result = None @@ -358,24 +361,32 @@ repocache = os.path.join(tmpdir,".createrepo-cache") shutil.rmtree(repocache, ignore_errors = True) os.makedirs(repocache) - + if len(self.config.repo_outputdir) > 1: + repo_outputdir = os.path.join(self.config.repo_outputdir, self.config.name) + shutil.rmtree(repo_outputdir, ignore_errors = True) + os.makedirs(repo_outputdir) + else: + repo_outputdir = outputdir + pids = [] for arch in self.config.arches: path = os.path.join(outputdir, self.config.rpm_path % { 'arch':arch }) - repo_path = os.path.join(outputdir, self.config.repodata_path % { 'arch':arch }) + repo_path = os.path.join(repo_outputdir, self.config.rpm_path % { 'arch':arch }) pid = _write_files(packages[arch].packages(), path, repo_path, repocache = repocache, comps = True, arch = arch) pids.append(pid) if self.config.debuginfo: path = os.path.join(outputdir, self.config.debuginfo_path % { 'arch': arch }) - pid = _write_files(debug[arch].packages(), path, path, + repo_path = os.path.join(repo_outputdir, self.config.debuginfo_path % { 'arch':arch }) + pid = _write_files(debug[arch].packages(), path, repo_path, repocache = repocache, arch = arch) pids.append(pid) path = os.path.join(outputdir, self.config.source_path) - pid = _write_files(source.packages(), path, path, repocache = repocache, arch = 'SRPMS') + repo_path = os.path.join(repo_outputdir, self.config.source_path) + pid = _write_files(source.packages(), path, repo_path, repocache = repocache, arch = 'SRPMS') pids.append(pid) self.logger.info("Waiting for createrepo to finish...") @@ -499,7 +510,7 @@ shutil.rmtree(tmproot, ignore_errors = True) self.logger.info("Running createrepo on %s..." %(repodir)) - self._makeMetadata(repodir, repocache, arch, comps = True, repoview = False) + self._makeMetadata(repodir, repodir, repocache, arch, comps = True, repoview = False) shutil.rmtree(tmproot, ignore_errors = True) os._exit(0)