From c4c2d2a9330239139ae2e609885a9df574e83cfd Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Fri, 8 Apr 2022 17:38:51 +0200 Subject: [PATCH] Add project_separator to config file This allows for arbitrary string to be used as a project separator instead of restricting oneself to : or directory structure. Fixes: #1024 --- osc/commandline.py | 2 ++ osc/conf.py | 5 +++++ osc/core.py | 2 ++ 3 files changed, 9 insertions(+) diff --git a/osc/commandline.py b/osc/commandline.py index c1cd2061..548a9c85 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -4704,6 +4704,8 @@ Please submit there instead, or use --nodevelproject to force direct submission. prj_dir = opts.output_dir if opts.output_dir else project if not opts.output_dir and conf.config['checkout_no_colon']: prj_dir = prj_dir.replace(':', '/') + else: + prj_dir = prj_dir.replace(':', conf.config['project_separator']) if os.path.exists(prj_dir): sys.exit('osc: project directory \'%s\' already exists' % prj_dir) diff --git a/osc/conf.py b/osc/conf.py index c6fba94c..74607951 100644 --- a/osc/conf.py +++ b/osc/conf.py @@ -168,6 +168,8 @@ DEFAULTS = {'apiurl': 'https://api.opensuse.org', 'getpac_default_project': 'openSUSE:Factory', # alternate filesystem layout: have multiple subdirs, where colons were. 'checkout_no_colon': '0', + # project separator + 'project_separator': ':', # change filesystem layout: avoid checkout from within a proj or package dir. 'checkout_rooted': '0', # local files to ignore with status, addremove, .... @@ -338,6 +340,9 @@ apiurl = %(apiurl)s # alternate filesystem layout: have multiple subdirs, where colons were. #checkout_no_colon = %(checkout_no_colon)s +# instead of colons, use the specified as separator +#project_separator = %(project_separator)s + # change filesystem layout: avoid checkout within a project or package dir. #checkout_rooted = %(checkout_rooted)s diff --git a/osc/core.py b/osc/core.py index ef149854..b849693d 100644 --- a/osc/core.py +++ b/osc/core.py @@ -5136,6 +5136,8 @@ def checkout_package(apiurl, project, package, prj_dir = olddir elif conf.config['checkout_no_colon']: prj_dir = prj_dir.replace(':', '/') + else: + prj_dir = prj_dir.replace(':', conf.config['project_separator']) root_dots = '.' if conf.config['checkout_rooted']: