Skip to content

Commit

Permalink
[api] allow to store support status in channels
Browse files Browse the repository at this point in the history
sdfpn
  • Loading branch information
adrianschroeter committed Nov 25, 2013
1 parent de553a3 commit 191aca8
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 5 deletions.
18 changes: 16 additions & 2 deletions docs/api/api/channel.rng
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
<attribute name="repository"/>
</optional>
<optional>
<attribute name="arch"/>
<attribute name="arch">
<ref name="build-arch" />
</attribute>
</optional>
<oneOrMore>
<ref name="channel-binary-element"/>
Expand All @@ -72,7 +74,19 @@
<attribute name="package"/>
</optional>
<optional>
<attribute name="arch"/>
<attribute name="arch">
<ref name="build-arch" />
</attribute>
</optional>
<optional>
<attribute name="supportstatus">
<choice>
<value>l3</value>
<value>l2</value>
<value>acc</value>
<value>unsupported</value>
</choice>
</attribute>
</optional>
<empty/>
</element>
Expand Down
1 change: 1 addition & 0 deletions docs/api/api/channel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
<target project="openSUSE:12.3:Update" repository="standard" />
<binaries project="openSUSE:12.3" repository="standard" arch="i586">
<binary name="glibc-devel" binaryarch="noarch" package="glibc.i686" project="openSUSE:12.3" repository="standard" arch="i586"/>
<binary name="bc" binaryarch="noarch" package="glibc.i686" supportstatus="l3"/>
</binaries>
</channel>
1 change: 1 addition & 0 deletions src/api/app/models/channel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def update_from_xml(xmlhash, check=false)
p.elements('binary') { |b|
binary = cbl.channel_binaries.create( name: b['name'] )
binary.binaryarch = b['binaryarch']
binary.supportstatus = b['supportstatus']
binary.architecture = Architecture.find_by_name( b['arch'] ) if b['arch']
project = b['project']
if project
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/models/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def is_channel?
end

def is_product?
is_of_kind? :channel
is_of_kind? :product
end

def is_of_kind? kind
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddSupportStatusToChannelBinary < ActiveRecord::Migration
def change
add_column :channel_binaries, :supportstatus, :string
end
end
3 changes: 3 additions & 0 deletions src/api/db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ CREATE TABLE `channel_binaries` (
`architecture_id` int(11) DEFAULT NULL,
`package` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`binaryarch` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`supportstatus` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `index_channel_binaries_on_project_id_and_package` (`project_id`,`package`),
KEY `channel_binary_list_id` (`channel_binary_list_id`),
Expand Down Expand Up @@ -1354,6 +1355,8 @@ INSERT INTO schema_migrations (version) VALUES ('20131123113417');

INSERT INTO schema_migrations (version) VALUES ('20131124071042');

INSERT INTO schema_migrations (version) VALUES ('20131125071042');

INSERT INTO schema_migrations (version) VALUES ('21');

INSERT INTO schema_migrations (version) VALUES ('22');
Expand Down
4 changes: 2 additions & 2 deletions src/api/test/functional/maintenance_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -449,15 +449,15 @@ def test_mbranch_and_maintenance_per_package_request
<channel>
<target project="BaseDistro3Channel" repository="channel_repo" />
<binaries project="BaseDistro3" repository="BaseDistro3_repo" arch="i586">
<binary name="package" package="pack2" project="BaseDistro3" />
<binary name="package" package="pack2" project="BaseDistro3" supportstatus="l3" />
<binary name="does_not_exist" />
</binaries>
</channel>'
assert_response :success
get '/source/Channel/BaseDistro3/_channel'
assert_response :success
assert_no_xml_tag :tag => 'binary', :attributes => { :project => 'BaseDistro2.0', :package => 'pack2.linked'}
assert_xml_tag :tag => 'binary', :attributes => { :project => 'BaseDistro3', :package => 'pack2'}
assert_xml_tag :tag => 'binary', :attributes => { :project => 'BaseDistro3', :package => 'pack2', :supportstatus => 'l3' }

# create channel packages and repos
login_adrian
Expand Down
1 change: 1 addition & 0 deletions src/backend/BSXML.pm
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ our $channel = [
'repository',
'package',
'arch',
'supportstatus',
]],
]],
];
Expand Down

0 comments on commit 191aca8

Please sign in to comment.