Skip to content

Commit 56b8aa6

Browse files
Fix revision'd checkout of scmsync package
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.
1 parent 1fc5813 commit 56b8aa6

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

osc/core.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3156,8 +3156,25 @@ def checkout_package(
31563156
raise oscerr.OscIOError(None, 'Install the obs-scm-bridge package to work on packages managed in scm (git)!')
31573157
scm_url = scmsync_element.text
31583158
directory = make_dir(apiurl, project, package, pathname, prj_dir, conf.config['do_package_tracking'], outdir)
3159+
3160+
if revision is not None:
3161+
# search for the git sha sum based on the OBS DISTURL package source revision
3162+
# we need also take into account that the url was different at that point of time
3163+
url = shasum = None
3164+
u = makeurl(apiurl, ['source', project, package, '_scmsync.obsinfo'], {'rev': revision})
3165+
f = http_GET(u)
3166+
for line in f.readlines():
3167+
if line.startswith(b"revision: "):
3168+
shasum = line[10:].rstrip()
3169+
if line.startswith(b"url: "):
3170+
url = line[5:].rstrip()
3171+
if shasum is None:
3172+
raise oscerr.OscIOError(None, 'Unable to find git shasum for given revision')
3173+
scm_url = url + b'#' + shasum
3174+
31593175
os.putenv("OSC_VERSION", get_osc_version())
31603176
run_external(['/usr/lib/obs/service/obs_scm_bridge', '--outdir', directory, '--url', scm_url])
3177+
31613178
Package.init_package(apiurl, project, package, directory, size_limit, meta, progress_obj, scm_url)
31623179

31633180
# add package to <prj>/.obs/_packages

0 commit comments

Comments
 (0)