{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,
|
||||
}:
|
||||
|
||||
let
|
||||
stdenv = stdenvNoCC;
|
||||
|
||||
darwinCodeSign = stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64;
|
||||
in
|
||||
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "nuke-references";
|
||||
|
||||
@@ -32,17 +26,14 @@ stdenvNoCC.mkDerivation {
|
||||
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.
|
||||
env = {
|
||||
inherit perl;
|
||||
inherit (builtins) storeDir;
|
||||
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";
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
fixupHooks=()
|
||||
|
||||
if [ -e @out@/nix-support/setup-hooks.sh ]; then
|
||||
source @out@/nix-support/setup-hooks.sh
|
||||
if [[ -n "@signingUtils@" ]]; then
|
||||
source "@signingUtils@"
|
||||
fi
|
||||
|
||||
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"
|
||||
if test -x "$i"; then chmod +x "$i.tmp"; fi
|
||||
mv "$i.tmp" "$i"
|
||||
|
||||
for hook in "${fixupHooks[@]}"; do
|
||||
eval "$hook" "$i"
|
||||
done
|
||||
if [[ -n "@signingUtils@" ]]; then
|
||||
signIfRequired "$i"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# Fixup hook for nukeReferences, not stdenv
|
||||
|
||||
source @signingUtils@
|
||||
|
||||
fixupHooks+=(signIfRequired)
|
||||
@@ -10,13 +10,7 @@
|
||||
shell ? stdenvNoCC.shell,
|
||||
}:
|
||||
|
||||
let
|
||||
stdenv = stdenvNoCC;
|
||||
|
||||
darwinCodeSign = stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64;
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "remove-references-to";
|
||||
|
||||
dontUnpack = true;
|
||||
@@ -29,16 +23,13 @@ stdenv.mkDerivation {
|
||||
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 = {
|
||||
inherit (builtins) storeDir;
|
||||
shell = lib.getBin shell + (shell.shellPath or "");
|
||||
}
|
||||
// lib.optionalAttrs darwinCodeSign { inherit signingUtils; };
|
||||
signingUtils = lib.optionalString (
|
||||
stdenvNoCC.targetPlatform.isDarwin && stdenvNoCC.targetPlatform.isAarch64
|
||||
) signingUtils;
|
||||
};
|
||||
|
||||
meta.mainProgram = "remove-references-to";
|
||||
}
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
|
||||
fixupHooks=()
|
||||
|
||||
if [ -e @out@/nix-support/setup-hooks.sh ]; then
|
||||
source @out@/nix-support/setup-hooks.sh
|
||||
fi
|
||||
|
||||
# References to remove
|
||||
targets=()
|
||||
while getopts t: o; do
|
||||
@@ -30,8 +26,9 @@ for target in "${targets[@]}" ; do
|
||||
sed -i -e "s|$target|eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee|g" "${regions[@]}"
|
||||
done
|
||||
|
||||
for region in "${regions[@]}"; do
|
||||
for hook in "${fixupHooks[@]}"; do
|
||||
eval "$hook" "$region"
|
||||
if [[ -n "@signingUtils@" ]]; then
|
||||
source "@signingUtils@"
|
||||
for region in "${regions[@]}"; do
|
||||
signIfRequired "$region"
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user