]> www.infradead.org Git - pidgin-chime.git/commitdiff
Autogenerate specfile, attempt to add COPR 'make srpm' support
authorDavid Woodhouse <dwmw2@infradead.org>
Sun, 29 Apr 2018 20:30:11 +0000 (21:30 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Sun, 29 Apr 2018 21:36:39 +0000 (22:36 +0100)
.copr/Makefile [new file with mode: 0644]
configure.ac
pidgin-chime.spec.in [moved from pidgin-chime.spec with 94% similarity]

diff --git a/.copr/Makefile b/.copr/Makefile
new file mode 100644 (file)
index 0000000..0e2095c
--- /dev/null
@@ -0,0 +1,34 @@
+# For COPR builds directly from git.
+#
+# https://docs.pagure.org/copr.copr/user_documentation.html#make-srpm
+#
+
+GITCOMMIT := $(shell git rev-parse HEAD)
+GITDESC := $(shell git describe --tags HEAD)
+GITDESC_WORDS := $(subst -, ,$(GITDESC))
+GITTAG := $(patsubst v%,%,$(word 1,$(GITDESC_WORDS)))
+GITCOUNT := $(word 2,$(GITDESC_WORDS))
+
+ifeq ($(GITCOUNT),)
+ISSNAP := 0
+TARNAME := $(GITTAG)
+TARPREFIX := $(GITTAG)
+else
+ISSNAP := 1
+TARNAME := $(shell echo $(GITCOMMIT) | cut -c1-7)
+TARPREFIX := $(GITCOMMIT)
+endif
+
+srpm: pidgin-chime.spec pidgin-chime-$(TARNAME).tar.gz
+       rpmbuild -bs pidgin-chime.spec --define "_sourcedir ." --define "_srcrpmdir $(outdir)"
+
+pidgin-chime.spec: ../pidgin-chime.spec.in Makefile
+       sed -e "s/@ISSNAP@/$(ISSNAP)/" \
+           -e "s/@VERSION@/$(GITTAG)/" \
+           -e "s/@SNAPCOMMIT@/$(GITCOMMIT)/" \
+           -e "s/@SNAPCOUNT@/$(GITCOUNT)/" \
+           $< > $@
+
+
+pidgin-chime-$(TARNAME).tar.gz Makefile:
+       cd .. && git archive --prefix=pidgin-chime-$(TARPREFIX)/ $(GITCOMMIT) -o .copr/$@
index f7ddb4b1b7fa16acf9f898fed485a32337be51da..d4c761da4260ff2c994c80ec6e199097e745aab9 100644 (file)
@@ -109,6 +109,15 @@ RAWLINGUAS=`sed -e "/^#/d" -e "s/#.*//" "${srcdir}/po/LINGUAS"`
 LINGUAS=`echo $RAWLINGUAS`
 AC_SUBST(LINGUAS)
 
+if git diff --name-only --exit-code v${PACKAGE_VERSION} HEAD > /dev/null; then
+   gitdesc=$(git describe --tags HEAD)
+   AC_SUBST(SNAPCOUNT, $(echo "$gitdesc" | cut -f2 -d-))
+   AC_SUBST(SNAPCOMMIT, $(git rev-parse HEAD))
+   AC_SUBST(ISSNAP, 1)
+else
+   AC_SUBST(ISSNAP, 0)
+fi
+
 AC_CONFIG_FILES([
        Makefile
        po/Makefile
@@ -123,5 +132,6 @@ AC_CONFIG_FILES([
        fs-app-transmitter/Makefile
        gst-chime/Makefile
        chimeseen/Makefile
+       pidgin-chime.spec
        ])
 AC_OUTPUT
similarity index 94%
rename from pidgin-chime.spec
rename to pidgin-chime.spec.in
index ec5c7471cfebbbd87ead3763575971e861e5537d..ff9cf589366d521d6dcc2c9a0fec70cd201a69b4 100644 (file)
@@ -1,4 +1,4 @@
-#global gitsnapshot 1
+%global gitsnapshot @ISSNAP@
 %if 0%{?gitsnapshot}
 %global snapcommit @SNAPCOMMIT@
 %global snapcount @SNAPCOUNT@
@@ -6,19 +6,19 @@
 %global snapver .git.%{snapcount}.%{shortcommit}
 %endif
 
-%global tagver 0.9
+%global tagver @VERSION@
 
 %bcond_without evolution # with
 
 Name:           pidgin-chime
 Summary:        libpurple / Pidgin protocol plugin for Amazon Chime
 Version:        %{tagver}%{?snapver}
-Release:        1%{?dist}
+Release:        0%{?dist}
 
 Group:          Applications/Communications
 License:        LGPLv2
 URL:            https://github.com/awslabs/%{name}
-%if 0%{?gitsnapshot:1}
+%if 0%{?gitsnapshot}
 Source0:        https://github.com/awslabs/%{name}/archive/%{snapcommit}/%{name}-%{shortcommit}.tar.gz
 %else
 Source0:        %{name}-%{version}.tar.gz
@@ -45,7 +45,7 @@ BuildRequires:  pkgconfig(libecal-1.2)
 %endif # with evolution
 BuildRequires:  gcc
 BuildRequires:  gettext
-%if 0%{?gitsnapshot:1}
+%if 0%{?gitsnapshot}
 BuildRequires:  libtool
 BuildRequires:  autoconf
 BuildRequires:  automake
@@ -82,11 +82,14 @@ A plugin for Evolution that allows you to create meetings in Amazon Chime.
 %endif # with evolution
 
 %prep
-%if 0%{?gitsnapshot:1}
+%if 0%{?gitsnapshot}
 %setup -q -n %{name}-%{snapcommit}
 NOCONFIGURE=x ./autogen.sh
 %else
 %setup -q
+if [ ! -x configure ]; then
+    NOCONFIGURE=x ./autogen.sh
+fi
 %endif
 
 %build