1 //<script type="text/javascript">
4 /** NOT CURRENTLY BEING WORKED ON !!! */
11 File = imports.File.File;
12 console = imports.console.console;
14 Seed.include('Date.js');
16 //DateExtra = imports.DateExtra.DateExtra;
20 // these should come from args
21 var SRC='/disk2/checkout/gnome2/';
23 // perhaps we can just do a simple make for building the girs - no make install etc.?
24 var UPDATE_SOURCES = false;
28 var LOGFILE = "jhbuild-" + (new Date()).format("Y-m-d-H") + '.log';
31 // change src & deleteGirs when you add / remove girs..
35 screen -d -m seed jhbuild.js
39 continue - do not trash gir's...
40 use this to diff changes when we fix gobject introspection..
41 git diff on directories..
43 run the doc tool as well.
48 --- git diff (current to /SRC/package-DATE.diff)
49 --- see if we have a patch list
50 --- if so: git reset --hard
63 to fix: - see the list of modules commented out.
70 'atk/atk/Atk-1.0.gir',
71 'clutter/clutter/json/ClutterJson-1.0.gir',
72 'clutter/clutter/cogl/Cogl-1.0.gir',
73 'clutter/clutter/Clutter-1.0.gir',
74 'clutter/clutter/Cogl-1.0.gir',
75 'clutter/clutter/ClutterJson-1.0.gir',
76 'epiphany/src/Epiphany-2.29.gir',
77 'libgda/libgda/Gda-4.0.gir',
78 'libgda/libgda-ui/Gdaui-4.0.gir',
79 'libgsf/gsf/Gsf-1.gir',
80 'gobject-introspection/gir/libxml2-2.0.gir', // needed!
81 'gobject-introspection/gir/Gio-2.0.gir',
82 'gobject-introspection/gir/GModule-2.0.gir',
83 'gobject-introspection/gir/GLib-2.0.gir',
84 'gobject-introspection/gir/GIRepository-2.0.gir',
85 'gobject-introspection/gir/GObject-2.0.gir',
87 'gtk+/gdk-pixbuf/GdkPixbuf-2.0.gir',
88 'gtk+/gtk/Gtk-2.0.gir',
89 'gtk+/gdk/Gdk-2.0.gir',
90 'clutter-gtk/clutter-gtk/GtkClutter-0.10.gir',
91 'gconf/GConf-2.0.gir',
92 'gtksourceview/gtksourceview/GtkSource-2.0.gir',
93 'gstreamer/gst/Gst-0.10.gir',
94 'gstreamer/libs/gst/check/GstCheck-0.10.gir',
95 'gstreamer/libs/gst/net/GstNet-0.10.gir',
96 'gstreamer/libs/gst/controller/GstController-0.10.gir',
97 'gstreamer/libs/gst/base/GstBase-0.10.gir',
98 'gst-plugins-base/gst-libs/gst/video/GstVideo-0.10.gir',
99 'gst-plugins-base/gst-libs/gst/tag/GstTag-0.10.gir',
100 'gst-plugins-base/gst-libs/gst/interfaces/GstInterfaces-0.10.gir',
101 'gst-plugins-base/gst-libs/gst/pbutils/GstPbutils-0.10.gir',
102 'gst-plugins-base/gst-libs/gst/netbuffer/GstNetbuffer-0.10.gir',
103 'gst-plugins-base/gst-libs/gst/riff/GstRiff-0.10.gir',
104 'gst-plugins-base/gst-libs/gst/audio/GstAudio-0.10.gir',
105 'gst-plugins-base/gst-libs/gst/fft/GstFft-0.10.gir',
106 'gst-plugins-base/gst-libs/gst/rtsp/GstRtsp-0.10.gir',
107 'gst-plugins-base/gst-libs/gst/app/GstApp-0.10.gir',
108 'gst-plugins-base/gst-libs/gst/sdp/GstSdp-0.10.gir',
109 'gst-plugins-base/gst-libs/gst/rtp/GstRtp-0.10.gir',
111 'gssdp/libgssdp/GSSDP-1.0.gir',
112 'gdome2/libgdome/Gdome-2.0.gir',
113 'gnome-menus/libmenu/GMenu-2.0.gir',
117 'pango/pango/PangoFT2-1.0.gir',
118 'pango/pango/PangoCairo-1.0.gir',
119 'pango/pango/PangoXft-1.0.gir',
120 'pango/pango/Pango-1.0.gir',
121 'PolicyKit/src/polkit/Polkit-1.0.gir',
122 'unique/unique/Unique-1.0.gir',
125 'WebKit/WebKit-1.0.gir',
126 //'WebKit/WebKit/gtk/JSCore-1.0.gir', -- not a generated file!
133 // package : directory
135 'clutter': 'clutter',
136 'clutter-gtk' :'clutter-gtk',
137 'eggdbus' : 'eggdbus',
139 'epiphany' : 'epiphany',
141 'gobject-introspection' : 'gobject-introspection',
143 'gstreamer' : 'gstreamer',
144 'gst-plugins-base' : 'gst-plugins-base',
145 'gtksourceview' : 'gtksourceview',
146 'gnome-menus' : 'gnome-menus',
150 'libunique' :'unique',
151 'libsoup' : 'libsoup',
153 'polkit' : 'PolicyKit',
164 //'gupnp', -- needs patch
165 // 'gnome-keyring' -- ndeds patch
166 // gnome-vfs -- needs patch
167 // 'goocanvas' -- needs patch
168 //'libnotify' -- needs patch
173 // we dont use these at present..
176 'http://bugzilla-attachments.gnome.org/attachment.cgi?id=156459',
177 'http://bugzilla-attachments.gnome.org/attachment.cgi?id=156457',
180 // not valid - against release..
181 //'http://bugzilla-attachments.gnome.org/attachment.cgi?id=145422'
184 'http://bugzilla-attachments.gnome.org/attachment.cgi?id=153062',
187 'http://www.akbkhome.com/svn/seed/gir/avahi.diff',
193 * spawn process, and print/monitor output.
196 * - global log.. -> our global log just indicates what was done and what was the result?
197 * - build log for a specific package?
200 * @arg string cwd working directory.
207 function write(fn, str) {
215 console.log(str.replace(/\n/,''));
217 if (typeof(streams[fn])=='undefined') {
219 var f = Gio.file_new_for_path(String(fn));
220 streams[fn] = new Gio.DataOutputStream({
221 base_stream: f.replace(null, false, Gio.FileCreateFlags.REPLACE_DESTINATION, null)
224 streams[fn].put_string(str, null);
227 if (!fn || typeof(streams[fn])=='undefined') {
230 streams[fn].close(null);
235 function spawnlog (cwd, s, outfile, errfile) {
237 var retval = { output: '' , error : '', cmd : s.join(' ') , done : false};
238 console.log(retval.cmd);
239 GLib.spawn_async_with_pipes(cwd, s, null,
240 GLib.SpawnFlags.DO_NOT_REAP_CHILD + GLib.SpawnFlags.SEARCH_PATH ,
243 var ctx = new GLib.MainLoop.c_new (null, false);
246 GLib.child_watch_add(GLib.PRIORITY_DEFAULT, ret.child_pid, function(pid, status) {
247 console.log("GOT STATUS:" + status);
248 retval.status = status;
251 console.log("Ending LOOP");
258 var in_ch = GLib.io_channel_unix_new(ret.standard_input);
259 var out_ch = GLib.io_channel_unix_new(ret.standard_output);
260 var err_ch = GLib.io_channel_unix_new(ret.standard_error);
262 function readstr(ch, fn, prop) {
266 var x = new GLib.String();
269 var cstatus = ch.get_buffer_condition();
270 cstatus = ch.get_flags (ch)
273 //Seed.print("WAITING INPUT?" + prop+':'+cstatus);
274 //var status = GLib.io_channel_read_line_string (ch, x, null);
277 var status = ch.read_line_string (x);
279 //Seed.print(prop + ":INPUT:" + status);
282 case GLib.IOStatus.NORMAL:
284 retval[prop] += x.str;
286 case GLib.IOStatus.AGAIN:
288 case GLib.IOStatus.ERROR:
289 case GLib.IOStatus.EOF:
299 GLib.io_add_watch(in_ch, GLib.PRIORITY_DEFAULT,
300 GLib.IOCondition.OUT + GLib.IOCondition.IN + GLib.IOCondition.PRI, function()
302 //Seed.print("GOT INOUT ON IN");
303 readstr(out_ch, outfile, 'output');
306 GLib.io_add_watch(err_ch, GLib.PRIORITY_DEFAULT,
307 GLib.IOCondition.ERR + GLib.IOCondition.IN + GLib.IOCondition.PRI + GLib.IOCondition.OUT,
310 // Seed.print("GOT INOUT ON ERR");
311 readstr(er_ch, errfile, 'error');
314 // let's just write some data...
315 //var x = new GLib.String();
316 //var status = GLib.io_channel_write (out_ch, "\n", 1);
318 //while (!retval.done) {
326 console.log("STARTING LOOP");
327 ctx.run(); // wait fore exit?
329 readstr(out_ch, outfile, 'output');
330 readstr(err_ch, errfile, 'error');
338 //GLib.spawn_close_pid(ret.child_pid);
346 if (typeof(res) == 'string') {
347 if (!res.length) { // skip blan.
352 write(SRC + LOGFILE, '[' + (new Date()).format("Y-m-d H:i:s") + '] ' + res);
355 log("CMD:" + res.cmd +"\n");
356 log("RETURN:" + (res.status ? res.status : "OK")+"\n");
357 log(res.output ? "---OUT---\n" + res.output + "\n" : '');
358 log(res.error ? " ---ERROR---\n" + res.error + "\n" : '');
361 function logresult(res) {
362 log("CMD: " + res.cmd +"\n");
363 log((res.status ? "RETURN: " + res.status : 'BUILD OK') +"\n");
364 if (res.status != 0 ) {
365 log(res.error ? "---ERROR---\n" + res.error + "\n" : '');
371 gdome : [ 'git', 'clean', 'make' , 'install' ], // fixme..
379 deleteGirs.map( function(g) {
381 console.log("DELETE" + SRC + g);
398 cline.unshift('list');
399 cline.unshift('jhbuild');
400 var order = spawnlog('/tmp', cline).output.split("\n");
401 // push introspection first...!!!
405 for (var i=0; i < order.length; i++) {
406 if (!order[i].length || pkgs.indexOf(order[i]) < 0) {
407 //console.log("SKIP (not related to gir) " + order[i] );
408 log("SKIP (not related to gir) " + order[i] +"\n");
413 // just for our reference..
414 spawnlog('/tmp', ['jhbuild','info', order[i]]);
415 // add -a -c for a clean build..
417 if (!UPDATE_SOURCES) {
418 // quick rebuild - probably to check introspection change results.
419 log("MAKE INSTALL: " + order[i] + "\n");
421 SRC+all[order[i]], ['bash' , '-c' ,'make install 2>&1'],
422 SRC+all[order[i]]+'/jhbuild.log',
423 SRC+all[order[i]]+'/jhbuild.err'
431 // for git.. - do a diff before we start, and store it..
433 if (File.exists(SRC+all[order[i]]+'/.git')) {
435 var gitres = spawnlog( SRC + all[order[i]], [ 'git', 'diff' ]);
438 if (gitres.output.length) {
439 fn = SRC+all[order[i]]+'-' + (new Date()).format('Y-m-d-H') + '.diff';
440 log("DIFF STORED: "+ fn+"\n");
441 write(fn, gitres.output);
444 log("RESET GIT / PULL\n");
445 spawnlog( SRC + all[order[i]], [ 'git', 'reset', '--hard' ]);
446 spawnlog( SRC + all[order[i]], [ 'git', 'pull' ]);
448 log("RE-APPLING DIFF\n");
449 spawnlog( SRC + all[order[i]], [ 'patch', '-p1', '-i', fn ]);
451 // we should apply patches here..
460 log("BUILDING : " + order[i] + "\n");
462 '/tmp', ['jhbuild', '--no-interact', 'buildone',order[i]],
463 SRC+all[order[i]]+'/jhbuild.log',
464 SRC+all[order[i]]+'/jhbuild.err'
467 if (res.status == 256 && res.error.match(/The remote end hung up unexpectedly/)) {
468 // try again - git connection failed..
478 close(SRC + LOGFILE);
486 //polkit -> PolicyKit
489 //libxml2 -> last! and must manual..
492 // we can just trash the gir's..
493 // usefull for checking changes in introspection..
494 // then run make on the whole lot..
498 //libxml (must be after introspecton)
504 // full build - needs jhbuild really...
506 // -- will not build stuff that's not changed.. (we need to store checkout id's to make this work..)
507 // otherwise do a -a -c
511 // what this has to do.. (similar to jhbuild...?? why not use it???