* Allow downloading of build products.

[?]
Nov 12, 2008, 2:41 PM
L5VIEXSC5R72SEDSWF7HWNXMSTAAADBUMCSREU5ITMRXLEJ6KZWQC

Dependencies

  • [2] B72GLND4
  • [3] DVNWJXWW * Generic declaration of build products.
  • [4] J5UVLXOK * Start of a basic Catalyst web interface.

Change contents

  • edit in src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm at line 163
    [3.2595]
    [3.2595]
    sub download :Local {
    my ( $self, $c, $id, $productnr, $filename ) = @_;
  • edit in src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm at line 168
    [3.2596]
    [3.2596]
    my $build = getBuild($c, $id);
    return error($c, "Build with ID $id doesn't exist.") if !defined $build;
  • edit in src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm at line 171
    [3.2597]
    [3.2597]
    my $product = $build->buildproducts->find({productnr => $productnr});
    return error($c, "Build $id doesn't have a product $productnr.") if !defined $product;
    return error($c, "File " . $product->path . " has disappeared.") unless -e $product->path;
    $c->serve_static_file($product->path);
    }
  • replacement in src/HydraFrontend/root/build.tt at line 200
    [3.1469][3.1469:1535](),[3.1535][2.2448:2562](),[2.2562][3.1649:1672](),[3.1649][3.1649:1672](),[3.1672][2.2563:2665](),[2.2665][3.1774:1895](),[3.1774][3.1774:1895]()
    [% SWITCH product.subtype %]
    [% CASE "source-dist" %]
    <img src="/static/images/source-dist.png" alt="Source" /> Source distribution <tt>[% product.name %]</tt>
    [% CASE "rpm" %]
    <img src="/static/images/rpm-fedora.png" alt="RPM" /> RPM package <tt>[% product.name %]</tt>
    [% CASE DEFAULT %]
    File <tt>[% product.path %]</tt> of type <tt>[% product.subtype %]</tt>
    [% END %]
    [3.1469]
    [2.2666]
    <a href="[% c.uri_for('/download' build.id product.productnr product.name) %]">
    [% SWITCH product.subtype %]
    [% CASE "source-dist" %]
    <img src="/static/images/source-dist.png" alt="Source" /> Source distribution <tt>[% product.name %]</tt>
    [% CASE "rpm" %]
    <img src="/static/images/rpm-fedora.png" alt="RPM" /> RPM package <tt>[% product.name %]</tt>
    [% CASE DEFAULT %]
    File <tt>[% product.name %]</tt> of type <tt>[% product.subtype %]</tt>
    [% END %]
    </a>