semgrep: 1.0.0 -> 1.14.0

Fixed update script
This commit is contained in:
06kellyjac 2023-03-03 09:21:48 +00:00
parent c9f7c47260
commit ce7e3aa356
3 changed files with 24 additions and 21 deletions

View file

@ -1,13 +1,13 @@
{ lib, fetchFromGitHub, fetchzip, stdenv }:
rec {
version = "1.0.0";
version = "1.14.0";
src = fetchFromGitHub {
owner = "returntocorp";
repo = "semgrep";
rev = "v${version}";
sha256 = "sha256-4fNBpokHKCtMB3P0ot1TzcuzOs5hlyH8nIw+bCGqThA=";
sha256 = "sha256-qtiOZRqN+EqJs7kDmNReW4uweEynJd0TrU7vpR/fbqI=";
};
# submodule dependencies
@ -18,14 +18,14 @@ rec {
"cli/src/semgrep/lang" = fetchFromGitHub {
owner = "returntocorp";
repo = "semgrep-langs";
rev = "65cb2ed80e31e01b122f893fef8428d14432da75";
sha256 = "sha256-HdPJdOlMM1l7vNSATkEu5KrCkpt2feEAH8LFDU84KUM=";
rev = "08656cdefc9e6818c64e168cf51ee1e76ea8829e";
sha256 = "sha256-vYf33JhfvEDmt/VW0hBOmqailIERS0GdUgrPuCxWt9I=";
};
"cli/src/semgrep/semgrep_interfaces" = fetchFromGitHub {
owner = "returntocorp";
repo = "semgrep-interfaces";
rev = "c69e30a4cf39f11cab5378700f5e193e8282079e";
sha256 = "sha256-Wr3/TWx/LHiTFCoGY4sqdsn3dHvMsEIVYA3RGiv88xQ=";
rev = "deffcb8e0e5166e29ce17b8af72716f45cbb2aa6";
sha256 = "sha256-yrVn1fJcAkQd3TMIvrWa5NDb/fN3ngybOycu7DG4pbE=";
};
};
@ -35,11 +35,11 @@ rec {
data = {
x86_64-linux = {
suffix = "-ubuntu-16.04.tgz";
sha256 = "sha256-SsaAuhcDyO3nr6H2xOtdxzOoEQd6aIe0mlpehvDWzU0=";
sha256 = "sha256-cnF92jrVeRxDAbDQxicZ4+CfdOD7BJUz2fHjIHEim24=";
};
x86_64-darwin = {
suffix = "-osx.zip";
sha256 = "sha256-DAcAB/q6XeljCp4mVljIJB4AUjUuzMSRMFzIuyjWMew=";
sha256 = "sha256-eg6oHTz3vRd4GubvOYiJIjv/NZgXRWHPBmFvSu60S+E=";
};
};
src = let

View file

@ -17,15 +17,17 @@ buildPythonApplication rec {
pname = "semgrep";
inherit (common) src version;
postPatch = (lib.concatStringsSep "\n" (lib.mapAttrsToList (
path: submodule: ''
# substitute ${path}
# remove git submodule placeholder
rm -r ${path}
# link submodule
ln -s ${submodule}/ ${path}
''
) common.submodules)) + ''
postPatch = (lib.concatStringsSep "\n" (lib.mapAttrsToList
(
path: submodule: ''
# substitute ${path}
# remove git submodule placeholder
rm -r ${path}
# link submodule
ln -s ${submodule}/ ${path}
''
)
common.submodules)) + ''
cd cli
'';
@ -50,6 +52,7 @@ buildPythonApplication rec {
click-option-group
glom
requests
rich
ruamel-yaml
tqdm
packaging

View file

@ -25,7 +25,7 @@ instantiateClean() {
# get latest version
NEW_VERSION=$(
curl -s -H
curl -s -H \
"Accept: application/vnd.github.v3+json" \
${GITHUB_TOKEN:+ -H "Authorization: bearer $GITHUB_TOKEN"} \
https://api.github.com/repos/returntocorp/semgrep/releases/latest \
@ -75,8 +75,8 @@ nix-instantiate -E "with import $NIXPKGS_ROOT {}; builtins.attrNames semgrep.com
| jq '.[]' -r \
| while read -r PLATFORM; do
echo "Updating core for $PLATFORM"
SUFFIX=$(instantiateClean semgrep.common.core.data."$1".suffix "$PLATFORM")
OLD_HASH=$(instantiateClean semgrep.common.core.data."$1".sha256 "$PLATFORM")
SUFFIX=$(instantiateClean semgrep.common.core.data."$PLATFORM".suffix)
OLD_HASH=$(instantiateClean semgrep.common.core.data."$PLATFORM".sha256)
echo "Old hash $OLD_HASH"
NEW_URL="https://github.com/returntocorp/semgrep/releases/download/v$NEW_VERSION/semgrep-v$NEW_VERSION$SUFFIX"
@ -123,7 +123,7 @@ nix-instantiate -E "with import $NIXPKGS_ROOT {}; builtins.attrNames semgrep.pas
NEW_URL=$(instantiateClean semgrep.passthru.common.submodules."$SUBMODULE".url | sed "s@$OLD_REV@$NEW_REV@g")
NEW_HASH=$(nix --experimental-features nix-command hash to-sri "sha256:$(nix-prefetch-url "$NEW_URL")")
TMP_HASH="sha256-ABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
TMP_HASH="sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
replace "$OLD_REV" "$NEW_REV" "$COMMON_FILE"
replace "$OLD_HASH" "$TMP_HASH" "$COMMON_FILE"
NEW_HASH="$(fetchgithub semgrep.passthru.common.submodules."$SUBMODULE")"