build-support/php: fix environment variables for Composer (#343900)
This commit is contained in:
commit
568bfef547
@ -94,12 +94,6 @@ let
|
||||
or (if finalAttrs.composerRepository.composerLock == null then nix-update-script { } else null);
|
||||
};
|
||||
|
||||
env = {
|
||||
COMPOSER_CACHE_DIR = "/dev/null";
|
||||
COMPOSER_DISABLE_NETWORK = "1";
|
||||
COMPOSER_MIRROR_PATH_REPOS = "1";
|
||||
};
|
||||
|
||||
meta = previousAttrs.meta or { } // {
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
|
@ -102,13 +102,6 @@ let
|
||||
runHook postInstallCheck
|
||||
'';
|
||||
|
||||
env = {
|
||||
COMPOSER_CACHE_DIR = "/dev/null";
|
||||
COMPOSER_MIRROR_PATH_REPOS = "1";
|
||||
COMPOSER_HTACCESS_PROTECT = "0";
|
||||
COMPOSER_DISABLE_NETWORK = "0";
|
||||
};
|
||||
|
||||
outputHashMode = "recursive";
|
||||
outputHashAlgo =
|
||||
if (finalAttrs ? vendorHash && finalAttrs.vendorHash != "") then null else "sha256";
|
||||
|
@ -149,12 +149,6 @@ let
|
||||
or (if finalAttrs.vendor.composerLock == null then nix-update-script { } else null);
|
||||
};
|
||||
|
||||
env = {
|
||||
COMPOSER_CACHE_DIR = "/dev/null";
|
||||
COMPOSER_DISABLE_NETWORK = "1";
|
||||
COMPOSER_MIRROR_PATH_REPOS = "1";
|
||||
};
|
||||
|
||||
meta = previousAttrs.meta or composer.meta;
|
||||
};
|
||||
in
|
||||
|
@ -24,7 +24,7 @@ composerInstallConfigureHook() {
|
||||
fi
|
||||
|
||||
if [[ ! -f "composer.lock" ]]; then
|
||||
setComposeRootVersion
|
||||
setComposerRootVersion
|
||||
|
||||
composer \
|
||||
--no-install \
|
||||
@ -79,7 +79,7 @@ composerInstallConfigureHook() {
|
||||
composerInstallBuildHook() {
|
||||
echo "Executing composerInstallBuildHook"
|
||||
|
||||
setComposeRootVersion
|
||||
setComposerRootVersion
|
||||
|
||||
# Since this file cannot be generated in the composer-repository-hook.sh
|
||||
# because the file contains hardcoded nix store paths, we generate it here.
|
||||
@ -99,7 +99,8 @@ composerInstallCheckHook() {
|
||||
composerInstallInstallHook() {
|
||||
echo "Executing composerInstallInstallHook"
|
||||
|
||||
setComposeRootVersion
|
||||
setComposerRootVersion
|
||||
setComposerEnvVariables
|
||||
|
||||
# Finally, run `composer install` to install the dependencies and generate
|
||||
# the autoloader.
|
||||
|
@ -20,7 +20,7 @@ composerRepositoryConfigureHook() {
|
||||
fi
|
||||
|
||||
if [[ ! -f "composer.lock" ]]; then
|
||||
setComposeRootVersion
|
||||
setComposerRootVersion
|
||||
|
||||
composer \
|
||||
--no-install \
|
||||
@ -58,7 +58,7 @@ composerRepositoryBuildHook() {
|
||||
|
||||
mkdir -p repository
|
||||
|
||||
setComposeRootVersion
|
||||
setComposerRootVersion
|
||||
|
||||
# Build the local composer repository
|
||||
# The command 'build-local-repo' is provided by the Composer plugin
|
||||
|
@ -28,7 +28,7 @@ composerWithPluginConfigureHook() {
|
||||
cp -ar $src $out/src
|
||||
|
||||
if [[ ! -f "$out/composer.lock" ]]; then
|
||||
setComposeRootVersion
|
||||
setComposerRootVersion
|
||||
|
||||
composer \
|
||||
global \
|
||||
|
@ -2,7 +2,7 @@ declare version
|
||||
declare composerStrictValidation
|
||||
declare composerGlobal
|
||||
|
||||
setComposeRootVersion() {
|
||||
setComposerRootVersion() {
|
||||
set +e # Disable exit on error
|
||||
|
||||
if [[ -v version ]]; then
|
||||
@ -13,8 +13,15 @@ setComposeRootVersion() {
|
||||
set -e
|
||||
}
|
||||
|
||||
setComposerEnvVariables() {
|
||||
echo -e "\e[32mSetting some required environment variables for Composer...\e[0m"
|
||||
export COMPOSER_MIRROR_PATH_REPOS=1
|
||||
export COMPOSER_CACHE_DIR=/dev/null
|
||||
export COMPOSER_HTACCESS_PROTECT=0
|
||||
}
|
||||
|
||||
checkComposerValidate() {
|
||||
setComposeRootVersion
|
||||
setComposerRootVersion
|
||||
|
||||
if [ "1" == "${composerGlobal-}" ]; then
|
||||
global="global";
|
||||
|
@ -94,12 +94,6 @@ let
|
||||
or (if finalAttrs.composerVendor.composerLock == null then nix-update-script { } else null);
|
||||
};
|
||||
|
||||
env = {
|
||||
COMPOSER_CACHE_DIR = "/dev/null";
|
||||
COMPOSER_DISABLE_NETWORK = "1";
|
||||
COMPOSER_MIRROR_PATH_REPOS = "1";
|
||||
};
|
||||
|
||||
meta = previousAttrs.meta or { } // {
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
|
@ -87,13 +87,6 @@ let
|
||||
runHook postInstallCheck
|
||||
'';
|
||||
|
||||
env = {
|
||||
COMPOSER_CACHE_DIR = "/dev/null";
|
||||
COMPOSER_MIRROR_PATH_REPOS = "1";
|
||||
COMPOSER_HTACCESS_PROTECT = "0";
|
||||
COMPOSER_DISABLE_NETWORK = "0";
|
||||
};
|
||||
|
||||
outputHashMode = "recursive";
|
||||
outputHashAlgo =
|
||||
if (finalAttrs ? vendorHash && finalAttrs.vendorHash != "") then null else "sha256";
|
||||
|
@ -14,7 +14,7 @@ source @phpScriptUtils@
|
||||
composerInstallConfigureHook() {
|
||||
echo "Executing composerInstallConfigureHook"
|
||||
|
||||
setComposeRootVersion
|
||||
setComposerRootVersion
|
||||
|
||||
if [[ ! -e "${composerVendor}" ]]; then
|
||||
echo "No local composer vendor found."
|
||||
|
@ -15,7 +15,7 @@ source @phpScriptUtils@
|
||||
composerVendorConfigureHook() {
|
||||
echo "Executing composerVendorConfigureHook"
|
||||
|
||||
setComposeRootVersion
|
||||
setComposerRootVersion
|
||||
|
||||
if [[ -e "$composerLock" ]]; then
|
||||
echo -e "\e[32mUsing user provided \`composer.lock\` file from \`$composerLock\`\e[0m"
|
||||
@ -59,11 +59,13 @@ composerVendorConfigureHook() {
|
||||
composerVendorBuildHook() {
|
||||
echo "Executing composerVendorBuildHook"
|
||||
|
||||
setComposerEnvVariables
|
||||
|
||||
composer \
|
||||
# The acpu-autoloader is not reproducible and has to be disabled.
|
||||
# Upstream PR: https://github.com/composer/composer/pull/12090
|
||||
# --apcu-autoloader \
|
||||
# --apcu-autoloader-prefix="$(jq -r -c 'try ."content-hash"' < composer.lock)" \
|
||||
`# The acpu-autoloader is not reproducible and has to be disabled.` \
|
||||
`# Upstream PR: https://github.com/composer/composer/pull/12090` \
|
||||
`# --apcu-autoloader` \
|
||||
`# --apcu-autoloader-prefix="$(jq -r -c 'try ."content-hash"' < composer.lock)"` \
|
||||
--no-interaction \
|
||||
--no-progress \
|
||||
--optimize-autoloader \
|
||||
|
@ -2,7 +2,7 @@ declare version
|
||||
declare composerStrictValidation
|
||||
declare composerGlobal
|
||||
|
||||
setComposeRootVersion() {
|
||||
setComposerRootVersion() {
|
||||
set +e # Disable exit on error
|
||||
|
||||
if [[ -v version ]]; then
|
||||
@ -13,6 +13,13 @@ setComposeRootVersion() {
|
||||
set -e
|
||||
}
|
||||
|
||||
setComposerEnvVariables() {
|
||||
echo -e "\e[32mSetting some required environment variables for Composer...\e[0m"
|
||||
export COMPOSER_MIRROR_PATH_REPOS=1
|
||||
export COMPOSER_CACHE_DIR=/dev/null
|
||||
export COMPOSER_HTACCESS_PROTECT=0
|
||||
}
|
||||
|
||||
checkComposerValidate() {
|
||||
if [ "1" == "${composerGlobal-}" ]; then
|
||||
global="global";
|
||||
|
Loading…
Reference in New Issue
Block a user