forked from lix-project/hydra
Remove SHA-1 hash from BuildProducts
SHA-1 is deprecated and it will be expensive to compute with the streaming NAR handler.
This commit is contained in:
parent
7622cbfe37
commit
d4e4be4fd1
11 changed files with 11 additions and 31 deletions
|
@ -311,7 +311,6 @@ Content-Type: application/json
|
||||||
"buildproducts": {
|
"buildproducts": {
|
||||||
"1": {
|
"1": {
|
||||||
"path": "/nix/store/lzrxkjc35mhp8w7r8h82g0ljyizfchma-vm-test-run-unnamed",
|
"path": "/nix/store/lzrxkjc35mhp8w7r8h82g0ljyizfchma-vm-test-run-unnamed",
|
||||||
"sha1hash": null,
|
|
||||||
"defaultpath": "log.html",
|
"defaultpath": "log.html",
|
||||||
"type": "report",
|
"type": "report",
|
||||||
"sha256hash": null,
|
"sha256hash": null,
|
||||||
|
|
|
@ -672,10 +672,6 @@ components:
|
||||||
name:
|
name:
|
||||||
description: Name of the file
|
description: Name of the file
|
||||||
type: string
|
type: string
|
||||||
sha1hash:
|
|
||||||
nullable: true
|
|
||||||
description: sha1 hash of the file
|
|
||||||
type: string
|
|
||||||
path:
|
path:
|
||||||
description: the nix store path
|
description: the nix store path
|
||||||
type: string
|
type: string
|
||||||
|
@ -863,7 +859,6 @@ components:
|
||||||
defaultpath: ''
|
defaultpath: ''
|
||||||
name: hello-2.10
|
name: hello-2.10
|
||||||
type: nix-build
|
type: nix-build
|
||||||
sha1hash: null
|
|
||||||
sha256hash: null
|
sha256hash: null
|
||||||
subtype: ''
|
subtype: ''
|
||||||
path: /nix/store/y26qxcq1gg2hrqpxdc58b2fghv2bhxjg-hello-2.10
|
path: /nix/store/y26qxcq1gg2hrqpxdc58b2fghv2bhxjg-hello-2.10
|
||||||
|
|
|
@ -78,7 +78,6 @@ BuildOutput getBuildOutput(nix::ref<Store> store,
|
||||||
product.isRegular = true;
|
product.isRegular = true;
|
||||||
product.fileSize = st.fileSize;
|
product.fileSize = st.fileSize;
|
||||||
auto contents = accessor->readFile(product.path);
|
auto contents = accessor->readFile(product.path);
|
||||||
product.sha1hash = hashString(htSHA1, contents);
|
|
||||||
product.sha256hash = hashString(htSHA256, contents);
|
product.sha256hash = hashString(htSHA256, contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ struct BuildProduct
|
||||||
nix::Path path, defaultPath;
|
nix::Path path, defaultPath;
|
||||||
std::string type, subtype, name;
|
std::string type, subtype, name;
|
||||||
bool isRegular = false;
|
bool isRegular = false;
|
||||||
nix::Hash sha1hash, sha256hash;
|
nix::Hash sha256hash;
|
||||||
off_t fileSize = 0;
|
off_t fileSize = 0;
|
||||||
BuildProduct() { }
|
BuildProduct() { }
|
||||||
};
|
};
|
||||||
|
|
|
@ -414,13 +414,12 @@ void State::markSucceededBuild(pqxx::work & txn, Build::ptr build,
|
||||||
unsigned int productNr = 1;
|
unsigned int productNr = 1;
|
||||||
for (auto & product : res.products) {
|
for (auto & product : res.products) {
|
||||||
txn.exec_params0
|
txn.exec_params0
|
||||||
("insert into BuildProducts (build, productnr, type, subtype, fileSize, sha1hash, sha256hash, path, name, defaultPath) values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)",
|
("insert into BuildProducts (build, productnr, type, subtype, fileSize, sha256hash, path, name, defaultPath) values ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
||||||
build->id,
|
build->id,
|
||||||
productNr++,
|
productNr++,
|
||||||
product.type,
|
product.type,
|
||||||
product.subtype,
|
product.subtype,
|
||||||
product.isRegular ? std::make_optional(product.fileSize) : std::nullopt,
|
product.isRegular ? std::make_optional(product.fileSize) : std::nullopt,
|
||||||
product.isRegular ? std::make_optional(product.sha1hash.to_string(Base16, false)) : std::nullopt,
|
|
||||||
product.isRegular ? std::make_optional(product.sha256hash.to_string(Base16, false)) : std::nullopt,
|
product.isRegular ? std::make_optional(product.sha256hash.to_string(Base16, false)) : std::nullopt,
|
||||||
product.path,
|
product.path,
|
||||||
product.name,
|
product.name,
|
||||||
|
|
|
@ -632,7 +632,7 @@ BuildOutput State::getBuildOutputCached(Connection & conn, nix::ref<nix::Store>
|
||||||
res.size = r[0][4].is_null() ? 0 : r[0][4].as<unsigned long long>();
|
res.size = r[0][4].is_null() ? 0 : r[0][4].as<unsigned long long>();
|
||||||
|
|
||||||
auto products = txn.exec_params
|
auto products = txn.exec_params
|
||||||
("select type, subtype, fileSize, sha1hash, sha256hash, path, name, defaultPath from BuildProducts where build = $1 order by productnr",
|
("select type, subtype, fileSize, sha256hash, path, name, defaultPath from BuildProducts where build = $1 order by productnr",
|
||||||
id);
|
id);
|
||||||
|
|
||||||
for (auto row : products) {
|
for (auto row : products) {
|
||||||
|
@ -646,14 +646,12 @@ BuildOutput State::getBuildOutputCached(Connection & conn, nix::ref<nix::Store>
|
||||||
product.fileSize = row[2].as<off_t>();
|
product.fileSize = row[2].as<off_t>();
|
||||||
}
|
}
|
||||||
if (!row[3].is_null())
|
if (!row[3].is_null())
|
||||||
product.sha1hash = Hash(row[3].as<std::string>(), htSHA1);
|
product.sha256hash = Hash(row[3].as<std::string>(), htSHA256);
|
||||||
if (!row[4].is_null())
|
if (!row[4].is_null())
|
||||||
product.sha256hash = Hash(row[4].as<std::string>(), htSHA256);
|
product.path = row[4].as<std::string>();
|
||||||
if (!row[5].is_null())
|
product.name = row[5].as<std::string>();
|
||||||
product.path = row[5].as<std::string>();
|
if (!row[6].is_null())
|
||||||
product.name = row[6].as<std::string>();
|
product.defaultPath = row[6].as<std::string>();
|
||||||
if (!row[7].is_null())
|
|
||||||
product.defaultPath = row[7].as<std::string>();
|
|
||||||
res.products.emplace_back(product);
|
res.products.emplace_back(product);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,6 @@ sub buildFinished {
|
||||||
type => $product->type,
|
type => $product->type,
|
||||||
subtype => $product->subtype,
|
subtype => $product->subtype,
|
||||||
fileSize => $product->filesize,
|
fileSize => $product->filesize,
|
||||||
sha1hash => $product->sha1hash,
|
|
||||||
sha256hash => $product->sha256hash,
|
sha256hash => $product->sha256hash,
|
||||||
path => $product->path,
|
path => $product->path,
|
||||||
name => $product->name,
|
name => $product->name,
|
||||||
|
|
|
@ -61,11 +61,6 @@ __PACKAGE__->table("buildproducts");
|
||||||
data_type: 'bigint'
|
data_type: 'bigint'
|
||||||
is_nullable: 1
|
is_nullable: 1
|
||||||
|
|
||||||
=head2 sha1hash
|
|
||||||
|
|
||||||
data_type: 'text'
|
|
||||||
is_nullable: 1
|
|
||||||
|
|
||||||
=head2 sha256hash
|
=head2 sha256hash
|
||||||
|
|
||||||
data_type: 'text'
|
data_type: 'text'
|
||||||
|
@ -99,8 +94,6 @@ __PACKAGE__->add_columns(
|
||||||
{ data_type => "text", is_nullable => 0 },
|
{ data_type => "text", is_nullable => 0 },
|
||||||
"filesize",
|
"filesize",
|
||||||
{ data_type => "bigint", is_nullable => 1 },
|
{ data_type => "bigint", is_nullable => 1 },
|
||||||
"sha1hash",
|
|
||||||
{ data_type => "text", is_nullable => 1 },
|
|
||||||
"sha256hash",
|
"sha256hash",
|
||||||
{ data_type => "text", is_nullable => 1 },
|
{ data_type => "text", is_nullable => 1 },
|
||||||
"path",
|
"path",
|
||||||
|
@ -143,8 +136,8 @@ __PACKAGE__->belongs_to(
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36
|
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-07-27 18:21:03
|
||||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:iI0gmKqQxiPBTy5QsM6tpQ
|
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:O4R8b/GukNaUmmAErb3Jlw
|
||||||
|
|
||||||
my %hint = (
|
my %hint = (
|
||||||
columns => [
|
columns => [
|
||||||
|
@ -152,7 +145,6 @@ my %hint = (
|
||||||
'subtype',
|
'subtype',
|
||||||
'name',
|
'name',
|
||||||
'filesize',
|
'filesize',
|
||||||
'sha1hash',
|
|
||||||
'sha256hash',
|
'sha256hash',
|
||||||
'path',
|
'path',
|
||||||
'defaultpath'
|
'defaultpath'
|
||||||
|
|
|
@ -191,7 +191,6 @@
|
||||||
<table class="info-table">
|
<table class="info-table">
|
||||||
[% INCLUDE renderProductLinks %]
|
[% INCLUDE renderProductLinks %]
|
||||||
<tr><th>File size:</th><td>[% product.filesize %] bytes ([% mibs(product.filesize / (1024 * 1024)) %] MiB)</td></tr>
|
<tr><th>File size:</th><td>[% product.filesize %] bytes ([% mibs(product.filesize / (1024 * 1024)) %] MiB)</td></tr>
|
||||||
<tr><th>SHA-1 hash:</th><td><tt>[% product.sha1hash %]</tt></td></tr>
|
|
||||||
<tr><th>SHA-256 hash:</th><td><tt>[% product.sha256hash %]</tt></td></tr>
|
<tr><th>SHA-256 hash:</th><td><tt>[% product.sha256hash %]</tt></td></tr>
|
||||||
<tr><th>Full path:</th><td><tt>[% product.path %]</tt></td></tr>
|
<tr><th>Full path:</th><td><tt>[% product.path %]</tt></td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -330,7 +330,6 @@ create table BuildProducts (
|
||||||
type text not null, -- "nix-build", "file", "doc", "report", ...
|
type text not null, -- "nix-build", "file", "doc", "report", ...
|
||||||
subtype text not null, -- "source-dist", "rpm", ...
|
subtype text not null, -- "source-dist", "rpm", ...
|
||||||
fileSize bigint,
|
fileSize bigint,
|
||||||
sha1hash text,
|
|
||||||
sha256hash text,
|
sha256hash text,
|
||||||
path text,
|
path text,
|
||||||
name text not null, -- generally just the filename part of `path'
|
name text not null, -- generally just the filename part of `path'
|
||||||
|
|
1
src/sql/upgrade-68.sql
Normal file
1
src/sql/upgrade-68.sql
Normal file
|
@ -0,0 +1 @@
|
||||||
|
alter table BuildProducts drop column sha1hash;
|
Loading…
Reference in a new issue