Skip to content

Commit

Permalink
Merge pull request #1592 from dmach/fix-linkpac-disable-build-publish
Browse files Browse the repository at this point in the history
Fix 'linkpac' command crash when used with '--disable-build' or '--disable-publish' option
  • Loading branch information
dmach authored Jul 1, 2024
2 parents 8f63422 + 7cd9635 commit 3a02c86
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
28 changes: 28 additions & 0 deletions behave/features/linkpac.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,34 @@ Background:
Given I set working directory to "{context.osc.temp}"


@destructive
Scenario: Run `osc linkpac`
When I execute osc with args "linkpac test:factory/test-pkgA home:Admin"
Then the exit code is 0
And I execute osc with args "api /source/home:Admin/test-pkgA/_link"
And stdout contains "<link project=\"test:factory\" package=\"test-pkgA\">"


@destructive
Scenario: Run `osc linkpac --disable-build`
When I execute osc with args "linkpac test:factory/test-pkgA home:Admin --disable-build"
Then the exit code is 0
And I execute osc with args "api /source/home:Admin/test-pkgA/_link"
And stdout contains "<link project=\"test:factory\" package=\"test-pkgA\">"
And I execute osc with args "api /source/home:Admin/test-pkgA/_meta"
And stdout contains "<build>\s*<disable/>\s*</build>"


@destructive
Scenario: Run `osc linkpac --disable-publish`
When I execute osc with args "linkpac test:factory/test-pkgA home:Admin --disable-publish"
Then the exit code is 0
And I execute osc with args "api /source/home:Admin/test-pkgA/_link"
And stdout contains "<link project=\"test:factory\" package=\"test-pkgA\">"
And I execute osc with args "api /source/home:Admin/test-pkgA/_meta"
And stdout contains "<publish>\s*<disable/>\s*</publish>"


@destructive
Scenario: Run `osc linkpac on a locked package`
Given I execute osc with args "lock test:factory/test-pkgA"
Expand Down
2 changes: 1 addition & 1 deletion osc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3294,7 +3294,7 @@ def link_pac(

if disable_build or disable_publish:
meta_change = True
root = ET.fromstring(b"".join(dst_meta))
root = ET.fromstring("".join(dst_meta))

if disable_build:
elm = root.find('build')
Expand Down

0 comments on commit 3a02c86

Please sign in to comment.