##// END OF EJS Templates
packaging: Subversion 1.8 -> 1.9...
johbo -
r72:e84adf60 default
parent child Browse files
Show More
@@ -1,145 +1,144 b''
1 1 # Nix environment for the community edition
2 2 #
3 3 # This shall be as lean as possible, just producing the rhodecode-vcsserver
4 4 # derivation. For advanced tweaks to pimp up the development environment we use
5 5 # "shell.nix" so that it does not have to clutter this file.
6 6
7 7 { pkgs ? (import <nixpkgs> {})
8 8 , pythonPackages ? "python27Packages"
9 9 , pythonExternalOverrides ? self: super: {}
10 10 , doCheck ? true
11 11 }:
12 12
13 13 let pkgs_ = pkgs; in
14 14
15 15 let
16 16 pkgs = pkgs_.overridePackages (self: super: {
17 17 # Override subversion derivation to
18 18 # - activate python bindings
19 # - set version to 1.8
20 subversion = super.subversion18.override {
19 subversion = super.subversion.override {
21 20 httpSupport = true;
22 21 pythonBindings = true;
23 22 python = self.python27Packages.python;
24 23 };
25 24 });
26 25
27 26 inherit (pkgs.lib) fix extends;
28 27
29 28 basePythonPackages = with builtins; if isAttrs pythonPackages
30 29 then pythonPackages
31 30 else getAttr pythonPackages pkgs;
32 31
33 32 elem = builtins.elem;
34 33 basename = path: with pkgs.lib; last (splitString "/" path);
35 34 startsWith = prefix: full: let
36 35 actualPrefix = builtins.substring 0 (builtins.stringLength prefix) full;
37 36 in actualPrefix == prefix;
38 37
39 38 src-filter = path: type: with pkgs.lib;
40 39 let
41 40 ext = last (splitString "." path);
42 41 in
43 42 !elem (basename path) [
44 43 ".git" ".hg" "__pycache__" ".eggs" "node_modules"
45 44 "build" "data" "tmp"] &&
46 45 !elem ext ["egg-info" "pyc"] &&
47 46 !startsWith "result" path;
48 47
49 48 rhodecode-vcsserver-src = builtins.filterSource src-filter ./.;
50 49
51 50 pythonGeneratedPackages = self: basePythonPackages.override (a: {
52 51 inherit self;
53 52 })
54 53 // (scopedImport {
55 54 self = self;
56 55 super = basePythonPackages;
57 56 inherit pkgs;
58 57 inherit (pkgs) fetchurl fetchgit;
59 58 } ./pkgs/python-packages.nix);
60 59
61 60 pythonOverrides = import ./pkgs/python-packages-overrides.nix {
62 61 inherit
63 62 basePythonPackages
64 63 pkgs;
65 64 };
66 65
67 66 version = builtins.readFile ./vcsserver/VERSION;
68 67
69 68 pythonLocalOverrides = self: super: {
70 69 rhodecode-vcsserver = super.rhodecode-vcsserver.override (attrs: {
71 70 inherit
72 71 doCheck
73 72 version;
74 73 name = "rhodecode-vcsserver-${version}";
75 74 releaseName = "RhodeCodeVCSServer-${version}";
76 75 src = rhodecode-vcsserver-src;
77 76
78 77 propagatedBuildInputs = attrs.propagatedBuildInputs ++ ([
79 78 pkgs.git
80 79 pkgs.subversion
81 80 ]);
82 81
83 82 # TODO: johbo: Make a nicer way to expose the parts. Maybe
84 83 # pkgs/default.nix?
85 84 passthru = {
86 85 pythonPackages = self;
87 86 };
88 87
89 88 # Somewhat snappier setup of the development environment
90 89 # TODO: move into shell.nix
91 90 # TODO: think of supporting a stable path again, so that multiple shells
92 91 # can share it.
93 92 shellHook = ''
94 93 # Set locale
95 94 export LC_ALL="en_US.UTF-8"
96 95
97 96 tmp_path=$(mktemp -d)
98 97 export PATH="$tmp_path/bin:$PATH"
99 98 export PYTHONPATH="$tmp_path/${self.python.sitePackages}:$PYTHONPATH"
100 99 mkdir -p $tmp_path/${self.python.sitePackages}
101 100 python setup.py develop --prefix $tmp_path --allow-hosts ""
102 101 '';
103 102
104 103 # Add VCSServer bin directory to path so that tests can find 'vcsserver'.
105 104 preCheck = ''
106 105 export PATH="$out/bin:$PATH"
107 106 '';
108 107
109 108 postInstall = ''
110 109 echo "Writing meta information for rccontrol to nix-support/rccontrol"
111 110 mkdir -p $out/nix-support/rccontrol
112 111 cp -v vcsserver/VERSION $out/nix-support/rccontrol/version
113 112 echo "DONE: Meta information for rccontrol written"
114 113
115 114 ln -s ${self.pyramid}/bin/* $out/bin #*/
116 115 ln -s ${self.gunicorn}/bin/gunicorn $out/bin/
117 116
118 117 # Symlink version control utilities
119 118 #
120 119 # We ensure that always the correct version is available as a symlink.
121 120 # So that users calling them via the profile path will always use the
122 121 # correct version.
123 122 ln -s ${pkgs.git}/bin/git $out/bin
124 123 ln -s ${self.mercurial}/bin/hg $out/bin
125 124 ln -s ${pkgs.subversion}/bin/svn* $out/bin
126 125
127 126 for file in $out/bin/*; do #*/
128 127 wrapProgram $file \
129 128 --prefix PYTHONPATH : $PYTHONPATH \
130 129 --set PYTHONHASHSEED random
131 130 done
132 131 '';
133 132
134 133 });
135 134 };
136 135
137 136 # Apply all overrides and fix the final package set
138 137 myPythonPackages =
139 138 (fix
140 139 (extends pythonExternalOverrides
141 140 (extends pythonLocalOverrides
142 141 (extends pythonOverrides
143 142 pythonGeneratedPackages))));
144 143
145 144 in myPythonPackages.rhodecode-vcsserver
General Comments 0
You need to be logged in to leave comments. Login now