##// END OF EJS Templates
packaging: Subversion 1.8 -> 1.9...
johbo -
r812:b55b9717 default
parent child Browse files
Show More
@@ -1,241 +1,240 b''
1 1 # Nix environment for the community edition
2 2 #
3 3 # This shall be as lean as possible, just producing the Enterprise
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 buildBowerComponents =
34 33 pkgs.buildBowerComponents or
35 34 (import ./pkgs/backport-16.03-build-bower-components.nix { inherit pkgs; });
36 35
37 36 elem = builtins.elem;
38 37 basename = path: with pkgs.lib; last (splitString "/" path);
39 38 startsWith = prefix: full: let
40 39 actualPrefix = builtins.substring 0 (builtins.stringLength prefix) full;
41 40 in actualPrefix == prefix;
42 41
43 42 src-filter = path: type: with pkgs.lib;
44 43 let
45 44 ext = last (splitString "." path);
46 45 in
47 46 !elem (basename path) [
48 47 ".git" ".hg" "__pycache__" ".eggs"
49 48 "bower_components" "node_modules"
50 49 "build" "data" "result" "tmp"] &&
51 50 !elem ext ["egg-info" "pyc"] &&
52 51 # TODO: johbo: This check is wrong, since "path" contains an absolute path,
53 52 # it would still be good to restore it since we want to ignore "result-*".
54 53 !startsWith "result" path;
55 54
56 55 sources = pkgs.config.rc.sources or {};
57 56 version = builtins.readFile ./rhodecode/VERSION;
58 57 rhodecode-enterprise-ce-src = builtins.filterSource src-filter ./.;
59 58
60 59 nodeEnv = import ./pkgs/node-default.nix {
61 60 inherit pkgs;
62 61 };
63 62 nodeDependencies = nodeEnv.shell.nodeDependencies;
64 63
65 64 bowerComponents = buildBowerComponents {
66 65 name = "enterprise-ce-${version}";
67 66 generated = ./pkgs/bower-packages.nix;
68 67 src = rhodecode-enterprise-ce-src;
69 68 };
70 69
71 70 pythonGeneratedPackages = self: basePythonPackages.override (a: {
72 71 inherit self;
73 72 })
74 73 // (scopedImport {
75 74 self = self;
76 75 super = basePythonPackages;
77 76 inherit pkgs;
78 77 inherit (pkgs) fetchurl fetchgit;
79 78 } ./pkgs/python-packages.nix);
80 79
81 80 pythonOverrides = import ./pkgs/python-packages-overrides.nix {
82 81 inherit
83 82 basePythonPackages
84 83 pkgs;
85 84 };
86 85
87 86 pythonLocalOverrides = self: super: {
88 87 rhodecode-enterprise-ce =
89 88 let
90 89 linkNodeAndBowerPackages = ''
91 90 echo "Export RhodeCode CE path"
92 91 export RHODECODE_CE_PATH=${rhodecode-enterprise-ce-src}
93 92 echo "Link node packages"
94 93 rm -fr node_modules
95 94 mkdir node_modules
96 95 # johbo: Linking individual packages allows us to run "npm install"
97 96 # inside of a shell to try things out. Re-entering the shell will
98 97 # restore a clean environment.
99 98 ln -s ${nodeDependencies}/lib/node_modules/* node_modules/
100 99
101 100 echo "DONE: Link node packages"
102 101
103 102 echo "Link bower packages"
104 103 rm -fr bower_components
105 104 mkdir bower_components
106 105
107 106 ln -s ${bowerComponents}/bower_components/* bower_components/
108 107 echo "DONE: Link bower packages"
109 108 '';
110 109 in super.rhodecode-enterprise-ce.override (attrs: {
111 110
112 111 inherit
113 112 doCheck
114 113 version;
115 114 name = "rhodecode-enterprise-ce-${version}";
116 115 releaseName = "RhodeCodeEnterpriseCE-${version}";
117 116 src = rhodecode-enterprise-ce-src;
118 117
119 118 buildInputs =
120 119 attrs.buildInputs ++
121 120 (with self; [
122 121 pkgs.nodePackages.bower
123 122 pkgs.nodePackages.grunt-cli
124 123 pkgs.subversion
125 124 pytest-catchlog
126 125 rhodecode-testdata
127 126 ]);
128 127
129 128 propagatedBuildInputs = attrs.propagatedBuildInputs ++ (with self; [
130 129 rhodecode-tools
131 130 ]);
132 131
133 132 # TODO: johbo: Make a nicer way to expose the parts. Maybe
134 133 # pkgs/default.nix?
135 134 passthru = {
136 135 inherit
137 136 bowerComponents
138 137 linkNodeAndBowerPackages
139 138 myPythonPackagesUnfix
140 139 pythonLocalOverrides;
141 140 pythonPackages = self;
142 141 };
143 142
144 143 LC_ALL = "en_US.UTF-8";
145 144 LOCALE_ARCHIVE =
146 145 if pkgs.stdenv ? glibc
147 146 then "${pkgs.glibcLocales}/lib/locale/locale-archive"
148 147 else "";
149 148
150 149 # Somewhat snappier setup of the development environment
151 150 # TODO: move into shell.nix
152 151 # TODO: think of supporting a stable path again, so that multiple shells
153 152 # can share it.
154 153 shellHook = ''
155 154 tmp_path=$(mktemp -d)
156 155 export PATH="$tmp_path/bin:$PATH"
157 156 export PYTHONPATH="$tmp_path/${self.python.sitePackages}:$PYTHONPATH"
158 157 mkdir -p $tmp_path/${self.python.sitePackages}
159 158 python setup.py develop --prefix $tmp_path --allow-hosts ""
160 159 '' + linkNodeAndBowerPackages;
161 160
162 161 preCheck = ''
163 162 export PATH="$out/bin:$PATH"
164 163 '';
165 164
166 165 postCheck = ''
167 166 rm -rf $out/lib/${self.python.libPrefix}/site-packages/pytest_pylons
168 167 rm -rf $out/lib/${self.python.libPrefix}/site-packages/rhodecode/tests
169 168 '';
170 169
171 170 preBuild = linkNodeAndBowerPackages + ''
172 171 grunt
173 172 rm -fr node_modules
174 173 '';
175 174
176 175 postInstall = ''
177 176 # python based programs need to be wrapped
178 177 ln -s ${self.supervisor}/bin/supervisor* $out/bin/
179 178 ln -s ${self.gunicorn}/bin/gunicorn $out/bin/
180 179 ln -s ${self.PasteScript}/bin/paster $out/bin/
181 180 ln -s ${self.channelstream}/bin/channelstream $out/bin/
182 181 ln -s ${self.pyramid}/bin/* $out/bin/ #*/
183 182
184 183 # rhodecode-tools
185 184 # TODO: johbo: re-think this. Do the tools import anything from enterprise?
186 185 ln -s ${self.rhodecode-tools}/bin/rhodecode-* $out/bin/
187 186
188 187 # note that condition should be restricted when adding further tools
189 188 for file in $out/bin/*; do #*/
190 189 wrapProgram $file \
191 190 --prefix PYTHONPATH : $PYTHONPATH \
192 191 --prefix PATH : $PATH \
193 192 --set PYTHONHASHSEED random
194 193 done
195 194
196 195 mkdir $out/etc
197 196 cp configs/production.ini $out/etc
198 197
199 198 echo "Writing meta information for rccontrol to nix-support/rccontrol"
200 199 mkdir -p $out/nix-support/rccontrol
201 200 cp -v rhodecode/VERSION $out/nix-support/rccontrol/version
202 201 echo "DONE: Meta information for rccontrol written"
203 202
204 203 # TODO: johbo: Make part of ac-tests
205 204 if [ ! -f rhodecode/public/js/scripts.js ]; then
206 205 echo "Missing scripts.js"
207 206 exit 1
208 207 fi
209 208 if [ ! -f rhodecode/public/css/style.css ]; then
210 209 echo "Missing style.css"
211 210 exit 1
212 211 fi
213 212 '';
214 213
215 214 });
216 215
217 216 rhodecode-testdata = import "${rhodecode-testdata-src}/default.nix" {
218 217 inherit
219 218 doCheck
220 219 pkgs
221 220 pythonPackages;
222 221 };
223 222
224 223 };
225 224
226 225 rhodecode-testdata-src = sources.rhodecode-testdata or (
227 226 pkgs.fetchhg {
228 227 url = "https://code.rhodecode.com/upstream/rc_testdata";
229 228 rev = "v0.8.0";
230 229 sha256 = "0hy1ba134rq2f9si85yx7j4qhc9ky0hjzdk553s3q026i7km809m";
231 230 });
232 231
233 232 # Apply all overrides and fix the final package set
234 233 myPythonPackagesUnfix =
235 234 (extends pythonExternalOverrides
236 235 (extends pythonLocalOverrides
237 236 (extends pythonOverrides
238 237 pythonGeneratedPackages)));
239 238 myPythonPackages = (fix myPythonPackagesUnfix);
240 239
241 240 in myPythonPackages.rhodecode-enterprise-ce
General Comments 0
You need to be logged in to leave comments. Login now