From: David Woodhouse Date: Sun, 29 Apr 2018 20:30:11 +0000 (+0100) Subject: Autogenerate specfile, attempt to add COPR 'make srpm' support X-Git-Tag: v0.91~22 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=49ad9f09c75a1a5471fe5bb7e093c969055e6029;p=pidgin-chime.git Autogenerate specfile, attempt to add COPR 'make srpm' support --- diff --git a/.copr/Makefile b/.copr/Makefile new file mode 100644 index 0000000..0e2095c --- /dev/null +++ b/.copr/Makefile @@ -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/$@ diff --git a/configure.ac b/configure.ac index f7ddb4b..d4c761d 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/pidgin-chime.spec b/pidgin-chime.spec.in similarity index 94% rename from pidgin-chime.spec rename to pidgin-chime.spec.in index ec5c747..ff9cf58 100644 --- a/pidgin-chime.spec +++ b/pidgin-chime.spec.in @@ -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