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