2021-01-11 07:54:33 +00:00
|
|
|
{lib, stdenv, fetchFromGitHub, git, mercurial, makeWrapper}:
|
2011-10-22 15:41:20 +00:00
|
|
|
|
2019-05-01 16:47:08 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "fast-export";
|
2020-05-07 22:32:41 +00:00
|
|
|
version = "200213";
|
2009-10-27 17:46:37 +00:00
|
|
|
|
2020-05-07 22:32:41 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "frej";
|
|
|
|
repo = pname;
|
2019-05-01 16:47:08 +00:00
|
|
|
rev = "v${version}";
|
2020-05-07 22:32:41 +00:00
|
|
|
sha256 = "0hzyh66rlawxip4n2pvz7pbs0cq82clqv1d6c7hf60v1drjxw287";
|
2011-10-22 15:41:20 +00:00
|
|
|
};
|
2009-10-27 17:46:37 +00:00
|
|
|
|
2019-05-01 16:47:08 +00:00
|
|
|
buildInputs = [mercurial.python mercurial makeWrapper];
|
2009-10-27 17:46:37 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2019-05-01 16:47:08 +00:00
|
|
|
binPath=$out/bin
|
|
|
|
libexecPath=$out/libexec/${pname}
|
|
|
|
sitepackagesPath=$out/${mercurial.python.sitePackages}
|
|
|
|
mkdir -p $binPath $libexecPath $sitepackagesPath
|
|
|
|
|
|
|
|
# Patch shell scripts so they can execute the Python scripts
|
|
|
|
sed -i "s|ROOT=.*|ROOT=$libexecPath|" *.sh
|
|
|
|
|
|
|
|
mv hg-fast-export.sh hg-reset.sh $binPath
|
|
|
|
mv hg-fast-export.py hg-reset.py $libexecPath
|
|
|
|
mv hg2git.py pluginloader plugins $sitepackagesPath
|
|
|
|
|
|
|
|
for script in $out/bin/*.sh; do
|
|
|
|
wrapProgram $script \
|
2020-05-07 22:32:41 +00:00
|
|
|
--prefix PATH : "${git}/bin":"${mercurial.python}/bin":$libexec \
|
2019-05-01 16:47:08 +00:00
|
|
|
--prefix PYTHONPATH : "${mercurial}/${mercurial.python.sitePackages}":$sitepackagesPath
|
2009-10-27 17:46:37 +00:00
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2020-05-07 22:34:20 +00:00
|
|
|
doInstallCheck = true;
|
|
|
|
# deliberately not adding git or hg into installCheckInputs - package should
|
|
|
|
# be able to work without them in runtime env
|
|
|
|
installCheckPhase = ''
|
|
|
|
mkdir repo-hg
|
|
|
|
pushd repo-hg
|
|
|
|
${mercurial}/bin/hg init
|
|
|
|
echo foo > bar
|
|
|
|
${mercurial}/bin/hg add bar
|
|
|
|
${mercurial}/bin/hg commit --message "baz"
|
|
|
|
popd
|
|
|
|
|
|
|
|
mkdir repo-git
|
|
|
|
pushd repo-git
|
|
|
|
${git}/bin/git init
|
|
|
|
${git}/bin/git config core.ignoreCase false # for darwin
|
|
|
|
$out/bin/hg-fast-export.sh -r ../repo-hg/ --hg-hash
|
|
|
|
for s in "foo" "bar" "baz" ; do
|
|
|
|
(${git}/bin/git show | grep $s > /dev/null) && echo $s found
|
|
|
|
done
|
|
|
|
popd
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-05-01 16:47:08 +00:00
|
|
|
description = "Import mercurial into git";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://repo.or.cz/w/fast-export.git";
|
2014-12-30 13:45:30 +00:00
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = [ maintainers.koral ];
|
2019-05-01 16:47:08 +00:00
|
|
|
platforms = platforms.unix;
|
2009-10-27 17:46:37 +00:00
|
|
|
};
|
|
|
|
}
|