sqitch: package cleanup

This commit is contained in:
Aaron Andersen 2020-12-15 21:05:38 -05:00
parent 5d5e970ce0
commit 3557bb49b0
2 changed files with 32 additions and 22 deletions

View File

@ -1,32 +1,46 @@
{ name, stdenv, perl, makeWrapper, sqitchModule, databaseModule, shortenPerlShebang }: { stdenv
, lib
, perlPackages
, makeWrapper
, shortenPerlShebang
, mysqlSupport ? false
, postgresqlSupport ? false
}:
let
sqitch = perlPackages.AppSqitch;
modules = with perlPackages; [ ]
++ lib.optional mysqlSupport DBDmysql
++ lib.optional postgresqlSupport DBDPg;
in
stdenv.mkDerivation { stdenv.mkDerivation {
name = "${name}-${sqitchModule.version}"; pname = "sqitch";
version = sqitch.version;
buildInputs = [ perl makeWrapper sqitchModule databaseModule ]; nativeBuildInputs = [ makeWrapper ] ++ lib.optional stdenv.isDarwin shortenPerlShebang;
src = sqitchModule; src = sqitch;
dontBuild = true; dontBuild = true;
nativeBuildInputs = stdenv.lib.optional stdenv.isDarwin shortenPerlShebang;
installPhase = '' installPhase = ''
mkdir -p $out/bin mkdir -p $out/bin
for d in bin/sqitch etc lib share ; do for d in bin/sqitch etc lib share ; do
# make sure dest alreay exists before symlink # make sure dest alreay exists before symlink
# this prevents installing a broken link into the path # this prevents installing a broken link into the path
if [ -e ${sqitchModule}/$d ]; then if [ -e ${sqitch}/$d ]; then
ln -s ${sqitchModule}/$d $out/$d ln -s ${sqitch}/$d $out/$d
fi fi
done done
'' + stdenv.lib.optionalString stdenv.isDarwin '' '' + lib.optionalString stdenv.isDarwin ''
shortenPerlShebang $out/bin/sqitch shortenPerlShebang $out/bin/sqitch
''; '';
dontStrip = true; dontStrip = true;
postFixup = "wrapProgram $out/bin/sqitch --prefix PERL5LIB : $PERL5LIB"; postFixup = ''
wrapProgram $out/bin/sqitch --prefix PERL5LIB : ${perlPackages.makeFullPerlPath modules}
'';
meta = { meta = {
platforms = stdenv.lib.platforms.unix; inherit (sqitch.meta) description homepage license platforms;
inherit (sqitchModule.meta) license;
}; };
} }

View File

@ -16803,17 +16803,13 @@ in
perlcritic = perlPackages.PerlCritic; perlcritic = perlPackages.PerlCritic;
sqitchMysql = callPackage ../development/tools/misc/sqitch { sqitchMysql = (callPackage ../development/tools/misc/sqitch {
name = "sqitch-mysql"; mysqlSupport = true;
databaseModule = perlPackages.DBDmysql; }).overrideAttrs (oldAttrs: { pname = "sqitch-mysql"; });
sqitchModule = perlPackages.AppSqitch;
};
sqitchPg = callPackage ../development/tools/misc/sqitch { sqitchPg = (callPackage ../development/tools/misc/sqitch {
name = "sqitch-pg"; postgresqlSupport = true;
databaseModule = perlPackages.DBDPg; }).overrideAttrs (oldAttrs: { pname = "sqitch-pg"; });
sqitchModule = perlPackages.AppSqitch;
};
### DEVELOPMENT / R MODULES ### DEVELOPMENT / R MODULES