Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkout: allow to checkout obs imported sources of scmsync sources #1624

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -5250,6 +5250,8 @@ def do_browse(self, subcmd, opts, *args):
help='Use server side generated sources instead of local generation.')
@cmdln.option('-l', '--limit-size', metavar='limit_size',
help='Skip all files with a given size')
@cmdln.option('--native-obs-package', action='store_true',
help='Do not clone native scm repositories: Different representation and you will not be able to submit changes!')
Copy link
Member

@dirkmueller dirkmueller Sep 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overindented (should be one space beyond the opening parentheses) and wrapping missing

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but I don't want to become inconsistent with all other options ... let's either change all or none (but I would do it in another commit)

@cmdln.alias('co')
def do_checkout(self, subcmd, opts, *args):
"""
Expand Down Expand Up @@ -5346,7 +5348,7 @@ def do_checkout(self, subcmd, opts, *args):
prj_dir=project_dir, service_files=opts.source_service_files,
server_service_files=opts.server_side_source_service_files,
progress_obj=self.download_progress, size_limit=opts.limit_size,
meta=opts.meta, outdir=opts.output_dir)
meta=opts.meta, outdir=opts.output_dir, native_obs_package=opts.native_obs_package)
if os.isatty(sys.stdout.fileno()):
print_request_list(apiurl, project, package)

Expand All @@ -5361,7 +5363,7 @@ def do_checkout(self, subcmd, opts, *args):
show_project_meta(apiurl, project)

scm_url = show_scmsync(apiurl, project)
if scm_url is not None:
if scm_url is not None and not opts.native_obs_package:
if not os.path.isfile('/usr/lib/obs/service/obs_scm_bridge'):
raise oscerr.OscIOError(None, 'Install the obs-scm-bridge package to work on packages managed in scm (git)!')
os.putenv("OSC_VERSION", get_osc_version())
Expand Down Expand Up @@ -5399,7 +5401,7 @@ def do_checkout(self, subcmd, opts, *args):
prj_dir=prj_dir, service_files=opts.source_service_files,
server_service_files=opts.server_side_source_service_files,
progress_obj=self.download_progress, size_limit=opts.limit_size,
meta=opts.meta)
meta=opts.meta, native_obs_package=opts.native_obs_package)
except oscerr.LinkExpandError as e:
print('Link cannot be expanded:\n', e, file=sys.stderr)
print('Use "osc repairlink" for fixing merge conflicts:\n', file=sys.stderr)
Expand All @@ -5408,7 +5410,7 @@ def do_checkout(self, subcmd, opts, *args):
prj_dir=prj_dir, service_files=opts.source_service_files,
server_service_files=opts.server_side_source_service_files,
progress_obj=self.download_progress, size_limit=opts.limit_size,
meta=opts.meta)
meta=opts.meta, native_obs_package=opts.native_obs_package)
if os.isatty(sys.stdout.fileno()):
print_request_list(apiurl, project)

Expand Down
3 changes: 2 additions & 1 deletion osc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3097,6 +3097,7 @@ def checkout_package(
prj_dir: Path=None,
server_service_files=None,
service_files=None,
native_obs_package=False,
progress_obj=None,
size_limit=None,
meta=False,
Expand Down Expand Up @@ -3157,7 +3158,7 @@ def checkout_package(
meta_data = b''.join(show_package_meta(apiurl, project, package))
root = ET.fromstring(meta_data)
scmsync_element = root.find("scmsync")
if scmsync_element is not None and scmsync_element.text is not None:
if not native_obs_package and scmsync_element is not None and scmsync_element.text is not None:
if not os.path.isfile('/usr/lib/obs/service/obs_scm_bridge'):
raise oscerr.OscIOError(None, 'Install the obs-scm-bridge package to work on packages managed in scm (git)!')
scm_url = scmsync_element.text
Expand Down
Loading