1 //<script type="text/javascript">
4 /** NOT CURRENTLY BEING WORKED ON !!! */
11 File = imports.File.File;
12 console = imports.console.console;
15 DateExtra = imports.DateExtra.DateExtra;
19 // these should come from args
20 var SRC='/disk2/checkout/gnome2/';
22 // perhaps we can just do a simple make for building the girs - no make install etc.?
23 var UPDATE_SOURCES = false;
27 var LOGFILE = "jhbuild-" + (new DateExtra()).format("Y-m-d-H") + '.log';
30 // change src & deleteGirs when you add / remove girs..
34 screen -d -m seed jhbuild.js
38 continue - do not trash gir's...
39 use this to diff changes when we fix gobject introspection..
40 git diff on directories..
42 run the doc tool as well.
47 --- git diff (current to /SRC/package-DATE.diff)
48 --- see if we have a patch list
49 --- if so: git reset --hard
62 to fix: - see the list of modules commented out.
69 'atk/atk/Atk-1.0.gir',
70 'clutter/clutter/json/ClutterJson-1.0.gir',
71 'clutter/clutter/cogl/Cogl-1.0.gir',
72 'clutter/clutter/Clutter-1.0.gir',
73 'clutter/clutter/Cogl-1.0.gir',
74 'clutter/clutter/ClutterJson-1.0.gir',
75 'epiphany/src/Epiphany-2.29.gir',
76 'libgda/libgda/Gda-4.0.gir',
77 'libgda/libgda-ui/Gdaui-4.0.gir',
78 'libgsf/gsf/Gsf-1.gir',
79 'gobject-introspection/gir/libxml2-2.0.gir', // needed!
80 'gobject-introspection/gir/Gio-2.0.gir',
81 'gobject-introspection/gir/GModule-2.0.gir',
82 'gobject-introspection/gir/GLib-2.0.gir',
83 'gobject-introspection/gir/GIRepository-2.0.gir',
84 'gobject-introspection/gir/GObject-2.0.gir',
86 'gtk+/gdk-pixbuf/GdkPixbuf-2.0.gir',
87 'gtk+/gtk/Gtk-2.0.gir',
88 'gtk+/gdk/Gdk-2.0.gir',
89 'clutter-gtk/clutter-gtk/GtkClutter-0.10.gir',
90 'gconf/GConf-2.0.gir',
91 'gtksourceview/gtksourceview/GtkSource-2.0.gir',
92 'gstreamer/gst/Gst-0.10.gir',
93 'gstreamer/libs/gst/check/GstCheck-0.10.gir',
94 'gstreamer/libs/gst/net/GstNet-0.10.gir',
95 'gstreamer/libs/gst/controller/GstController-0.10.gir',
96 'gstreamer/libs/gst/base/GstBase-0.10.gir',
97 'gst-plugins-base/gst-libs/gst/video/GstVideo-0.10.gir',
98 'gst-plugins-base/gst-libs/gst/tag/GstTag-0.10.gir',
99 'gst-plugins-base/gst-libs/gst/interfaces/GstInterfaces-0.10.gir',
100 'gst-plugins-base/gst-libs/gst/pbutils/GstPbutils-0.10.gir',
101 'gst-plugins-base/gst-libs/gst/netbuffer/GstNetbuffer-0.10.gir',
102 'gst-plugins-base/gst-libs/gst/riff/GstRiff-0.10.gir',
103 'gst-plugins-base/gst-libs/gst/audio/GstAudio-0.10.gir',
104 'gst-plugins-base/gst-libs/gst/fft/GstFft-0.10.gir',
105 'gst-plugins-base/gst-libs/gst/rtsp/GstRtsp-0.10.gir',
106 'gst-plugins-base/gst-libs/gst/app/GstApp-0.10.gir',
107 'gst-plugins-base/gst-libs/gst/sdp/GstSdp-0.10.gir',
108 'gst-plugins-base/gst-libs/gst/rtp/GstRtp-0.10.gir',
110 'gssdp/libgssdp/GSSDP-1.0.gir',
111 'gdome2/libgdome/Gdome-2.0.gir',
112 'gnome-menus/libmenu/GMenu-2.0.gir',
116 'pango/pango/PangoFT2-1.0.gir',
117 'pango/pango/PangoCairo-1.0.gir',
118 'pango/pango/PangoXft-1.0.gir',
119 'pango/pango/Pango-1.0.gir',
120 'PolicyKit/src/polkit/Polkit-1.0.gir',
121 'unique/unique/Unique-1.0.gir',
124 'WebKit/WebKit-1.0.gir',
125 //'WebKit/WebKit/gtk/JSCore-1.0.gir', -- not a generated file!
132 // package : directory
134 'clutter': 'clutter',
135 'clutter-gtk' :'clutter-gtk',
136 'eggdbus' : 'eggdbus',
138 'epiphany' : 'epiphany',
140 'gobject-introspection' : 'gobject-introspection',
142 'gstreamer' : 'gstreamer',
143 'gst-plugins-base' : 'gst-plugins-base',
144 'gtksourceview' : 'gtksourceview',
145 'gnome-menus' : 'gnome-menus',
149 'libunique' :'unique',
150 'libsoup' : 'libsoup',
152 'polkit' : 'PolicyKit',
156 //'gupnp', -- needs patch
157 // 'gnome-keyring' -- ndeds patch
158 // gnome-vfs -- needs patch
159 // 'goocanvas' -- needs patch
160 //'libnotify' -- needs patch
165 // we dont use these at present..
168 'http://bugzilla-attachments.gnome.org/attachment.cgi?id=156459',
169 'http://bugzilla-attachments.gnome.org/attachment.cgi?id=156457',
172 // not valid - against release..
173 //'http://bugzilla-attachments.gnome.org/attachment.cgi?id=145422'
176 'http://bugzilla-attachments.gnome.org/attachment.cgi?id=153062',
179 'http://www.akbkhome.com/svn/seed/gir/avahi.diff',
185 * spawn process, and print/monitor output.
188 * - global log.. -> our global log just indicates what was done and what was the result?
189 * - build log for a specific package?
192 * @arg string cwd working directory.
199 function write(fn, str) {
207 console.log(str.replace(/\n/,''));
209 if (typeof(streams[fn])=='undefined') {
211 var f = Gio.file_new_for_path(String(fn));
212 streams[fn] = new Gio.DataOutputStream({
213 base_stream: f.replace(null, false, Gio.FileCreateFlags.REPLACE_DESTINATION, null)
216 streams[fn].put_string(str, null);
219 if (!fn || typeof(streams[fn])=='undefined') {
222 streams[fn].close(null);
227 function spawnlog (cwd, s, outfile, errfile) {
229 var retval = { output: '' , error : '', cmd : s.join(' ') , done : false};
230 console.log(retval.cmd);
231 GLib.spawn_async_with_pipes(cwd, s, null,
232 GLib.SpawnFlags.DO_NOT_REAP_CHILD + GLib.SpawnFlags.SEARCH_PATH ,
235 var ctx = GLib.main_loop_new (null, false);
238 GLib.child_watch_add(GLib.PRIORITY_DEFAULT, ret.child_pid, function(pid, status) {
239 console.log("GOT STATUS:" + status);
240 retval.status = status;
243 console.log("Ending LOOP");
244 GLib.main_loop_quit(ctx);
250 var in_ch = GLib.io_channel_unix_new(ret.standard_input);
251 var out_ch = GLib.io_channel_unix_new(ret.standard_output);
252 var err_ch = GLib.io_channel_unix_new(ret.standard_error);
254 function readstr(ch, fn, prop) {
258 var x = new GLib.String();
261 var cstatus = GLib.io_channel_get_buffer_condition(ch);
262 cstatus = GLib.io_channel_get_flags (ch)
265 //Seed.print("WAITING INPUT?" + prop+':'+cstatus);
266 //var status = GLib.io_channel_read_line_string (ch, x, null);
269 var status = GLib.io_channel_read_line_string (ch, x);
271 //Seed.print(prop + ":INPUT:" + status);
274 case GLib.IOStatus.NORMAL:
276 retval[prop] += x.str;
278 case GLib.IOStatus.AGAIN:
280 case GLib.IOStatus.ERROR:
281 case GLib.IOStatus.EOF:
291 GLib.io_add_watch(in_ch, GLib.PRIORITY_DEFAULT,
292 GLib.IOCondition.OUT + GLib.IOCondition.IN + GLib.IOCondition.PRI, function()
294 //Seed.print("GOT INOUT ON IN");
295 readstr(out_ch, outfile, 'output');
298 GLib.io_add_watch(err_ch, GLib.PRIORITY_DEFAULT,
299 GLib.IOCondition.ERR + GLib.IOCondition.IN + GLib.IOCondition.PRI + GLib.IOCondition.OUT,
302 // Seed.print("GOT INOUT ON ERR");
303 readstr(er_ch, errfile, 'error');
306 // let's just write some data...
307 //var x = new GLib.String();
308 //var status = GLib.io_channel_write (out_ch, "\n", 1);
310 //while (!retval.done) {
318 console.log("STARTING LOOP");
319 GLib.main_loop_run(ctx, false); // wait fore exit?
321 readstr(out_ch, outfile, 'output');
322 readstr(err_ch, errfile, 'error');
330 //GLib.spawn_close_pid(ret.child_pid);
338 if (typeof(res) == 'string') {
339 if (!res.length) { // skip blan.
344 write(SRC + LOGFILE, '[' + (new Date()).format("Y-m-d H:i:s") + '] ' + res);
347 log("CMD:" + res.cmd +"\n");
348 log("RETURN:" + (res.status ? res.status : "OK")+"\n");
349 log(res.output ? "---OUT---\n" + res.output + "\n" : '');
350 log(res.error ? " ---ERROR---\n" + res.error + "\n" : '');
353 function logresult(res) {
354 log("CMD: " + res.cmd +"\n");
355 log((res.status ? "RETURN: " + res.status : 'BUILD OK') +"\n");
356 if (res.status != 0 ) {
357 log(res.error ? "---ERROR---\n" + res.error + "\n" : '');
363 gdome : [ 'git', 'clean', 'make' , 'install' ], // fixme..
371 deleteGirs.map( function(g) {
373 console.log("DELETE" + SRC + g);
390 cline.unshift('list');
391 cline.unshift('jhbuild');
392 var order = spawnlog('/tmp', cline).output.split("\n");
393 // push introspection first...!!!
397 for (var i=0; i < order.length; i++) {
398 if (!order[i].length || pkgs.indexOf(order[i]) < 0) {
399 //console.log("SKIP (not related to gir) " + order[i] );
400 log("SKIP (not related to gir) " + order[i] +"\n");
405 // just for our reference..
406 spawnlog('/tmp', ['jhbuild','info', order[i]]);
407 // add -a -c for a clean build..
409 if (!UPDATE_SOURCES) {
410 // quick rebuild - probably to check introspection change results.
411 log("MAKE INSTALL: " + order[i] + "\n");
413 SRC+all[order[i]], ['bash' , '-c' ,'make install 2>&1'],
414 SRC+all[order[i]]+'/jhbuild.log',
415 SRC+all[order[i]]+'/jhbuild.err'
423 // for git.. - do a diff before we start, and store it..
425 if (File.exists(SRC+all[order[i]]+'/.git')) {
427 var gitres = spawnlog( SRC + all[order[i]], [ 'git', 'diff' ]);
430 if (gitres.output.length) {
431 fn = SRC+all[order[i]]+'-' + (new Date()).format('Y-m-d-H') + '.diff';
432 log("DIFF STORED: "+ fn+"\n");
433 write(fn, gitres.output);
436 log("RESET GIT / PULL\n");
437 spawnlog( SRC + all[order[i]], [ 'git', 'reset', '--hard' ]);
438 spawnlog( SRC + all[order[i]], [ 'git', 'pull' ]);
440 log("RE-APPLING DIFF\n");
441 spawnlog( SRC + all[order[i]], [ 'patch', '-p1', '-i', fn ]);
443 // we should apply patches here..
452 log("BUILDING : " + order[i] + "\n");
454 '/tmp', ['jhbuild', '--no-interact', 'buildone',order[i]],
455 SRC+all[order[i]]+'/jhbuild.log',
456 SRC+all[order[i]]+'/jhbuild.err'
459 if (res.status == 256 && res.error.match(/The remote end hung up unexpectedly/)) {
460 // try again - git connection failed..
470 close(SRC + LOGFILE);
478 //polkit -> PolicyKit
481 //libxml2 -> last! and must manual..
484 // we can just trash the gir's..
485 // usefull for checking changes in introspection..
486 // then run make on the whole lot..
490 //libxml (must be after introspecton)
496 // full build - needs jhbuild really...
498 // -- will not build stuff that's not changed.. (we need to store checkout id's to make this work..)
499 // otherwise do a -a -c
503 // what this has to do.. (similar to jhbuild...?? why not use it???