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