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 {
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;
nativeBuildInputs = stdenv.lib.optional stdenv.isDarwin shortenPerlShebang;
installPhase = ''
mkdir -p $out/bin
for d in bin/sqitch etc lib share ; do
# make sure dest alreay exists before symlink
# this prevents installing a broken link into the path
if [ -e ${sqitchModule}/$d ]; then
ln -s ${sqitchModule}/$d $out/$d
if [ -e ${sqitch}/$d ]; then
ln -s ${sqitch}/$d $out/$d
fi
done
'' + stdenv.lib.optionalString stdenv.isDarwin ''
'' + lib.optionalString stdenv.isDarwin ''
shortenPerlShebang $out/bin/sqitch
'';
dontStrip = true;
postFixup = "wrapProgram $out/bin/sqitch --prefix PERL5LIB : $PERL5LIB";
postFixup = ''
wrapProgram $out/bin/sqitch --prefix PERL5LIB : ${perlPackages.makeFullPerlPath modules}
'';
meta = {
platforms = stdenv.lib.platforms.unix;
inherit (sqitchModule.meta) license;
inherit (sqitch.meta) description homepage license platforms;
};
}

View file

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