diff --git a/autodist-git b/autodist-git index dbb6f81..4043bd1 100755 --- a/autodist-git +++ b/autodist-git @@ -70,6 +70,28 @@ def findOrCreateRepo(pkg_name, pkg_description=None, create=True): gitea_repo = giteaGetRepository(repo_name) return gitea_repo +def archivePkg(pkg_name): + # Replace '+' for repository name as it is not allowed + repo_name = pkg_name.replace('+','Plus') + + # Get gitea repository instance + #try: + # gitea_repo = org.get_repository(repo_name) + gitea_repo = giteaGetRepository(repo_name) + + if gitea_repo == None: + print(f'archiveRepo: repository {repo_name} not found') + return + + if getattr(gitea_repo, "archived"): + print(f'Repository {repo_name} is already archived') + return False + + setattr(gitea_repo, "archived", True) + gitea_repo.commit() + return True + + def commitReleaseFromDir(options, pkg_info, gitea_repo, repo, temp_dir): src_dir = pkg_info["src"] @@ -292,6 +314,9 @@ def main(): parser_syncpkg.add_argument('-d', '--delete', action='store_true', help="delete and recreate existing repository", required=False) + parser_archiverepo = subparsers.add_parser('archivepkg', help="archive a specified repository package on git server") + parser_archiverepo.add_argument('pkgname', help="name of package") + parser_syncrepo = subparsers.add_parser('syncrepo', help="sync base repository with git server") parser_syncrepo.add_argument('--from', dest='frompkg', help="from package name", required=False) parser_syncrepo.add_argument('--to', dest='topkg', help="to package name", required=False) @@ -315,6 +340,9 @@ def main(): gitea_repo.delete() findAndCommitPackageReleases(options, options.pkgname, options.pkgver) + elif options.mode == 'archivepkg': + archivePkg(options.pkgname) + elif options.mode == 'syncrepo': dir_list = sorted(filter(os.path.isfile, glob.glob(f'{cfg["SRPMS_DIR"]}/*.src.rpm'))) for dir_file in dir_list: