@cryptotaxi247 / infra / commits / b3d4380a

Forked easy build system; added support for building Java packages.

svn path=/configurations/trunk/tud/; revision=12067

Karl Trygve Kalleberg committed Jun 12, 2008 at 21:19 UTC b3d4380a3a9563e781ee4a71db52c3208452948a
6 files changed +359 -1
buildfarm/jobs.nix
+7 -1
@@ -70,8 +70,14 @@ let
70 inherit makeJob pathInput svnInput svnInputRev;
71 };
72
73 + spoofaxJobs =
74 + (import ./spoofax/jobs.nix) {
75 + inherit makeJob pathInput svnInput svnInputRev;
76 + };
77 +
78 in
74 - strategoxtJobs // {
79 + strategoxtJobs //
80 + spoofaxJobs // {
81
82
83 /* Nix */
buildfarm/spoofax/baseline.nix new
+21
@@ -0,0 +1,21 @@
1 +{
2 + aterm =
3 + http://releases.strategoxt.org/strategoxt-0.17/aterm/aterm-2.5pre21238-26ra85lr/;
4 +
5 + # martin: needs to be updated, but I'm scared what will happen. We
6 + # should do this when the buildfarm transition has stabilized a bit.
7 + sdf =
8 + http://releases.strategoxt.org/strategoxt-0.17/sdf2-bundle/sdf2-bundle-2.4pre212034-37nm9z7p/;
9 +
10 + strategoxt =
11 + http://releases.strategoxt.org/strategoxt/strategoxt-0.17M3pre17690-0ryq08iv/;
12 +
13 + strategoLibraries =
14 + http://releases.strategoxt.org/stratego-libraries/stratego-libraries-0.17pre1768017680-hjqcxi9w/;
15 +
16 + # used for compiling Stratego/XT from Subversion.
17 + strategoxtBootstrap =
18 + http://releases.strategoxt.org/strategoxt/strategoxt-0.17M3pre17690-0ryq08iv/strategoxt-0.17M3pre17690.tar.gz;
19 + # ftp server is down a lot at the moment
20 + # ftp://ftp.strategoxt.org/pub/stratego/StrategoXT/baseline/latest/strategoxt.tar.gz
21 +}
buildfarm/spoofax/easy-job.nix new
+186
@@ -0,0 +1,186 @@
1 +{makeJob, pathInput, svnInput, svnInputRev} :
2 +
3 +rec {
4 + urlInput = url: {type = "url"; inherit url;};
5 + infoInput = url : urlInput "${url}/release-info.xml";
6 +
7 + makeSpoofaxJob = attrs : makeJob (attrs // {
8 + args = [
9 + # directory relative to the supervisor.
10 + "../jobs/spoofax/releases.nix"
11 + attrs.jobAttr
12 + "/data/webserver/dist/spoofax/${attrs.dirName}"
13 + "http://releases.strategoxt.org/${attrs.dirName}"
14 + "/data/webserver/dist/nix-cache"
15 + "http://buildfarm.st.ewi.tudelft.nl/releases/nix-cache"
16 + ];
17 +
18 + inputs = {
19 + systems = pathInput ./systems.nix;
20 + } // attrs.inputs;
21 + });
22 +
23 + /**
24 + * This job function makes a buildfarm job based on a specification of
25 + * a package in packages.nix. It automatically adds the svn inputs
26 + * and the releaae-info.xml files of the requirements.
27 + */
28 + makeEasyJob = attrs :
29 + let makeInfoURL =
30 + if attrs ? makeInfoURL then attrs.makeInfoURL else defaultMakeInfoURL;
31 + spec =
32 + attrs.spec;
33 + stable =
34 + if attrs ? stable then attrs.stable else false;
35 + svn =
36 + if attrs ? svn then attrs.svn else "trunk";
37 + customInputs =
38 + if attrs ? inputs then attrs.inputs else {};
39 + in makeSpoofaxJob (removeAttrs (({
40 + dirName =
41 + reflect.packageName spec;
42 + notifyAddresses =
43 + reflect.notifyAddresses spec;
44 + jobAttr =
45 + reflect.jobAttr spec stable;
46 + }
47 + // attrs)
48 + // {
49 + inputs =
50 + ( (reflect.svnInputs spec svn)
51 + // (reflect.requiresInputs spec makeInfoURL))
52 + // customInputs;
53 + }) ["makeInfoURL"]);
54 +
55 + defaultMakeInfoURL = spec :
56 + let packageName = reflect.packageName spec;
57 + in infoInput "http://releases.strategoxt.org/${packageName}/${packageName}-unstable/";
58 +
59 + /**
60 + * Some packages reflect of pkgs to determine dependencies
61 + * and options. We need to accommodate that a bit ...
62 + */
63 + fakePkgs = {
64 + stdenv = {
65 + system = "generic";
66 + };
67 + };
68 +
69 + fakePkgsMinGW = {
70 + stdenv = {
71 + system = "i686-cygwin";
72 + stdenvType = "i686-mingw";
73 + isMinGW = true;
74 + };
75 + };
76 +
77 + /**
78 + * Reflection tools for package specifications.
79 + */
80 + reflect = rec {
81 + /**
82 + * packageName is optional. We fall back to the fullName
83 + */
84 + packageName = spec :
85 + if (spec fakePkgs) ? packageName then
86 + (spec fakePkgs).packageName
87 + else
88 + (spec fakePkgs).fullName;
89 +
90 + /**
91 + * notifyAddresses are optional. We fall back to the contactEmail.
92 + */
93 + notifyAddresses = spec :
94 + if (spec fakePkgs) ? notifyAddresses then
95 + (spec fakePkgs).notifyAddresses
96 + else
97 + [(spec fakePkgs).contactEmail];
98 +
99 + /**
100 + * if stable, then the job attribute is by convention ${attrPrefix}Stable.
101 + * if not stable, then ${attrPrefix}Unstable.
102 + */
103 + jobAttr = spec : stable :
104 + if stable then
105 + (spec fakePkgs).attrPrefix + "Stable"
106 + else
107 + (spec fakePkgs).attrPrefix + "Unstable";
108 +
109 + /**
110 + * The svn input is by convention ${attrPrefix}Checkout.
111 + *
112 + * The package description must have an svn attribute set
113 + * with attributes for the variant.
114 + */
115 + svnInputAttr = spec : variant :
116 + { name =
117 + (spec fakePkgs).attrPrefix + "Checkout";
118 +
119 + value =
120 + svnInput (builtins.getAttr variant (spec fakePkgs).svn);
121 + };
122 +
123 + svnInputs = spec : variant :
124 + if (spec fakePkgs) ? svn then
125 + builtins.listToAttrs [(svnInputAttr spec variant)]
126 + else
127 + {};
128 +
129 + /**
130 + * The info attribute name is by convention ${attrPrefix}Info
131 + */
132 + infoInputAttr = spec : makeInfoURL :
133 + { name = (spec fakePkgs).attrPrefix + "Info";
134 + value = makeInfoURL spec;
135 + };
136 +
137 + requiresInputs = spec : makeInfoURL :
138 + builtins.listToAttrs (
139 + map (somespec : (reflect.infoInputAttr somespec makeInfoURL)) (requiresClosure spec)
140 + );
141 +
142 + /**
143 + * Take the closure of requirements.
144 + */
145 + requiresClosure = spec :
146 + let closure = somespec :
147 + (somespec fakePkgs).requires
148 + ++ (somespec fakePkgsMinGW).requires
149 + ++ (fun.concatLists
150 + (map (x : closure x) (somespec fakePkgs).requires)
151 + );
152 + in (if (spec fakePkgs) ? bundles then
153 + (spec fakePkgs).bundles
154 + ++ (fun.concatLists
155 + (map (x : closure x) (spec fakePkgs).bundles)
156 + )
157 + else
158 + [])
159 + ++ (closure spec)
160 + ++ (fun.concatLists
161 + (map (x : closure x) (spec fakePkgs).svnRequires)
162 + )
163 + ++ (spec fakePkgs).svnRequires;
164 +
165 + /**
166 + * Is the second argument spec required by the spec?
167 + */
168 + isRequired = byspec : somespec :
169 + fun.elem somespec (requiresClosure byspec);
170 + };
171 +
172 + /**
173 + * Taken from the nixpkgs library.
174 + */
175 + fun = rec {
176 + elem = x: list: fold (a: bs: x == a || bs) false list;
177 +
178 + fold = op: nul: list:
179 + if list == []
180 + then nul
181 + else op (builtins.head list) (fold op nul (builtins.tail list));
182 +
183 + concatLists =
184 + fold (x: y: x ++ y) [];
185 + };
186 +}
buildfarm/spoofax/jobs-helpers.nix new
+113
@@ -0,0 +1,113 @@
1 +attrs :
2 +
3 +rec {
4 +
5 + # The easy buildfarm configuration is a system based on a
6 + # declarative package description, and dependencies that are
7 + # downloaded directly from release pages produced by the
8 + # buildfarm.
9 +
10 + easy = (import ./easy-job.nix) attrs;
11 +
12 + # Reflect is a set of functions for reflecting over package
13 + # specifications.
14 +
15 + reflect = easy.reflect;
16 +
17 + # infoInput turns a URL of a release into a buildfarm input,
18 + # attaching release-info.xml to the URL.
19 +
20 + infoInput = easy.infoInput;
21 +
22 + # urlInput turns a URL of a release into a buildfarm input,
23 +
24 + urlInput = easy.urlInput;
25 +
26 + inherit (attrs) svnInput svnInputRev pathInput;
27 +
28 + # Main function to make easy jobs.
29 +
30 + makeEasyJob = easy.makeEasyJob;
31 +
32 + # A more generic job. Requires more configuration though! You need
33 + # to specify yourself: dirName, notifyAddresses, jobAttr in
34 + # releases.nix, and inputs.
35 +
36 + makeSpoofaxJob = easy.makeSpoofaxJob;
37 +
38 + # Generic job function.
39 +
40 + makeJob = attrs.makeJob;
41 +
42 + # The file packages.nix describes packages, their dependencies,
43 + # specific platform requirements, etc.
44 +
45 + specs =
46 + (import ../../../../release/jobs/spoofax/packages.nix);
47 +
48 + # Current Stratego/XT baseline packages.
49 +
50 + baseline =
51 + import ./baseline.nix;
52 +
53 + # The makeEasyJob function accepts an argument
54 + # 'makeInfoURL'. makeInfoURL is a function that given a package
55 + # specification returns a URL to a release-info.xml file. This
56 + # file provides the buildfarm with information about available
57 + # source tarballs and RPMs for this package.
58 +
59 + # The default makeInfoURL always uses the latest -unstable release
60 + # of a package. You only need to specify your own makeInfoURL if
61 + # you want a different behaviour. Some useful makeInfoURL variants
62 + # are defined here.
63 +
64 + makeInfoURL = {
65 + unstable =
66 + easy.defaultMakeInfoURL;
67 +
68 + # A common example of makeInfoURL is 'usingBaseline'. This
69 + # makeInfoURL variant uses baseline releases for aterm,
70 + # sdf2-bundle, and strategoxt. The URLs of the baseline are
71 + # specified in 'baseline.nix'.
72 + usingBaseline = spec :
73 + let packageName = reflect.packageName spec;
74 + in if packageName == "aterm" then
75 + infoInput baseline.aterm
76 + else if packageName == "sdf2-bundle" then
77 + infoInput baseline.sdf
78 + else if packageName == "strategoxt" then
79 + infoInput baseline.strategoxt
80 + else if packageName == "stratego-libraries" then
81 + infoInput baseline.strategoLibraries
82 + else
83 + infoInput "http://releases.strategoxt.org/${packageName}/${packageName}-unstable/";
84 +
85 + # Stratego/XT uses a branch of the ATerm library. For the
86 + # Meta-Environment packages to built against this branch, and
87 + # against other releases that have been built using this branch,
88 + # we use this makeInfoURL function, which attaches
89 + # '-with-aterm64' to package names.
90 +
91 + # This function is not required for Stratego/XT packages, since
92 + # these are all built using with this branch of the ATerm
93 + # library.
94 + withATerm64 = spec :
95 + let packageName = reflect.packageName spec;
96 + in if packageName == "aterm" then
97 + infoInput "http://releases.strategoxt.org/aterm64/${packageName}-unstable/"
98 + else if reflect.isRequired spec specs.aterm then
99 + infoInput "http://releases.strategoxt.org/${packageName}-with-aterm64/${packageName}-unstable/"
100 + else
101 + infoInput "http://releases.strategoxt.org/${packageName}/${packageName}-unstable/";
102 + };
103 +
104 + spoofaxArgs = {jobFile, jobAttr, subdir} :
105 + [
106 + ("../jobs/" + jobFile)
107 + jobAttr
108 + ("/data/webserver/dist/spoofax/" + subdir)
109 + ("http://releases.strategoxt.org/" + subdir)
110 + "/data/webserver/dist/nix-cache"
111 + "http://buildfarm.st.ewi.tudelft.nl/releases/nix-cache"
112 + ];
113 +}
buildfarm/spoofax/jobs.nix new
+19
@@ -0,0 +1,19 @@
1 +attrs :
2 +
3 +# check jobs-helpers.nix for documentation.
4 +with (import ./jobs-helpers.nix) attrs;
5 +
6 +{
7 +
8 + spoofaxATermTrunk = makeEasyJob {
9 + spec = specs.spoofaxATerm;
10 + makeInfoURL = makeInfoURL.usingBaseline;
11 + };
12 +
13 + spoofaxJsglrTrunk = makeEasyJob {
14 + spec = specs.spoofaxJsglr;
15 + makeInfoURL = makeInfoURL.usingBaseline;
16 + };
17 +
18 +}
19 +
buildfarm/spoofax/systems.nix new
+13
@@ -0,0 +1,13 @@
1 +/**
2 + * List of available systems in the TUD buildfarm.
3 + */
4 +[ "i686-linux"
5 + "x86_64-linux"
6 + "i686-darwin"
7 +# "i686-cygwin"
8 +]
9 +
10 +
11 + # "powerpc-darwin"
12 + # "powerpc-linux"
13 + # "i686-freebsd"