diff --git a/.gitignore b/.gitignore index 31fd2fa..e0a04d0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,60 @@ /podman-tui-0.2.0.tar.gz -/podman-tui-0.2.1.tar.gz +/podman-tui-0.3.0.tar.gz +/podman-tui-0.3.1.tar.gz +/podman-tui-0.4.0.tar.gz +/podman-tui-0.5.0.tar.gz +/podman-tui-0.6.0.tar.gz +/podman-tui-0.7.0.tar.gz +/podman-tui-0.9.0.tar.gz +/podman-tui-0.9.1.tar.gz +/podman-tui-0.11.0.tar.gz +/podman-tui-0.12.0.tar.gz +/vendor-0.12.0.tar.gz +/podman-tui-0.13.0.tar.gz +/vendor-0.13.0.tar.gz +/podman-tui-0.14.0.tar.gz +/vendor-0.14.0.tar.gz +/podman-tui-0.15.0.tar.gz +/vendor-0.15.0.tar.gz +/podman-tui-0.16.0.tar.gz +/vendor-0.16.0.tar.gz +/podman-tui-0.17.0.tar.gz +/vendor-0.17.0.tar.gz +/podman-tui-0.18.0.tar.gz +/vendor-0.18.0.tar.gz +/podman-tui-1.0.0.tar.gz +/vendor-1.0.0.tar.gz +/podman-tui-1.0.1.tar.gz +/vendor-1.0.1.tar.gz +/podman-tui-1.1.0.tar.gz +/vendor-1.1.0.tar.gz +/podman-tui-1.2.0.tar.gz +/vendor-1.2.0.tar.gz +/podman-tui-1.2.1.tar.gz +/vendor-1.2.1.tar.gz +/podman-tui-1.2.2.tar.gz +/vendor-1.2.2.tar.gz +/podman-tui-1.2.3.tar.gz +/vendor-1.2.3.tar.gz +/podman-tui-1.3.0.tar.gz +/vendor-1.3.0.tar.gz +/podman-tui-1.3.1.tar.gz +/vendor-1.3.1.tar.gz +/podman-tui-1.4.0.tar.gz +/vendor-1.4.0.tar.gz +/podman-tui-1.5.0.tar.gz +/vendor-1.5.0.tar.gz +/podman-tui-1.6.0.tar.gz +/vendor-1.6.0.tar.gz +/podman-tui-1.6.1.tar.gz +/vendor-1.6.1.tar.gz +/podman-tui-1.7.0.tar.gz +/vendor-1.7.0.tar.gz +/podman-tui-1.8.0.tar.gz +/vendor-1.8.0.tar.gz +/podman-tui-1.8.1.tar.gz +/vendor-1.8.1.tar.gz +/podman-tui-1.9.0.tar.gz +/vendor-1.9.0.tar.gz +/podman-tui-1.10.0.tar.gz +/vendor-1.10.0.tar.gz diff --git a/bundle_go_deps_for_rpm.sh b/bundle_go_deps_for_rpm.sh new file mode 100644 index 0000000..358556d --- /dev/null +++ b/bundle_go_deps_for_rpm.sh @@ -0,0 +1,116 @@ +#!/bin/bash + +# Description: +# This script creates an archive with vendored dependencies from a Go SPEC file. + +# License: +# MIT License +# +# Copyright (c) 2023 Robert-André Mauchin +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +# Check if the RPM SPEC file is given as an argument +if [[ $# -ne 1 ]]; then + echo "Usage: $0 " + exit 1 +fi + +RPM_SPEC_FILE=$1 + +# Extract the directory from the RPM SPEC file path +SPEC_DIR=$(dirname $(realpath "$RPM_SPEC_FILE")) + +# Extract the URL, commit, tag, and version from the RPM SPEC file +FORGEURL=$(awk '/^%global forgeurl/ {print $NF}' "$RPM_SPEC_FILE") +GOIPATH=$(awk '/^%global goipath/ {print $NF}' "$RPM_SPEC_FILE") +COMMIT=$(awk '/^%global commit/ {print $NF}' "$RPM_SPEC_FILE") +TAG=$(awk '/^%global tag/ {print $NF}' "$RPM_SPEC_FILE") +VERSION=$(awk '/^Version:/ {print $NF}' "$RPM_SPEC_FILE") + +# Decide which URL to use +if [[ -n "$FORGEURL" ]]; then + REPO_URL="$FORGEURL" +elif [[ -n "$GOIPATH" ]]; then + REPO_URL="https://$GOIPATH" +else + echo "No repository URL found in the RPM SPEC file." + exit 2 +fi + +# Create a temporary directory and clone the repository +TMP_DIR=$(mktemp -d) +trap "rm -rf $TMP_DIR" EXIT +git clone "$REPO_URL" "$TMP_DIR" +if [[ $? -ne 0 ]]; then + echo "Failed to clone repository." + exit 3 +fi + +# Change to the directory +pushd "$TMP_DIR" > /dev/null + +# Checkout based on priority: commit > tag > Version +CHECKOUT_SUCCESS=0 +if [[ -n "$COMMIT" ]]; then + CHECKOUT_IDENTIFIER="$COMMIT" + git checkout "$CHECKOUT_IDENTIFIER" && CHECKOUT_SUCCESS=1 +elif [[ -n "$TAG" ]]; then + CHECKOUT_IDENTIFIER="$TAG" + git checkout "$CHECKOUT_IDENTIFIER" && CHECKOUT_SUCCESS=1 +elif [[ -n "$VERSION" ]]; then + CHECKOUT_IDENTIFIER="$VERSION" + git checkout "$VERSION" || git checkout "v$VERSION" + if [ $? -eq 0 ]; then + CHECKOUT_SUCCESS=1 + fi +else + echo "No commit, tag, or version found in the RPM SPEC file." + exit 4 +fi + +if [ $CHECKOUT_SUCCESS -eq 0 ]; then + echo "Failed to checkout using commit, tag, or version." + exit 5 +fi + +# Run go mod vendor +go mod vendor +if [[ $? -ne 0 ]]; then + echo "Failed to run 'go mod vendor'." + exit 6s +fi + +# Create a tar.gz of the vendor directory +tar czf "vendor-$CHECKOUT_IDENTIFIER.tar.gz" vendor/ +if [[ $? -ne 0 ]]; then + echo "Failed to create tar.gz of the vendor directory." + exit 7 +fi + +# Move the tar.gz to the SPEC directory +mv "vendor-$CHECKOUT_IDENTIFIER.tar.gz" "$SPEC_DIR/" + +# Go back to the original directory +popd > /dev/null + +# Clean up +rm -rf "$TMP_DIR" + +echo "Created vendor-$CHECKOUT_IDENTIFIER.tar.gz successfully." diff --git a/podman-tui.spec b/podman-tui.spec index 1840bc1..ac2acde 100644 --- a/podman-tui.spec +++ b/podman-tui.spec @@ -1,23 +1,28 @@ -%global with_check 0 -%global with_debug 1 - -%if 0%{?with_debug} -%global _find_debuginfo_dwz_opts %{nil} -%global _dwz_low_mem_die_limit 0 -%else -%global debug_package %{nil} +%bcond_without check +%bcond_without bundled +%if 0%{?rhel} +%bcond_without bundled %endif +%if %{defined rhel} && 0%{?rhel} < 10 +%define gobuild(o:) go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "-linkmode=external -compressdwarf=false ${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'" -a -v -x %{?**}; +%endif + +%if %{with bundled} +%global gomodulesmode GO111MODULE=on +%endif + +# https://github.com/containers/podman-tui %global goipath github.com/containers/podman-tui -Version: 0.2.1 -%global tag v0.2.1 +Version: 1.10.0 %gometa %global goname podman-tui %global common_description %{expand: -%{goname} is a terminal user interface for Podman v3 (>= 3.1). -it is using podman.socket service to communicate with podman machine. +%{goname} is a terminal user interface for Podman v4 and v5. +%{goname} is using podman.socket service to communicate with podman environment +and SSH to connect to remote podman machines. } %global golicenses LICENSE @@ -30,153 +35,59 @@ Requires: %{name} = %{version}-%{release} Name: %{goname} Release: %autorelease Summary: Podman Terminal User Interface -License: ASL 2.0 and BSD and ISC and MIT and MPLv2.0 + +License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 URL: %{gourl} -Source0: %{gosource} +Source: %{gosource} +Source: vendor-%{version}.tar.gz +Source: bundle_go_deps_for_rpm.sh BuildRequires: gcc -BuildRequires: golang >= 1.16.6 +BuildRequires: golang BuildRequires: glib2-devel BuildRequires: glibc-devel BuildRequires: glibc-static BuildRequires: git-core BuildRequires: go-rpm-macros BuildRequires: make -BuildRequires: gpgme-devel -BuildRequires: device-mapper-devel -BuildRequires: libassuan-devel -%if ! 0%{?centos} -BuildRequires: btrfs-progs-devel -%endif + %if 0%{?fedora} >= 35 BuildRequires: shadow-utils-subid-devel %endif -# vendored libraries -# awk '{print "Provides: bundled(golang("$1")) = "$2}' go.mod | sort | uniq | sed -e 's/-/_/g' -e '/bundled(golang())/d' -e '/bundled(golang(go\|module\|replace\|require))/d' -Provides: bundled(golang(github.com/acarl005/stripansi)) = v0.0.0_20180116102854_5a71ef0e047d -Provides: bundled(golang(github.com/Azure/go_ansiterm)) = v0.0.0_20210617225240_d185dfc1b5a1 -Provides: bundled(golang(github.com/beorn7/perks)) = v1.0.1 -Provides: bundled(golang(github.com/blang/semver)) = v3.5.1+incompatible -Provides: bundled(golang(github.com/BurntSushi/toml)) = v1.0.0 -Provides: bundled(golang(github.com/cespare/xxhash/v2)) = v2.1.2 -Provides: bundled(golang(github.com/chzyer/readline)) = v0.0.0_20180603132655_2972be24d48e -Provides: bundled(golang(github.com/containerd/cgroups)) = v1.0.1 -Provides: bundled(golang(github.com/containerd/containerd)) = v1.5.7 -Provides: bundled(golang(github.com/containerd/stargz_snapshotter/estargz)) = v0.10.1 -Provides: bundled(golang(github.com/containernetworking/cni)) = v0.8.1 -Provides: bundled(golang(github.com/containernetworking/plugins)) = v0.9.1 -Provides: bundled(golang(github.com/containers/buildah)) = v1.23.1 -Provides: bundled(golang(github.com/containers/common)) = v0.44.4 -Provides: bundled(golang(github.com/containers/image/v5)) = v5.17.0 -Provides: bundled(golang(github.com/containers/libtrust)) = v0.0.0_20190913040956_14b96171aa3b -Provides: bundled(golang(github.com/containers/ocicrypt)) = v1.1.2 -Provides: bundled(golang(github.com/containers/podman/v3)) = v3.4.4 -Provides: bundled(golang(github.com/containers/psgo)) = v1.7.2 -Provides: bundled(golang(github.com/containers/storage)) = v1.38.0 -Provides: bundled(golang(github.com/coreos/go_systemd/v22)) = v22.3.2 -Provides: bundled(golang(github.com/cri_o/ocicni)) = v0.2.1_0.20210621164014_d0acc7862283 -Provides: bundled(golang(github.com/cyphar/filepath_securejoin)) = v0.2.3 -Provides: bundled(golang(github.com/disiqueira/gotree/v3)) = v3.0.2 -Provides: bundled(golang(github.com/docker/distribution)) = v2.7.1+incompatible -Provides: bundled(golang(github.com/docker/docker_credential_helpers)) = v0.6.4 -Provides: bundled(golang(github.com/docker/docker)) = v20.10.12+incompatible -Provides: bundled(golang(github.com/docker/go_connections)) = v0.4.0 -Provides: bundled(golang(github.com/docker/go_metrics)) = v0.0.1 -Provides: bundled(golang(github.com/docker/go_units)) = v0.4.0 -Provides: bundled(golang(github.com/fsnotify/fsnotify)) = v1.5.1 -Provides: bundled(golang(github.com/gdamore/encoding)) = v1.0.0 -Provides: bundled(golang(github.com/gdamore/tcell/v2)) = v2.4.1_0.20210905002822_f057f0a857a1 -Provides: bundled(golang(github.com/ghodss/yaml)) = v1.0.0 -Provides: bundled(golang(github.com/godbus/dbus/v5)) = v5.0.6 -Provides: bundled(golang(github.com/gogo/protobuf)) = v1.3.2 -Provides: bundled(golang(github.com/golang/groupcache)) = v0.0.0_20210331224755_41bb18bfe9da -Provides: bundled(golang(github.com/golang/protobuf)) = v1.5.2 -Provides: bundled(golang(github.com/google/go_intervals)) = v0.0.2 -Provides: bundled(golang(github.com/google/uuid)) = v1.3.0 -Provides: bundled(golang(github.com/gorilla/mux)) = v1.8.0 -Provides: bundled(golang(github.com/gorilla/schema)) = v1.2.0 -Provides: bundled(golang(github.com/hashicorp/errwrap)) = v1.0.0 -Provides: bundled(golang(github.com/hashicorp/go_multierror)) = v1.1.1 -Provides: bundled(golang(github.com/hpcloud/tail)) = v1.0.0 -Provides: bundled(golang(github.com/imdario/mergo)) = v0.3.12 -Provides: bundled(golang(github.com/inconshreveable/mousetrap)) = v1.0.0 -Provides: bundled(golang(github.com/jinzhu/copier)) = v0.3.2 -Provides: bundled(golang(github.com/json_iterator/go)) = v1.1.12 -Provides: bundled(golang(github.com/klauspost/compress)) = v1.14.1 -Provides: bundled(golang(github.com/klauspost/pgzip)) = v1.2.5 -Provides: bundled(golang(github.com/lucasb_eyer/go_colorful)) = v1.2.0 -Provides: bundled(golang(github.com/manifoldco/promptui)) = v0.9.0 -Provides: bundled(golang(github.com/mattn/go_runewidth)) = v0.0.13 -Provides: bundled(golang(github.com/mattn/go_shellwords)) = v1.0.12 -Provides: bundled(golang(github.com/matttproud/golang_protobuf_extensions)) = v1.0.2_0.20181231171920_c182affec369 -Provides: bundled(golang(github.com/Microsoft/go_winio)) = v0.5.1 -Provides: bundled(golang(github.com/Microsoft/hcsshim)) = v0.9.2 -Provides: bundled(golang(github.com/miekg/pkcs11)) = v1.0.3 -Provides: bundled(golang(github.com/mistifyio/go_zfs)) = v2.1.2_0.20190413222219_f784269be439+incompatible -Provides: bundled(golang(github.com/moby/sys/mountinfo)) = v0.5.0 -Provides: bundled(golang(github.com/moby/term)) = v0.0.0_20210619224110_3f7ff695adc6 -Provides: bundled(golang(github.com/modern_go/concurrent)) = v0.0.0_20180306012644_bacd9c7ef1dd -Provides: bundled(golang(github.com/modern_go/reflect2)) = v1.0.2 -Provides: bundled(golang(github.com/mtrmac/gpgme)) = v0.1.2 -Provides: bundled(golang(github.com/navidys/tvxwidgets)) = v0.1.0 -Provides: bundled(golang(github.com/navidys/vtterm)) = v0.1.0 -Provides: bundled(golang(github.com/opencontainers/go_digest)) = v1.0.0 -Provides: bundled(golang(github.com/opencontainers/image_spec)) = v1.0.2_0.20210819154149_5ad6f50d6283 -Provides: bundled(golang(github.com/opencontainers/runc)) = v1.1.0 -Provides: bundled(golang(github.com/opencontainers/runtime_spec)) = v1.0.3_0.20210326190908_1c3f411f0417 -Provides: bundled(golang(github.com/opencontainers/runtime_tools)) = v0.9.0 -Provides: bundled(golang(github.com/opencontainers/selinux)) = v1.10.0 -Provides: bundled(golang(github.com/ostreedev/ostree_go)) = v0.0.0_20190702140239_759a8c1ac913 -Provides: bundled(golang(github.com/pkg/errors)) = v0.9.1 -Provides: bundled(golang(github.com/prometheus/client_golang)) = v1.7.1 -Provides: bundled(golang(github.com/prometheus/client_model)) = v0.2.0 -Provides: bundled(golang(github.com/prometheus/common)) = v0.10.0 -Provides: bundled(golang(github.com/prometheus/procfs)) = v0.6.0 -Provides: bundled(golang(github.com/rivo/tview)) = v0.0.0_20220106183741_90d72bc664f5 -Provides: bundled(golang(github.com/rivo/uniseg)) = v0.2.0 -Provides: bundled(golang(github.com/rs/zerolog)) = v1.26.1 -Provides: bundled(golang(github.com/sirupsen/logrus)) = v1.8.1 -Provides: bundled(golang(github.com/spf13/cobra)) = v1.3.0 -Provides: bundled(golang(github.com/spf13/pflag)) = v1.0.5 -Provides: bundled(golang(github.com/stefanberger/go_pkcs11uri)) = v0.0.0_20201008174630_78d3cae3a980 -Provides: bundled(golang(github.com/syndtr/gocapability)) = v0.0.0_20200815063812_42c35b437635 -Provides: bundled(golang(github.com/tchap/go_patricia)) = v2.3.0+incompatible -Provides: bundled(golang(github.com/ulikunitz/xz)) = v0.5.10 -Provides: bundled(golang(github.com/vbatts/tar_split)) = v0.11.2 -Provides: bundled(golang(github.com/vbauerster/mpb/v7)) = v7.1.5 -Provides: bundled(golang(github.com/vishvananda/netlink)) = v1.1.1_0.20201029203352_d40f9887b852 -Provides: bundled(golang(github.com/vishvananda/netns)) = v0.0.0_20200728191858_db3c7e526aae -Provides: bundled(golang(github.com/VividCortex/ewma)) = v1.2.0 -Provides: bundled(golang(github.com/xeipuuv/gojsonpointer)) = v0.0.0_20190809123943_df4f5c81cb3b -Provides: bundled(golang(github.com/xeipuuv/gojsonreference)) = v0.0.0_20180127040603_bd5ef7bd5415 -Provides: bundled(golang(github.com/xeipuuv/gojsonschema)) = v1.2.0 %description %{common_description} %prep -%goprep +%goprep %{?with_bundledc:-k} +%if %{with bundled} +%setup -q -T -D -a 1 -n %{name}-%{version} +%endif -mkdir _depbundle -pushd _depbundle -/usr/bin/gzip -dc %{SOURCE0} | /usr/bin/tar -xof - -/usr/bin/chmod -Rf a+rX,u+w,g-w,o-w . -%{__install} -m 0755 -vd %{gobuilddir}/src/ -# copy required bundled libraries -%{__cp} -rp %{goname}-%{version}/vendor/* %{gobuilddir}/src/ -popd -%{_bindir}/rm -rf _depbundle +%if %{without bundled} +%generate_buildrequires +%go_generate_buildrequires +%endif %build -%gobuild -o %{gobuilddir}/bin/%{goname} %{goipath}/ +%if %{with bundled} +export GOFLAGS="-mod=vendor" +%endif + +export BUILDTAGS="exclude_graphdriver_devicemapper exclude_graphdriver_btrfs btrfs_noversion containers_image_openpgp remote" +%if 0%{?rhel} +export BUILDTAGS="$BUILDTAGS libtrust_openssl" +%endif + +export CGO_LDFLAGS="${CGO_LDFLAGS} -Wl,--allow-multiple-definition" +%gobuild -o %{gobuilddir}/bin/%{goname} %{goipath} %install %{__install} -m 0755 -vd %{buildroot}%{_bindir} %{__install} -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/ -%if 0%{?with_check} +%if %{with check} %check -%gocheck %endif %files @@ -185,4 +96,4 @@ popd %{_bindir}/* %changelog -%autochangelog \ No newline at end of file +%autochangelog diff --git a/sources b/sources index e10b47a..94f983f 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ -SHA512 (podman-tui-0.2.1.tar.gz) = 63bc1c22cea2eae1864fd4d939966bfc159b0660af0478ae20bce51730ff7b84482293ea52860c66a247603ad7b687510c4c4e80dd010a62d683aea78fab2b64 +SHA512 (podman-tui-1.10.0.tar.gz) = 55604933d2f4f285b24473eca3738f89f943424da1e5d9161a6cef3f4a9aa9c316467f2eb982866b47132eff7ed6abf06a0e34fed2f04c4bf345507e4d040390 +SHA512 (vendor-1.10.0.tar.gz) = 2c30cb295c0f69ea1717646ce9bbfc7fb782006caf48f710da9448daf4f86276a972fae3a5152579582d4328b4dd84eed58292a64a47c17ba5069a4b289045f8