Add ability to specify non-Factory

This is important for devel-project only imports
non-factory is still blocked by assert
This commit is contained in:
Adam Majer 2024-08-07 16:55:05 +02:00
parent 1318f9e0c4
commit 531dbc7c1b

View File

@ -42,8 +42,8 @@ PROJECTS = [
] ]
def export_package(package, repodir, cachedir, gc): def export_package(project, package, repodir, cachedir, gc):
exporter = GitExporter(URL_OBS, "openSUSE:Factory", package, repodir, cachedir) exporter = GitExporter(URL_OBS, project, package, repodir, cachedir)
exporter.set_gc_interval(gc) exporter.set_gc_interval(gc)
exporter.export_as_git() exporter.export_as_git()
@ -51,6 +51,12 @@ def export_package(package, repodir, cachedir, gc):
def main(): def main():
parser = argparse.ArgumentParser(description="OBS history importer into git") parser = argparse.ArgumentParser(description="OBS history importer into git")
parser.add_argument("packages", help="OBS package names", nargs="*") parser.add_argument("packages", help="OBS package names", nargs="*")
parser.add_argument(
"-p",
"--project",
default="openSUSE:Factory",
help="Project to import/export, default is openSUSE:Factory",
)
parser.add_argument( parser.add_argument(
"-r", "-r",
"--repodir", "--repodir",
@ -110,10 +116,10 @@ def main():
if not args.cachedir: if not args.cachedir:
args.cachedir = pathlib.Path("~/.cache/git-import/").expanduser() args.cachedir = pathlib.Path("~/.cache/git-import/").expanduser()
importer = Importer(URL_OBS, "openSUSE:Factory", args.packages) importer = Importer(URL_OBS, args.project, args.packages)
importer.import_into_db() importer.import_into_db()
for package in args.packages: for package in args.packages:
export_package(package, args.repodir, args.cachedir, args.gc) export_package(args.project, package, args.repodir, args.cachedir, args.gc)
if __name__ == "__main__": if __name__ == "__main__":