svn path=/configurations/trunk/tud/; revision=11333
svn path=/configurations/trunk/tud/; revision=11333
Martin Bravenboer committed
Mar 28, 2008 at 22:43 UTC
38703f83bd8eda451a39a2c8fd45f6dfe4fbb63a
2 files changed
+161
-34
supervisor/strategoxt/easy-job.nix
new
+146
@@ -0,0 +1,146 @@
1
+{makeJob, pathInput, svnInput, svnInputRev} :
2
+
3
+rec {
4
+ urlInput = url: {type = "tgz"; url = url;};
5
+ infoInput = url : urlInput "${url}/release-info.xml";
6
+
7
+ makeStrategoXTJob = attrs : makeJob (attrs // {
8
+ args = [
9
+ # directory relative to the supervisor.
10
+ "../jobs/strategoxt2/releases.nix"
11
+ attrs.jobAttr
12
+ "/data/webserver/dist/strategoxt-tmp/${attrs.dirName}"
13
+ "http://buildfarm.st.ewi.tudelft.nl/releases/strategoxt-tmp/${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
+ baseline =
24
+ let urls = import ./baseline.nix;
25
+ in { aterm = infoInput urls.aterm;
26
+ sdf = infoInput urls.sdf;
27
+ strategoxt = infoInput urls.strategoxt;
28
+ strategoLibraries = infoInput urls.strategoLibraries;
29
+ };
30
+
31
+ makeEasyJob = attrs :
32
+ let refspec = reflect (attrs.spec);
33
+ in makeStrategoXTJob (({
34
+ dirName = refspec.packageName;
35
+
36
+ notifyAddresses =
37
+ refspec.notifyAddresses;
38
+
39
+ jobAttr =
40
+ refspec.jobAttr attrs.stable;
41
+
42
+ } // attrs)
43
+ // {
44
+ inputs =
45
+ ((refspec.svnInput attrs.svn) // refspec.requiresInputs)
46
+ // (if attrs ? inputs then attrs.inputs else {});
47
+ });
48
+
49
+ /**
50
+ * Reflection tools for package specifications.
51
+ */
52
+ reflect = somespec :
53
+ let spec = somespec {};
54
+ in rec {
55
+ /**
56
+ * packageName is optional. We fall back to the fullName
57
+ */
58
+ packageName =
59
+ if spec ? packageName then
60
+ spec.packageName
61
+ else
62
+ spec.fullName;
63
+
64
+ /**
65
+ * notifyAddresses are optional. We fall back to the contactEmail.
66
+ */
67
+ notifyAddresses =
68
+ if spec ? notifyAddresses then
69
+ spec.notifyAddresses
70
+ else
71
+ [spec.contactEmail];
72
+
73
+ /**
74
+ * if stable, then the job attribute is by convention ${attrPrefix}Stable.
75
+ * if not stable, then ${attrPrefix}Unstable.
76
+ */
77
+ jobAttr = stable :
78
+ if stable then
79
+ spec.attrPrefix + "Stable"
80
+ else
81
+ spec.attrPrefix + "Unstable";
82
+
83
+ /**
84
+ * The svn input is by convention ${attrPrefix}Checkout.
85
+ */
86
+ svnInputAttrName =
87
+ spec.attrPrefix + "Checkout";
88
+
89
+ /**
90
+ * The package description must have an svn attribute set
91
+ * with attributes for the variant.
92
+ */
93
+ svnInputAttrValue = variant :
94
+ builtins.getAttr variant spec.svn;
95
+
96
+ svnInput = variant :
97
+ (builtins.listToAttrs [
98
+ { name = svnInputAttrName;
99
+ value = svnInputAttrValue variant;
100
+ }
101
+ ]);
102
+
103
+ /**
104
+ * The info attribute name is by convention ${attrPrefix}Info
105
+ */
106
+ internalInfoInput =
107
+ { name = infoInputAttrName;
108
+ value = infoInputAttrValue;
109
+ };
110
+
111
+ infoInputAttrName =
112
+ spec.attrPrefix + "Info";
113
+
114
+ infoInputAttrValue =
115
+ if spec.packageName == "aterm" then
116
+ baseline.aterm
117
+ else if spec.packageName == "sdf" then
118
+ baseline.sdf
119
+ else if spec.packageName == "strategoxt" then
120
+ baseline.strategoxt
121
+ else
122
+ infoInput "http://buildfarm.st.ewi.tudelft.nl/releases/strategoxt/${spec.packageName}-unstable-latest/";
123
+
124
+ requiresInputs =
125
+ builtins.listToAttrs (
126
+ map (somespec : (reflect somespec).internalInfoInput) requiresClosure
127
+ );
128
+
129
+ /**
130
+ * Take the closure of requirements.
131
+ */
132
+ requiresClosure =
133
+ let closure = somespec :
134
+ somespec.requires ++ (concatLists (map (x : closure (x {})) somespec.requires));
135
+
136
+ fold = op: nul: list:
137
+ if list == []
138
+ then nul
139
+ else op (builtins.head list) (fold op nul (builtins.tail list));
140
+
141
+ concatLists =
142
+ fold (x: y: x ++ y) [];
143
+
144
+ in (closure spec) ++ (concatLists (map (x : closure (x {})) spec.svnRequires)) ++ spec.svnRequires;
145
+ };
146
+}
\ No newline at end of file
supervisor/strategoxt/jobs.nix
+15
-34
@@ -1,46 +1,26 @@
1
-{makeJob, pathInput, svnInput, svnInputRev} :
1
+attrs :
2
3
-let
4
- urlInput = url: {type = "tgz"; url = url;};
5
- infoInput = url : urlInput "${url}/release-info.xml";
3
+let easy = (import ./easy-job.nix) attrs;
4
+ makeEasyJob = easy.makeEasyJob;
5
7
- job = attrs : makeJob (attrs // {
8
- dirname ="strategoxt";
6
+ specs =
7
+ (import ../jobs/strategoxt2/packages.nix);
8
10
- args = [
11
- "../jobs/strategoxt2/releases.nix" /* brrr */
12
- attrs.jobAttr
13
- "/data/webserver/dist/strategoxt-tmp/${attrs.dirName}"
14
- "http://buildfarm.st.ewi.tudelft.nl/releases/strategoxt-tmp/${attrs.dirName}"
15
- "/data/webserver/dist/nix-cache"
16
- "http://buildfarm.st.ewi.tudelft.nl/releases/nix-cache"
17
- ];
18
-
19
- inputs = {
20
- systems = pathInput ./systems.nix;
21
- } // attrs.inputs;
22
- });
23
-
24
- bravenboer = "martin.bravenboer@gmail.com";
25
- kalleberg = "karltk@strategoxt.org";
26
- visser = "e.visser.@tudelft.nl";
27
-
28
- baseline =
29
- let urls = import ./baseline.nix;
30
- in { aterm = infoInput urls.aterm;
31
- sdf = infoInput urls.sdf;
32
- strategoxt = infoInput urls.strategoxt;
33
- strategoLibraries = infoInput urls.strategoLibraries;
34
- };
9
+ in {
10
+ javaFrontSyntaxTrunk = makeEasyJob {
11
+ spec = specs.javaFrontSyntax;
12
+ stable = false;
13
+ svn = "trunk";
14
+ };
15
+}
16
36
-in
17
+/*
18
19
{
20
javaFrontSyntaxTrunk = job {
40
- dirName = "java-front-syntax"; /* @todo should be automated */
21
+ dirName = "java-front-syntax";
22
inputs = {
23
javaFrontSyntax = svnInput https://svn.cs.uu.nl:12443/repos/StrategoXT/java-front/trunk/syntax;
43
- /* @todo it should be easy to automate this now (based on info in packages.nix) */
24
atermInfo = baseline.aterm;
25
sdf2BundleInfo = baseline.sdf;
26
strategoxtInfo = baseline.strategoxt;
@@ -50,3 +30,4 @@ in
30
jobAttr = "javaFrontSyntaxUnstable";
31
};
32
}
33
+ */