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