Merge pull request #164614 from 06kellyjac/syft

This commit is contained in:
Sandro 2022-03-23 03:41:31 +01:00 committed by GitHub
commit 360a2296f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 10 deletions

View File

@ -2,27 +2,25 @@
buildGoModule rec {
pname = "syft";
version = "0.41.6";
version = "0.42.2";
src = fetchFromGitHub {
owner = "anchore";
repo = pname;
rev = "v${version}";
sha256 = "sha256-Ebs0IVdcll7bTNjoZalD5Ye0GFXJeas1nPseYLzZxOk=";
sha256 = "sha256-ejyUe2FM8pNQO9esWi9QbSiq6PVEjGbRu+AEnbCFqDE=";
# populate values that require us to use git. By doing this in postFetch we
# can delete .git afterwards and maintain better reproducibility of the src.
leaveDotGit = true;
postFetch = ''
cd "$out"
commit="$(git rev-parse HEAD)"
source_date_epoch="$(git log --date=format:'%Y-%m-%dT%H:%M:%SZ' -1 --pretty=%ad)"
substituteInPlace "$out/internal/version/build.go" \
--replace 'gitCommit = valueNotProvided' "gitCommit = \"$commit\"" \
--replace 'buildDate = valueNotProvided' "buildDate = \"$source_date_epoch\""
git rev-parse HEAD > $out/COMMIT
# 0000-00-00T00:00:00Z
date -u -d "@$(git log -1 --pretty=%ct)" "+%Y-%m-%dT%H:%M:%SZ" > $out/SOURCE_DATE_EPOCH
find "$out" -name .git -print0 | xargs -0 rm -rf
'';
};
vendorSha256 = "sha256-/WGkQfCUDmolGdzNxIZKzZnXWnqO2vvizBLJgO+s4Ak=";
vendorSha256 = "sha256-o5Gq4ZN9H/rXSfIeU2hlExzV5KQZP9DfQsWbOZOB43E=";
nativeBuildInputs = [ installShellFiles ];
@ -32,10 +30,15 @@ buildGoModule rec {
"-s"
"-w"
"-X github.com/anchore/syft/internal/version.version=${version}"
"-X github.com/anchore/syft/internal/version.gitTreeState=clean"
"-X github.com/anchore/syft/internal/version.gitDescription=v${version}"
"-X github.com/anchore/syft/internal/version.gitTreeState=clean"
];
preBuild = ''
ldflags+=" -X github.com/anchore/syft/internal/version.gitCommit=$(cat COMMIT)"
ldflags+=" -X github.com/anchore/syft/internal/version.buildDate=$(cat SOURCE_DATE_EPOCH)"
'';
# tests require a running docker instance
doCheck = false;

View File

@ -10303,7 +10303,9 @@ with pkgs;
systrayhelper = callPackage ../tools/misc/systrayhelper {};
syft = callPackage ../tools/admin/syft { };
syft = callPackage ../tools/admin/syft {
buildGoModule = buildGo118Module;
};
Sylk = callPackage ../applications/networking/Sylk {};