##// END OF EJS Templates
packaging: don't run strip on sources for python packages
marcink -
r174:bf29343f default
parent child Browse files
Show More
@@ -1,153 +1,154 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 { 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 # bump GIT version
18 18 git = pkgs.lib.overrideDerivation pkgs_.git (oldAttrs: {
19 19 name = "git-2.9.3";
20 20 src = pkgs.fetchurl {
21 21 url = "https://www.kernel.org/pub/software/scm/git/git-2.9.3.tar.xz";
22 22 sha256 = "0qzs681a64k3shh5p0rg41l1z16fbk5sj0xga45k34hp1hsp654z";
23 23 };
24 24
25 25 });
26 26
27 27 # Override subversion derivation to
28 28 # - activate python bindings
29 29 subversion = let
30 30 subversionWithPython = super.subversion.override {
31 31 httpSupport = true;
32 32 pythonBindings = true;
33 33 python = self.python27Packages.python;
34 34 };
35 35
36 36 in
37 37
38 38 pkgs.lib.overrideDerivation subversionWithPython (oldAttrs: {
39 39 patches = (oldAttrs.patches or []) ++
40 40 pkgs.lib.optionals pkgs.stdenv.isDarwin [
41 41 # johbo: "import svn.client" fails on darwin currently.
42 42 ./pkgs/subversion-1.9.4-darwin.patch
43 43 ];
44 44 });
45 45
46 46 });
47 47
48 48 inherit (pkgs.lib) fix extends;
49 49 basePythonPackages = with builtins; if isAttrs pythonPackages
50 50 then pythonPackages
51 51 else getAttr pythonPackages pkgs;
52 52
53 53 elem = builtins.elem;
54 54 basename = path: with pkgs.lib; last (splitString "/" path);
55 55 startsWith = prefix: full: let
56 56 actualPrefix = builtins.substring 0 (builtins.stringLength prefix) full;
57 57 in actualPrefix == prefix;
58 58
59 59 src-filter = path: type: with pkgs.lib;
60 60 let
61 61 ext = last (splitString "." path);
62 62 in
63 63 !elem (basename path) [".hg" ".git" "__pycache__" ".eggs"
64 64 "node_modules" "build" "data" "tmp"] &&
65 65 !elem ext ["egg-info" "pyc"] &&
66 66 !startsWith "result" path;
67 67
68 68 rhodecode-vcsserver-src = builtins.filterSource src-filter ./.;
69 69
70 70 pythonGeneratedPackages = self: basePythonPackages.override (a: {
71 71 inherit self;
72 72 }) // (scopedImport {
73 73 self = self;
74 74 super = basePythonPackages;
75 75 inherit pkgs;
76 76 inherit (pkgs) fetchurl fetchgit;
77 77 } ./pkgs/python-packages.nix);
78 78
79 79 pythonOverrides = import ./pkgs/python-packages-overrides.nix {
80 80 inherit basePythonPackages pkgs;
81 81 };
82 82
83 83 version = builtins.readFile ./vcsserver/VERSION;
84 84
85 85 pythonLocalOverrides = self: super: {
86 86 rhodecode-vcsserver = super.rhodecode-vcsserver.override (attrs: {
87 87 inherit doCheck version;
88 88
89 89 name = "rhodecode-vcsserver-${version}";
90 90 releaseName = "RhodeCodeVCSServer-${version}";
91 91 src = rhodecode-vcsserver-src;
92 dontStrip = true; # prevent strip, we don't need it.
92 93
93 94 propagatedBuildInputs = attrs.propagatedBuildInputs ++ ([
94 95 pkgs.git
95 96 pkgs.subversion
96 97 ]);
97 98
98 99 # TODO: johbo: Make a nicer way to expose the parts. Maybe
99 100 # pkgs/default.nix?
100 101 passthru = {
101 102 pythonPackages = self;
102 103 };
103 104
104 105 # Add VCSServer bin directory to path so that tests can find 'vcsserver'.
105 106 preCheck = ''
106 107 export PATH="$out/bin:$PATH"
107 108 '';
108 109
109 110 # put custom attrs here
110 111 checkPhase = ''
111 112 runHook preCheck
112 113 PYTHONHASHSEED=random py.test -p no:sugar -vv --cov-config=.coveragerc --cov=vcsserver --cov-report=term-missing vcsserver
113 114 runHook postCheck
114 115 '';
115 116
116 117 postInstall = ''
117 118 echo "Writing 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: Meta information for rccontrol written"
121 122
122 123 ln -s ${self.pyramid}/bin/* $out/bin/
123 124 ln -s ${self.gunicorn}/bin/gunicorn $out/bin/
124 125
125 126 # Symlink version control utilities
126 127 #
127 128 # We ensure that always the correct version is available as a symlink.
128 129 # So that users calling them via the profile path will always use the
129 130 # correct version.
130 131 ln -s ${pkgs.git}/bin/git $out/bin
131 132 ln -s ${self.mercurial}/bin/hg $out/bin
132 133 ln -s ${pkgs.subversion}/bin/svn* $out/bin
133 134
134 135 for file in $out/bin/*; do
135 136 wrapProgram $file \
136 137 --set PATH $PATH \
137 138 --set PYTHONPATH $PYTHONPATH \
138 139 --set PYTHONHASHSEED random
139 140 done
140 141 '';
141 142
142 143 });
143 144 };
144 145
145 146 # Apply all overrides and fix the final package set
146 147 myPythonPackages =
147 148 (fix
148 149 (extends pythonExternalOverrides
149 150 (extends pythonLocalOverrides
150 151 (extends pythonOverrides
151 152 pythonGeneratedPackages))));
152 153
153 154 in myPythonPackages.rhodecode-vcsserver
General Comments 0
You need to be logged in to leave comments. Login now