##// END OF EJS Templates
build: fix 32bit builds
marcink -
r639:c31dac4c default
parent child
Show More
@@ -1,196 +1,197
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 rhodecode-vcsserver
3 # This shall be as lean as possible, just producing the rhodecode-vcsserver
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 args@
7 args@
8 { pythonPackages ? "python27Packages"
8 { system ? builtins.currentSystem
9 , pythonPackages ? "python27Packages"
9 , pythonExternalOverrides ? self: super: {}
10 , pythonExternalOverrides ? self: super: {}
10 , doCheck ? false
11 , doCheck ? false
11 , ...
12 , ...
12 }:
13 }:
13
14
14 let
15 let
15 pkgs_ = (import <nixpkgs> {});
16 pkgs_ = args.pkgs or (import <nixpkgs> { inherit system; });
16 in
17 in
17
18
18 let
19 let
19 pkgs = import <nixpkgs> {
20 pkgs = import <nixpkgs> {
20 overlays = [
21 overlays = [
21 (import ./pkgs/overlays.nix)
22 (import ./pkgs/overlays.nix)
22 ];
23 ];
23 inherit
24 inherit
24 (pkgs_)
25 (pkgs_)
25 system;
26 system;
26 };
27 };
27
28
28 # Works with the new python-packages, still can fallback to the old
29 # Works with the new python-packages, still can fallback to the old
29 # variant.
30 # variant.
30 basePythonPackagesUnfix = basePythonPackages.__unfix__ or (
31 basePythonPackagesUnfix = basePythonPackages.__unfix__ or (
31 self: basePythonPackages.override (a: { inherit self; }));
32 self: basePythonPackages.override (a: { inherit self; }));
32
33
33 # Evaluates to the last segment of a file system path.
34 # Evaluates to the last segment of a file system path.
34 basename = path: with pkgs.lib; last (splitString "/" path);
35 basename = path: with pkgs.lib; last (splitString "/" path);
35
36
36 # source code filter used as arugment to builtins.filterSource.
37 # source code filter used as arugment to builtins.filterSource.
37 src-filter = path: type: with pkgs.lib;
38 src-filter = path: type: with pkgs.lib;
38 let
39 let
39 ext = last (splitString "." path);
40 ext = last (splitString "." path);
40 in
41 in
41 !builtins.elem (basename path) [
42 !builtins.elem (basename path) [
42 ".git" ".hg" "__pycache__" ".eggs" ".idea" ".dev"
43 ".git" ".hg" "__pycache__" ".eggs" ".idea" ".dev"
43 "node_modules" "node_binaries"
44 "node_modules" "node_binaries"
44 "build" "data" "result" "tmp"] &&
45 "build" "data" "result" "tmp"] &&
45 !builtins.elem ext ["egg-info" "pyc"] &&
46 !builtins.elem ext ["egg-info" "pyc"] &&
46 # TODO: johbo: This check is wrong, since "path" contains an absolute path,
47 # TODO: johbo: This check is wrong, since "path" contains an absolute path,
47 # it would still be good to restore it since we want to ignore "result-*".
48 # it would still be good to restore it since we want to ignore "result-*".
48 !hasPrefix "result" path;
49 !hasPrefix "result" path;
49
50
50 sources =
51 sources =
51 let
52 let
52 inherit
53 inherit
53 (pkgs.lib)
54 (pkgs.lib)
54 all
55 all
55 isString
56 isString
56 attrValues;
57 attrValues;
57 sourcesConfig = pkgs.config.rc.sources or {};
58 sourcesConfig = pkgs.config.rc.sources or {};
58 in
59 in
59 # Ensure that sources are configured as strings. Using a path
60 # Ensure that sources are configured as strings. Using a path
60 # would result in a copy into the nix store.
61 # would result in a copy into the nix store.
61 assert all isString (attrValues sourcesConfig);
62 assert all isString (attrValues sourcesConfig);
62 sourcesConfig;
63 sourcesConfig;
63
64
64 version = builtins.readFile "${rhodecode-vcsserver-src}/vcsserver/VERSION";
65 version = builtins.readFile "${rhodecode-vcsserver-src}/vcsserver/VERSION";
65 rhodecode-vcsserver-src = builtins.filterSource src-filter ./.;
66 rhodecode-vcsserver-src = builtins.filterSource src-filter ./.;
66
67
67 pythonLocalOverrides = self: super: {
68 pythonLocalOverrides = self: super: {
68 rhodecode-vcsserver =
69 rhodecode-vcsserver =
69 let
70 let
70 releaseName = "RhodeCodeVCSServer-${version}";
71 releaseName = "RhodeCodeVCSServer-${version}";
71 in super.rhodecode-vcsserver.override (attrs: {
72 in super.rhodecode-vcsserver.override (attrs: {
72 inherit
73 inherit
73 doCheck
74 doCheck
74 version;
75 version;
75
76
76 name = "rhodecode-vcsserver-${version}";
77 name = "rhodecode-vcsserver-${version}";
77 releaseName = releaseName;
78 releaseName = releaseName;
78 src = rhodecode-vcsserver-src;
79 src = rhodecode-vcsserver-src;
79 dontStrip = true; # prevent strip, we don't need it.
80 dontStrip = true; # prevent strip, we don't need it.
80
81
81 # expose following attributed outside
82 # expose following attributed outside
82 passthru = {
83 passthru = {
83 pythonPackages = self;
84 pythonPackages = self;
84 };
85 };
85
86
86 propagatedBuildInputs =
87 propagatedBuildInputs =
87 attrs.propagatedBuildInputs or [] ++ [
88 attrs.propagatedBuildInputs or [] ++ [
88 pkgs.git
89 pkgs.git
89 pkgs.subversion
90 pkgs.subversion
90 ];
91 ];
91
92
92 # set some default locale env variables
93 # set some default locale env variables
93 LC_ALL = "en_US.UTF-8";
94 LC_ALL = "en_US.UTF-8";
94 LOCALE_ARCHIVE =
95 LOCALE_ARCHIVE =
95 if pkgs.stdenv.isLinux
96 if pkgs.stdenv.isLinux
96 then "${pkgs.glibcLocales}/lib/locale/locale-archive"
97 then "${pkgs.glibcLocales}/lib/locale/locale-archive"
97 else "";
98 else "";
98
99
99 # Add bin directory to path so that tests can find 'vcsserver'.
100 # Add bin directory to path so that tests can find 'vcsserver'.
100 preCheck = ''
101 preCheck = ''
101 export PATH="$out/bin:$PATH"
102 export PATH="$out/bin:$PATH"
102 '';
103 '';
103
104
104 # custom check phase for testing
105 # custom check phase for testing
105 checkPhase = ''
106 checkPhase = ''
106 runHook preCheck
107 runHook preCheck
107 PYTHONHASHSEED=random py.test -vv -p no:sugar -r xw --cov-config=.coveragerc --cov=vcsserver --cov-report=term-missing vcsserver
108 PYTHONHASHSEED=random py.test -vv -p no:sugar -r xw --cov-config=.coveragerc --cov=vcsserver --cov-report=term-missing vcsserver
108 runHook postCheck
109 runHook postCheck
109 '';
110 '';
110
111
111 postCheck = ''
112 postCheck = ''
112 echo "Cleanup of vcsserver/tests"
113 echo "Cleanup of vcsserver/tests"
113 rm -rf $out/lib/${self.python.libPrefix}/site-packages/vcsserver/tests
114 rm -rf $out/lib/${self.python.libPrefix}/site-packages/vcsserver/tests
114 '';
115 '';
115
116
116 postInstall = ''
117 postInstall = ''
117 echo "Writing vcsserver meta information for rccontrol to nix-support/rccontrol"
118 echo "Writing vcsserver meta information for rccontrol to nix-support/rccontrol"
118 mkdir -p $out/nix-support/rccontrol
119 mkdir -p $out/nix-support/rccontrol
119 cp -v vcsserver/VERSION $out/nix-support/rccontrol/version
120 cp -v vcsserver/VERSION $out/nix-support/rccontrol/version
120 echo "DONE: vcsserver meta information for rccontrol written"
121 echo "DONE: vcsserver meta information for rccontrol written"
121
122
122 mkdir -p $out/etc
123 mkdir -p $out/etc
123 cp configs/production.ini $out/etc
124 cp configs/production.ini $out/etc
124 echo "DONE: saved vcsserver production.ini into $out/etc"
125 echo "DONE: saved vcsserver production.ini into $out/etc"
125
126
126 # python based programs need to be wrapped
127 # python based programs need to be wrapped
127 mkdir -p $out/bin
128 mkdir -p $out/bin
128 ln -s ${self.python}/bin/python $out/bin/
129 ln -s ${self.python}/bin/python $out/bin/
129 ln -s ${self.gunicorn}/bin/gunicorn $out/bin/
130 ln -s ${self.gunicorn}/bin/gunicorn $out/bin/
130 ln -s ${self.pyramid}/bin/prequest $out/bin/
131 ln -s ${self.pyramid}/bin/prequest $out/bin/
131 ln -s ${self.pyramid}/bin/pserve $out/bin/
132 ln -s ${self.pyramid}/bin/pserve $out/bin/
132
133
133 # Symlink version control utilities
134 # Symlink version control utilities
134 # We ensure that always the correct version is available as a symlink.
135 # We ensure that always the correct version is available as a symlink.
135 # So that users calling them via the profile path will always use the
136 # So that users calling them via the profile path will always use the
136 # correct version. Wrapping is required so those can "import"
137 # correct version. Wrapping is required so those can "import"
137 # vcsserver python hooks.
138 # vcsserver python hooks.
138
139
139 ln -s ${pkgs.git}/bin/git $out/bin
140 ln -s ${pkgs.git}/bin/git $out/bin
140 ln -s ${self.mercurial}/bin/hg $out/bin
141 ln -s ${self.mercurial}/bin/hg $out/bin
141 ln -s ${pkgs.subversion}/bin/svn* $out/bin
142 ln -s ${pkgs.subversion}/bin/svn* $out/bin
142
143
143 echo "DONE: created symlinks into $out/bin"
144 echo "DONE: created symlinks into $out/bin"
144 DEPS="$out/bin/*"
145 DEPS="$out/bin/*"
145
146
146 # wrap only dependency scripts, they require to have full PYTHONPATH set
147 # wrap only dependency scripts, they require to have full PYTHONPATH set
147 # to be able to import all packages
148 # to be able to import all packages
148 for file in $DEPS;
149 for file in $DEPS;
149 do
150 do
150 wrapProgram $file \
151 wrapProgram $file \
151 --prefix PATH : $PATH \
152 --prefix PATH : $PATH \
152 --prefix PYTHONPATH : $PYTHONPATH \
153 --prefix PYTHONPATH : $PYTHONPATH \
153 --set PYTHONHASHSEED random
154 --set PYTHONHASHSEED random
154 done
155 done
155
156
156 echo "DONE: vcsserver binary wrapping"
157 echo "DONE: vcsserver binary wrapping"
157
158
158 '';
159 '';
159
160
160 });
161 });
161 };
162 };
162
163
163 basePythonPackages = with builtins;
164 basePythonPackages = with builtins;
164 if isAttrs pythonPackages then
165 if isAttrs pythonPackages then
165 pythonPackages
166 pythonPackages
166 else
167 else
167 getAttr pythonPackages pkgs;
168 getAttr pythonPackages pkgs;
168
169
169 pythonGeneratedPackages = import ./pkgs/python-packages.nix {
170 pythonGeneratedPackages = import ./pkgs/python-packages.nix {
170 inherit
171 inherit
171 pkgs;
172 pkgs;
172 inherit
173 inherit
173 (pkgs)
174 (pkgs)
174 fetchurl
175 fetchurl
175 fetchgit
176 fetchgit
176 fetchhg;
177 fetchhg;
177 };
178 };
178
179
179 pythonVCSServerOverrides = import ./pkgs/python-packages-overrides.nix {
180 pythonVCSServerOverrides = import ./pkgs/python-packages-overrides.nix {
180 inherit
181 inherit
181 pkgs
182 pkgs
182 basePythonPackages;
183 basePythonPackages;
183 };
184 };
184
185
185
186
186 # Apply all overrides and fix the final package set
187 # Apply all overrides and fix the final package set
187 myPythonPackagesUnfix = with pkgs.lib;
188 myPythonPackagesUnfix = with pkgs.lib;
188 (extends pythonExternalOverrides
189 (extends pythonExternalOverrides
189 (extends pythonLocalOverrides
190 (extends pythonLocalOverrides
190 (extends pythonVCSServerOverrides
191 (extends pythonVCSServerOverrides
191 (extends pythonGeneratedPackages
192 (extends pythonGeneratedPackages
192 basePythonPackagesUnfix))));
193 basePythonPackagesUnfix))));
193
194
194 myPythonPackages = (pkgs.lib.fix myPythonPackagesUnfix);
195 myPythonPackages = (pkgs.lib.fix myPythonPackagesUnfix);
195
196
196 in myPythonPackages.rhodecode-vcsserver
197 in myPythonPackages.rhodecode-vcsserver
@@ -1,14 +1,22
1 # This file defines how to "build" for packaging.
1 # This file defines how to "build" for packaging.
2
2
3 { doCheck ? true
3 { pkgs ? import <nixpkgs> {}
4 , system ? builtins.currentSystem
5 , doCheck ? false
4 }:
6 }:
5
7
6 let
8 let
7 vcsserver = import ./default.nix {
9 vcsserver = import ./default.nix {
8 inherit
10 inherit
9 doCheck;
11 doCheck
12 system;
13
14 # disable checkPhase for build
15 checkPhase = ''
16 '';
17
10 };
18 };
11
19
12 in {
20 in {
13 build = vcsserver;
21 build = vcsserver;
14 }
22 }
General Comments 0
You need to be logged in to leave comments. Login now