From a3caf7f6dddebbb3a59517c9cb803e44f9e9f5f3 Mon Sep 17 00:00:00 2001 From: Louie Shprung Date: Fri, 6 Sep 2024 17:04:26 -0400 Subject: Update package build scripts --- actions/Makefile.am | 22 ++++++++++------------ actions/build_deb.sh | 25 +++++++++++++++++++++++++ actions/build_rpm.sh | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 12 deletions(-) create mode 100755 actions/build_deb.sh create mode 100755 actions/build_rpm.sh (limited to 'actions') diff --git a/actions/Makefile.am b/actions/Makefile.am index e3451aa..2c1641b 100644 --- a/actions/Makefile.am +++ b/actions/Makefile.am @@ -1,3 +1,5 @@ +EXTRA_DIST = build_deb.sh build_rpm.sh + DEBUILD_ARGS = SAVE_CONTAINER = no @@ -8,16 +10,13 @@ clean-local: actions_build_deb: IMAGE_NAME = debian actions_build_deb: IMAGE_VERSION = unstable actions_build_deb: CONTAINER_NAME = $(PACKAGE_NAME)_$@_$(IMAGE_NAME)-$(IMAGE_VERSION) -actions_build_deb: DEPENDENCY_LIST = autoconf-archive debmake devscripts liblua5.1-0-dev lua5.1 ncurses-dev pkg-config -actions_build_deb: ../$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz +actions_build_deb: ../$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz build_deb.sh podman pull docker.io/library/$(IMAGE_NAME):$(IMAGE_VERSION) podman container exists "$(CONTAINER_NAME)" || podman run -itd --name "$(CONTAINER_NAME)" "$(IMAGE_NAME):$(IMAGE_VERSION)" podman exec "$(CONTAINER_NAME)" mkdir -p /tmp/build podman cp "../$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz" "$(CONTAINER_NAME)":/tmp/build - podman exec -w /tmp/build "$(CONTAINER_NAME)" apt-get -y update - podman exec -w /tmp/build "$(CONTAINER_NAME)" apt-get -y upgrade - podman exec -w /tmp/build "$(CONTAINER_NAME)" apt install -y $(DEPENDENCY_LIST) - podman exec -w /tmp/build "$(CONTAINER_NAME)" debmake -y -a $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz -i debuild $(DEBUILD_ARGS) + podman cp "build_deb.sh" "$(CONTAINER_NAME)":/tmp/build + podman exec -w /tmp/build "$(CONTAINER_NAME)" ./build_deb.sh $(IMAGE_NAME) $(IMAGE_VERSION) $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz $(DEBUILD_ARGS) mkdir -p "build/$@/$(IMAGE_NAME)-$(IMAGE_VERSION)" podman cp "$(CONTAINER_NAME)":/tmp/build/. "build/$@/$(IMAGE_NAME)-$(IMAGE_VERSION)/" if [ "$(SAVE_CONTAINER)" = "no" ]; then podman kill "$(CONTAINER_NAME)" && podman rm "$(CONTAINER_NAME)"; fi @@ -26,16 +25,15 @@ actions_build_deb: ../$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz actions_build_rpm: IMAGE_NAME = fedora actions_build_rpm: IMAGE_VERSION = rawhide actions_build_rpm: CONTAINER_NAME = $(PACKAGE_NAME)_$@_$(IMAGE_NAME)-$(IMAGE_VERSION) -actions_build_rpm: DEPENDENCY_LIST = gcc lua lua-devel make ncurses-devel rpmdevtools rpmlint -actions_build_rpm: ../$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz +actions_build_rpm: ../$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz build_rpm.sh podman pull docker.io/library/$(IMAGE_NAME):$(IMAGE_VERSION) podman container exists "$(CONTAINER_NAME)" || podman run -itd --name "$(CONTAINER_NAME)" "$(IMAGE_NAME):$(IMAGE_VERSION)" - podman exec "$(CONTAINER_NAME)" yum makecache - podman exec "$(CONTAINER_NAME)" yum install -y $(DEPENDENCY_LIST) - podman exec "$(CONTAINER_NAME)" rpmdev-setuptree + podman exec "$(CONTAINER_NAME)" mkdir -p /root/rpmbuild/SOURCES + podman exec "$(CONTAINER_NAME)" mkdir -p /root/rpmbuild/SPECS podman cp "../$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz" "$(CONTAINER_NAME)":/root/rpmbuild/SOURCES/ podman cp "../spec/$(PACKAGE_NAME).spec" "$(CONTAINER_NAME)":/root/rpmbuild/SPECS/ - podman exec "$(CONTAINER_NAME)" rpmbuild -ba /root/rpmbuild/SPECS/$(PACKAGE_NAME).spec + podman cp "build_rpm.sh" "$(CONTAINER_NAME)":/root/ + podman exec "$(CONTAINER_NAME)" /root/build_rpm.sh $(IMAGE_NAME) $(IMAGE_VERSION) $(PACKAGE_NAME).spec mkdir -p "build/$@/$(IMAGE_NAME)-$(IMAGE_VERSION)" podman cp "$(CONTAINER_NAME)":/root/rpmbuild/. "build/$@/$(IMAGE_NAME)-$(IMAGE_VERSION)/" if [ "$(SAVE_CONTAINER)" = "no" ]; then podman kill "$(CONTAINER_NAME)" && podman rm "$(CONTAINER_NAME)"; fi diff --git a/actions/build_deb.sh b/actions/build_deb.sh new file mode 100755 index 0000000..7c33067 --- /dev/null +++ b/actions/build_deb.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env sh + +print_help() { + echo "Usage: $0 IMAGE_NAME IMAGE_VERSION ARCHIVE_FILE [DEBUILD_ARGS]..." +} + +DEPENDENCY_LIST="autoconf-archive debmake devscripts liblua5.1-0-dev lua5.1 ncurses-dev pkg-config" + +# print help if not enough arguments were passed +if [ $# -lt 3 ]; then + print_help + exit 1 +fi + +IMAGE_NAME="$1" +shift +IMAGE_VERSION="$1" +shift +ARCHIVE_FILE="$1" +shift + +apt-get -y update +apt-get -y upgrade +apt install -y $DEPENDENCY_LIST +debmake -y -a "$ARCHIVE_FILE" -i debuild "$@" diff --git a/actions/build_rpm.sh b/actions/build_rpm.sh new file mode 100755 index 0000000..5b1f1df --- /dev/null +++ b/actions/build_rpm.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env sh + +print_help() { + echo "Usage: $0 IMAGE_NAME IMAGE_VERSION SPEC_FILE" +} + +DEPENDENCY_LIST="gcc lua lua-devel make ncurses-devel rpmdevtools rpmlint" + +# print help if not enough arguments were passed +if [ $# -lt 3 ]; then + print_help + exit 1 +fi + +IMAGE_NAME="$1" +shift +IMAGE_VERSION="$1" +shift +SPEC_FILE="$1" +shift + +yum -y update + +if [ "$IMAGE_NAME" = "rockylinux" ] && [ "$IMAGE_VERSION" = "8" ]; then + yum -y install yum-utils + yum -y install epel-release + if [ "$IMAGE_VERSION" = "8" ]; then + yum -y config-manager --set-enabled powertools + else + yum -y config-manager --set-enabled crb + fi + yum -y update +fi + +yum -y makecache +yum install -y $DEPENDENCY_LIST +rpmdev-setuptree +rpmbuild -ba /root/rpmbuild/SPECS/"$SPEC_FILE" -- cgit