-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathbs-upload-kernel
More file actions
executable file
·57 lines (52 loc) · 3.04 KB
/
bs-upload-kernel
File metadata and controls
executable file
·57 lines (52 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/python3
from obsapi.uploader import Uploader
from obsapi.api import APIError
from kutil.config import uniq, read_config_sh
import subprocess
import tempfile
import argparse
import sys
import os
argv = sys.argv
params = sys.argv[1:]
progname = sys.argv[0]
parser = argparse.ArgumentParser()
parser.add_argument('-A', '--apiurl', default='https://api.opensuse.org', help='OBS API URL')
parser.add_argument('-i', '--ignore-kabi', action='store_true', help='disable kABI check at build time')
parser.add_argument('--no-init', action='store_true', help='do not create or update OBS project')
parser.add_argument('-c', '--enable-checks', action='store_true', help='do no skip rpmlint checks')
parser.add_argument('-d', '--debuginfo', action='store_true', help='enable debuginfo in OBS project')
parser.add_argument('-r', '--rebuild', action='store_true', help='do not ignore out-of-project dependency updates')
parser.add_argument('-s', '--submit', nargs='?', const=True, help='create a gitea PR, optionally provide text')
parser.add_argument('--set-git-maintainers', action='store_true', help='Set maintainers in build project _maintainership.json')
parser.add_argument('-l', '--log', nargs=1, help='log API calls to file')
parser.add_argument('--reset-branch', action='store_true', help='reset git branch head to upstream')
parser.add_argument('--re-fork', action='store_true', help='delete and re-fork repository if needed')
parser.add_argument('--maintainer', dest='maintainers', action='append', help='specify OBS project maintainers')
parser.add_argument('--flavor', dest='limit_packages', action='append', help='build only specified packages')
parser.add_argument('-q', '--quiet', dest='verbose', action='store_false', default=True, help='do not show progress')
parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', default=True, help='show progress')
parser.add_argument('data', help='directory produced by tar-up')
parser.add_argument('project', help='OBS project to upload to')
args = parser.parse_args(params)
if args.maintainers:
args.maintainers = uniq(args.maintainers)
logfile = None
if args.log:
logfile = open(args.log[0], 'a')
sys.stderr.write('Logging API calls to %s\n' % (logfile.name,))
try:
ul = Uploader(api=args.apiurl, data=args.data, user_project=args.project, reset_branch=args.reset_branch, re_fork=args.re_fork,
logfile=logfile, progress=args.verbose, ignore_kabi=args.ignore_kabi, upload_all=read_config_sh(args.data).getboolean('noexec'))
if args.set_git_maintainers:
ul.set_git_maintainers(args.maintainers)
ul.upload()
if args.submit:
ul.submit(message=None if args.submit == True else args.submit)
if not args.no_init:
ul.create_project(limit_packages=args.limit_packages, maintainers=args.maintainers,
debuginfo=args.debuginfo, rpm_checks=args.enable_checks, rebuild=args.rebuild)
ul.create_package(limit_packages=args.limit_packages, no_init=args.no_init)
except APIError as e:
sys.stderr.write('ERROR: %s\n' % (e,))
exit(1)