mirror of
https://codeberg.org/privacy1st/arch
synced 2024-12-23 01:16:04 +01:00
update makepkg build process with docker
This commit is contained in:
parent
34ae554e25
commit
aa932691c0
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,3 +10,4 @@
|
||||
|
||||
/build-iso/out/
|
||||
/build-pkg/out/
|
||||
/build-pkg/*.tmp
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Please consider using ./build-all.sh instead. This script is outdated."
|
||||
|
||||
function build-with-aurutils() {
|
||||
aur build -c
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ function start-docker() {
|
||||
# Docker service is inactive -> Let's start it
|
||||
echo "Starting docker service ..."
|
||||
sudo systemctl start docker || return $?
|
||||
sleep 5s
|
||||
sleep 5s || return $?
|
||||
;;
|
||||
*)
|
||||
echo "Unknown state or error!"
|
||||
@ -27,14 +27,17 @@ function start-docker() {
|
||||
}
|
||||
|
||||
function build-pkg() {
|
||||
# --rm: Remove container after run.
|
||||
COMPOSE_ARGS=('run' '--rm' 'makepkg')
|
||||
if [ "${INTERACTIVE}" = "true" ]; then
|
||||
COMPOSE_ARGS+=('interactive')
|
||||
fi
|
||||
COMPOSE_ARGS+=("${1}")
|
||||
# $1: package-name
|
||||
# $2, $3, ...: makepkg-args
|
||||
|
||||
sudo docker-compose "${COMPOSE_ARGS[@]}"
|
||||
# --rm: Remove container after run.
|
||||
COMPOSE_ARGS=('run' '--rm' 'makepkg' "${1}") || return $?
|
||||
|
||||
if [ ${#MAKEPKG_ARGS[@]} -gt 0 ]; then
|
||||
COMPOSE_ARGS+=("${MAKEPKG_ARGS[@]}") || return $?
|
||||
fi
|
||||
|
||||
sudo docker-compose "${COMPOSE_ARGS[@]}" || return $?
|
||||
}
|
||||
|
||||
function push-pkg() {
|
||||
@ -62,16 +65,31 @@ function space_separated_to_array() {
|
||||
}
|
||||
|
||||
function main() {
|
||||
start-docker || return $?
|
||||
is-installed "docker-compose" || return $?
|
||||
|
||||
if [ "${1}" = "interactive" ]; then
|
||||
echo "Interactive mode enabled"
|
||||
INTERACTIVE=true
|
||||
shift; # remove first argument
|
||||
# parse arguments
|
||||
{
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "Usage: ${0} <PKGLIST-FILE> [<makepkgArguments>]
|
||||
With PKGLIST-FILE a file containing zero or more package names in each line, separated by space.
|
||||
All packages in a line will be built sequentially and are then synced to the remote repository
|
||||
before continuing with the next line.";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
PKGLIST=pkglist-de-p1st.txt # TODO
|
||||
PKGLIST="${1}"
|
||||
shift; # remove first arg
|
||||
MAKEPKG_ARGS=("$@")
|
||||
}
|
||||
|
||||
# check dependencies and start services
|
||||
{
|
||||
start-docker || return $?
|
||||
is-installed "docker-compose" || return $?
|
||||
}
|
||||
|
||||
|
||||
# Read content of PKGLIST file to an array
|
||||
# For each line: build and push all space separated packages
|
||||
mapfile -t STAGES < "${PKGLIST}"
|
||||
# shellcheck disable=SC2034
|
||||
for line in "${STAGES[@]}"; do
|
||||
|
@ -2,12 +2,11 @@ version: '3.7'
|
||||
services:
|
||||
|
||||
# usage:
|
||||
# - use PKGBUILD found in /pkg
|
||||
# sudo docker-compose run --rm makepkg
|
||||
# sudo docker-compose run --rm makepkg interactive
|
||||
# - use PKGBUILD found in /pkg/<RelativePath>
|
||||
# sudo docker-compose run --rm makepkg <RelativePath>
|
||||
# sudo docker-compose run --rm makepkg interactive <RelativePath>
|
||||
# If desired, adjust "DEFAULT_MAKEPKG_ARGS" in "run.sh"
|
||||
# Build the docker container with:
|
||||
# sudo docker-compose build --pull
|
||||
# Then build a package with:
|
||||
# sudo docker-compose run --rm makepkg <packageName> [<makepkgArguemnts>]
|
||||
makepkg:
|
||||
build: .
|
||||
|
||||
|
@ -1,27 +1,46 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# For each ARG in ARGUMENTS
|
||||
# build /pkg/$ARG/PKGBUILD
|
||||
# and store the built package at /out/
|
||||
#
|
||||
# If no ARGUMENTS are given, then fallback to path /pkg/PKGBUILD
|
||||
#
|
||||
set -e
|
||||
|
||||
DEFAULT_MAKEPKG_ARGS=('--syncdeps' '--noconfirm')
|
||||
|
||||
#################################
|
||||
|
||||
function main(){
|
||||
# Write-permission for user "build"
|
||||
sudo chown "build:wheel" /out
|
||||
|
||||
# Refresh mirrors
|
||||
# TODO: Move this to the Dockerfile?
|
||||
sudo pacman -Sy
|
||||
|
||||
PKG=/pkg/"${1}"
|
||||
shift; # remove first arg
|
||||
echo "Looking for PKGBUILD in ${PKG} ..."
|
||||
|
||||
build-pkg "$@"
|
||||
|
||||
# Ensure permissions match those of the original PKGBUILD.
|
||||
sudo chown "$(stat -c '%u:%g' "${PKG}"/PKGBUILD)" /out/*.pkg.tar.*
|
||||
}
|
||||
|
||||
function build-pkg(){
|
||||
# Make a copy as "/pkg" might be read-only and we do not want to alter it
|
||||
# Make a copy as we don't want to change stuff inside "/pkg"
|
||||
cp -r "${PKG}" /tmp/pkg
|
||||
cd /tmp/pkg
|
||||
|
||||
MAKEPKG_ARGS=('--syncdeps')
|
||||
if [ "${INTERACTIVE}" != "true" ]; then
|
||||
MAKEPKG_ARGS+=('--noconfirm') # --noconfirm is passed to pacman
|
||||
MAKEPKG_ARGS=()
|
||||
if [ "${#DEFAULT_MAKEPKG_ARGS[@]}" -gt 0 ]; then
|
||||
MAKEPKG_ARGS+=("$@")
|
||||
fi
|
||||
if [ $# -gt 0 ]; then
|
||||
MAKEPKG_ARGS+=("$@")
|
||||
fi
|
||||
|
||||
# Build the package.
|
||||
echo "Running: makepkg ${MAKEPKG_ARGS[*]}"
|
||||
# Disable exit on error as we manually check the exit status in a switch-case
|
||||
set +e
|
||||
makepkg "${MAKEPKG_ARGS[@]}"
|
||||
saved="$?"
|
||||
makepkg "${MAKEPKG_ARGS[@]}"; saved="$?";
|
||||
set -e
|
||||
|
||||
case "${saved}" in
|
||||
@ -41,32 +60,4 @@ function build-pkg(){
|
||||
esac
|
||||
}
|
||||
|
||||
function main(){
|
||||
# Write-permission for user "build"
|
||||
sudo chown "build:wheel" /out
|
||||
|
||||
# Refresh mirrors
|
||||
sudo pacman -Sy
|
||||
|
||||
if [ "${1}" = "interactive" ]; then
|
||||
INTERACTIVE=true
|
||||
shift; # remove first argument
|
||||
fi
|
||||
|
||||
# If first argument is zero, use default directory
|
||||
if [ -z "${1}" ]; then
|
||||
PKG=/pkg
|
||||
echo "No argument given. Using default directory ${PKG} to look for PKGBUILD ..."
|
||||
# Else append argument $1 as relative path
|
||||
else
|
||||
PKG=/pkg/"${1}"
|
||||
echo "Looking for PKGBUILD in ${PKG} ..."
|
||||
fi
|
||||
|
||||
build-pkg
|
||||
|
||||
# Ensure permissions match those of the original PKGBUILD.
|
||||
sudo chown "$(stat -c '%u:%g' "${PKG}"/PKGBUILD)" /out/*.pkg.tar.*
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
@ -2,7 +2,7 @@
|
||||
_pkgname=installer
|
||||
_reponame=arch
|
||||
pkgname="de-p1st-$_pkgname"
|
||||
pkgver=0.1.11
|
||||
pkgver=0.1.12
|
||||
pkgrel=1
|
||||
pkgdesc="Bash script to install Arch Linux"
|
||||
arch=('any')
|
||||
@ -10,6 +10,7 @@ url="https://codeberg.org/privacy1st/${_reponame}"
|
||||
license=('MIT')
|
||||
depends=('dialog')
|
||||
makedepends=('git')
|
||||
backup=(etc/"${pkgname}"/installer.cfg) # Use relative paths without leading slash
|
||||
source=("git+${url}.git")
|
||||
sha256sums=('SKIP')
|
||||
|
||||
|
2
pkg/holo
2
pkg/holo
@ -1 +1 @@
|
||||
Subproject commit 62cca9db19cc12ace23ce02daeb07b0f1432de62
|
||||
Subproject commit 1824047a640ddbe8f22231cafd2c1fee89e74e63
|
@ -1 +1 @@
|
||||
Subproject commit 4e705538c72e7d2c3d7fc4fd312452ebdbf3322d
|
||||
Subproject commit f30746503aedd0ab397641dc37b464c33a95ab74
|
Loading…
Reference in New Issue
Block a user