Skip to content

Commit

Permalink
Fix revision'd checkout of scmsync package
Browse files Browse the repository at this point in the history
When specifing a revision to a checkout we need to transfer the
information to the bridge to do the right checkout. We also need
to take the former git url in case it has changed meanwhile.
  • Loading branch information
adrianschroeter committed Oct 4, 2024
1 parent 1fc5813 commit 56b8aa6
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions osc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3156,8 +3156,25 @@ def checkout_package(
raise oscerr.OscIOError(None, 'Install the obs-scm-bridge package to work on packages managed in scm (git)!')
scm_url = scmsync_element.text
directory = make_dir(apiurl, project, package, pathname, prj_dir, conf.config['do_package_tracking'], outdir)

if revision is not None:
# search for the git sha sum based on the OBS DISTURL package source revision
# we need also take into account that the url was different at that point of time
url = shasum = None
u = makeurl(apiurl, ['source', project, package, '_scmsync.obsinfo'], {'rev': revision})
f = http_GET(u)
for line in f.readlines():
if line.startswith(b"revision: "):
shasum = line[10:].rstrip()
if line.startswith(b"url: "):
url = line[5:].rstrip()
if shasum is None:
raise oscerr.OscIOError(None, 'Unable to find git shasum for given revision')
scm_url = url + b'#' + shasum

os.putenv("OSC_VERSION", get_osc_version())
run_external(['/usr/lib/obs/service/obs_scm_bridge', '--outdir', directory, '--url', scm_url])

Package.init_package(apiurl, project, package, directory, size_limit, meta, progress_obj, scm_url)

# add package to <prj>/.obs/_packages
Expand Down

0 comments on commit 56b8aa6

Please sign in to comment.