pkg/kamailio: added rpm spec version and release configuration [skip ci]
authorSergey Safarov <s.safarov@gmail.com>
Tue, 27 Aug 2019 18:03:33 +0000 (21:03 +0300)
committerSergey Safarov <s.safarov@gmail.com>
Tue, 10 Sep 2019 10:43:39 +0000 (13:43 +0300)
pkg/kamailio/Makefile

index 63c024c..a221ff0 100644 (file)
@@ -6,8 +6,10 @@ else ifneq ($(MAKECMDGOALS),cfg)
 $(error Please start "make cfg" first)
 endif
 
-RPMBUILD_TOP := /tmp/rpmbuild
-DIST_ARCHIVE = ${shell echo "kamailio-$(RELEASE)_src.tar.gz" | sed -e "s/-dev[0-9]//" }
+RPMBUILD_TOP := /tmp/kamailio_rpmbuild
+RPM_VER = ${shell echo "$(RELEASE)" | sed -e "s/-dev[0-9]//" }
+RPM_REL = ${shell echo "$(RELEASE)." | grep -o -P "dev[0-9]\." }
+DIST_ARCHIVE = ${shell echo "kamailio-$(RPM_VER)_src.tar.gz"}
 APK_VERSION = ${shell echo "$(RELEASE)" | grep -o "^[0-9.]*"}
 RPMBUILD_OPT= --define "_topdir $(RPMBUILD_TOP)"
 GIT_TAG = ${shell git rev-parse HEAD 2> /dev/null}
@@ -38,7 +40,10 @@ apk:
 src.rpm: tar
        mkdir -p ${RPMBUILD_TOP}/SOURCES
        mv ../../kamailio-$(RELEASE)_src.tar.gz ${RPMBUILD_TOP}/SOURCES/${DIST_ARCHIVE}
-       sed -i -e 's/setup -n %{name}-%{ver}/setup -n kamailio-$(RELEASE)/' obs/kamailio.spec
+       sed -e 's/%define ver .*/%define ver ${RPM_VER}/' \
+            -e 's/%define rel .*/%define rel ${RPM_REL}0%{dist}/' \
+            -e 's/setup -n %{name}-%{ver}/setup -n kamailio-$(RELEASE)/' \
+            -i obs/kamailio.spec
        rpmbuild ${RPMBUILD_OPT} -bs obs/kamailio.spec
        mv ${RPMBUILD_TOP}/SRPMS/kamailio-$(RELEASE)*.src.rpm ../..
        rm -Rf ${RPMBUILD_TOP}