def delete(paths, commit=False): silent = config.get("log", "ignore-string", "SILENT") for path in paths: message = "%s: delete file %s" % (silent, path) if binrepo.is_binary(path): topdir = getpkgtopdir() binrepo.update_sources(topdir, removed=[os.path.basename(path)]) if commit: svn = SVN() svn.commit(binrepo.sources_path(topdir), log=message) else: svn = SVN() svn.remove(path, local=True) if commit: svn.commit(path, log=message)
def upload(paths, commit=False): for path in paths: if os.path.isdir(path) or binrepo.is_binary(path): topdir = getpkgtopdir() binrepo.upload_binary(topdir, os.path.basename(path)) binrepo.update_sources(topdir, added=[path]) if commit: svn = SVN() silent = config.get("log", "ignore-string", "SILENT") message = "%s: new file %s" % (silent, path) svn.commit(binrepo.sources_path(topdir), log=message) else: svn = SVN() svn.add(path, local=True) if commit: silent = config.get("log", "ignore-string", "SILENT") message = "%s: new file %s" % (silent, path) svn.commit(path, log=message)
def sync(dryrun=False, commit=False, download=False): svn = SVN() topdir = getpkgtopdir() spath = binrepo.sources_path(topdir) binrepoentries = binrepo.parse_sources(spath) # run svn info because svn st does not complain when topdir is not an # working copy svn.info(topdir) specsdir = os.path.join(topdir, "SPECS/") sourcesdir = os.path.join(topdir, "SOURCES/") for path in (specsdir, sourcesdir): if not os.path.isdir(path): raise Error, "%s directory not found" % path specs = glob.glob(os.path.join(specsdir, "*.spec")) if not specs: raise Error, "no .spec files found in %s" % specsdir specpath = specs[0] # FIXME better way? try: rpm.addMacro("_topdir", os.path.abspath(topdir)) spec = rpm.TransactionSet().parseSpec(specpath) except rpm.error, e: raise Error, "could not load spec file: %s" % e