Skip to content

Commit

Permalink
ymp builder package metadate path move to build path.
Browse files Browse the repository at this point in the history
  • Loading branch information
sulincix committed Sep 10, 2024
1 parent 08c1b44 commit ee214d9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
Empty file modified example/application/array.c
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion src/data/package.vala
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public class package {
pkgfile.extract_all ();
build.build_single(get_build_dir () + "/" + name);
error (1);
quarantine_import_from_path (build.ymp_build.ympbuild_buildpath + "/output");
quarantine_import_from_path (build.ymp_build.ympbuild_buildpath);
cd (curdir);
}

Expand Down
11 changes: 6 additions & 5 deletions src/data/quarantine.vala
Original file line number Diff line number Diff line change
Expand Up @@ -212,17 +212,18 @@ public void quarantine_install () {
fs_sync ();
}

private void quarantine_import_from_path (string path) {
private void quarantine_import_from_path (string fpath) {
print (colorize (_ ("Quarantine import"), yellow));
string rootfs = srealpath (get_storage () + "/quarantine/rootfs/");
string files = srealpath (get_storage () + "/quarantine/files/");
string links = srealpath (get_storage () + "/quarantine/links/");
string metadata = srealpath (get_storage () + "/quarantine/metadata/");
package p = new package ();
p.load (path + "/metadata.yaml");
move_file (path + "/metadata.yaml", metadata + "/" + p.name + ".yaml");
move_file (path + "/files", files + "/" + p.name);
move_file (path + "/links", links + "/" + p.name);
p.load (fpath + "/metadata.yaml");
move_file (fpath + "/metadata.yaml", metadata + "/" + p.name + ".yaml");
move_file (fpath + "/files", files + "/" + p.name);
move_file (fpath + "/links", links + "/" + p.name);
string path = fpath + "/output/";
foreach (string fname in find (path)) {
string ftarget = fname[path.length:];
if (isfile (fname)) {
Expand Down
35 changes: 17 additions & 18 deletions src/util/builder_target/ymp.vala
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ private static void build_target_ymp_init() {
if (unsafe || ymp_target.builder.ymp_build.get_ympbuild_value("unsafe") != "") {
metadata += " unsafe: true\n";
}
create_dir(buildpath);
writefile(srealpath(buildpath + "/metadata.yaml"), metadata.strip() + "\n");
var tar = new archive();
tar.load(buildpath + "/source.zip");
Expand Down Expand Up @@ -106,8 +107,8 @@ private static void build_target_ymp_init() {
cd(curdir);
return false;
}
writefile(output + "/files", files_data);
writefile(output + "/links", links_data);
writefile(ymp_target.builder.ymp_build.ympbuild_buildpath + "/files", files_data);
writefile(ymp_target.builder.ymp_build.ympbuild_buildpath + "/links", links_data);
cd(curdir);
return true;
});
Expand All @@ -116,7 +117,7 @@ private static void build_target_ymp_init() {
string buildpath = ymp_target.builder.ymp_build.ympbuild_buildpath;
string metadata = ymp_target.builder.ymp_build.get_ympbuild_metadata();
bool unsafe = get_bool("unsafe");
debug("Create metadata info: " + buildpath + "/output/metadata.yaml");
debug("Create metadata info: " + buildpath + "/metadata.yaml");
var yaml = new yamlfile();
yaml.data = metadata;
string srcdata = yaml.get("ymp.source");
Expand Down Expand Up @@ -211,27 +212,27 @@ private static void build_target_ymp_init() {
return false;
}
ymp_target.builder.output_package_name = name + "_" + version + "_" + release;
create_dir(buildpath + "/output/");
writefile(buildpath + "/output/metadata.yaml", trim(new_data));
create_dir(buildpath);
writefile(buildpath + "/metadata.yaml", trim(new_data));
return true;
});

ymp_target.create_data_file.connect(() => {
string buildpath = ymp_target.builder.ymp_build.ympbuild_buildpath;
debug(_("Create data file: %s/output/data.tar.gz").printf(buildpath));
debug(_("Create data file: %s/data.tar.gz").printf(buildpath));
var tar = new archive();
if (get_value("compress") == "none") {
tar.load(buildpath + "/output/data.tar");
tar.load(buildpath + "/data.tar");
tar.set_type("tar", "none");
} else if (get_value("compress") == "gzip") {
tar.load(buildpath + "/output/data.tar.gz");
tar.load(buildpath + "/data.tar.gz");
tar.set_type("tar", "gzip");
} else if (get_value("compress") == "xz") {
tar.load(buildpath + "/output/data.tar.xz");
tar.load(buildpath + "/data.tar.xz");
tar.set_type("tar", "xz");
} else {
// Default format (gzip)
tar.load(buildpath + "/output/data.tar.gz");
tar.load(buildpath + "/data.tar.gz");
tar.set_type("tar", "gzip");
}
int fnum = 0;
Expand All @@ -249,28 +250,26 @@ private static void build_target_ymp_init() {
tar.add(file);
fnum++;
}
if (isfile(buildpath + "/output/data.tar.gz")) {
remove_file(buildpath + "/output/data.tar.gz");
}
if (fnum != 0) {
tar.create();
}
cd(curdir);
string hash = calculate_sha1sum(buildpath + "/output/data.tar.gz");
uint64 size = filesize(buildpath + "/output/data.tar.gz");
string new_data = readfile(buildpath + "/output/metadata.yaml");
string hash = calculate_sha1sum(buildpath + "/data.tar.gz");
uint64 size = filesize(buildpath + "/data.tar.gz");
string new_data = readfile(buildpath + "/metadata.yaml");
new_data += " archive-hash: " + hash + "\n";
new_data += " arch: " + getArch() + "\n";
new_data += " archive-size: " + size.to_string() + "\n";
writefile(buildpath + "/output/metadata.yaml", trim(new_data));
create_dir(buildpath);
writefile(buildpath + "/metadata.yaml", trim(new_data));

});

ymp_target.create_binary_package.connect(() => {
string buildpath = ymp_target.builder.ymp_build.ympbuild_buildpath;

string curdir = pwd();
cd(buildpath + "/output/");
cd(buildpath);
ymp_target.create_data_file();
var tar = new archive();
tar.load(buildpath + "/package.zip");
Expand Down

0 comments on commit ee214d9

Please sign in to comment.