mirror of
https://github.com/terrapkg/packages.git
synced 2026-05-31 09:01:55 +00:00
3566e7eddf
* feat(ci)!: switch to rpmbuild * fix: support extra_repos * let's try this instead * fix the funny condition * fix: disable gpgcheck This should be fine because checksum is checked for the repomd and the packages too
27 lines
815 B
Plaintext
27 lines
815 B
Plaintext
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
|
|
`);
|
|
}
|
|
}
|