From 657b11d05a0983c591b7dd1c813e0e25cb7f4598 Mon Sep 17 00:00:00 2001 From: Michal Konečný Date: Feb 22 2021 14:08:50 +0000 Subject: [PATCH 1/3] Add requirements file Signed-off-by: Michal Konečný --- diff --git a/.gitignore b/.gitignore index 89039a6..ba67d7d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ dist *.pyc .ropeproject .pytest_cache +test.conf +.venv/ diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..9d3d234 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +rpkg +rpm diff --git a/setup.py b/setup.py index 928f5c1..77756b0 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,35 @@ from setuptools import setup +def get_requirements(requirements_file="requirements.txt"): + """Get the contents of a file listing the requirements. + + :arg requirements_file: path to a requirements file + :type requirements_file: string + :returns: the list of requirements, or an empty list if + `requirements_file` could not be opened or read + :return type: list + """ + + lines = open(requirements_file).readlines() + dependencies = [] + for line in lines: + maybe_dep = line.strip() + if maybe_dep.startswith("#"): + # Skip pure comment lines + continue + if maybe_dep.startswith("git+"): + # VCS reference for dev purposes, expect a trailing comment + # with the normal requirement + __, __, maybe_dep = maybe_dep.rpartition("#") + else: + # Ignore any trailing comment + maybe_dep, __, __ = maybe_dep.partition("#") + # Remove any whitespace and assume non-empty results are dependencies + maybe_dep = maybe_dep.strip() + if maybe_dep: + dependencies.append(maybe_dep) + return dependencies + setup( name="centpkg", version='0.4.6', @@ -9,6 +39,7 @@ setup( license="GPLv2+", package_dir={'': 'src'}, packages=['centpkg'], + install_requires=get_requirements(), scripts=['src/bin/centpkg'], data_files=[('/etc/rpkg',['src/centpkg.conf']),] ) From 370301a702b23230a4457a369bd7ab8504f3a24a Mon Sep 17 00:00:00 2001 From: Michal Konečný Date: Feb 22 2021 16:23:43 +0000 Subject: [PATCH 2/3] Add --config argument Signed-off-by: Michal Konečný --- diff --git a/src/centpkg/__main__.py b/src/centpkg/__main__.py index 2f28cf0..c394ae3 100644 --- a/src/centpkg/__main__.py +++ b/src/centpkg/__main__.py @@ -35,13 +35,16 @@ def main(): parser.add_argument('-S', '--sig', help='Operate as a CentOS SIG user instead of using the Stream distro environment', default=False, action='store_true') + parser.add_argument('-C', '--config', help='Specify a config file to use') + (args, other) = parser.parse_known_args() - if args.sig: - args.config = '/etc/rpkg/centpkg-sig.conf' - else: - args.config = '/etc/rpkg/centpkg.conf' + if not args.config: + if args.sig: + args.config = '/etc/rpkg/centpkg-sig.conf' + else: + args.config = '/etc/rpkg/centpkg.conf' # Make sure we have a sane config file if not os.path.exists(args.config) and not other[-1] in ['--help', '-h', 'help']: From 31716f2b6e102ed2c5e959737373dcda1f0da941 Mon Sep 17 00:00:00 2001 From: Michal Konečný Date: Feb 23 2021 11:05:45 +0000 Subject: [PATCH 3/3] Clone command is working Signed-off-by: Michal Konečný --- diff --git a/README.md b/README.md index 2d82532..cd371d3 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,10 @@ For now only a very small subset of rpkg commands are enabled. Exception handling at the top level has been disabled for now to get better tracebacks during development. +## Supported commands +Here is the list currently supported commands by centpkg: +* clone + ## Current workflow For a sig working on a package in git.centos.org, the following workflow is recommended: diff --git a/src/centpkg.conf b/src/centpkg.conf index b818a86..d8066c0 100644 --- a/src/centpkg.conf +++ b/src/centpkg.conf @@ -4,8 +4,8 @@ lookasidehash = sha512 lookaside_cgi = https://sources.stream.rdu2.redhat.com/lookaside/upload.cgi distgit_namespaced = True distgit_namespaces = rpms -gitbaseurl = ssh://git@gitlab.com/%(repo)s.git -anongiturl = https://gitlab.com/%(repo)s +gitbaseurl = ssh://git@gitlab.com/redhat/centos-stream/%(repo)s.git +anongiturl = https://gitlab.com/redhat/centos-stream/%(repo)s branchre = .+\d$|.+\d-.+|master$ kojiprofile = stream-koji build_client = stream-koji