mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-09-11 14:35:30 +03:00
fix: php: set package name
package name and composer.json#name can be different (mostly happens in private repositories) set the composer.json#name to the package name before including the package in other one
This commit is contained in:
parent
c2c61b82b1
commit
c523f2c17e
@ -148,6 +148,7 @@
|
||||
nativeBuildInputs = with pkgs; [
|
||||
jq
|
||||
composer
|
||||
moreutils
|
||||
];
|
||||
buildInputs = with pkgs;
|
||||
[
|
||||
@ -169,26 +170,29 @@
|
||||
|
||||
pushd $PKG_OUT
|
||||
|
||||
# create composer.json if does not exist
|
||||
if [ ! -f composer.json ]
|
||||
then
|
||||
echo {\"name\":\"${name}\"} > composer.json
|
||||
echo "{}" > composer.json
|
||||
fi
|
||||
cp composer.json composer.json.orig
|
||||
|
||||
# remove composer.lock if exists
|
||||
rm -f composer.lock
|
||||
# fixup composer.json
|
||||
jq \
|
||||
"(.name = \"${name}\") | \
|
||||
(.version = \"${versionString}\")" \
|
||||
composer.json | sponge composer.json
|
||||
|
||||
# disable packagist, set path repositories
|
||||
mv composer.json composer.json.orig
|
||||
|
||||
jq \
|
||||
--slurpfile repositories $repositoriesStringPath \
|
||||
--slurpfile dependencies $dependenciesStringPath \
|
||||
"(.repositories = \$repositories[0]) | \
|
||||
(.require = \$dependencies[0]) | \
|
||||
(.\"require-dev\" = {}) | \
|
||||
(.version = \"${versionString}\")" \
|
||||
composer.json.orig > composer.json
|
||||
(.\"require-dev\" = {})" \
|
||||
composer.json | sponge composer.json
|
||||
|
||||
# remove composer.lock if exists
|
||||
rm -f composer.lock
|
||||
|
||||
# build
|
||||
composer install --no-scripts
|
||||
|
@ -81,6 +81,10 @@
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "${l.strings.sanitizeDerivationName name}-source";
|
||||
inherit version;
|
||||
versionString =
|
||||
if version == "unknown"
|
||||
then "0.0.0"
|
||||
else version;
|
||||
src = getSource name version;
|
||||
dontConfigure = true;
|
||||
buildPhase = ''
|
||||
@ -88,7 +92,9 @@
|
||||
cp -r ${src} $out
|
||||
if [ ! -f $out/composer.json ]
|
||||
then
|
||||
echo {\"name\":\"${name}\"} > $out/composer.json
|
||||
echo \
|
||||
{\"name\":\"${name}\",\"version\":\"${versionString}\"} \
|
||||
> $out/composer.json
|
||||
fi
|
||||
'';
|
||||
dontInstall = true;
|
||||
@ -142,6 +148,7 @@
|
||||
nativeBuildInputs = with pkgs; [
|
||||
jq
|
||||
composer
|
||||
moreutils
|
||||
];
|
||||
buildInputs = with pkgs; [
|
||||
php
|
||||
@ -160,20 +167,29 @@
|
||||
|
||||
pushd $PKG_OUT
|
||||
|
||||
# remove composer.lock if exists
|
||||
rm -f composer.lock
|
||||
if [ ! -f composer.json ]
|
||||
then
|
||||
echo "{}" > composer.json
|
||||
fi
|
||||
cp composer.json composer.json.orig
|
||||
|
||||
# fixup composer.json
|
||||
jq \
|
||||
"(.name = \"${name}\") | \
|
||||
(.version = \"${versionString}\")" \
|
||||
composer.json | sponge composer.json
|
||||
|
||||
# disable packagist, set path repositories
|
||||
mv composer.json composer.json.orig
|
||||
|
||||
jq \
|
||||
--slurpfile repositories $repositoriesStringPath \
|
||||
--slurpfile dependencies $dependenciesStringPath \
|
||||
"(.repositories = \$repositories[0]) | \
|
||||
(.require = \$dependencies[0]) | \
|
||||
(.\"require-dev\" = {}) | \
|
||||
(.version = \"${versionString}\")" \
|
||||
composer.json.orig > composer.json
|
||||
(.\"require-dev\" = {})" \
|
||||
composer.json | sponge composer.json
|
||||
|
||||
# remove composer.lock if exists
|
||||
rm -f composer.lock
|
||||
|
||||
# build
|
||||
composer install --no-scripts
|
||||
|
Loading…
Reference in New Issue
Block a user