Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/lib/Hydra/Schema/Result/JobsetEvalInputs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ __PACKAGE__->table("jobsetevalinputs");
data_type: 'text'
is_nullable: 1

=head2 shortRevLength

data_type: 'number'
is_nullable: 1

=head2 value

data_type: 'text'
Expand Down Expand Up @@ -102,6 +107,8 @@ __PACKAGE__->add_columns(
{ data_type => "text", is_nullable => 1 },
"revision",
{ data_type => "text", is_nullable => 1 },
"shortRevLength",
{ data_type => "integer", is_nullable => 1 },
"value",
{ data_type => "text", is_nullable => 1 },
"dependency",
Expand Down Expand Up @@ -183,4 +190,28 @@ sub json_hint {
return \%hint;
}

# Revision to be rendered by the frontend
sub frontend_revision() {
my ($self) = @_;
my $type = $self->get_column('type');
if ($type eq 'svn' or $type eq 'svn-checkout' or $type eq 'bzr' or $type eq 'bzr-checkout') {
return 'r' . $self->get_column('revision');
} elsif ($type eq 'git') {
# Find the longest revision length of this URI
my $schema = $self->result_source->schema;
my $maxLength = $schema
->resultset('JobsetEvalInputs')
->search({ uri => $self->get_column('uri')})
->get_column('shortRevLength')
->max;
# Fall back to a fixed value if there was no value
return substr($self->get_column('revision'), 0, $maxLength || 12);
} elsif ($type eq 'bzr') {
return substr($self->get_column('revision'), 0, 12);
} else {
return $self->get_column('revision');
}

}

1;
12 changes: 3 additions & 9 deletions src/root/common.tt
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ BLOCK renderInputDiff; %]
[% ELSIF bi1.uri == bi2.uri && bi1.revision != bi2.revision %]
[% IF bi1.type == "git" %]
<tr><td>
<b>[% HTML.escape(bi1.name) %]</b></td><td><tt>[% INCLUDE renderDiffUri contents=(bi1.revision.substr(0, 12) _ ' to ' _ bi2.revision.substr(0, 12)) %]</tt>
<b>[% HTML.escape(bi1.name) %]</b></td><td><tt>[% INCLUDE renderDiffUri contents=(bi1.frontend_revision _ ' to ' _ bi2.frontend_revision) %]</tt>
</td></tr>
[% ELSE %]
<tr><td>
Expand Down Expand Up @@ -452,16 +452,10 @@ BLOCK renderPager %]


BLOCK renderShortEvalInput;
IF input.type == "svn" || input.type == "svn-checkout" || input.type == "bzr" || input.type == "bzr-checkout" %]
r[% input.revision %]
[% ELSIF input.type == "git" %]
<tt>[% input.revision.substr(0, 7) | html %]</tt>
[% ELSIF input.type == "hg" %]
<tt>[% input.revision.substr(0, 12) | html %]</tt>
[% ELSIF input.type == "build" || input.type == "sysbuild" %]
IF input.type == "build" || input.type == "sysbuild" %]
<a [% HTML.attributes(href => c.uri_for('/build' input.get_column('dependency'))) %]>[% HTML.escape(input.get_column('dependency')) %]</a>
[% ELSE %]
<tt>[% input.revision | html %]</tt>
<tt>[% input.frontend_revision | html %]</tt>
[% END;
END;

Expand Down
2 changes: 1 addition & 1 deletion src/root/reproduce.tt
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ else
revCount="$(cat "$tmpDir/[% input.name %]/rev-count")"
fi

args+=(--arg '[% input.name %]' "{ outPath = $inputDir; rev = \"[% input.revision %]\"; shortRev = \"[% input.revision.substr(0, 7) %]\"; revCount = $revCount; }")
args+=(--arg '[% input.name %]' "{ outPath = $inputDir; rev = \"[% input.revision %]\"; shortRev = \"[% input.frontend_revision %]\"; revCount = $revCount; }")

[%+ ELSIF input.type == "hg" %]

Expand Down
1 change: 1 addition & 0 deletions src/script/hydra-eval-jobset
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,7 @@ sub checkJobsetWrapped {
, type => $input->{type}
, uri => $input->{uri}
, revision => $input->{revision}
, shortRevLength => length($input->{shortRev})
, value => $input->{value}
, dependency => $input->{id}
, path => $input->{storePath} || "" # !!! temporary hack
Expand Down
11 changes: 6 additions & 5 deletions src/sql/hydra.sql
Original file line number Diff line number Diff line change
Expand Up @@ -487,11 +487,12 @@ create table JobsetEvalInputs (
altNr integer not null,

-- Copied from the jobsetinputs from which the build was created.
type text not null,
uri text,
revision text,
value text,
dependency integer, -- build ID of the input, for type == 'build'
type text not null,
uri text,
revision text,
shortRevLength smallint, -- length of a short revision at the time this was checked out
value text,
dependency integer, -- build ID of the input, for type == 'build'

path text,

Expand Down
1 change: 1 addition & 0 deletions src/sql/upgrade-85.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE JobsetEvalInputs ADD COLUMN shortRevLength smallint;