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
|
@ -311,7 +311,6 @@ Content-Type: application/json
|
|||
"buildproducts": {
|
||||
"1": {
|
||||
"path": "/nix/store/lzrxkjc35mhp8w7r8h82g0ljyizfchma-vm-test-run-unnamed",
|
||||
"sha1hash": null,
|
||||
"defaultpath": "log.html",
|
||||
"type": "report",
|
||||
"sha256hash": null,
|
||||
|
|
|
@ -672,10 +672,6 @@ components:
|
|||
name:
|
||||
description: Name of the file
|
||||
type: string
|
||||
sha1hash:
|
||||
nullable: true
|
||||
description: sha1 hash of the file
|
||||
type: string
|
||||
path:
|
||||
description: the nix store path
|
||||
type: string
|
||||
|
@ -863,7 +859,6 @@ components:
|
|||
defaultpath: ''
|
||||
name: hello-2.10
|
||||
type: nix-build
|
||||
sha1hash: null
|
||||
sha256hash: null
|
||||
subtype: ''
|
||||
path: /nix/store/y26qxcq1gg2hrqpxdc58b2fghv2bhxjg-hello-2.10
|
||||
|
|
|
@ -78,7 +78,6 @@ BuildOutput getBuildOutput(nix::ref<Store> store,
|
|||
product.isRegular = true;
|
||||
product.fileSize = st.fileSize;
|
||||
auto contents = accessor->readFile(product.path);
|
||||
product.sha1hash = hashString(htSHA1, contents);
|
||||
product.sha256hash = hashString(htSHA256, contents);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ struct BuildProduct
|
|||
nix::Path path, defaultPath;
|
||||
std::string type, subtype, name;
|
||||
bool isRegular = false;
|
||||
nix::Hash sha1hash, sha256hash;
|
||||
nix::Hash sha256hash;
|
||||
off_t fileSize = 0;
|
||||
BuildProduct() { }
|
||||
};
|
||||
|
|
|
@ -414,13 +414,12 @@ void State::markSucceededBuild(pqxx::work & txn, Build::ptr build,
|
|||
unsigned int productNr = 1;
|
||||
for (auto & product : res.products) {
|
||||
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,
|
||||
productNr++,
|
||||
product.type,
|
||||
product.subtype,
|
||||
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.path,
|
||||
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>();
|
||||
|
||||
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);
|
||||
|
||||
for (auto row : products) {
|
||||
|
@ -646,14 +646,12 @@ BuildOutput State::getBuildOutputCached(Connection & conn, nix::ref<nix::Store>
|
|||
product.fileSize = row[2].as<off_t>();
|
||||
}
|
||||
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())
|
||||
product.sha256hash = Hash(row[4].as<std::string>(), htSHA256);
|
||||
if (!row[5].is_null())
|
||||
product.path = row[5].as<std::string>();
|
||||
product.name = row[6].as<std::string>();
|
||||
if (!row[7].is_null())
|
||||
product.defaultPath = row[7].as<std::string>();
|
||||
product.path = row[4].as<std::string>();
|
||||
product.name = row[5].as<std::string>();
|
||||
if (!row[6].is_null())
|
||||
product.defaultPath = row[6].as<std::string>();
|
||||
res.products.emplace_back(product);
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,6 @@ sub buildFinished {
|
|||
type => $product->type,
|
||||
subtype => $product->subtype,
|
||||
fileSize => $product->filesize,
|
||||
sha1hash => $product->sha1hash,
|
||||
sha256hash => $product->sha256hash,
|
||||
path => $product->path,
|
||||
name => $product->name,
|
||||
|
|
|
@ -61,11 +61,6 @@ __PACKAGE__->table("buildproducts");
|
|||
data_type: 'bigint'
|
||||
is_nullable: 1
|
||||
|
||||
=head2 sha1hash
|
||||
|
||||
data_type: 'text'
|
||||
is_nullable: 1
|
||||
|
||||
=head2 sha256hash
|
||||
|
||||
data_type: 'text'
|
||||
|
@ -99,8 +94,6 @@ __PACKAGE__->add_columns(
|
|||
{ data_type => "text", is_nullable => 0 },
|
||||
"filesize",
|
||||
{ data_type => "bigint", is_nullable => 1 },
|
||||
"sha1hash",
|
||||
{ data_type => "text", is_nullable => 1 },
|
||||
"sha256hash",
|
||||
{ data_type => "text", is_nullable => 1 },
|
||||
"path",
|
||||
|
@ -143,8 +136,8 @@ __PACKAGE__->belongs_to(
|
|||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:iI0gmKqQxiPBTy5QsM6tpQ
|
||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-07-27 18:21:03
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:O4R8b/GukNaUmmAErb3Jlw
|
||||
|
||||
my %hint = (
|
||||
columns => [
|
||||
|
@ -152,7 +145,6 @@ my %hint = (
|
|||
'subtype',
|
||||
'name',
|
||||
'filesize',
|
||||
'sha1hash',
|
||||
'sha256hash',
|
||||
'path',
|
||||
'defaultpath'
|
||||
|
|
|
@ -191,7 +191,6 @@
|
|||
<table class="info-table">
|
||||
[% INCLUDE renderProductLinks %]
|
||||
<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>Full path:</th><td><tt>[% product.path %]</tt></td></tr>
|
||||
</table>
|
||||
|
|
|
@ -330,7 +330,6 @@ create table BuildProducts (
|
|||
type text not null, -- "nix-build", "file", "doc", "report", ...
|
||||
subtype text not null, -- "source-dist", "rpm", ...
|
||||
fileSize bigint,
|
||||
sha1hash text,
|
||||
sha256hash text,
|
||||
path text,
|
||||
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