[NetworkManager-openconnect/copr: 23/23] Add make_srpm files for COPR




commit efdd153ed1ffa2818a2064b3cf0b8254906e2205
Author: David Woodhouse <dwmw2 infradead org>
Date:   Sat Apr 30 17:09:52 2022 +0100

    Add make_srpm files for COPR

 .copr/Makefile                     |  26 ++++++
 NetworkManager-openconnect.spec.in | 166 +++++++++++++++++++++++++++++++++++++
 mkspec.sh                          |  24 ++++++
 3 files changed, 216 insertions(+)
---
diff --git a/.copr/Makefile b/.copr/Makefile
new file mode 100644
index 0000000..7da2ab5
--- /dev/null
+++ b/.copr/Makefile
@@ -0,0 +1,26 @@
+# For COPR builds directly from git.
+#
+# https://docs.pagure.org/copr.copr/user_documentation.html#make-srpm
+#
+
+TARGET=NetworkManager-openconnect
+
+srpm: /usr/bin/git
+       ./mkspec.sh $(TARGET)
+       set -x; if grep -q "global gitsnapshot 1" $(TARGET).spec; then \
+               tarprefix=$$(sed -n '/^%global snapcommit /s/.* //p' $(TARGET).spec); \
+               tarname=$${tarprefix:0:7}; \
+       else \
+               tarprefix=$$(sed -n '/^%global tagver /s/.* //p' $(TARGET).spec); \
+               tarname=$${tarprefix}; \
+       fi; \
+       git archive --prefix=$(TARGET)-$${tarname}/ HEAD -o .copr/$(TARGET)-$${tarname}.tar.gz
+       rpmbuild -bs $(TARGET).spec --define "_sourcedir .copr" --define "_srcrpmdir $(outdir)"
+
+/usr/bin/git:
+       dnf install git
+
+build: srpm
+       rpmbuild -bb $(TARGET).spec --define "_sourcedir `pwd`/.copr"
+
+
diff --git a/NetworkManager-openconnect.spec.in b/NetworkManager-openconnect.spec.in
new file mode 100644
index 0000000..6849b01
--- /dev/null
+++ b/NetworkManager-openconnect.spec.in
@@ -0,0 +1,166 @@
+%global gitsnapshot @ISSNAP@
+%if 0%{?gitsnapshot}
+%global snapcommit @SNAPCOMMIT@
+%global snapcount @SNAPCOUNT@
+%global shortcommit %(c=%{snapcommit}; echo ${c:0:7})
+%global snapver .git.%{snapcount}.%{shortcommit}
+%endif
+
+%global tagver @VERSION@
+
+%if 0%{?fedora} < 28 && 0%{?rhel} < 8
+%bcond_without libnm_glib
+%else
+# Disable the legacy version by default
+%bcond_with libnm_glib
+%endif
+
+%if 0%{?fedora} < 36 && 0%{?rhel} < 10
+%bcond_with gtk4
+%else
+%bcond_without gtk4
+%endif
+
+%global nm_version          1.2.0
+%global gtk3_version        3.4.0
+%global openconnect_version 7.00
+
+Summary:   NetworkManager VPN plugin for openconnect
+Name:      NetworkManager-openconnect
+Version:   %{tagver}%{?snapver}
+Release:   0%{?dist}
+License:   GPLv2+ and LGPLv2
+URL:       http://www.gnome.org/projects/NetworkManager/
+%if 0%{?gitsnapshot}
+Source0:   https://gitlab.gnome.org/GNOME/%{name}/archive/%{snapcommit}/%{name}-%{shortcommit}.tar.gz
+%else
+Source0:   https://www.infradead.org/openconnect/download/%{name}-%{version}.tar.gz
+%endif
+
+BuildRequires: make
+BuildRequires: gcc
+BuildRequires: pkgconfig(gtk+-3.0) >= %{gtk3_version}
+BuildRequires: pkgconfig(libnm) >= %{nm_version}
+BuildRequires: pkgconfig(libnma) >= %{nm_version}
+BuildRequires: pkgconfig(libsecret-1)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: intltool gettext libtool
+BuildRequires: pkgconfig(libxml-2.0)
+BuildRequires: pkgconfig(openconnect) >= %{openconnect_version}
+BuildRequires: pkgconfig(gcr-3) >= 3.4
+%if %{with libnm_glib}
+BuildRequires: pkgconfig(libnm-util) >= %{nm_version}
+BuildRequires: pkgconfig(libnm-glib) >= %{nm_version}
+BuildRequires: pkgconfig(libnm-glib-vpn) >= %{nm_version}
+%endif
+%if %with gtk4
+BuildRequires: pkgconfig(gtk4) >= 4.0
+BuildRequires: pkgconfig(libnma-gtk4) >= 1.8.33
+%endif
+
+Requires: NetworkManager   >= %{nm_version}
+Requires: openconnect      >= %{openconnect_version}
+Requires: dbus-common
+Obsoletes: NetworkManager-openconnect < 1.2.3-0
+
+Requires(pre): %{_sbindir}/useradd
+Requires(pre): %{_sbindir}/groupadd
+
+%global __provides_exclude ^libnm-.*\\.so
+
+%description
+This package contains software for integrating the openconnect VPN software
+with NetworkManager and the GNOME desktop
+
+%package gnome
+Summary: NetworkManager VPN plugin for OpenConnect - GNOME files
+
+Requires: %{name}%{?_isa} = %{version}-%{release}
+Obsoletes: NetworkManager-openconnect < 1.2.3-0
+
+%description gnome
+This package contains software for integrating VPN capabilities with
+the OpenConnect client with NetworkManager (GNOME files).
+
+%prep
+%if 0%{?gitsnapshot}
+%autosetup -p1 -n %{name}-%{shortcommit}
+NOCONFIGURE=x ./autogen.sh
+%else
+$autosetup -p1
+if [ ! -x configure ]; then
+    NOCONFIGURE=x ./autogen.sh
+fi
+%endif
+
+%build
+%configure \
+        --enable-more-warnings=yes \
+        --disable-static \
+%if %{with libnm_glib}
+        --with-libnm-glib \
+%else
+        --without-libnm-glib \
+%endif
+%if %with gtk4
+        --with-gtk4 \
+%endif
+        --with-dist-version=%{version}-%{release}
+make %{?_smp_mflags}
+
+%install
+make install DESTDIR=%{buildroot}
+
+rm -f %{buildroot}%{_libdir}/NetworkManager/lib*.la
+
+%find_lang %{name}
+
+%pre
+%{_sbindir}/groupadd -r nm-openconnect &>/dev/null || :
+%{_sbindir}/useradd  -r -s /sbin/nologin -d / -M \
+                     -c 'NetworkManager user for OpenConnect' \
+                     -g nm-openconnect nm-openconnect &>/dev/null || :
+
+%if 0%{?rhel} && 0%{?rhel} <= 7
+%post
+/usr/bin/update-desktop-database &> /dev/null || :
+touch --no-create %{_datadir}/icons/hicolor
+if [ -x %{_bindir}/gtk-update-icon-cache ]; then
+      %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
+fi
+
+%postun
+/usr/bin/update-desktop-database &> /dev/null || :
+touch --no-create %{_datadir}/icons/hicolor
+if [ -x %{_bindir}/gtk-update-icon-cache ]; then
+      %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
+fi
+%endif
+
+%files -f %{name}.lang
+%{_libdir}/NetworkManager/libnm-vpn-plugin-openconnect.so
+%{_datadir}/dbus-1/system.d/nm-openconnect-service.conf
+%{_prefix}/lib/NetworkManager/VPN/nm-openconnect-service.name
+%{_libexecdir}/nm-openconnect-service
+%{_libexecdir}/nm-openconnect-service-openconnect-helper
+%doc AUTHORS ChangeLog NEWS
+%license COPYING
+
+%files gnome
+%{_libexecdir}/nm-openconnect-auth-dialog
+%{_libdir}/NetworkManager/libnm-vpn-plugin-openconnect-editor.so
+%{_datadir}/appdata/network-manager-openconnect.metainfo.xml
+
+%if %with gtk4
+%{_libdir}/NetworkManager/libnm-gtk4-vpn-plugin-openconnect-editor.so
+%endif
+
+%if %{with libnm_glib}
+%{_libdir}/NetworkManager/libnm-*-properties.so
+%{_sysconfdir}/NetworkManager/VPN/nm-openconnect-service.name
+%endif
+
+
+%changelog
+* Sat Apr 30 2022 David Woodhouse <dwmw2 infradead org> - %{version}-%{release}
+- Autopackaging for COPR
diff --git a/mkspec.sh b/mkspec.sh
new file mode 100755
index 0000000..91e362d
--- /dev/null
+++ b/mkspec.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+TARGET="$1"
+
+GITCOMMIT="$(git rev-parse HEAD)"
+GITDESC="$(git describe --tags HEAD)"
+
+GITTAG="$(echo $GITDESC | sed 's/-[0-9]\+-g[0-9a-f]\+$//')"
+GITTAG="${GITTAG#v}"
+GITTAG="${GITTAG%-dev}"
+
+if [ "v$GITTAG" = "$GITDESC" ]; then
+    ISSNAP=0
+    GITCOUNT=0
+else
+    ISSNAP=1
+    GITCOUNT="$(echo $GITDESC | sed 's/.*-\([0-9]\+\)-g[0-9a-f]\+$/\1/')"
+fi
+
+sed -e "s/@ISSNAP@/${ISSNAP}/" \
+    -e "s/@VERSION@/${GITTAG}/" \
+    -e "s/@SNAPCOMMIT@/${GITCOMMIT}/" \
+    -e "s/@SNAPCOUNT@/${GITCOUNT}/" \
+    ${TARGET}.spec.in > ${TARGET}.spec


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]