Introduce nwg-look package
Some checks failed
Build nwg-look / Build and push image (push) Failing after 4m7s
Some checks failed
Build nwg-look / Build and push image (push) Failing after 4m7s
This commit is contained in:
33
.gitea/workflows/build-nwg-look.yml
Normal file
33
.gitea/workflows/build-nwg-look.yml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
name: Build nwg-look
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- .gitea/workflows/build-nwg-look.yml
|
||||||
|
- "nwg-look/**"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_push:
|
||||||
|
name: Build and push image
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Setup environment
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y podman iptables
|
||||||
|
|
||||||
|
# These stage versions are pinned by https://github.com/renovatebot/renovate
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6 # v5
|
||||||
|
|
||||||
|
- name: Build RPM and Upload
|
||||||
|
uses: https://git.hydrosaber.com/hydros/build-rpm@main
|
||||||
|
with:
|
||||||
|
spec-file-path: ./nwg-look/nwg-look.spec
|
||||||
|
repository-user: eriq12
|
||||||
|
repository-user-token: ${{ secrets.RPM_PACKAGE_TOKEN }}
|
||||||
|
extra-source-directory: ./nwg-look
|
||||||
117
nwg-look/bundle_go_deps_for_rpm.sh
Normal file
117
nwg-look/bundle_go_deps_for_rpm.sh
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
#!/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 <zebob.m@gmail.com>
|
||||||
|
#
|
||||||
|
# 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 <path_to_rpm_spec_file>"
|
||||||
|
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")
|
||||||
|
PLAINURL=$(awk '/^URL:/ {print $NF}' "$RPM_SPEC_FILE")
|
||||||
|
COMMIT=$(awk '/^%global commit0/ {print $NF}' "$RPM_SPEC_FILE")
|
||||||
|
COMMIT_UNNEEDED=$(grep -q "%global bumpver" "$RPM_SPEC_FILE"; echo $?)
|
||||||
|
TAG=$(awk '/^%global tag/ {print $NF}' "$RPM_SPEC_FILE")
|
||||||
|
VERSION=$(rpmspec -q --srpm --qf "%{version}\n" "$RPM_SPEC_FILE" | sed 's/\^.*//')
|
||||||
|
|
||||||
|
# Decide which URL to use
|
||||||
|
if [[ -n "$FORGEURL" ]]; then
|
||||||
|
REPO_URL="$FORGEURL"
|
||||||
|
elif [[ -n "$GOIPATH" ]]; then
|
||||||
|
REPO_URL="https://$GOIPATH"
|
||||||
|
elif [[ -n "$PLAINURL" ]]; then
|
||||||
|
REPO_URL="${PLAINURL}.git"
|
||||||
|
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" && "$COMMIT_UNNEEDED" != "1" ]]; then
|
||||||
|
CHECKOUT_IDENTIFIER="$COMMIT"
|
||||||
|
git checkout "$CHECKOUT_IDENTIFIER" && CHECKOUT_SUCCESS=1; CHECKOUT_IDENTIFIER="${COMMIT:0:7}"
|
||||||
|
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
|
||||||
|
|
||||||
|
go mod tidy
|
||||||
|
# Run go mod vendor
|
||||||
|
go mod vendor
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "Failed to run 'go mod vendor'."
|
||||||
|
exit 6
|
||||||
|
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
|
||||||
|
|
||||||
|
echo "Created vendor-$CHECKOUT_IDENTIFIER.tar.gz successfully."
|
||||||
87
nwg-look/nwg-look.spec
Normal file
87
nwg-look/nwg-look.spec
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
# Generated by go2rpm 1.14.0
|
||||||
|
%bcond check 1
|
||||||
|
%bcond bootstrap 0
|
||||||
|
|
||||||
|
%if %{with bootstrap}
|
||||||
|
%global debug_package %{nil}
|
||||||
|
%endif
|
||||||
|
|
||||||
|
# https://github.com/nwg-piotr/nwg-look
|
||||||
|
%global goipath github.com/nwg-piotr/nwg-look
|
||||||
|
Version: 1.0.6
|
||||||
|
|
||||||
|
%gometa -L -f
|
||||||
|
|
||||||
|
%global common_description %{expand:
|
||||||
|
GTK3 settings editor adapted to work in the wlroots environment.}
|
||||||
|
|
||||||
|
%global golicenses LICENSE
|
||||||
|
%global godocs README.md
|
||||||
|
|
||||||
|
Name: nwg-look
|
||||||
|
Release: %autorelease
|
||||||
|
Summary: GTK3 settings editor adapted to work in the wlroots environment
|
||||||
|
|
||||||
|
License: MIT
|
||||||
|
URL: %{gourl}
|
||||||
|
Source: %{gosource}
|
||||||
|
Source: vendor-%{version}.tar.gz
|
||||||
|
Source: bundle_go_deps_for_rpm.sh
|
||||||
|
|
||||||
|
BuildRequires: desktop-file-utils
|
||||||
|
BuildRequires: pkgconfig(cairo-gobject)
|
||||||
|
BuildRequires: pkgconfig(cairo)
|
||||||
|
BuildRequires: pkgconfig(gdk-3.0)
|
||||||
|
BuildRequires: pkgconfig(gio-2.0)
|
||||||
|
BuildRequires: pkgconfig(glib-2.0)
|
||||||
|
BuildRequires: pkgconfig(gobject-2.0)
|
||||||
|
BuildRequires: pkgconfig(gtk+-3.0)
|
||||||
|
BuildRequires: pkgconfig(pango)
|
||||||
|
|
||||||
|
Requires: /usr/bin/gsettings
|
||||||
|
Requires: xcur2png
|
||||||
|
|
||||||
|
%description %{common_description}
|
||||||
|
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%goprep -A
|
||||||
|
%setup -q -T -D -a 1
|
||||||
|
%autopatch -p1
|
||||||
|
|
||||||
|
%if %{without bootstrap}
|
||||||
|
%build
|
||||||
|
%gobuild -o %{gobuilddir}/bin/nwg-look %{goipath}
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%install
|
||||||
|
%if %{without bootstrap}
|
||||||
|
install -m 0755 -vd %{buildroot}%{_bindir}
|
||||||
|
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/
|
||||||
|
install -Dpm0644 stuff/main.glade -t %{buildroot}%{_datadir}/nwg-look
|
||||||
|
install -Dpm0644 langs/* -t %{buildroot}%{_datadir}/nwg-look/langs
|
||||||
|
install -Dpm0644 stuff/nwg-look.desktop -t %{buildroot}%{_datadir}/applications
|
||||||
|
install -Dpm0644 stuff/nwg-look.svg -t %{buildroot}%{_datadir}/pixmaps
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if %{without bootstrap}
|
||||||
|
%if %{with check}
|
||||||
|
%check
|
||||||
|
%gocheck
|
||||||
|
desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
|
||||||
|
%endif
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if %{without bootstrap}
|
||||||
|
%files
|
||||||
|
%license vendor/modules.txt
|
||||||
|
%license LICENSE
|
||||||
|
%doc README.md
|
||||||
|
%{_bindir}/nwg-look
|
||||||
|
%{_datadir}/%{name}/
|
||||||
|
%{_datadir}/applications/nwg-look.desktop
|
||||||
|
%{_datadir}/pixmaps/nwg-look.svg
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
%autochangelog
|
||||||
Reference in New Issue
Block a user