Skip to content

Commit

Permalink
Fix hephaestus
Browse files Browse the repository at this point in the history
  • Loading branch information
D3vil0p3r committed Nov 16, 2024
1 parent e0e5656 commit 544a797
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions packages/hephaestus
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ build_package() {
pkgepoch=$(grep "^epoch=" PKGBUILD | awk -F"=" '{split($2,a," ");gsub(/"/, "", a[1]);print a[1] ":"}' | sed -e 's/^"\|'\''//g' -e 's/"\|'\''$//g')
groups=$(grep "^groups=" PKGBUILD | sed -e "s/groups=(//" -e "s/)//" -e "s/'//g" -e 's/"//g' | tr ' ' '\n' | grep -v '^athena$' | sed 's/^athena-//' | awk '{printf "%s, ", $0}' | sed 's/, $//')
arch=$(awk -v cpu_arch="x86_64" -F"['\" ]" '/^arch=\(/ { for (i=2; i<=NF; i++) if ($i == cpu_arch || $i == "any") print $i }' PKGBUILD)
pkgurl=$(grep "^url=" PKGBUILD | awk -F"=" '{print $2}' | sed -e 's/^["'\'']//g' -e 's/["'\'']$//g')
pkgver=$(grep "^pkgver=" PKGBUILD | awk -F"=" '{print $2}' | sed -e 's/^"\|'\''//g' -e 's/"\|'\''$//g')
pkgfile=()
for pname in "${pkgname[@]}"; do
Expand Down Expand Up @@ -124,17 +125,19 @@ build_package() {
sign_package

# A PKGBUILD could contain more than one package (i.e., python- packages)
for pfile in "${pkgfile[@]}"; do
echo -e "Moving $pfile to $out_dir"
cp -f $pfile* $out_dir
rm -f $pfile*
for pname in "${pkgname[@]}"; do
pkgfile+=("${pname}-${pkgepoch}${pkgver}-${pkgrel}-${arch}.pkg.tar.zst")
installed_size="$(pacman -Qip $pkgfile | grep 'Installed Size' | awk '{print $4, $5}')"
echo -e "Moving $pkgfile to $out_dir"
cp -f $pkgfile* $out_dir
rm -f $pkgfile*

build_status_api
package_list_api

# Add the package to the pkg_array
pkg_array+=("$pfile")
pkg_array+=("$pkgfile")
done

build_status_api
package_list_api

else
>&2 echo "$pkgfile already exists in $out_dir"
Expand All @@ -144,11 +147,11 @@ build_package() {

# Currently works only on x86_64. Need to be adapted for other archs
build_status_api() {
curl -X POST https://cms.athenaos.org/api/builders -H "Authorization: Bearer $(cat /run/secrets/strapi-sec)" -H "Content-Type: application/json" -d "{\"data\":{\"package_name\":\"$pkgname\",\"status_x86_64\":\"$build_status\",\"status_x86_64_version\":\"$pkgepoch$pkgver-$pkgrel\",\"status_i686\":\"Skip\",\"status_i686_version\":\"0\",\"status_ARMv6h\":\"Skip\",\"status_ARMv6h_version\":\"0\",\"Status_ARMv7h\":\"Skip\",\"status_ARMv7h_version\":\"0\",\"status_AArch64\":\"Skip\",\"status_AArch64_version\":\"0\"}}"
curl -X POST https://cms.athenaos.org/api/builders -H "Authorization: Bearer $(cat /run/secrets/strapi-sec)" -H "Content-Type: application/json" -d "{\"data\":{\"package_name\":\"$pname\",\"status_x86_64\":\"$build_status\",\"status_x86_64_version\":\"$pkgepoch$pkgver-$pkgrel\",\"status_i686\":\"Skip\",\"status_i686_version\":\"0\",\"status_ARMv6h\":\"Skip\",\"status_ARMv6h_version\":\"0\",\"Status_ARMv7h\":\"Skip\",\"status_ARMv7h_version\":\"0\",\"status_AArch64\":\"Skip\",\"status_AArch64_version\":\"0\"}}"
}

package_list_api() {
curl -X POST https://cms.athenaos.org/api/packages -H "Authorization: Bearer $(cat /run/secrets/strapi-sec)" -H "Content-Type: application/json" -d "{\"data\":{\"package_name\":\"$pkgname\",\"version\":\"$pkgepoch$pkgver-$pkgrel\",\"category\":\"$groups\",\"description\":\"$pkgdesc\"}}"
curl -X POST https://cms.athenaos.org/api/packages -H "Authorization: Bearer $(cat /run/secrets/strapi-sec)" -H "Content-Type: application/json" -d "{\"data\":{\"package_name\":\"$pname\",\"version\":\"$pkgepoch$pkgver-$pkgrel\",\"category\":\"$groups\",\"description\":\"$pkgdesc\",\"installed_size\":\"$installed_size\",\"upstream_url\":\"$pkgurl\"}}"
}

git_bump_package() {
Expand Down

0 comments on commit 544a797

Please sign in to comment.