mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-26 22:56:15 +01:00
Merge pull request #1552 from dmach/boo#1221340-spec-include
Improve 'build' and 'buildinfo' commands by injecting *.inc files into spec that is sent to OBS for parsing BuildRequires (boo#1221340)
This commit is contained in:
commit
4e4f3cb093
12
behave/features/buildinfo.feature
Normal file
12
behave/features/buildinfo.feature
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
Feature: `osc buildinfo` command
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Run `osc buildinfo` on a package with a .inc file
|
||||||
|
Given I set working directory to "{context.osc.temp}"
|
||||||
|
And I execute osc with args "co test:factory/test-pkgA"
|
||||||
|
And I set working directory to "{context.osc.temp}/test:factory/test-pkgA"
|
||||||
|
And I copy file "{context.fixtures}/pac/test-pkgA-3-inc.spec" to "{context.osc.temp}/test:factory/test-pkgA/test-pkgA.spec"
|
||||||
|
And I copy file "{context.fixtures}/pac/test-pkgA-3-inc.inc" to "{context.osc.temp}/test:factory/test-pkgA/test-pkgA.inc"
|
||||||
|
When I execute osc with args "buildinfo"
|
||||||
|
Then the exit code is 0
|
||||||
|
And stdout contains "<error>unresolvable: nothing provides DOES-NOT-EXIST</error>"
|
1
behave/fixtures/pac/test-pkgA-3-inc.inc
Normal file
1
behave/fixtures/pac/test-pkgA-3-inc.inc
Normal file
@ -0,0 +1 @@
|
|||||||
|
BuildRequires: DOES-NOT-EXIST
|
27
behave/fixtures/pac/test-pkgA-3-inc.spec
Normal file
27
behave/fixtures/pac/test-pkgA-3-inc.spec
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
%include test-pkgA.inc
|
||||||
|
|
||||||
|
Name: test-pkgA
|
||||||
|
Version: 4
|
||||||
|
Release: 1
|
||||||
|
License: GPL-2.0
|
||||||
|
Summary: Test package
|
||||||
|
URL: https://example.com/test-package/
|
||||||
|
|
||||||
|
|
||||||
|
BuildArch: noarch
|
||||||
|
|
||||||
|
|
||||||
|
%description
|
||||||
|
desc
|
||||||
|
|
||||||
|
|
||||||
|
%prep
|
||||||
|
|
||||||
|
|
||||||
|
%install
|
||||||
|
|
||||||
|
|
||||||
|
%files
|
||||||
|
|
||||||
|
|
||||||
|
%changelog
|
@ -708,6 +708,13 @@ def create_build_descr_data(
|
|||||||
# build recipe must go first for compatibility with the older OBS versions
|
# build recipe must go first for compatibility with the older OBS versions
|
||||||
result_data.append((os.path.basename(build_descr_path).encode("utf-8"), build_descr_data))
|
result_data.append((os.path.basename(build_descr_path).encode("utf-8"), build_descr_data))
|
||||||
|
|
||||||
|
if topdir:
|
||||||
|
for include_file in glob.glob(os.path.join(topdir, "*.inc")):
|
||||||
|
fn = os.path.basename(include_file)
|
||||||
|
print(f"Using local file: {fn}", file=sys.stderr)
|
||||||
|
with open(include_file, "rb") as f:
|
||||||
|
result_data.append((fn.encode("utf-8"), f.read()))
|
||||||
|
|
||||||
if topdir:
|
if topdir:
|
||||||
buildenv_file = os.path.join(topdir, f"_buildenv.{repo}.{arch}")
|
buildenv_file = os.path.join(topdir, f"_buildenv.{repo}.{arch}")
|
||||||
if not os.path.isfile(buildenv_file):
|
if not os.path.isfile(buildenv_file):
|
||||||
|
Loading…
Reference in New Issue
Block a user