mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-22 18:22:12 +01:00
Move running obs_scm_bridge into run_obs_scm_bridge() function
This commit is contained in:
parent
0765997028
commit
6d91083413
@ -5387,7 +5387,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
from .core import parseRevisionOption
|
from .core import parseRevisionOption
|
||||||
from .core import print_request_list
|
from .core import print_request_list
|
||||||
from .core import revision_is_empty
|
from .core import revision_is_empty
|
||||||
from .core import run_external
|
from .core import run_obs_scm_bridge
|
||||||
from .core import show_files_meta
|
from .core import show_files_meta
|
||||||
from .core import show_project_meta
|
from .core import show_project_meta
|
||||||
from .core import show_scmsync
|
from .core import show_scmsync
|
||||||
@ -5506,10 +5506,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
scm_url = show_scmsync(apiurl, project)
|
scm_url = show_scmsync(apiurl, project)
|
||||||
if scm_url is not None and not opts.native_obs_package:
|
if scm_url is not None and not opts.native_obs_package:
|
||||||
if not os.path.isfile('/usr/lib/obs/service/obs_scm_bridge'):
|
run_obs_scm_bridge(url=scm_url, target_dir=str(prj_dir))
|
||||||
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())
|
|
||||||
run_external(['/usr/lib/obs/service/obs_scm_bridge', '--outdir', str(prj_dir), '--url', scm_url])
|
|
||||||
|
|
||||||
Project.init_project(apiurl, prj_dir, project, conf.config['do_package_tracking'], scm_url=scm_url)
|
Project.init_project(apiurl, prj_dir, project, conf.config['do_package_tracking'], scm_url=scm_url)
|
||||||
print(statfrmt('A', prj_dir))
|
print(statfrmt('A', prj_dir))
|
||||||
|
12
osc/conf.py
12
osc/conf.py
@ -1308,6 +1308,18 @@ class Options(OscOptions):
|
|||||||
ini_key="download-assets-cmd",
|
ini_key="download-assets-cmd",
|
||||||
) # type: ignore[assignment]
|
) # type: ignore[assignment]
|
||||||
|
|
||||||
|
obs_scm_bridge_cmd: str = Field(
|
||||||
|
default=
|
||||||
|
shutil.which("obs_scm_bridge", path="/usr/lib/obs/service")
|
||||||
|
or "/usr/lib/obs/service/obs_scm_bridge",
|
||||||
|
description=textwrap.dedent(
|
||||||
|
"""
|
||||||
|
Path to the 'obs_scm_bridge' tool used for cloning scmsync projects and packages.
|
||||||
|
"""
|
||||||
|
),
|
||||||
|
ini_key="obs-scm-bridge-cmd",
|
||||||
|
) # type: ignore[assignment]
|
||||||
|
|
||||||
vc_cmd: str = Field(
|
vc_cmd: str = Field(
|
||||||
default=shutil.which("vc", path="/usr/lib/build:/usr/lib/obs-build") or "/usr/lib/build/vc",
|
default=shutil.which("vc", path="/usr/lib/build:/usr/lib/obs-build") or "/usr/lib/build/vc",
|
||||||
description=textwrap.dedent(
|
description=textwrap.dedent(
|
||||||
|
15
osc/core.py
15
osc/core.py
@ -3080,6 +3080,14 @@ def make_dir(
|
|||||||
return pkg_path
|
return pkg_path
|
||||||
|
|
||||||
|
|
||||||
|
def run_obs_scm_bridge(url: str, target_dir: str):
|
||||||
|
if not os.path.isfile(conf.config.obs_scm_bridge_cmd):
|
||||||
|
raise oscerr.OscIOError(None, "Install the obs-scm-bridge package to work on packages managed in scm (git)!")
|
||||||
|
env = os.environ.copy()
|
||||||
|
env["OSC_VERSION"] = get_osc_version()
|
||||||
|
run_external([conf.config.obs_scm_bridge_cmd, "--outdir", target_dir, "--url", url], env=env)
|
||||||
|
|
||||||
|
|
||||||
def checkout_package(
|
def checkout_package(
|
||||||
apiurl: str,
|
apiurl: str,
|
||||||
project: str,
|
project: str,
|
||||||
@ -3153,9 +3161,6 @@ def checkout_package(
|
|||||||
root = ET.fromstring(meta_data)
|
root = ET.fromstring(meta_data)
|
||||||
scmsync_element = root.find("scmsync")
|
scmsync_element = root.find("scmsync")
|
||||||
if not native_obs_package and 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
|
|
||||||
directory = make_dir(apiurl, project, package, pathname, prj_dir, conf.config['do_package_tracking'], outdir)
|
directory = make_dir(apiurl, project, package, pathname, prj_dir, conf.config['do_package_tracking'], outdir)
|
||||||
|
|
||||||
if revision is not None:
|
if revision is not None:
|
||||||
@ -3165,8 +3170,8 @@ def checkout_package(
|
|||||||
scmsync_obsinfo = ScmsyncObsinfo.from_api(apiurl, project, package, rev=revision)
|
scmsync_obsinfo = ScmsyncObsinfo.from_api(apiurl, project, package, rev=revision)
|
||||||
scm_url = f"{scmsync_obsinfo.url}#{scmsync_obsinfo.revision}"
|
scm_url = f"{scmsync_obsinfo.url}#{scmsync_obsinfo.revision}"
|
||||||
|
|
||||||
os.putenv("OSC_VERSION", get_osc_version())
|
scm_url = scmsync_element.text
|
||||||
run_external(['/usr/lib/obs/service/obs_scm_bridge', '--outdir', directory, '--url', scm_url])
|
run_obs_scm_bridge(url=scm_url, target_dir=directory)
|
||||||
|
|
||||||
Package.init_package(apiurl, project, package, directory, size_limit, meta, progress_obj, scm_url)
|
Package.init_package(apiurl, project, package, directory, size_limit, meta, progress_obj, scm_url)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user