%global debug_package %{nil} %ifarch x86_64 %global zot_goarch amd64 %endif %ifarch aarch64 %global zot_goarch arm64 %endif Name: zot Version: 2.1.22 Release: %autorelease Summary: A scale-out production-ready vendor-neutral OCI-native container image/artifact registry License: Apache-2.0 URL: https://github.com/project-zot/zot Source0: %{url}/archive/refs/tags/v%{version}.tar.gz Source10: %{name}.service Source11: %{name}.sysusers Source12: %{name}-tmpfiles.conf Source13: %{name}-service.preset Source14: %{name}.conf Source15: %{name}-config.yaml ExclusiveArch: x86_64 aarch64 BuildRequires: curl BuildRequires: git BuildRequires: golang BuildRequires: make BuildRequires: systemd-rpm-macros %{?systemd_requires} %{?sysusers_requires_compat} Requires: ca-certificates Recommends: zot-zli = %{version}-%{release} %description %{summary}. %package zli Summary: Command line client for zot registries %description zli %{summary}. %package zb Summary: Benchmark tool for OCI registries %description zb %{summary}. %package zxp Summary: Metrics exporter for zot minimal deployments %description zxp %{summary}. %prep %autosetup -n zot-%{version} __SYSTEM_GO_VERSION="$(go version | sed -E 's/^go version go([0-9]+(\.[0-9]+){1,2}).*/\1/')" __REQUIRED_GO_VERSION="$(awk ' $1 == "go" && go_version == "" { go_version = $2 } $1 == "toolchain" { sub(/^go/, "", $2); print $2; found = 1; exit } END { if (!found && go_version != "") print go_version } ' go.mod)" __REQUIRED_GO_VERSION="$(printf '%s\n' "$__REQUIRED_GO_VERSION" | awk -F. ' NF == 2 { print $0 ".0" } NF == 3 { print $0 } ')" if [ -z "$__SYSTEM_GO_VERSION" ] || [ -z "$__REQUIRED_GO_VERSION" ]; then echo "Unable to determine the Go versions" exit 1 fi if [ "$(printf '%s\n%s\n' "$__SYSTEM_GO_VERSION" "$__REQUIRED_GO_VERSION" | sort -V | tail -n1)" = "$__SYSTEM_GO_VERSION" ]; then echo "Skipping go download. Required ${__REQUIRED_GO_VERSION} , Installed: ${__SYSTEM_GO_VERSION}" else if [ "%{_arch}" = "x86_64" ]; then __TOOLCHAIN_ARCH=amd64 elif [ "%{_arch}" = "aarch64" ]; then __TOOLCHAIN_ARCH=arm64 else echo "Unsupported arch: %{_arch}" exit 1 fi echo "Downloading Go ${__REQUIRED_GO_VERSION} for ${__TOOLCHAIN_ARCH} ..." curl --location --silent "https://go.dev/dl/go${__REQUIRED_GO_VERSION}.linux-${__TOOLCHAIN_ARCH}.tar.gz" \ | tar --extract --gzip --file=- fi %build if [ -x go/bin/go ]; then export PATH="$(pwd)/go/bin:${PATH}" fi go version make \ OS=linux \ ARCH=%{zot_goarch} \ RELEASE_TAG=v%{version} \ COMMIT=v%{version}-%{release} \ binary \ cli \ bench \ exporter-minimal %install install --directory %{buildroot}%{_bindir} install --directory %{buildroot}%{_sysconfdir}/zot install --directory %{buildroot}%{_sysconfdir}/sysconfig install --directory %{buildroot}%{_unitdir} install --directory %{buildroot}%{_sysusersdir} install --directory %{buildroot}%{_exec_prefix}/lib/tmpfiles.d install --directory %{buildroot}%{_prefix}/lib/systemd/system-preset install --mode=0755 bin/zot-linux-%{zot_goarch} %{buildroot}%{_bindir}/zot install --mode=0755 bin/zli-linux-%{zot_goarch} %{buildroot}%{_bindir}/zli install --mode=0755 bin/zb-linux-%{zot_goarch} %{buildroot}%{_bindir}/zb install --mode=0755 bin/zxp-linux-%{zot_goarch} %{buildroot}%{_bindir}/zxp install --mode=0644 %{SOURCE10} %{buildroot}%{_unitdir}/zot.service install --mode=0644 %{SOURCE11} %{buildroot}%{_sysusersdir}/zot.conf install --mode=0644 %{SOURCE12} %{buildroot}%{_exec_prefix}/lib/tmpfiles.d/zot.conf install --mode=0644 %{SOURCE13} %{buildroot}%{_prefix}/lib/systemd/system-preset/90-zot.preset install --mode=0644 %{SOURCE14} %{buildroot}%{_sysconfdir}/sysconfig/zot install --mode=0644 %{SOURCE15} %{buildroot}%{_sysconfdir}/zot/config.yaml %files %doc README.md %license LICENSE %{_bindir}/zot %{_unitdir}/zot.service %{_sysusersdir}/zot.conf %{_exec_prefix}/lib/tmpfiles.d/zot.conf %{_prefix}/lib/systemd/system-preset/90-zot.preset %config(noreplace) %{_sysconfdir}/sysconfig/zot %config(noreplace) %{_sysconfdir}/zot/config.yaml %files zli %license LICENSE %{_bindir}/zli %files zb %license LICENSE %{_bindir}/zb %files zxp %license LICENSE %{_bindir}/zxp %pre %sysusers_create_compat %{_sysusersdir}/zot.conf %post %systemd_post zot.service %preun %systemd_preun zot.service %postun %systemd_postun_with_restart zot.service %changelog %autochangelog