Skip to content

Commit

Permalink
[api] fix branching of packages with local links containing a dot in …
Browse files Browse the repository at this point in the history
…the name (aka glibc.i686 bnc#794347)
  • Loading branch information
adrianschroeter committed Dec 18, 2012
1 parent 3d0b526 commit 9b36071
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions src/api/app/helpers/maintenance_helper.rb
Expand Up @@ -674,7 +674,7 @@ def do_branch params
found = true if ep[:package] == ap
end
unless found
logger.info "found local linked package in project #{p[:package].project.name}, adding it as well #{ap.name}"
logger.info "found local linked package in project #{p[:package].project.name}/#{ap.name}, adding it as well, pointing it to #{p[:package].name} for #{target_package}"
@packages.push({ :base_project => p[:base_project], :link_target_project => p[:link_target_project], :link_target_package => p[:package].name, :package => ap, :target_package => target_package, :local_link => 1 })
end
end
Expand Down Expand Up @@ -852,7 +852,7 @@ def do_branch params
ret.delete_attribute('project') # its a local link, project name not needed
linked_package = p[:link_target_package]
linked_package = params[:target_package] if params[:target_package] and params[:package] == ret.package # user enforce a rename of base package
linked_package += "." + tpkg.name.gsub(/^[^\.]*\./,'') if extend_names
linked_package += "." + p[:link_target_project].name.gsub(':', '_') if extend_names
ret.set_attribute('package', linked_package)
answer = Suse::Backend.put "/source/#{tpkg.project.name}/#{tpkg.name}/_link?user=#{CGI.escape(@http_user.login)}", ret.dump_xml
tpkg.sources_changed
Expand Down
2 changes: 1 addition & 1 deletion src/api/script/start_test_backend
Expand Up @@ -207,7 +207,7 @@ Suse::Backend.put( '/source/BaseDistro2.0/_config', "Type: spec" )
Suse::Backend.post( '/source/BaseDistro2.0/pack2?cmd=commitfilelist&vrev=2.3&version=1.0', '<directory/>') # set vrev like it get created with makeolder=1
Suse::Backend.put( '/source/BaseDistro2.0/pack2/myfile', "DummyContent of BaseDistro2.0/pack2")
Suse::Backend.put( '/source/BaseDistro2.0/pack2/package.spec',File.open("#{Rails.root}/test/fixtures/backend/binary/package.spec").read())
Suse::Backend.put( '/source/BaseDistro2.0/pack2_linked/_link', "<link package=\"pack2\" cicount='copy' />")
Suse::Backend.put( '/source/BaseDistro2.0/pack2.linked/_link', "<link package=\"pack2\" cicount='copy' />")
Suse::Backend.put( '/source/BaseDistro3/_config', "Type: spec" )
Suse::Backend.put( '/source/BaseDistro3/pack2/package.spec',File.open("#{Rails.root}/test/fixtures/backend/binary/package.spec").read())
Suse::Backend.put( '/source/BaseDistro:Update/pack2/_link', "<link project=\"BaseDistro\" package=\"pack2\" />")
Expand Down
2 changes: 1 addition & 1 deletion src/api/test/fixtures/packages.yml
Expand Up @@ -88,7 +88,7 @@ packages_10099:
packages_10100:
id: 10100
db_project_id: 2045
name: pack2_linked
name: pack2.linked
title: For maintenance tests
description: ''
created_at: 2007-05-16 16:19:18.000000000 Z
Expand Down
2 changes: 1 addition & 1 deletion src/api/test/functional/interconnect_test.rb
Expand Up @@ -156,7 +156,7 @@ def test_read_and_command_tests
get "/source/RemoteInstance:BaseDistro2.0:LinkedUpdateProject?expand=1"
assert_response :success
assert_xml_tag( :tag => "entry", :attributes => { :name => "pack2", :originproject => "RemoteInstance:BaseDistro2.0" } )
assert_xml_tag( :tag => "entry", :attributes => { :name => "pack2_linked", :originproject => "RemoteInstance:BaseDistro2.0" } )
assert_xml_tag( :tag => "entry", :attributes => { :name => "pack2.linked", :originproject => "RemoteInstance:BaseDistro2.0" } )
# test binary operations
prepare_request_with_user "king", "sunflower"
post "/build/RemoteInstance:BaseDistro", :cmd => "wipe", :package => "pack1"
Expand Down
28 changes: 14 additions & 14 deletions src/api/test/functional/maintenance_test.rb
Expand Up @@ -359,7 +359,7 @@ def test_mbranch_and_maintenance_per_package_request
</options>
</action>
<action type="maintenance_incident">
<source project="home:tom:branches:OBS_Maintained:pack2" package="pack2_linked.BaseDistro2.0_LinkedUpdateProject" />
<source project="home:tom:branches:OBS_Maintained:pack2" package="pack2.linked.BaseDistro2.0_LinkedUpdateProject" />
<options>
<sourceupdate>cleanup</sourceupdate>
</options>
Expand Down Expand Up @@ -496,7 +496,7 @@ def test_mbranch_and_maintenance_entire_project_request
get "/source/home:tom:branches:OBS_Maintained:pack2/pack2.BaseDistro3/_link"
assert_response :success
assert_xml_tag :tag => "link", :attributes => { :project => "BaseDistro3", :package => "pack2" }
get "/source/home:tom:branches:OBS_Maintained:pack2/pack2_linked.BaseDistro2.0_LinkedUpdateProject/_link"
get "/source/home:tom:branches:OBS_Maintained:pack2/pack2.linked.BaseDistro2.0_LinkedUpdateProject/_link"
assert_response :success
assert_no_xml_tag :tag => "link", :attributes => { :project => "BaseDistro2.0" }
assert_xml_tag :tag => "link", :attributes => { :package => "pack2.BaseDistro2.0_LinkedUpdateProject" }
Expand Down Expand Up @@ -756,15 +756,15 @@ def test_manual_branch_with_extend_names
get "/source/home:tom:branches:BaseDistro2.0:LinkedUpdateProject"
assert_response :success
assert_xml_tag( :tag => "entry", :attributes => { :name => "DUMMY_package.BaseDistro2.0_LinkedUpdateProject" })
assert_xml_tag( :tag => "entry", :attributes => { :name => "pack2_linked.BaseDistro2.0_LinkedUpdateProject" })
assert_xml_tag( :tag => "entry", :attributes => { :name => "pack2.linked.BaseDistro2.0_LinkedUpdateProject" })

# check link of branched package
get "/source/home:tom:branches:BaseDistro2.0:LinkedUpdateProject/DUMMY_package.BaseDistro2.0_LinkedUpdateProject/_link"
assert_response :success
assert_xml_tag( :tag => "link", :attributes => { :project => "BaseDistro2.0:LinkedUpdateProject", :package => "pack2" })

# check link of local linked package
get "/source/home:tom:branches:BaseDistro2.0:LinkedUpdateProject/pack2_linked.BaseDistro2.0_LinkedUpdateProject/_link"
get "/source/home:tom:branches:BaseDistro2.0:LinkedUpdateProject/pack2.linked.BaseDistro2.0_LinkedUpdateProject/_link"
assert_response :success
assert_xml_tag( :tag => "link", :attributes => { :project => nil })
assert_xml_tag( :tag => "link", :attributes => { :package => "DUMMY_package.BaseDistro2.0_LinkedUpdateProject" })
Expand Down Expand Up @@ -828,7 +828,7 @@ def test_create_maintenance_project_and_release_packages
assert_response :success
assert_xml_tag( :tag => "directory", :attributes => { :count => "3" } )
assert_xml_tag( :tag => "entry", :attributes => { :name => "pack2.BaseDistro2.0_LinkedUpdateProject" } )
assert_xml_tag( :tag => "entry", :attributes => { :name => "pack2_linked.BaseDistro2.0_LinkedUpdateProject" } )
assert_xml_tag( :tag => "entry", :attributes => { :name => "pack2.linked.BaseDistro2.0_LinkedUpdateProject" } )
assert_xml_tag( :tag => "entry", :attributes => { :name => "pack2.BaseDistro3" } )
get "/source/"+incidentProject+"/_meta"
assert_response :success
Expand All @@ -843,7 +843,7 @@ def test_create_maintenance_project_and_release_packages
get "/source/"+incidentProject+"/pack2.BaseDistro2.0_LinkedUpdateProject/_meta"
assert_response :success
assert_xml_tag( :parent => { :tag => "build" }, :tag => "enable", :attributes => { :repository => "BaseDistro2.0_LinkedUpdateProject"} )
get "/source/"+incidentProject+"/pack2_linked.BaseDistro2.0_LinkedUpdateProject/_meta"
get "/source/"+incidentProject+"/pack2.linked.BaseDistro2.0_LinkedUpdateProject/_meta"
assert_response :success
assert_xml_tag( :parent => { :tag => "build" }, :tag => "enable", :attributes => { :repository => "BaseDistro2.0_LinkedUpdateProject"} )
get "/source/"+incidentProject+"/pack2.BaseDistro3/_meta"
Expand Down Expand Up @@ -966,7 +966,7 @@ def test_create_maintenance_project_and_release_packages
assert_xml_tag :parent => { :tag => "result", :attributes => { :repository=>"BaseDistro2.0_LinkedUpdateProject", :arch=>"i586"} },
:tag => "status", :attributes => { :package=>"pack2.BaseDistro3", :code=>"disabled" }
assert_xml_tag :parent => { :tag => "result", :attributes => { :repository=>"BaseDistro2.0_LinkedUpdateProject", :arch=>"i586"} },
:tag => "status", :attributes => { :package=>"pack2_linked.BaseDistro2.0_LinkedUpdateProject", :code=>"scheduled" }
:tag => "status", :attributes => { :package=>"pack2.linked.BaseDistro2.0_LinkedUpdateProject", :code=>"scheduled" }
assert_xml_tag :parent => { :tag => "result", :attributes => { :repository=>"BaseDistro2.0_LinkedUpdateProject", :arch=>"i586"} },
:tag => "status", :attributes => { :package=>"packNew.BaseDistro2.0_LinkedUpdateProject", :code=>"scheduled" }
assert_xml_tag :parent => { :tag => "result", :attributes => { :repository=>"BaseDistro2.0_LinkedUpdateProject", :arch=>"i586"} },
Expand All @@ -992,8 +992,8 @@ def test_create_maintenance_project_and_release_packages
# upload build result as a worker would do
inject_build_job( incidentProject, "pack2.BaseDistro2.0_LinkedUpdateProject", "BaseDistro2.0_LinkedUpdateProject", "x86_64" )
inject_build_job( incidentProject, "pack2.BaseDistro2.0_LinkedUpdateProject", "BaseDistro2.0_LinkedUpdateProject", "i586" )
inject_build_job( incidentProject, "pack2_linked.BaseDistro2.0_LinkedUpdateProject", "BaseDistro2.0_LinkedUpdateProject", "x86_64" )
inject_build_job( incidentProject, "pack2_linked.BaseDistro2.0_LinkedUpdateProject", "BaseDistro2.0_LinkedUpdateProject", "i586" )
inject_build_job( incidentProject, "pack2.linked.BaseDistro2.0_LinkedUpdateProject", "BaseDistro2.0_LinkedUpdateProject", "x86_64" )
inject_build_job( incidentProject, "pack2.linked.BaseDistro2.0_LinkedUpdateProject", "BaseDistro2.0_LinkedUpdateProject", "i586" )
inject_build_job( incidentProject, "packNew.BaseDistro2.0_LinkedUpdateProject", "BaseDistro2.0_LinkedUpdateProject", "x86_64" )
inject_build_job( incidentProject, "packNew.BaseDistro2.0_LinkedUpdateProject", "BaseDistro2.0_LinkedUpdateProject", "i586" )
inject_build_job( incidentProject, "pack2.BaseDistro3", "BaseDistro3", "i586" )
Expand Down Expand Up @@ -1065,7 +1065,7 @@ def test_create_maintenance_project_and_release_packages
assert_no_xml_tag( :tag => "target", :attributes => { :project => "BaseDistro3", :package => "pack2" } )
assert_no_xml_tag( :tag => "target", :attributes => { :project => incidentProject } )
assert_xml_tag( :tag => "target", :attributes => { :project => "BaseDistro2.0:LinkedUpdateProject", :package => "pack2." + incidentID } )
assert_xml_tag( :tag => "target", :attributes => { :project => "BaseDistro2.0:LinkedUpdateProject", :package => "pack2_linked." + incidentID } )
assert_xml_tag( :tag => "target", :attributes => { :project => "BaseDistro2.0:LinkedUpdateProject", :package => "pack2.linked." + incidentID } )
assert_xml_tag( :tag => "target", :attributes => { :project => "BaseDistro2.0:LinkedUpdateProject", :package => "packNew." + incidentID } )
assert_xml_tag( :tag => "target", :attributes => { :project => "BaseDistro2.0:LinkedUpdateProject", :package => "patchinfo." + incidentID } )
assert_xml_tag( :tag => "target", :attributes => { :project => "BaseDistro3", :package => "pack2." + incidentID } )
Expand Down Expand Up @@ -1160,7 +1160,7 @@ def test_create_maintenance_project_and_release_packages
assert_xml_tag( :tag => "directory", :attributes => { :vrev => "2.10" } )
get "/source/BaseDistro2.0:LinkedUpdateProject/pack2.#{incidentID}/_link"
assert_response 404
get "/source/BaseDistro2.0:LinkedUpdateProject/pack2_linked.#{incidentID}/_link"
get "/source/BaseDistro2.0:LinkedUpdateProject/pack2.linked.#{incidentID}/_link"
assert_response :success
assert_xml_tag :tag => "link", :attributes => { :project => nil, :package => "pack2.#{incidentID}", :cicount => "copy" }
get "/source/BaseDistro2.0:LinkedUpdateProject/patchinfo"
Expand Down Expand Up @@ -1245,7 +1245,7 @@ def test_create_maintenance_project_and_release_packages
get "/source/home:king:branches:BaseDistro2.0:LinkedUpdateProject/pack2/_link"
assert_response :success
assert_xml_tag :tag => 'link', :attributes => { :project => "BaseDistro2.0:LinkedUpdateProject", :package => nil }
get "/source/home:king:branches:BaseDistro2.0:LinkedUpdateProject/pack2_linked/_link"
get "/source/home:king:branches:BaseDistro2.0:LinkedUpdateProject/pack2.linked/_link"
assert_response :success
assert_xml_tag :tag => 'link', :attributes => { :project => nil, :package => "pack2" }
delete "/source/home:king:branches:BaseDistro2.0:LinkedUpdateProject"
Expand All @@ -1254,15 +1254,15 @@ def test_create_maintenance_project_and_release_packages
# revoke a release update
delete "/source/BaseDistro2.0:LinkedUpdateProject/pack2"
assert_response :success
delete "/source/BaseDistro2.0:LinkedUpdateProject/pack2_linked"
delete "/source/BaseDistro2.0:LinkedUpdateProject/pack2.linked"
assert_response :success
delete "/source/BaseDistro2.0:LinkedUpdateProject/packNew"
assert_response :success
delete "/source/BaseDistro2.0:LinkedUpdateProject/packNew.0"
assert_response :success
delete "/source/BaseDistro2.0:LinkedUpdateProject/pack2.0"
assert_response :success
delete "/source/BaseDistro2.0:LinkedUpdateProject/pack2_linked.0"
delete "/source/BaseDistro2.0:LinkedUpdateProject/pack2.linked.0"
assert_response :success
delete "/source/BaseDistro2.0:LinkedUpdateProject/patchinfo.0"
assert_response :success
Expand Down
6 changes: 3 additions & 3 deletions src/api/test/functional/search_controller_test.rb
Expand Up @@ -223,15 +223,15 @@ def test_osc_search_devel_package_after_request_accept

def test_search_request
prepare_request_with_user "Iggy", "asdfasdf"
get "/search/request", match: "(action/target/@package='pack2' and action/target/@project='BaseDistro2.0' and action/source/@project='BaseDistro2.0' and action/source/@package='pack2_linked' and action/@type='submit')"
get "/search/request", match: "(action/target/@package='pack2' and action/target/@project='BaseDistro2.0' and action/source/@project='BaseDistro2.0' and action/source/@package='pack2.linked' and action/@type='submit')"
assert_response :success

# what osc may do
get "search/request", match: "(state/@name='new' or state/@name='review') and (action/target/@project='BaseDistro2.0' or submit/target/@project='BaseDistro2.0' or action/source/@project='BaseDistro2.0' or submit/source/@project='BaseDistro2.0') and (action/target/@package='pack2_linked' or submit/target/@package='pack2_linked' or action/source/@package='pack2_linked' or submit/source/@package='pack2_linked')"
get "search/request", match: "(state/@name='new' or state/@name='review') and (action/target/@project='BaseDistro2.0' or submit/target/@project='BaseDistro2.0' or action/source/@project='BaseDistro2.0' or submit/source/@project='BaseDistro2.0') and (action/target/@package='pack2.linked' or submit/target/@package='pack2_linked' or action/source/@package='pack2_linked' or submit/source/@package='pack2_linked')"
assert_response :success

# what osc really is doing
get "search/request", match: "(state/@name='new' or state/@name='review') and (target/@project='BaseDistro2.0' or source/@project='BaseDistro2.0') and (target/@package='pack2_linked' or source/@package='pack2_linked')"
get "search/request", match: "(state/@name='new' or state/@name='review') and (target/@project='BaseDistro2.0' or source/@project='BaseDistro2.0') and (target/@package='pack2.linked' or source/@package='pack2_linked')"
assert_response :success

# maintenance team is doing this query
Expand Down
4 changes: 2 additions & 2 deletions src/api/test/functional/source_controller_test.rb
Expand Up @@ -1754,7 +1754,7 @@ def test_linked_project_operations
assert_response :success
assert_xml_tag( :tag => "directory", :attributes => { :count => "2" } )
assert_xml_tag( :tag => "entry", :attributes => { :name => "pack2", :originproject => "BaseDistro2.0" } )
assert_xml_tag( :tag => "entry", :attributes => { :name => "pack2_linked", :originproject => "BaseDistro2.0" } )
assert_xml_tag( :tag => "entry", :attributes => { :name => "pack2.linked", :originproject => "BaseDistro2.0" } )

# pack2 exists only via linked project
get "/source/BaseDistro2.0:LinkedUpdateProject/pack2"
Expand Down Expand Up @@ -1787,7 +1787,7 @@ def test_linked_project_operations
assert_response :success
post "/source/BaseDistro2.0:LinkedUpdateProject/pack2", :cmd => "branch"
assert_response :success
post "/source/BaseDistro2.0:LinkedUpdateProject/pack2_linked", :cmd => "linkdiff"
post "/source/BaseDistro2.0:LinkedUpdateProject/pack2.linked", :cmd => "linkdiff"
assert_response :success

# read-write user, binary operations must be allowed
Expand Down

1 comment on commit 9b36071

@coolo
Copy link
Member

@coolo coolo commented on 9b36071 Dec 19, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why didn't you fix the webui test suite after removing a packag from fixtures? ;(

Please sign in to comment.