Skip to content

Commit

Permalink
[api] Extend binary tracking information for media
Browse files Browse the repository at this point in the history
- Show the project a binary is taken from inside of a medium
- Show medium package container
  • Loading branch information
adrianschroeter authored and hennevogel committed Aug 12, 2020
1 parent 022f4d3 commit b688493
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
19 changes: 19 additions & 0 deletions docs/api/api/binary_released.rng
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@
</element>
<optional>
<element name="publish">
<optional>
<!-- exists only if not identical. This is the case if it is
part of a medium, but the binary is taken from another
project -->
<attribute name="project">
<data type="string" />
</attribute>
</optional>
<attribute name="package">
<data type="string" />
</attribute>
Expand All @@ -57,6 +65,17 @@
</attribute>
</element>
</optional>
<optional>
<!-- exists only if the binary is on a tracked medium -->
<element name="medium">
<attribute name="project">
<data type="string" />
</attribute>
<attribute name="package">
<data type="string" />
</attribute>
</element>
</optional>
<optional>
<element name="build">
<attribute name="time">
Expand Down
10 changes: 9 additions & 1 deletion src/api/app/models/binary_release.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ def render_xml
binary.operation(operation)

node = {}
node[:package] = release_package.name if release_package
if release_package
node[:project] = release_package.project.name if release_package.project != repository.project
node[:package] = release_package.name
end
node[:time] = binary_releasetime if binary_releasetime
node[:flavor] = flavor if flavor
binary.publish(node) unless node.empty?
Expand All @@ -168,6 +171,11 @@ def render_xml
binary.updatefor(up.extend_id_hash(project: up.package.project.name, product: up.name))
end

if medium && (medium_package = on_medium.try(:release_package))
binary.medium(project: medium_package.project.name,
package: medium_package.name)
end

if product_medium
binary.product(product_medium.product.extend_id_hash(name: product_medium.product.name))
end
Expand Down

0 comments on commit b688493

Please sign in to comment.