|
@@ -12,7 +12,7 @@ public static int manifest_main(string[] args) {
|
|
|
|
|
|
var verb = args[1];
|
|
var verb = args[1];
|
|
|
|
|
|
- if(verb != "remove" && verb != "acquire" && verb != "install") {
|
|
|
|
|
|
+ if(verb != "remove" && verb != "acquire" && verb != "install" && verb != "package") {
|
|
if(args.length < 3) {
|
|
if(args.length < 3) {
|
|
manifest_usage();
|
|
manifest_usage();
|
|
return 255;
|
|
return 255;
|
|
@@ -61,6 +61,10 @@ public static int manifest_main(string[] args) {
|
|
return uininstall();
|
|
return uininstall();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if(verb == "package") {
|
|
|
|
+ return package();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
manifest_usage();
|
|
manifest_usage();
|
|
return 255;
|
|
return 255;
|
|
@@ -285,5 +289,73 @@ private int uininstall() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+private int package() {
|
|
|
|
+ if(manifest.executables.acquire != null) {
|
|
|
|
+ printerr("Running Acquire...\n");
|
|
|
|
+ var result = acquire();
|
|
|
|
+ if(result != 0) {
|
|
|
|
+ printerr(@"Acquire failed, code: $(result)\n");
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ printerr("Manifest does not specify an acquire script, assuming we have everything we need already and packaging.\n");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var proc = new Subprocess.newv(new string[] { "tar", "-cJf", @"../$(manifest.name)-$(manifest.version).usmc", "."}, SubprocessFlags.INHERIT_FDS);
|
|
|
|
+ return proc.wait_check() ? 0 : 254;
|
|
|
|
+
|
|
|
|
+ // var parent_working_dir = GLib.File.new_for_path (".");
|
|
|
|
+
|
|
|
|
+ // // Create the tar.gz archive named according the the first argument.
|
|
|
|
+ // Archive.Write archive = new Archive.Write ();
|
|
|
|
+ // archive.add_filter_xz();
|
|
|
|
+ // archive.set_format_pax_restricted ();
|
|
|
|
+ // archive.open_filename (@"../$(manifest.name)-$(manifest.version).usmc");
|
|
|
|
+
|
|
|
|
+ // var files = new Invercargill.Fifo<string>();
|
|
|
|
+ // Invercargill.directory(".").iterate(d => files.push(d));
|
|
|
|
+
|
|
|
|
+ // // Add all the other arguments into the archive
|
|
|
|
+ // foreach (var path in files) {
|
|
|
|
+ // var file = GLib.File.new_for_path (path);
|
|
|
|
+ // try {
|
|
|
|
+ // GLib.FileInfo file_info = file.query_info (GLib.FileAttribute.STANDARD_SIZE, GLib.FileQueryInfoFlags.NONE);
|
|
|
|
+ // FileInputStream input_stream = file.read ();
|
|
|
|
+ // DataInputStream data_input_stream = new DataInputStream (input_stream);
|
|
|
|
+
|
|
|
|
+ // // Add an entry to the archive
|
|
|
|
+ // Archive.Entry entry = new Archive.Entry ();
|
|
|
|
+ // entry.set_pathname (parent_working_dir.get_relative_path (file));
|
|
|
|
+ // entry.set_size ((Archive.int64_t)file_info.get_size ());
|
|
|
|
+ // entry.set_filetype ((uint)Posix.S_IFREG);
|
|
|
|
+ // entry.set_perm (0644);
|
|
|
|
+ // if (archive.write_header (entry) != Archive.Result.OK) {
|
|
|
|
+ // critical ("Error writing '%s': %s (%d)", file.get_path (), archive.error_string (), archive.errno ());
|
|
|
|
+ // continue;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // // Add the actual content of the file
|
|
|
|
+ // size_t bytes_read;
|
|
|
|
+ // uint8[] buffer = new uint8[64];
|
|
|
|
+ // while (data_input_stream.read_all (buffer, out bytes_read)) {
|
|
|
|
+ // if (bytes_read <= 0) {
|
|
|
|
+ // break;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // archive.write_data(buffer[:bytes_read]);
|
|
|
|
+ // }
|
|
|
|
+ // } catch (Error e) {
|
|
|
|
+ // critical (e.message);
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // if (archive.close () != Archive.Result.OK) {
|
|
|
|
+ // error ("Error : %s (%d)", archive.error_string (), archive.errno ());
|
|
|
|
+ // }
|
|
|
|
+
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|