Skip to content

Commit b51c41e

Browse files
watologo1Thomas Renninger
authored andcommitted
Allow repository name change via git scm basename paramter
Example: https://github.com/DMTF/Redfishtool.git vs network:utilities/redfishtool In mainline project the first letter 'R' is uppercase, but in OBS it's lowercase. Adding basename= parameter in _service file with this patch like: <param name="revision">main</param> <param name="versionformat">@PARENT_TAG@.@[email protected]%h</param> <param name="changesgenerate">enable</param> - </service> + <param name="basename">redfishtool</param> + </service> <service name="set_version" mode="localonly"/> <service name="tar" mode="buildtime"> </service> results in: redfishtool redfishtool-1.1.7.1.gfaa99dc.obscpio redfishtool-1.1.7.1.gfaa99dc.tar.xz redfishtool.obsinfo instead of (without basename param): Redfishtool Redfishtool-1.1.7.1.gfaa99dc.obscpio Redfishtool-1.1.7.1.gfaa99dc.tar.xz Redfishtool.obsinfo With this patch it is possible to adopt or rename any arbitrary git project name to its matching OBS project name and process it via OBS services.
1 parent e7c0883 commit b51c41e

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

TarSCM/cli.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def __init__(self):
5858
self.user = None
5959
self.keyring_passphrase = None
6060
self.changesgenerate = False
61+
self.basename = None
6162

6263
def parse_args(self, options):
6364
parser = argparse.ArgumentParser(description='Git Tarballs')
@@ -194,6 +195,12 @@ def parse_args(self, options):
194195
'(only used with \'--latest-signed-*\')')
195196
parser.add_argument('--without-version', default = False,
196197
help='Do not add version to output file.')
198+
parser.add_argument('--basename', default = None,
199+
help='Checkout/rename and further process '
200+
'repository as <BASENAME> (requires git scm).'
201+
'Make sure there are no leftovers '
202+
'(workrepo, obsinfo or obscpio) files from'
203+
'a previous run')
197204

198205
self.verify_args(parser.parse_args(options))
199206

TarSCM/scm/base.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __init__(self, args, task):
3939
self.repocachedir = None
4040
self.clone_dir = None
4141
self.lock_file = None
42-
self.basename = None
42+
self.basename = args.basename
4343
self.repodir = None
4444
self.user = None
4545
self.password = None
@@ -288,8 +288,9 @@ def _calc_dir_to_clone_to(self, prefix):
288288
# special handling for cloning bare repositories (../repo/.git/)
289289
url_path = url_path.rstrip('/')
290290

291-
self.basename = os.path.basename(os.path.normpath(url_path))
292-
self.basename = prefix + self.basename
291+
if not self.basename:
292+
self.basename = os.path.basename(os.path.normpath(url_path))
293+
self.basename = prefix + self.basename
293294

294295
osc_version = 0
295296

0 commit comments

Comments
 (0)