Skip to content

Commit

Permalink
Merge pull request #11849 from adrianschroeter/channel_rev_fix
Browse files Browse the repository at this point in the history
[api] fix source revisions for channel submissions in maintenance_rel…
  • Loading branch information
hennevogel committed Mar 4, 2022
2 parents 4842f9f + ccfdcf1 commit f8d2043
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/api/.rubocop_todo.yml
Expand Up @@ -131,7 +131,7 @@ Lint/UselessMethodDefinition:
# Offense count: 832
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 235
Max: 241

# Offense count: 17
# Configuration parameters: CountBlocks, Max.
Expand Down
8 changes: 6 additions & 2 deletions src/api/app/models/bs_request_action.rb
Expand Up @@ -430,7 +430,6 @@ def create_expand_package(packages, opts = {})
# FIXME: this is currently handling local project links for packages with multiple spec files.
# This can be removed when we handle this as shadow packages in the backend.
tpkg = ltpkg = pkg.name
rev = source_rev
data = nil
missing_ok_link = false
suffix = ''
Expand Down Expand Up @@ -552,10 +551,15 @@ def create_expand_package(packages, opts = {})
new_action.target_project = tprj.name
new_action.target_package = tpkg + incident_suffix
end
new_action.source_rev = rev if rev
if is_maintenance_release? || is_release?
if pkg.is_channel?

if new_action.source_rev.blank?
# set revision
dir = Xmlhash.parse(Backend::Api::Sources::Package.files(new_action.source_project, new_action.source_package, { expand: 1 }))
new_action.source_rev = dir['srcmd5']
end

# create submit request for possible changes in the _channel file
submit_action = create_submit_action(source_package: new_action.source_package, source_project: new_action.source_project,
target_package: tpkg, target_project: tprj.name, source_rev: new_action.source_rev)
Expand Down
2 changes: 1 addition & 1 deletion src/api/test/functional/channel_maintenance_test.rb
Expand Up @@ -645,7 +645,7 @@ def test_large_channel_test
assert_no_xml_tag tag: 'source', attributes: { project: 'My:Maintenance:0', package: 'BaseDistro3.Channel' },
parent: { tag: 'action', attributes: { type: 'maintenance_release' } }
# but it has a source change, so submit action
assert_xml_tag tag: 'source', attributes: { project: 'My:Maintenance:0', package: 'BaseDistro3.Channel' },
assert_xml_tag tag: 'source', attributes: { project: 'My:Maintenance:0', package: 'BaseDistro3.Channel', rev: 'b8629db76e8cfb1346acf3be7501b25c' },
parent: { tag: 'action', attributes: { type: 'submit' } }
# no release patchinfo into channel
assert_no_xml_tag tag: 'target', attributes: { project: 'Channel', package: 'patchinfo.0' },
Expand Down
2 changes: 0 additions & 2 deletions src/api/test/functional/maintenance_test.rb
Expand Up @@ -1411,12 +1411,10 @@ def test_create_maintenance_project_and_release_packages
assert_xml_tag(parent: { tag: 'state' }, tag: 'comment', content: 'All reviewers accepted request')

get '/search/request', params: { match: 'review/@when>="2010-07-12"' }
print @response.body
assert_response :success
assert_xml_tag tag: 'request', attributes: { id: reqid }

get '/search/request', params: { match: 'review/history/@when>="1975-07-12"' }
print @response.body
assert_response :success
assert_xml_tag tag: 'request', attributes: { id: reqid }

Expand Down

0 comments on commit f8d2043

Please sign in to comment.