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