* Channels: provide an index page that lists all the packages in the

channel.
* Store the meta.homepage attribute in the Builds table.
This commit is contained in:
Eelco Dolstra 2009-03-04 14:49:21 +00:00
parent dad2f31099
commit 56beebc9c6
24 changed files with 114 additions and 41 deletions

View file

@ -47,7 +47,7 @@ sub pkg : Chained('nix') PathPart Args(1) {
notFound($c, "Unknown Nix package `$pkgName'.") notFound($c, "Unknown Nix package `$pkgName'.")
unless defined $pkg; unless defined $pkg;
$c->stash->{build} = $pkg; $c->stash->{build} = $pkg->{build};
$c->stash->{manifestUri} = $c->uri_for($self->action_for("manifest"), $c->req->captures); $c->stash->{manifestUri} = $c->uri_for($self->action_for("manifest"), $c->req->captures);
@ -63,4 +63,16 @@ sub nixexprs : Chained('nix') PathPart('nixexprs.tar.bz2') Args(0) {
} }
sub name {
my ($build) = @_;
return $build->resultInfo->releasename || $build->nixname;
}
sub channel_contents : Chained('nix') PathPart('') Args(0) {
my ($self, $c) = @_;
$c->stash->{template} = 'channel-contents.tt';
$c->stash->{nixPkgs} = [sort { lc(name($a->{build})) cmp lc(name($b->{build})) } (values %{$c->stash->{nixPkgs}})];
}
1; 1;

View file

@ -151,8 +151,8 @@ sub nix : Chained('build') PathPart('nix') CaptureArgs(0) {
$c->stash->{storePaths} = [$build->outpath]; $c->stash->{storePaths} = [$build->outpath];
my $pkgName = $build->nixname . "-" . $build->system . ".nixpkg"; my $pkgName = $build->nixname . "-" . $build->system;
$c->stash->{nixPkgs} = {$pkgName => $build}; $c->stash->{nixPkgs} = {"${pkgName}.nixpkg" => {build => $build, name => $pkgName}};
} }

View file

@ -78,8 +78,8 @@ sub getChannelData {
next unless $build->buildproducts->find({type => "nix-build"}); next unless $build->buildproducts->find({type => "nix-build"});
next unless isValidPath($build->outpath); next unless isValidPath($build->outpath);
push @storePaths, $build->outpath; push @storePaths, $build->outpath;
my $pkgName = $build->nixname . "-" . $build->system . "-" . $build->id . ".nixpkg"; my $pkgName = $build->nixname . "-" . $build->system . "-" . $build->id;
$c->stash->{nixPkgs}->{$pkgName} = $build; $c->stash->{nixPkgs}->{"${pkgName}.nixpkg"} = {build => $build, name => $pkgName};
}; };
$c->stash->{storePaths} = [@storePaths]; $c->stash->{storePaths} = [@storePaths];

View file

@ -8,8 +8,8 @@ use base 'DBIx::Class::Schema';
__PACKAGE__->load_classes; __PACKAGE__->load_classes;
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-02-11 23:16:48 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-04 14:50:30
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+EFA/I0SY8Jih++hjX1Ypg # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QcB8T/bY2/Pw34uuYXt2Cw
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -36,8 +36,8 @@ __PACKAGE__->belongs_to("build", "Hydra::Schema::Builds", { id => "build" });
__PACKAGE__->belongs_to("dependency", "Hydra::Schema::Builds", { id => "dependency" }); __PACKAGE__->belongs_to("dependency", "Hydra::Schema::Builds", { id => "dependency" });
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-02-11 23:16:48 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-04 14:50:30
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:sfGY0lHkOxmL8MUh9XRzcQ # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7Th7GxvR7m/DdodQqlmJXQ
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -33,8 +33,8 @@ __PACKAGE__->set_primary_key("build", "productnr");
__PACKAGE__->belongs_to("build", "Hydra::Schema::Builds", { id => "build" }); __PACKAGE__->belongs_to("build", "Hydra::Schema::Builds", { id => "build" });
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-02-11 23:16:48 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-04 14:50:30
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0Q+SE9zoGRXIKLQbKgUEOg # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:FFVpdoV0vBLhF9yyKJSoTA
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -31,8 +31,8 @@ __PACKAGE__->set_primary_key("id");
__PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" }); __PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" });
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-02-11 23:16:48 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-04 14:50:30
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5fMxCc6sKchB4munRoQ3tg # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CkjyZptB79J32VhDbXhKEg
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -27,8 +27,8 @@ __PACKAGE__->set_primary_key("id");
__PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" }); __PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" });
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-02-11 23:16:48 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-04 14:50:30
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:b3e3/nNEkIL5NT0njXfmvQ # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:HeodRHEOs/do8RKwDJhaXg
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -35,8 +35,8 @@ __PACKAGE__->set_primary_key("id", "stepnr");
__PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" }); __PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" });
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-02-11 23:16:48 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-04 14:50:30
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+Uu75EKOIqmX2kDdoF4urw # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kKpIuRMrqdh7m4M5XPIEgg
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -34,6 +34,8 @@ __PACKAGE__->add_columns(
{ data_type => "text", is_nullable => 0, size => undef }, { data_type => "text", is_nullable => 0, size => undef },
"license", "license",
{ data_type => "text", is_nullable => 0, size => undef }, { data_type => "text", is_nullable => 0, size => undef },
"homepage",
{ data_type => "text", is_nullable => 0, size => undef },
); );
__PACKAGE__->set_primary_key("id"); __PACKAGE__->set_primary_key("id");
__PACKAGE__->belongs_to("project", "Hydra::Schema::Projects", { name => "project" }); __PACKAGE__->belongs_to("project", "Hydra::Schema::Projects", { name => "project" });
@ -74,8 +76,8 @@ __PACKAGE__->has_many(
); );
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-02-11 23:16:48 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-04 14:50:30
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+5YWpNShfJeY0rZxT6NFXg # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fGOOscNFEgDZpeVpA6HH0w
__PACKAGE__->has_many(dependents => 'Hydra::Schema::BuildInputs', 'dependency'); __PACKAGE__->has_many(dependents => 'Hydra::Schema::BuildInputs', 'dependency');

View file

@ -22,8 +22,8 @@ __PACKAGE__->add_columns(
__PACKAGE__->set_primary_key("srcpath", "sha256hash"); __PACKAGE__->set_primary_key("srcpath", "sha256hash");
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-02-11 23:16:48 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-04 14:50:30
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fVED/6C0XGnrNGSazH7amg # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0wY3JTSelPQSTbxpNQDJjg
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -20,8 +20,8 @@ __PACKAGE__->add_columns(
__PACKAGE__->set_primary_key("uri", "revision"); __PACKAGE__->set_primary_key("uri", "revision");
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-02-11 23:16:48 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-04 14:50:30
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kOLnExOz2rlFJQ3tcE+7Xg # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:eZPs3SB3XZW5BNQOQFrFBw
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -31,8 +31,8 @@ __PACKAGE__->belongs_to(
); );
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-02-11 23:16:48 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-04 14:50:30
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:3QPU9ikr0SZn/S99qOMRAg # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:atlyxsSKg41KbDkbCfuvHQ
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -43,8 +43,8 @@ __PACKAGE__->has_many(
); );
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-02-11 23:16:48 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-04 14:50:30
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dpuTqJIOcIuMe9xxR9NYdQ # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:85ro4sVmhc3HwAjgoA6p6w
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -50,8 +50,8 @@ __PACKAGE__->has_many(
); );
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-02-11 23:16:48 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-04 14:50:30
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:r/PJAD9K8L3WHUncNFlnaw # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:c5PqrzN43jEGGrzKqI6WWQ
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -45,8 +45,8 @@ __PACKAGE__->has_many(
); );
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-02-11 23:16:48 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-04 14:50:30
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9UhObD4jTQzVnYRWKPQOvg # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7iZYMDM+wn+Neud0Fm1ZMA
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -32,8 +32,8 @@ __PACKAGE__->belongs_to(
); );
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-02-11 23:16:48 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-04 14:50:30
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:aK/I+BIryTR1h/KGOxQ7mw # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Rs3CRPpzFi30sAeHVe1yQA
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -29,8 +29,8 @@ __PACKAGE__->has_many(
); );
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-02-11 23:16:48 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-04 14:50:30
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vQ4hwubK2w3czUD9ghGHBg # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PA+dfXHaBsSx9kE1mEZZ9w
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -16,8 +16,8 @@ __PACKAGE__->add_columns(
__PACKAGE__->set_primary_key("system"); __PACKAGE__->set_primary_key("system");
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-02-11 23:16:48 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-04 14:50:30
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:63NZCqYk/4E0ISCUaDqneA # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:olHboRdtxD6E7Ukr4aCLCA
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -17,8 +17,8 @@ __PACKAGE__->set_primary_key("username", "role");
__PACKAGE__->belongs_to("username", "Hydra::Schema::Users", { username => "username" }); __PACKAGE__->belongs_to("username", "Hydra::Schema::Users", { username => "username" });
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-02-11 23:16:48 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-04 14:50:30
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Lck5v6SX1rzILTrkSdZBtg # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Q7Nd3wv7Y3184GhkE/pdFA
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -30,8 +30,8 @@ __PACKAGE__->has_many(
); );
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-02-11 23:16:48 # Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-03-04 14:50:30
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OQzF0LFe3iSh9KxLk1vL8w # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:z8fRKy//Mx8wqymMgOcrWA
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -0,0 +1,57 @@
[% WRAPPER layout.tt title="Channel ${channelName}" %]
[% PROCESS common.tt %]
[% USE HTML %]
<h1>Channel <tt>[% channelName %]</tt></h1>
<p>You can subscribe to this channel by doing
<pre>$ nix-channel --add [% curUri %]</pre>
</p>
<h2>Packages</h2>
<p>This channel contains the following packages.</p>
<table class="tablesorter">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>System</th>
<th>Description</th>
</tr>
</thead>
<tbody>
[% FOREACH pkg IN nixPkgs %]
[% build = pkg.build %]
[% uri = "${curUri}/pkg/${pkg.name}.nixpkg" %]
<tr class="clickable" onclick="window.location = '[% uri %]'">
<td><a href="[% c.uri_for('/build' build.id) %]">[% build.id %]</a></td>
<td><a href="[% uri %]"><tt>[% build.resultInfo.releasename || build.nixname %]</tt></a></td>
<td><tt>[% build.system %]</tt></td>
<td>
[% IF build.homepage -%]
<a [% HTML.attributes(href => build.homepage) %]>[% HTML.escape(build.description) %]</a>
[% ELSE -%]
[% HTML.escape(build.description) -%]
[% END -%]
</td>
</tr>
[% END %]
</tbody>
</table>
[% END %]

View file

@ -190,6 +190,7 @@ sub checkJob {
my $description = defined $job->{meta}->{description} ? $job->{meta}->{description}->{value} : ""; my $description = defined $job->{meta}->{description} ? $job->{meta}->{description}->{value} : "";
my $longDescription = defined $job->{meta}->{longDescription} ? $job->{meta}->{longDescription}->{value} : ""; my $longDescription = defined $job->{meta}->{longDescription} ? $job->{meta}->{longDescription}->{value} : "";
my $license = defined $job->{meta}->{license} ? $job->{meta}->{license}->{value} : ""; my $license = defined $job->{meta}->{license} ? $job->{meta}->{license}->{value} : "";
my $homepage = defined $job->{meta}->{homepage} ? $job->{meta}->{homepage}->{value} : "";
die unless $job->{drvPath} eq $drvPath; die unless $job->{drvPath} eq $drvPath;
my $outPath = $job->{outPath}; my $outPath = $job->{outPath};

View file

@ -24,6 +24,7 @@ create table Builds (
longDescription text, -- meta.longDescription longDescription text, -- meta.longDescription
license text, -- meta.license license text, -- meta.license
homepage text, -- meta.homepage
foreign key (project) references Projects(name), -- ignored by sqlite foreign key (project) references Projects(name), -- ignored by sqlite
foreign key (project, jobset) references Jobsets(project, name) -- ignored by sqlite foreign key (project, jobset) references Jobsets(project, name) -- ignored by sqlite