gunnar: server/pear .cvsignore,NONE,1.1 Horde.mk,NONE,1.1

cvs at kolab.org cvs at kolab.org
Mon May 18 18:12:30 CEST 2009


Author: gunnar

Update of /kolabrepository/server/pear
In directory doto:/tmp/cvs-serv4343

Added Files:
	.cvsignore Horde.mk 
Log Message:
Started centralizing the PEAR package Makefile. This reduces the amount of Makefile code and should streamline the way we generate RPMs from PEAR packages. At the same time it should allow to deal with PEAR packages derived from CVS/git as we still need to cope with the bad package management Horde 3 provides.

--- NEW FILE: .cvsignore ---
upstream

--- NEW FILE: Horde.mk ---
# If home is unset this Makefile assumes the Kolab server installation
# resides in /kolab. If this is not the case this Makefile must be
# called using
#
# HOME="/mykolabroot" make TARGET
#
ifeq "x$(HOME)" "x"
  HOME = /kolab
endif

# If HOME is set to /root it is likely that somebody is calling this
# Makefile as root user. In this case this Makefile assumes that the
# Kolab server installation resides in /kolab.
#
# In the (hopefully) unlikely event that somebody really installed the
# Kolab server in /root this Makefile will fail.
ifeq "x$(HOME)" "x/root"
  HOME = /kolab
endif

# Set the location of the rpm binary
ifeq "x$(RPM)" "x"
  RPM = $(HOME)/bin/openpkg rpm
endif

# Set the location for rpm source package installations
ifeq "x$(KOLABRPMSRC)" "x"
  KOLABRPMSRC = $(HOME)/RPM/SRC
endif

# Set the location for rpm packages
ifeq "x$(KOLABRPMPKG)" "x"
  KOLABRPMPKG = $(HOME)/RPM/PKG
endif

# Set the location for the rpm temporary directory
ifeq "x$(KOLABRPMTMP)" "x"
  KOLABRPMTMP = $(HOME)/RPM/TMP
endif

# Determine the suffix for binary packages on this system
ifeq "x$(PLATTAG)" "x"
	PLATTAG = $(shell $(RPM) -q --qf="%{ARCH}-%{OS}" openpkg)-$(HOME:/%=%)
endif

# Determine the staging area for collecting new source rpms
ifeq "x$(STAGING)" "x"
  STAGING = ../../stage
endif

# Determine the horde package name from the *.spec file
HORDE_PKGDIR = $(shell grep "%define[ ]*V_horde_pkgdir" *.spec | sed -e "s/.*V_horde_pkgdir \([A-Za-z\-\_]*\).*/\1/")

# Determine the horde package name from the *.spec file
HORDE_PACKAGE = $(shell grep "%define[ ]*V_horde_package" *.spec | sed -e "s/.*V_horde_package \([A-Za-z\-\_]*\).*/\1/")

# Determine the package origin from the *.spec file
PACKAGE_ORIGIN = $(shell grep "%define[ ]*V_package_origin" *.spec | sed -e "s/.*V_package_origin \([A-Z]*\).*/\1/")

# Determine the package version control type from the *.spec file
PACKAGE_VC = $(shell grep "%define[ ]*V_package_origin" *.spec | sed -e "s/.*V_package_origin VC-\([A-Z]*\).*/\1/")

# Determine the package name from the *.spec file
PACKAGE = $(shell grep "%define[ ]*V_package " *.spec | sed -e "s/.*V_package \([A-Za-z\-\_]*\).*/\1/")

# Determine the package version from the *.spec file
VERSION = $(shell grep "%define[ ]*V_version" *.spec | sed -e "s/.*V_version\s*\([0-9.a-z]*\).*/\1/")

# Determine the release number from the *.spec file
RELEASE = $(shell grep "%define[ ]*V_release" *.spec | sed -e "s/.*V_release\s*\([0-9]*\).*/\1/")

# Determine the exact commit that should be retrieved from the repository
COMMIT =  $(shell grep "%define[ ]*V_repo_commit" *.spec | sed -e "s/.*V_repo_commit\s*\([A-Za-z0-9_]*\).*/\1/")

# Determine the release tag a package derived from a repository checkout should get
RELTAG = $(shell grep "%define[ ]*V_repo_release" *.spec | sed -e "s/.*V_repo_release\s*\([0-9]*\).*/\1/")

# Determine the download url for the PEAR package from the *.spec file
SOURCE_URL=$(shell grep "%define[ ]*V_sourceurl" *.spec | sed -e "s/.*V_sourceurl\s*\(.*\)/\1/")

# Generate the full package name
SOURCE_0=$(HORDE_PACKAGE)-$(VERSION).tgz

# Get the list of patches if there are any in the patch directory
PATCHES = $(shell ls patches/$(PACKAGE)-$(VERSION)/*.patch 2> /dev/null)

# Generate a list of extra files for the package
EXTRA=ChangeLog package.patch

# CVS information
UPSTREAM=../upstream/cvs
CVS_REPO=framework
CVS_REPO_URL=:pserver:cvsread at anoncvs.horde.org:/repository
CVS_REPO_UP_CMD=cvs update
CVS_REPO_CO_CMD=cvs -d $(CVS_REPO_URL) co
CVS_REPO_SC_CMD=cvs update -r
DATE=$(shell date +%Y-%m-%d)
PEAR=$(HOME)/bin/pear

# Default target to generate the source rpm package
.PHONY: all
all: $(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm

# Target for placing the source rpm in the staging area
.PHONY: dist
dist: all
	test -d $(STAGING) || mkdir $(STAGING)
	cp $(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm $(STAGING)

# Target for installing the binary rpm package in our current Kolab
# server installation
.PHONY: install
install: $(KOLABRPMPKG)/$(PACKAGE)-$(VERSION)-$(RELEASE).$(PLATTAG).rpm
	$(RPM) -Uhv --force $(KOLABRPMPKG)/$(PACKAGE)-$(VERSION)-$(RELEASE).$(PLATTAG).rpm

# Target location for the repository checkout
$(UPSTREAM):
	mkdir -p $(UPSTREAM)

# Target for generating the repository checkout
ifeq ($(PACKAGE_VC),CVS)
.PHONY: $(UPSTREAM)/$(CVS_REPO)
$(UPSTREAM)/$(CVS_REPO):
	if [ -e $(UPSTREAM)/$(CVS_REPO) ]; then                     \
	  cd $(UPSTREAM)/$(CVS_REPO) && $(CVS_REPO_SC_CMD) "$(COMMIT)"; \
	else                                                    \
	  @echo The password is 'horde';                        \
	  cvs -d $(CVS_REPO_URL) login;                             \
	  cd $(UPSTREAM) && $(CVS_REPO_CO_CMD) $(CVS_REPO);             \
	  cd $(UPSTREAM)/$(CVS_REPO) && $(CVS_REPO_SC_CMD) "$(COMMIT)"; \
	fi;
else
ifeq ($(PACKAGE_VC),GIT)
.PHONY: $(UPSTREAM)/$(GIT_REPO)
$(UPSTREAM)/$(GIT_REPO):
	if [ -e $(UPSTREAM)/$(GIT_REPO) ]; then                     \
	  cd $(UPSTREAM)/$(GIT_REPO) && $(GIT_REPO_SC_CMD) "$(COMMIT)"; \
	else                                                    \
	  cvs -d $(GIT_REPO_URL) login;                             \
	  cd $(UPSTREAM) && $(GIT_REPO_CO_CMD) $(GIT_REPO);             \
	  cd $(UPSTREAM)/$(GIT_REPO) && $(GIT_REPO_SC_CMD) "$(COMMIT)"; \
	fi;
endif
endif

# Generate the source package from the repository checkout
ifeq ($(PACKAGE_VC),CVS)
tmp/$(PACKAGE): $(UPSTREAM) $(UPSTREAM)/$(CVS_REPO)
	rm -rf tmp
	mkdir tmp
	cp -r $(UPSTREAM)/$(CVS_REPO)/$(HORDE_PKGDIR) tmp/$(PACKAGE)
else
ifeq ($(PACKAGE_VC),GIT)
tmp/$(PACKAGE): $(UPSTREAM) $(UPSTREAM)/$(GIT_REPO)
	rm -rf tmp
	mkdir tmp
	cp -r $(UPSTREAM)/$(GIT_REPO)/$(HORDE_PKGDIR) tmp/$(PACKAGE)
endif
endif

# Short name for the source package as a target for the command line.
.PHONY:source
source: $(SOURCE_0)

# Target for retrieving the source package
ifeq ($(PACKAGE_ORIGIN),VC)
$(SOURCE_0): tmp/$(PACKAGE)
	sed -i -e "/version/,+1 s#<release>\(.*\)</release>#<release>\1dev$(RELTAG)</release>#" tmp/$(PACKAGE)/package.xml
	sed -i -e "/lead/,+1 s#<date>.*</date>#<date>$(DATE)</date>#" tmp/$(PACKAGE)/package.xml
	$(PEAR) package tmp/$(PACKAGE)/package.xml
	rm -rf tmp
else
$(SOURCE_0):
	wget -c "$(SOURCE_URL)/$(SOURCE_0)"
endif

# Target for the src rpm directory.
$(KOLABRPMSRC)/$(PACKAGE)/$(SOURCE_0): $(SOURCE_0)
	test -d $(KOLABRPMSRC)/$(PACKAGE) || mkdir $(KOLABRPMSRC)/$(PACKAGE)
	cp $(SOURCE_0) $(KOLABRPMSRC)/$(PACKAGE)/

# Prepare the patch for the package.
package.patch: $(PATCHES)
	echo > package.patch
	for PATCH in $(PATCHES);        \
	do                              \
	  cat $$PATCH >> package.patch; \
	done

# Target for preparing the source area and building the package
$(KOLABRPMPKG)/$(PACKAGE)-$(VERSION)-$(RELEASE).$(PLATTAG).rpm: Makefile $(PACKAGE).spec $(EXTRA) $(KOLABRPMSRC)/$(PACKAGE)/$(SOURCE_0)
	cp $(PACKAGE).spec $(EXTRA) $(KOLABRPMSRC)/$(PACKAGE)
	cd $(KOLABRPMSRC)/$(PACKAGE) && $(RPM) -ba $(PACKAGE).spec

# Target for fetching the source rpm into the current directory
$(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm: $(KOLABRPMPKG)/$(PACKAGE)-$(VERSION)-$(RELEASE).$(PLATTAG).rpm
	cp -p $(KOLABRPMPKG)/$(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm .

# Target for cleaning up the files that can be generated with this Makefile
.PHONY: clean
clean:
	rm -rf $(KOLABRPMPKG)/$(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm
	rm -rf $(KOLABRPMPKG)/$(PACKAGE)-$(VERSION)-$(RELEASE).$(PLATTAG).rpm
	rm -rf $(KOLABRPMSRC)/$(PACKAGE)
	rm -rf $(KOLABRPMTMP)/$(PACKAGE)*
	rm -rf $(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm
	rm -rf $(SOURCE_0)
	rm -rf *~
	rm -rf package.patch






More information about the commits mailing list