summary refs log tree commit diff
path: root/pkgs/applications/version-management/reposurgeon/default.nix
blob: 55858034b1c4ef1daf7c13cf4c009f5cf34b3eb2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{stdenv, fetchurl, makeWrapper, python27, python27Packages, git,
 docbook_xml_dtd_412, docbook_xml_xslt, asciidoc, xmlto,
 cython ? null,
 bazaar ? null, cvs ? null, darcs ? null, fossil ? null,
 mercurial ? null, monotone ? null, rcs ? null, src ? null,
 subversion ? null, cvs_fast_export ? null }:
with stdenv; with lib;
mkDerivation rec {
  name = "reposurgeon-${meta.version}";
  meta = {
    description = "A tool for editing version-control repository history";
    version = "3.28";
    license = licenses.bsd3;
    homepage = "http://www.catb.org/esr/reposurgeon/";
    maintainers = with maintainers; [ dfoxfranke ];
    platforms = platforms.all;
  };

  src = fetchurl {
    url = "http://www.catb.org/~esr/reposurgeon/reposurgeon-3.28.tar.gz";
    sha256 = "3225b44109b8630310a0ea6fe63a3485d27aa46deaf80e8d07820e01a6f62626";
  };

  # See https://gitlab.com/esr/reposurgeon/issues/17
  patches = [ ./fix-preserve-type.patch ];  

  buildInputs =
    [ docbook_xml_dtd_412 docbook_xml_xslt asciidoc xmlto makeWrapper ] ++
    optional (cython != null) cython
  ;

  preBuild = ''
    makeFlagsArray=(
      XML_CATALOG_FILES="${docbook_xml_dtd_412}/xml/dtd/docbook/catalog.xml ${docbook_xml_xslt}/xml/xsl/docbook/catalog.xml"
      prefix="$out"
      pyinclude="-I${python27}/include/python2.7"
      pylib="-L${python27}/lib -lpython2.7"
    )
  '';

  buildFlags = "all" + (if cython != null then " cyreposurgeon" else "");

  installTargets =
    "install" + (if cython != null then " install-cyreposurgeon" else "")
  ;

  postInstall =
    let
      binpath = makeBinPath (
        filter (x: x != null)
        [ out git bazaar cvs darcs fossil mercurial
          monotone rcs src subversion cvs_fast_export ]
      );
      pythonpath = makeSearchPathOutput "lib" python27.sitePackages (
        filter (x: x != null)
        [ python27Packages.readline or null python27Packages.hglib or null ]
      );
    in ''
      for prog in reposurgeon repodiffer repotool; do
        wrapProgram $out/bin/$prog \
          --prefix PATH : "${binpath}" \
          --prefix PYTHONPATH : "${pythonpath}"
      done
    ''
  ;    
}