Merge pull request #3173 from nilxam/slfo_1_1_updater

slfo-packagelist-uploader: add a 'branch' argument and use 1.1 branch for Leap 16.0
This commit is contained in:
Max Lin 2024-10-07 15:53:35 +08:00 committed by GitHub
commit 0d331eec72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View File

@ -196,4 +196,4 @@ pipelines:
resources: resources:
- repo-checker - repo-checker
tasks: tasks:
- script: ./slfo-packagelist-uploader.py --project openSUSE:Leap:16.0 - script: ./slfo-packagelist-uploader.py --project openSUSE:Leap:16.0 --branch 1.1

View File

@ -17,8 +17,10 @@ META_FILE = 'SLFO_Packagelist.group'
class PackagelistUploader(object): class PackagelistUploader(object):
def __init__(self, project, print_only, verbose): def __init__(self, project, branch, print_only, verbose):
self.project = project self.project = project
# Use default branch if there is no specify branch given
self.branch = branch if branch else 'main'
self.print_only = print_only self.print_only = print_only
self.verbose = verbose self.verbose = verbose
self.apiurl = osc.conf.config['apiurl'] self.apiurl = osc.conf.config['apiurl']
@ -41,7 +43,7 @@ class PackagelistUploader(object):
if os.path.isdir(filepath): if os.path.isdir(filepath):
shutil.rmtree(filepath) shutil.rmtree(filepath)
gitpath = 'https://src.opensuse.org/products/SLFO_main.git' gitpath = 'https://src.opensuse.org/products/SLFO_main.git'
git.Repo.clone_from(gitpath, filepath, branch='main') git.Repo.clone_from(gitpath, filepath, branch=self.branch)
packages = [] packages = []
files = os.listdir(filepath) files = os.listdir(filepath)
for f in files: for f in files:
@ -68,7 +70,7 @@ def main(args):
print("Please pass --project argument. See usage with --help.") print("Please pass --project argument. See usage with --help.")
quit() quit()
uc = PackagelistUploader(args.project, args.print_only, args.verbose) uc = PackagelistUploader(args.project, args.branch, args.print_only, args.verbose)
uc.crawl() uc.crawl()
@ -80,6 +82,8 @@ if __name__ == '__main__':
help='print info useful for debuging') help='print info useful for debuging')
parser.add_argument('-p', '--project', dest='project', metavar='PROJECT', parser.add_argument('-p', '--project', dest='project', metavar='PROJECT',
help='Target project on buildservice') help='Target project on buildservice')
parser.add_argument('-b', '--branch', dest='branch', metavar='BRANCH',
help='Git tree branch name')
parser.add_argument('-o', '--print-only', action='store_true', parser.add_argument('-o', '--print-only', action='store_true',
help='show the result instead of the uploading') help='show the result instead of the uploading')
parser.add_argument('-v', '--verbose', action='store_true', parser.add_argument('-v', '--verbose', action='store_true',