mirror of
https://github.com/terrapkg/packages.git
synced 2026-05-31 09:01:55 +00:00
@@ -0,0 +1,22 @@
|
||||
fn as_bodhi_ver(branch) {
|
||||
if branch.starts_with("el") {
|
||||
branch.crop(2);
|
||||
if branch == "10" {
|
||||
return "EPEL-10.0";
|
||||
}
|
||||
return `EPEL-${release}`;
|
||||
} else if branch == "frawhide" {
|
||||
return "42";
|
||||
} else if branch.starts_with("f") {
|
||||
branch.crop(1);
|
||||
return branch;
|
||||
} else {
|
||||
print(`E: unsupported branch: ${labels.branch}`);
|
||||
terminate();
|
||||
}
|
||||
}
|
||||
|
||||
fn bodhi(pkg, branch) {
|
||||
let url = `https://bodhi.fedoraproject.org/updates/?search=${pkg}&status=stable&releases=${branch}&rows_per_page=1&page=1`;
|
||||
return find(`^${pkg}-([\d.]+)-\d+\.[\w\d]+$`, get(url).json().updates[0].title, 1);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import "anda::cfg" as cfg;
|
||||
|
||||
fn install(labels) {
|
||||
if labels.script_path == () {
|
||||
print("fatal: labels.script_path is empty");
|
||||
terminate();
|
||||
}
|
||||
let releasever = sh("rpm -E '%fedora'", #{"stdout": "piped"}).ctx.stdout;
|
||||
releasever.trim();
|
||||
let basearch = sh("rpm -E '%_arch'", #{"stdout": "piped"}).ctx.stdout;
|
||||
basearch.trim();
|
||||
let hcl = cfg::load_file(sub(`(.+/)[^.]+\.rhai`, "${1}anda.hcl", labels.script_path));
|
||||
for repo in hcl.project.pkg.rpm.extra_repos {
|
||||
repo = sub(`\$releasever`, releasever, repo);
|
||||
repo = sub(`\$basearch`, basearch, repo);
|
||||
let filename = sub(`\W`, "_", repo);
|
||||
let file = open_file(`/etc/yum.repos.d/${filename}.repo`);
|
||||
file.write(`
|
||||
[filename]
|
||||
name=${filename}
|
||||
baseurl=${repo}
|
||||
enabled=1
|
||||
gpgcheck=0
|
||||
`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
import "anda::cfg" as cfg;
|
||||
print(cfg::load_file(labels.project).project.pkg.labels.to_json());
|
||||
Reference in New Issue
Block a user