-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrelease.nix
More file actions
214 lines (173 loc) · 6.9 KB
/
release.nix
File metadata and controls
214 lines (173 loc) · 6.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
{ libfault ? { outPath = ./.; revCount = 0; shortRev = "abcdef"; rev = "HEAD"; }
, officialRelease ? false
, coverityUpload ? false
}:
let
nixcfg = { allowUnfree = true; };
pkgs = import <nixpkgs> { config=nixcfg; };
systems = [ "i686-linux" "x86_64-linux"
#"x86_64-darwin"
];
version = builtins.readFile ./VERSION +
(pkgs.lib.optionalString (!officialRelease)
"-r${toString libfault.revCount}-g${libfault.shortRev}");
ifNotCoverity = x: if coverityUpload == true then {} else x;
ifCoverity = x: if coverityUpload == false then {} else x;
jobs = rec {
## -- Tarballs -------------------------------------------------------------
tarball = pkgs.releaseTools.sourceTarball {
name = "libfault-tarball";
src = libfault;
inherit version;
buildInputs = with pkgs; [ git xz perl ];
meta.maintainers = [ "aseipp@pobox.com" ];
distPhase = ''
relname=libfault-${version}
mkdir ../$relname
cp -prd . ../$relname
rm -rf ../$relname/.git ../$relname/svn-revision
echo -n ${version} > ../$relname/VERSION
mkdir $out/tarballs
tar cvfJ $out/tarballs/$relname.tar.xz -C .. $relname
'';
};
## -- Build ----------------------------------------------------------------
build = ifNotCoverity (pkgs.lib.genAttrs systems (system:
with import <nixpkgs> { inherit system; config=nixcfg; };
releaseTools.nixBuild {
name = "libfault";
inherit version;
src = tarball;
buildInputs = with pkgs; [ perl ];
meta.maintainers = [ "aseipp@pobox.com" ];
enableParallelBuilding = true;
doCheck = false;
installPhase = "make install PREFIX=$out";
}
));
## -- Tests ----------------------------------------------------------------
tests = ifNotCoverity (pkgs.lib.genAttrs systems (system:
with import <nixpkgs> { inherit system; config=nixcfg; };
releaseTools.nixBuild {
name = "libfault-test";
inherit version;
src = tarball;
buildInputs = with pkgs; [ perl ];
meta.maintainers = [ "aseipp@pobox.com" ];
enableParallelBuilding = true;
doCheck = true;
checkFlags = [ "DEBUG=1" ];
dontInstall = true;
}
));
## -- Coverity -------------------------------------------------------------
coverity = ifCoverity (
with import <nixpkgs> { system = "x86_64-linux"; config=nixcfg; };
releaseTools.coverityAnalysis {
name = "libfault-coverity";
inherit version;
src = tarball;
buildInputs = with pkgs; [ perl ];
meta.maintainers = [ "aseipp@pobox.com" ];
buildPhase = "make all check DEBUG=1";
doCheck = false;
}
);
## -- Clang analyzer -------------------------------------------------------
clang-analyzer = ifNotCoverity (
with import <nixpkgs> { system = "x86_64-linux"; config=nixcfg; };
releaseTools.clangAnalysis {
name = "libfault-clang-analyzer";
inherit version;
src = tarball;
buildInputs = with pkgs; [ perl ];
meta.maintainers = [ "aseipp@pobox.com" ];
buildPhase = "make all check DEBUG=1";
doCheck = false;
}
);
## -- Coverage -------------------------------------------------------------
coverage = ifNotCoverity (
with import <nixpkgs> { system = "x86_64-linux"; config=nixcfg; };
releaseTools.coverageAnalysis {
name = "libfault-coverage";
inherit version;
src = tarball;
buildInputs = with pkgs; [ perl ];
meta.maintainers = [ "aseipp@pobox.com" ];
enableParallelBuilding = true;
makeFlags = [ "DEBUG=1" ];
}
);
## -- Debian build ---------------------------------------------------------
#deb_debian7i386 = ifNotCoverity
# (makeDeb_i686 (diskImageFuns: diskImageFuns.debian7i386) 60);
#deb_debian7x86_64 = ifNotCoverity
# (makeDeb_x86_64 (diskImageFunsFun: diskImageFunsFun.debian7x86_64) 60);
## -- Ubuntu builds --------------------------------------------------------
#deb_ubuntu1004i386 = ifNotCoverity
# (makeDeb_i686 (diskImageFuns: diskImageFuns.ubuntu1004i386) 50);
#deb_ubuntu1004x86_64 = ifNotCoverity
# (makeDeb_x86_64 (diskImageFuns: diskImageFuns.ubuntu1004x86_64) 50);
#deb_ubuntu1204i386 = ifNotCoverity
# (makeDeb_i686 (diskImageFuns: diskImageFuns.ubuntu1204i386) 60);
#deb_ubuntu1204x86_64 = ifNotCoverity
# (makeDeb_x86_64 (diskImageFuns: diskImageFuns.ubuntu1204x86_64) 60);
#deb_ubuntu1404i386 = ifNotCoverity
# (makeDeb_i686 (diskImageFuns: diskImageFuns.ubuntu1404i386) 60);
#deb_ubuntu1404x86_64 = ifNotCoverity
# (makeDeb_x86_64 (diskImageFuns: diskImageFuns.ubuntu1404x86_64) 60);
## -- Fedora builds --------------------------------------------------------
#rpm_fedora20i386 = ifNotCoverity
# (makeRPM_i686 (diskImageFuns: diskImageFuns.fedora20i386) 70);
#rpm_fedora20x86_64 = ifNotCoverity
# (makeRPM_x86_64 (diskImageFunsFun: diskImageFunsFun.fedora20x86_64) 70);
## -- Release build --------------------------------------------------------
release = ifNotCoverity (pkgs.releaseTools.aggregate
{ name = "libfault-${version}";
constituents =
[ tarball
build.i686-linux build.x86_64-linux # build.x86_64-darwin
tests.i686-linux tests.x86_64-linux # tests.x864_64-darwin
#deb_debian7i386 deb_debian7x86_64
#deb_ubuntu1004i386 deb_ubuntu1004x86_64
#deb_ubuntu1204i386 deb_ubuntu1204x86_64
#deb_ubuntu1404i386 deb_ubuntu1404x86_64
#rpm_fedora20i386 rpm_fedora20x86_64
coverage
];
meta.description = "Release-critical builds";
meta.maintainers = [ "aseipp@pobox.com" ];
}
);
};
## -- RPM/Deb utilities ----------------------------------------------------
makeDeb_i686 = makeDeb "i686-linux";
makeDeb_x86_64 = makeDeb "x86_64-linux";
makeDeb =
system: diskImageFun: prio:
with import <nixpkgs> { inherit system; };
releaseTools.debBuild {
name = "libfault-deb";
src = jobs.tarball;
diskImage = (diskImageFun vmTools.diskImageFuns) {};
memSize = 1024;
meta.schedulingPriority = prio;
debMaintainer = "Austin Seipp <aseipp@pobox.com>";
doInstallCheck = false;
preInstall = "export INSTALLPREFIX=/usr";
};
makeRPM_i686 = makeRPM "i686-linux";
makeRPM_x86_64 = makeRPM "x86_64-linux";
makeRPM =
system: diskImageFun: prio:
with import <nixpkgs> { inherit system; };
releaseTools.rpmBuild rec {
name = "libfault-rpm";
src = jobs.tarball;
diskImage = (diskImageFun vmTools.diskImageFuns) {};
memSize = 1024;
meta.schedulingPriority = prio;
preInstall = "export INSTALLPREFIX=/usr";
};
in jobs