{nukeReferences,removeReferencesTo}: simplify and fix quoting
This commit is contained in:
@@ -1,5 +0,0 @@
|
|||||||
# Fixup hook for nukeReferences, not stdenv
|
|
||||||
|
|
||||||
source @signingUtils@
|
|
||||||
|
|
||||||
fixupHooks+=(signIfRequired)
|
|
||||||
@@ -11,12 +11,6 @@
|
|||||||
shell ? stdenvNoCC.shell,
|
shell ? stdenvNoCC.shell,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
|
||||||
stdenv = stdenvNoCC;
|
|
||||||
|
|
||||||
darwinCodeSign = stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64;
|
|
||||||
in
|
|
||||||
|
|
||||||
stdenvNoCC.mkDerivation {
|
stdenvNoCC.mkDerivation {
|
||||||
name = "nuke-references";
|
name = "nuke-references";
|
||||||
|
|
||||||
@@ -32,17 +26,14 @@ stdenvNoCC.mkDerivation {
|
|||||||
chmod a+x $out/bin/nuke-refs
|
chmod a+x $out/bin/nuke-refs
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postFixup = lib.optionalString darwinCodeSign ''
|
|
||||||
mkdir -p $out/nix-support
|
|
||||||
substituteAll ${./darwin-sign-fixup.sh} $out/nix-support/setup-hooks.sh
|
|
||||||
'';
|
|
||||||
|
|
||||||
# FIXME: get rid of perl dependency.
|
# FIXME: get rid of perl dependency.
|
||||||
env = {
|
env = {
|
||||||
inherit perl;
|
inherit perl;
|
||||||
inherit (builtins) storeDir;
|
inherit (builtins) storeDir;
|
||||||
shell = lib.getBin shell + (shell.shellPath or "");
|
shell = lib.getBin shell + (shell.shellPath or "");
|
||||||
signingUtils = lib.optionalString darwinCodeSign signingUtils;
|
signingUtils = lib.optionalString (
|
||||||
|
stdenvNoCC.targetPlatform.isDarwin && stdenvNoCC.targetPlatform.isAarch64
|
||||||
|
) signingUtils;
|
||||||
};
|
};
|
||||||
|
|
||||||
meta.mainProgram = "nuke-refs";
|
meta.mainProgram = "nuke-refs";
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
fixupHooks=()
|
fixupHooks=()
|
||||||
|
|
||||||
if [ -e @out@/nix-support/setup-hooks.sh ]; then
|
if [[ -n "@signingUtils@" ]]; then
|
||||||
source @out@/nix-support/setup-hooks.sh
|
source "@signingUtils@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
excludes=""
|
excludes=""
|
||||||
@@ -25,9 +25,8 @@ for i in "$@"; do
|
|||||||
cat "$i" | @perl@/bin/perl -pe "s|\Q@storeDir@\E/$excludes[a-z0-9]{32}-|@storeDir@/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-|g" > "$i.tmp"
|
cat "$i" | @perl@/bin/perl -pe "s|\Q@storeDir@\E/$excludes[a-z0-9]{32}-|@storeDir@/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-|g" > "$i.tmp"
|
||||||
if test -x "$i"; then chmod +x "$i.tmp"; fi
|
if test -x "$i"; then chmod +x "$i.tmp"; fi
|
||||||
mv "$i.tmp" "$i"
|
mv "$i.tmp" "$i"
|
||||||
|
if [[ -n "@signingUtils@" ]]; then
|
||||||
for hook in "${fixupHooks[@]}"; do
|
signIfRequired "$i"
|
||||||
eval "$hook" "$i"
|
fi
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
# Fixup hook for nukeReferences, not stdenv
|
|
||||||
|
|
||||||
source @signingUtils@
|
|
||||||
|
|
||||||
fixupHooks+=(signIfRequired)
|
|
||||||
@@ -10,13 +10,7 @@
|
|||||||
shell ? stdenvNoCC.shell,
|
shell ? stdenvNoCC.shell,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
stdenvNoCC.mkDerivation {
|
||||||
stdenv = stdenvNoCC;
|
|
||||||
|
|
||||||
darwinCodeSign = stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64;
|
|
||||||
in
|
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
name = "remove-references-to";
|
name = "remove-references-to";
|
||||||
|
|
||||||
dontUnpack = true;
|
dontUnpack = true;
|
||||||
@@ -29,16 +23,13 @@ stdenv.mkDerivation {
|
|||||||
chmod a+x $out/bin/remove-references-to
|
chmod a+x $out/bin/remove-references-to
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postFixup = lib.optionalString darwinCodeSign ''
|
|
||||||
mkdir -p $out/nix-support
|
|
||||||
substituteAll ${./darwin-sign-fixup.sh} $out/nix-support/setup-hooks.sh
|
|
||||||
'';
|
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
inherit (builtins) storeDir;
|
inherit (builtins) storeDir;
|
||||||
shell = lib.getBin shell + (shell.shellPath or "");
|
shell = lib.getBin shell + (shell.shellPath or "");
|
||||||
}
|
signingUtils = lib.optionalString (
|
||||||
// lib.optionalAttrs darwinCodeSign { inherit signingUtils; };
|
stdenvNoCC.targetPlatform.isDarwin && stdenvNoCC.targetPlatform.isAarch64
|
||||||
|
) signingUtils;
|
||||||
|
};
|
||||||
|
|
||||||
meta.mainProgram = "remove-references-to";
|
meta.mainProgram = "remove-references-to";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,6 @@
|
|||||||
|
|
||||||
fixupHooks=()
|
fixupHooks=()
|
||||||
|
|
||||||
if [ -e @out@/nix-support/setup-hooks.sh ]; then
|
|
||||||
source @out@/nix-support/setup-hooks.sh
|
|
||||||
fi
|
|
||||||
|
|
||||||
# References to remove
|
# References to remove
|
||||||
targets=()
|
targets=()
|
||||||
while getopts t: o; do
|
while getopts t: o; do
|
||||||
@@ -30,8 +26,9 @@ for target in "${targets[@]}" ; do
|
|||||||
sed -i -e "s|$target|eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee|g" "${regions[@]}"
|
sed -i -e "s|$target|eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee|g" "${regions[@]}"
|
||||||
done
|
done
|
||||||
|
|
||||||
for region in "${regions[@]}"; do
|
if [[ -n "@signingUtils@" ]]; then
|
||||||
for hook in "${fixupHooks[@]}"; do
|
source "@signingUtils@"
|
||||||
eval "$hook" "$region"
|
for region in "${regions[@]}"; do
|
||||||
|
signIfRequired "$region"
|
||||||
done
|
done
|
||||||
done
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user