From 61e78e134406316c68a316b730205d12972eb023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santiago=20Rodr=C3=ADguez?= Date: Thu, 5 Dec 2024 14:37:19 +0100 Subject: [PATCH] rpms: add verapdf package Based on work from Jens Steidl at https://git.slub-dresden.de/digital-preservation/verapdf_package_build/ --- rpms/EL9/verapdf/Dockerfile | 10 +++++ rpms/EL9/verapdf/Makefile | 57 +++++++++++++++++++++++++ rpms/EL9/verapdf/files/auto-install.xml | 15 +++++++ rpms/EL9/verapdf/package.spec | 34 +++++++++++++++ 4 files changed, 116 insertions(+) create mode 100644 rpms/EL9/verapdf/Dockerfile create mode 100644 rpms/EL9/verapdf/Makefile create mode 100644 rpms/EL9/verapdf/files/auto-install.xml create mode 100644 rpms/EL9/verapdf/package.spec diff --git a/rpms/EL9/verapdf/Dockerfile b/rpms/EL9/verapdf/Dockerfile new file mode 100644 index 0000000..69ea8a6 --- /dev/null +++ b/rpms/EL9/verapdf/Dockerfile @@ -0,0 +1,10 @@ +FROM rockylinux:9 +MAINTAINER Jörg Sachse + +### install build tools +RUN yum update -y + +RUN yum install -y rpmdevtools gpg* rng-tools \ + make wget java-1.8.0-openjdk.x86_64 +RUN yum clean all && rm -rf /var/cache/yum + diff --git a/rpms/EL9/verapdf/Makefile b/rpms/EL9/verapdf/Makefile new file mode 100644 index 0000000..1a54479 --- /dev/null +++ b/rpms/EL9/verapdf/Makefile @@ -0,0 +1,57 @@ +NAME = verapdf +VERSION = 1.26.2 +RPM_TOPDIR = "/rpmbuild" +DOCKER_VOLUME = "/src" +DOCKER_IMAGE = "rpmbuild-$(NAME)-$(VERSION)" + +RPMBUILD_ARGS := \ + --define "_topdir $(RPM_TOPDIR)" \ + --define "_etcdir $(DOCKER_VOLUME)/etc" \ + --define "name $(NAME)" \ + --define "version $(VERSION)" + +.PHONY: build-docker-image build rpm-build rpm-clean rpm-test + +all: build-docker-image build + +build-docker-image: + @echo "==> Building Docker image with build environment." + @docker build --tag "$(DOCKER_IMAGE)" . + +build: + @echo "==> Building RPM." + @docker run --rm --volume "$(shell pwd):$(DOCKER_VOLUME)" $(DOCKER_IMAGE) make -C $(DOCKER_VOLUME) rpm-build + +dev: + @echo "==> Building RPM." + @docker run -i -t --rm --volume "$(shell pwd):$(DOCKER_VOLUME)" $(DOCKER_IMAGE) /bin/bash + + +rpm-build: rpm-clean + @echo "==> Preparing environment for rpmbuild." + mkdir -p $(RPM_TOPDIR) + cp $(DOCKER_VOLUME)/package.spec $(RPM_TOPDIR)/package.spec + mkdir -p $(RPM_TOPDIR)/BUILD/ + cp files/* $(RPM_TOPDIR)/BUILD/ + cd $(RPM_TOPDIR)/; rpmbuild $(RPMBUILD_ARGS) -ba --clean package.spec + + + + @echo "==> Copying RPM files." + cp -p $(RPM_TOPDIR)/RPMS/x86_64/$(NAME)-$(VERSION)*.x86_64.rpm $(DOCKER_VOLUME) + cp -p $(RPM_TOPDIR)/SRPMS/$(NAME)-$(VERSION)*.src.rpm $(DOCKER_VOLUME) + +rpm-clean: + @echo "==> Cleaning up previous RPMs builds." + @rm -rf $(RPM_TOPDIR) + +rpm-test: + @docker run --rm --volume="$(shell pwd):$(DOCKER_VOLUME)" rockylinux:9 bash -c "yum install -y epel-release && yum localinstall -y --nogpgcheck $(DOCKER_VOLUME)/$(NAME)-$(VERSION)*.rpm" + +cleanup: + @echo "==> Remove artifacts created as root." + @docker run -i \ + --rm \ + --volume "$(shell pwd):$(DOCKER_VOLUME)" \ + $(DOCKER_IMAGE) \ + bash -c "rm -rf /src/*.rpm /src/verapdf" diff --git a/rpms/EL9/verapdf/files/auto-install.xml b/rpms/EL9/verapdf/files/auto-install.xml new file mode 100644 index 0000000..b978448 --- /dev/null +++ b/rpms/EL9/verapdf/files/auto-install.xml @@ -0,0 +1,15 @@ + + + + INSTALL_PATH + + + + + + + + + + + diff --git a/rpms/EL9/verapdf/package.spec b/rpms/EL9/verapdf/package.spec new file mode 100644 index 0000000..e73681f --- /dev/null +++ b/rpms/EL9/verapdf/package.spec @@ -0,0 +1,34 @@ +Name: verapdf +Version: %{version} +Release: 1%{?dist} +Summary: VeraPDF validation tool +License: GPLv3 + +BuildRequires: unzip, wget +Requires: java-1.8.0-openjdk-headless + +%description +VeraPDF validation tool + +%prep +# download veraPDF installer +wget -q http://downloads.verapdf.org/rel/verapdf-installer.zip +# configure installation path for unattended installation +sed -i 's#INSTALL_PATH#/rpmbuild/BUILD/%{name}#g' auto-install.xml +# extract +unzip verapdf-installer.zip +# run the veraPDF installer using autoinstall configuration +java -jar verapdf-greenfield-%{version}/verapdf-izpack-installer-%{version}.jar auto-install.xml + +%build +# no need to build anything, veraPDF comes precompiled + +%install +mkdir -p %{buildroot}/usr/local/verapdf/ +cp -r /rpmbuild/BUILD/verapdf/* %{buildroot}/usr/local/verapdf + +%files +# DOC: http://ftp.rpm.org/max-rpm/s1-rpm-inside-files-list-directives.html +/usr/local/verapdf/ + +%license