[minor] improve RPM and DEB generation in Makefile, change version string format

This commit is contained in:
Julien Vehent 2014-06-16 15:50:09 -04:00
Родитель 7488f852d0
Коммит f8cd31707e
2 изменённых файлов: 13 добавлений и 7 удалений

Просмотреть файл

@ -4,15 +4,21 @@
BUILDREF := $(shell git log --pretty=format:'%h' -n 1)
BUILDDATE := $(shell date +%Y%m%d%H%M)
BUILDREV := $(BUILDDATE)_$(BUILDREF)
BUILDENV := dev
BUILDDC := local
BUILDREV := $(BUILDDATE)+$(BUILDREF).$(BUILDENV)
# Supported OSes: linux darwin freebsd windows
# Supported ARCHes: 386 amd64
OS := linux
ARCH := amd64
ifeq ($(ARCH),amd64)
FPMARCH := x86_64
endif
ifeq ($(ARCH),386)
FPMARCH := i686
endif
PREFIX := /usr/local/
DESTDIR := /
GPGMEDIR := src/mig/pgp/sign
@ -98,12 +104,12 @@ rpm-agent: mig-agent
rm -fr tmp
$(INSTALL) -D -m 0755 $(BINDIR)/mig-agent-$(BUILDREV) tmp/sbin/mig-agent-$(BUILDREV)
$(MKDIR) -p tmp/var/cache/mig
# Agent auto install startup scripts, so we just need to execute it once as priviliged user
# Agent auto install startup scripts, so we just need to execute it once as privileged user
echo -en "#!/bin/sh\nset -e\n[ -e /sbin/mig-agent ] && rm /sbin/mig-agent\nln -s /sbin/mig-agent-$(BUILDREV) /sbin/mig-agent\n/sbin/mig-agent" > tmp/agent_install.sh
chmod 0755 tmp/agent_install.sh
fpm -C tmp -n mig-agent --license GPL --vendor mozilla --description "Mozilla InvestiGator Agent" \
--url https://github.com/mozilla/mig --after-install tmp/agent_install.sh \
-v $(BUILDREV)_$(BUILDDC)_$(BUILDENV) -s dir -t rpm .
--architecture $(FPMARCH) -v $(BUILDREV) -s dir -t rpm .
deb-agent: mig-agent
# Bonus FPM options
@ -111,12 +117,12 @@ deb-agent: mig-agent
rm -fr tmp
$(INSTALL) -D -m 0755 $(BINDIR)/mig-agent-$(BUILDREV) tmp/sbin/mig-agent-$(BUILDREV)
$(MKDIR) -p tmp/var/cache/mig
# Agent auto install startup scripts, so we just need to execute it once as priviliged user
# Agent auto install startup scripts, so we just need to execute it once as privileged user
echo -en "#!/bin/sh\nset -e\n[ -e /sbin/mig-agent ] && rm /sbin/mig-agent\nln -s /sbin/mig-agent-$(BUILDREV) /sbin/mig-agent\n/sbin/mig-agent" > tmp/agent_install.sh
chmod 0755 tmp/agent_install.sh
fpm -C tmp -n mig-agent --license GPL --vendor mozilla --description "Mozilla InvestiGator Agent" \
--url https://github.com/mozilla/mig --after-install tmp/agent_install.sh \
-v $(BUILDREV)_$(BUILDDC)_$(BUILDENV) -s dir -t deb .
--architecture $(FPMARCH) -v $(BUILDREV) -s dir -t deb .
rpm-scheduler: mig-scheduler
rm -rf tmp

Просмотреть файл

@ -68,7 +68,7 @@ type Results struct {
}
func (p Parameters) Validate() (err error) {
versionre := regexp.MustCompile(`^[0-9]{12}_[a-z0-9]{7}$`)
versionre := regexp.MustCompile(`^[0-9]{12}+[a-z0-9]{7}.[a-zA-Z0-9]{50}$`)
locre := regexp.MustCompile(`^https?://`)
checksumre := regexp.MustCompile(`^[a-zA-Z0-9]{64}$`)
for k, el := range p.Elements {