@cryptotaxi247 / infra-1 / commits / c552ab4c

support for building with variants of packages (aterm64)

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

Martin Bravenboer committed Mar 30, 2008 at 20:26 UTC c552ab4c35497f3452b9461c346616ab31b92f69
2 files changed +222 -125
supervisor/strategoxt/easy-job.nix
+123 -120
@@ -20,42 +20,41 @@ rec {
20 } // attrs.inputs;
21 });
22
23 - /**
24 - * Current Stratego/XT baseline packages.
25 - */
26 - baseline =
27 - let urls = import ./baseline.nix;
28 - in { aterm = infoInput urls.aterm;
29 - sdf = infoInput urls.sdf;
30 - strategoxt = infoInput urls.strategoxt;
31 - strategoLibraries = infoInput urls.strategoLibraries;
32 - };
33 -
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 :
40 - let refspec = reflect (attrs ? useBaseline && attrs.useBaseline) (attrs.spec);
41 - in makeStrategoXTJob (({
42 - dirName = refspec.packageName;
43 -
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 makeStrategoXTJob (removeAttrs (({
40 + dirName =
41 + reflect.packageName spec;
42 notifyAddresses =
45 - refspec.notifyAddresses;
46 -
43 + reflect.notifyAddresses spec;
44 jobAttr =
48 - refspec.jobAttr (if attrs ? stable then attrs.stable else false);
49 -
50 - } // attrs)
45 + reflect.jobAttr spec stable;
46 + }
47 + // attrs)
48 // {
49 inputs =
53 - (
54 - (refspec.svnInputAttrs
55 - (if attrs ? svn then attrs.svn else "trunk")
56 - ) // refspec.requiresInputs
57 - ) // (if attrs ? inputs then attrs.inputs else {});
58 - });
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://buildfarm.st.ewi.tudelft.nl/releases/strategoxt2/${packageName}/${packageName}-unstable/";
58
59 /**
60 * Some packages reflect of pkgs to determine dependencies
@@ -71,98 +70,102 @@ rec {
70 /**
71 * Reflection tools for package specifications.
72 */
74 - reflect = useBaseline : somespec :
75 - let spec = somespec fakePkgs;
76 - in rec {
77 - /**
78 - * packageName is optional. We fall back to the fullName
79 - */
80 - packageName =
81 - if spec ? packageName then
82 - spec.packageName
83 - else
84 - spec.fullName;
85 -
86 - /**
87 - * notifyAddresses are optional. We fall back to the contactEmail.
88 - */
89 - notifyAddresses =
90 - if spec ? notifyAddresses then
91 - spec.notifyAddresses
92 - else
93 - [spec.contactEmail];
94 -
95 - /**
96 - * if stable, then the job attribute is by convention ${attrPrefix}Stable.
97 - * if not stable, then ${attrPrefix}Unstable.
98 - */
99 - jobAttr = stable :
100 - if stable then
101 - spec.attrPrefix + "Stable"
102 - else
103 - spec.attrPrefix + "Unstable";
104 -
105 - /**
106 - * The svn input is by convention ${attrPrefix}Checkout.
107 - */
108 - svnInputAttrName =
109 - spec.attrPrefix + "Checkout";
110 -
111 - /**
112 - * The package description must have an svn attribute set
113 - * with attributes for the variant.
114 - */
115 - svnInputAttrValue = variant :
116 - svnInput (builtins.getAttr variant spec.svn);
117 -
118 - svnInputAttrs = variant :
119 - (builtins.listToAttrs [
120 - { name = svnInputAttrName;
121 - value = svnInputAttrValue variant;
122 - }
123 - ]);
124 -
125 - /**
126 - * The info attribute name is by convention ${attrPrefix}Info
127 - */
128 - infoInputAttr =
129 - { name = infoInputAttrName;
130 - value = infoInputAttrValue;
131 - };
132 -
133 - infoInputAttrName =
134 - spec.attrPrefix + "Info";
135 -
136 - infoInputAttrValue =
137 - if useBaseline && spec.packageName == "aterm" then
138 - baseline.aterm
139 - else if useBaseline && spec.packageName == "sdf2-bundle" then
140 - baseline.sdf
141 - else if useBaseline && spec.packageName == "strategoxt" then
142 - baseline.strategoxt
143 - else
144 - infoInput "http://buildfarm.st.ewi.tudelft.nl/releases/strategoxt2/${spec.packageName}/${spec.packageName}-unstable/";
145 -
146 - requiresInputs =
147 - builtins.listToAttrs (
148 - map (somespec : (reflect useBaseline somespec).infoInputAttr) requiresClosure
149 - );
150 -
151 - /**
152 - * Take the closure of requirements.
153 - */
154 - requiresClosure =
155 - let closure = somespec :
156 - somespec.requires ++ (concatLists (map (x : closure (x {})) somespec.requires));
157 -
158 - fold = op: nul: list:
159 - if list == []
160 - then nul
161 - else op (builtins.head list) (fold op nul (builtins.tail list));
162 -
163 - concatLists =
164 - fold (x: y: x ++ y) [];
165 -
166 - in (closure spec) ++ (concatLists (map (x : closure (x {})) spec.svnRequires)) ++ spec.svnRequires;
167 - };
73 + reflect = rec {
74 + /**
75 + * packageName is optional. We fall back to the fullName
76 + */
77 + packageName = spec :
78 + if (spec fakePkgs) ? packageName then
79 + (spec fakePkgs).packageName
80 + else
81 + (spec fakePkgs).fullName;
82 +
83 + /**
84 + * notifyAddresses are optional. We fall back to the contactEmail.
85 + */
86 + notifyAddresses = spec :
87 + if (spec fakePkgs) ? notifyAddresses then
88 + (spec fakePkgs).notifyAddresses
89 + else
90 + [(spec fakePkgs).contactEmail];
91 +
92 + /**
93 + * if stable, then the job attribute is by convention ${attrPrefix}Stable.
94 + * if not stable, then ${attrPrefix}Unstable.
95 + */
96 + jobAttr = spec : stable :
97 + if stable then
98 + (spec fakePkgs).attrPrefix + "Stable"
99 + else
100 + (spec fakePkgs).attrPrefix + "Unstable";
101 +
102 + /**
103 + * The svn input is by convention ${attrPrefix}Checkout.
104 + *
105 + * The package description must have an svn attribute set
106 + * with attributes for the variant.
107 + */
108 + svnInputAttr = spec : variant :
109 + { name =
110 + (spec fakePkgs).attrPrefix + "Checkout";
111 +
112 + value =
113 + svnInput (builtins.getAttr variant (spec fakePkgs).svn);
114 + };
115 +
116 + svnInputs = spec : variant :
117 + builtins.listToAttrs [(svnInputAttr spec variant)];
118 +
119 + /**
120 + * The info attribute name is by convention ${attrPrefix}Info
121 + */
122 + infoInputAttr = spec : makeInfoURL :
123 + { name = (spec fakePkgs).attrPrefix + "Info";
124 + value = makeInfoURL spec;
125 + };
126 +
127 + requiresInputs = spec : makeInfoURL :
128 + builtins.listToAttrs (
129 + map (somespec : (reflect.infoInputAttr somespec makeInfoURL)) (requiresClosure spec)
130 + );
131 +
132 + /**
133 + * Take the closure of requirements.
134 + */
135 + requiresClosure = spec :
136 + let closure = somespec :
137 + (somespec fakePkgs).requires;
138 +/*
139 + ++ (fun.concatLists
140 + (map (x : closure (x {})) (somespec fakePkgs).requires)
141 + ); */
142 + in (closure spec);
143 +
144 +/*
145 + ++ (fun.concatLists
146 + (map (x : closure (x {})) (spec fakePkgs).svnRequires)
147 + )
148 + ++ (spec fakePkgs).svnRequires; */
149 +
150 + /**
151 + * Is the second argument spec required by the spec?
152 + */
153 + isRequired = byspec : somespec :
154 + fun.elem somespec (requiresClosure byspec);
155 + };
156 +
157 + /**
158 + * Taken from the nixpkgs library.
159 + */
160 + fun = rec {
161 + elem = x: list: fold (a: bs: x == a || bs) false list;
162 +
163 + fold = op: nul: list:
164 + if list == []
165 + then nul
166 + else op (builtins.head list) (fold op nul (builtins.tail list));
167 +
168 + concatLists =
169 + fold (x: y: x ++ y) [];
170 + };
171 }
\ No newline at end of file
supervisor/strategoxt/jobs.nix
+99 -5
@@ -1,39 +1,74 @@
1 attrs :
2
3 let easy = (import ./easy-job.nix) attrs;
4 + reflect = easy.reflect;
5 + infoInput = easy.infoInput;
6 makeEasyJob = easy.makeEasyJob;
7 makeStrategoXTJob = easy.makeStrategoXTJob;
8
9 specs =
10 (import ../../../../release/jobs/strategoxt2/packages.nix);
11
12 + /**
13 + * Current Stratego/XT baseline packages.
14 + */
15 + baseline =
16 + import ./baseline.nix;
17 +
18 + makeInfoURL = {
19 + usingBaseline = spec :
20 + let packageName = reflect.packageName spec;
21 + in if packageName == "aterm" then
22 + infoInput baseline.aterm
23 + else if packageName == "sdf2-bundle" then
24 + infoInput baseline.sdf
25 + else if packageName == "strategoxt" then
26 + infoInput baseline.strategoxt
27 + else if packageName == "stratego-libraries" then
28 + infoInput baseline.strategoLibraries
29 + else
30 + infoInput "http://buildfarm.st.ewi.tudelft.nl/releases/strategoxt2/${packageName}/${packageName}-unstable/";
31 +
32 + withATerm64 = spec :
33 + let packageName = reflect.packageName spec;
34 + in if packageName == "aterm" then
35 + infoInput "http://buildfarm.st.ewi.tudelft.nl/releases/strategoxt2/aterm64/${packageName}-unstable/"
36 + else if reflect.isRequired spec specs.aterm then
37 + infoInput "http://buildfarm.st.ewi.tudelft.nl/releases/strategoxt2/${packageName}-with-aterm64/${packageName}-unstable/"
38 + else
39 + infoInput "http://buildfarm.st.ewi.tudelft.nl/releases/strategoxt2/${packageName}/${packageName}-unstable/";
40 + };
41 +
42 in {
43
44 javaFrontSyntaxTrunk = makeEasyJob {
45 spec = specs.javaFrontSyntax;
14 - useBaseline = true;
46 + makeInfoURL = makeInfoURL.usingBaseline;
47 };
48
49 javaFrontTrunk = makeEasyJob {
50 spec = specs.javaFront;
19 - useBaseline = true;
51 + makeInfoURL = makeInfoURL.usingBaseline;
52 };
53
54 jimpleFrontTrunk = makeEasyJob {
55 spec = specs.jimpleFront;
24 - useBaseline = true;
56 + makeInfoURL = makeInfoURL.usingBaseline;
57 };
58
59 strategoLibrariesTrunk = makeEasyJob {
60 spec = specs.strategoLibraries;
29 - useBaseline = true;
61 + makeInfoURL = makeInfoURL.usingBaseline;
62 };
63
64 strategoShellTrunk = makeEasyJob {
65 spec = specs.strategoShell;
34 - useBaseline = true;
66 + makeInfoURL = makeInfoURL.usingBaseline;
67 };
68
69 + /**
70 + * Meta-Environment
71 + */
72 metaBuildEnvTrunk = makeEasyJob {
73 spec = specs.metaBuildEnv;
74 };
@@ -47,6 +82,65 @@ let easy = (import ./easy-job.nix) attrs;
82 atermTrunk = makeEasyJob {
83 spec = specs.aterm;
84 };
85 +
86 + sdfLibraryTrunk = makeEasyJob {
87 + spec = specs.sdfLibrary;
88 + makeInfoURL = makeInfoURL.withATerm64;
89 + };
90 +
91 + toolbuslibTrunk = makeEasyJob {
92 + spec = specs.toolbuslib;
93 + dirName = "toolbuslib-with-aterm64";
94 + makeInfoURL = makeInfoURL.withATerm64;
95 + };
96 +
97 + errorSupportTrunk = makeEasyJob {
98 + spec = specs.errorSupport;
99 + dirName = "error-support-with-aterm64";
100 + };
101 +
102 + tideSupportTrunk = makeEasyJob {
103 + spec = specs.tideSupport;
104 + dirName = "tide-support-with-aterm64";
105 + makeInfoURL = makeInfoURL.withATerm64;
106 + };
107 +
108 + ptSupportTrunk = makeEasyJob {
109 + spec = specs.ptSupport;
110 + dirName = "pt-support-with-aterm64";
111 + makeInfoURL = makeInfoURL.withATerm64;
112 + };
113 +
114 +
115 + sglrTrunk = makeEasyJob {
116 + spec = specs.sglr;
117 + dirName = "sglr-with-aterm64";
118 + makeInfoURL = makeInfoURL.withATerm64;
119 + };
120 +
121 + asfSupportTrunk = makeEasyJob {
122 + spec = specs.asfSupport;
123 + dirName = "asf-support-with-aterm64";
124 + makeInfoURL = makeInfoURL.withATerm64;
125 + };
126 +
127 + ascSupportTrunk = makeEasyJob {
128 + spec = specs.ascSupport;
129 + dirName = "asc-support-with-aterm64";
130 + makeInfoURL = makeInfoURL.withATerm64;
131 + };
132 +
133 + sdfSupportTrunk = makeEasyJob {
134 + spec = specs.sdfSupport;
135 + dirName = "sdf-support-with-aterm64";
136 + makeInfoURL = makeInfoURL.withATerm64;
137 + };
138 +
139 + pgenTrunk = makeEasyJob {
140 + spec = specs.pgen;
141 + dirName = "pgen-with-aterm64";
142 + makeInfoURL = makeInfoURL.withATerm64;
143 + };
144 }
145
146