Merge pull request 'Add ability to specify non-Factory' (#31) from adamm/git-importer:option_for_non_factory into main

Reviewed-on: #31
Reviewed-by: Dirk Mueller <dirkmueller@noreply@src.opensuse.org>
This commit is contained in:
Dirk Mueller 2024-08-07 18:27:11 +02:00
commit 39ba616226

View File

@ -42,8 +42,8 @@ PROJECTS = [
]
def export_package(package, repodir, cachedir, gc):
exporter = GitExporter(URL_OBS, "openSUSE:Factory", package, repodir, cachedir)
def export_package(project, package, repodir, cachedir, gc):
exporter = GitExporter(URL_OBS, project, package, repodir, cachedir)
exporter.set_gc_interval(gc)
exporter.export_as_git()
@ -51,6 +51,12 @@ def export_package(package, repodir, cachedir, gc):
def main():
parser = argparse.ArgumentParser(description="OBS history importer into git")
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(
"-r",
"--repodir",
@ -110,10 +116,10 @@ def main():
if not args.cachedir:
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()
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__":