gunnar: server/pear pear.spec.template,NONE,1.1 Pear.mk,NONE,1.1
cvs at kolab.org
cvs at kolab.org
Tue Jun 23 16:15:43 CEST 2009
- Previous message: gunnar: server/pear Horde.mk,1.12,1.13
- Next message: gunnar: server/pear/Horde_Util-H4 package.info, NONE, 1.1 .cvsignore, 1.1, 1.2 Makefile, 1.1, 1.2 Horde_Util-H4.spec, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: gunnar
Update of /kolabrepository/server/pear
In directory doto:/tmp/cvs-serv23315
Added Files:
pear.spec.template Pear.mk
Log Message:
use a template based approach for the pear based spec files.
--- NEW FILE: pear.spec.template ---
# Variables
%define V_horde_pkgdir @horde_pkgdir@
%define V_horde_package @horde_package@
%define V_package @package@
%define V_package_origin @package_origin@
%define V_repo_commit @repo_commit@
%define V_repo_release @repo_release@
%define V_version @version@
%define V_release @release@
%define V_sourceurl @sourceurl@
%define V_php_lib_loc @php_lib_loc@
%define V_www_loc @www_loc@
%define V_summary @summary@
%define V_license @license@
# Package Information
Name: %{V_package}
Summary: %{V_summary}
URL: http://pear.horde.org/index.php?package=%{V_horde_package}
Packager: Gunnar Wrobel <wrobel at pardus.de> (p at rdus)
Version: %{V_version}
Release: %{V_release}
License: %{V_license}
Group: Development/Libraries
Distribution: OpenPKG
# List of Sources
Source: %{V_sourceurl}/%{V_horde_package}-%{V_version}.tgz
# List of patches
Patch0: package.patch
# Build Info
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
#Pre requisites
@buildprereq@
@prereq@
# Package options
%option with_chroot no
%description
@description@
%prep
%setup -n %{V_horde_package}-%{V_version}
if [ -n "`cat %{PATCH0}`" ]; then
%patch -p0 -P 0
fi
cat ../package.xml | sed -e 's/md5sum="[^"]*"//' > package.xml
%build
%install
env PHP_PEAR_PHP_BIN="%{l_prefix}/bin/php -d safe_mode=off -d memory_limit=40M"\
PHP_PEAR_CACHE_DIR="/tmp/pear/cache" \
%{l_prefix}/bin/pear -d www_dir="%{l_prefix}/var/kolab/www/%{V_www_loc}" \
-d php_dir="%{l_prefix}/lib/%{V_php_lib_loc}" \
install --offline --force --nodeps -P $RPM_BUILD_ROOT \
package.xml
rm -rf $RPM_BUILD_ROOT/%{l_prefix}/lib/%{V_php_lib_loc}/{.filemap,.lock,.channels,.depdb,.depdblock}
# With chroot
%if "%{with_chroot}" == "yes"
%{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/var/kolab/www/%{l_prefix}/lib
cp -a $RPM_BUILD_ROOT/%{l_prefix}/lib/%{V_php_lib_loc} $RPM_BUILD_ROOT%{l_prefix}/var/kolab/www/%{l_prefix}/lib/
%endif
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
%clean
rm -rf $RPM_BUILD_ROOT
%files -f files
--- NEW FILE: Pear.mk ---
include ../Base.mk
# Determine the staging area for collecting new source rpms
ifeq "x$(STAGING)" "x"
STAGING = ../../stage
endif
# Set the default upstream directory.
ifeq "x$(UPSTREAM_DIR)" "x"
UPSTREAM_DIR = ../../upstream
endif
# Location of the PEAR script
PEAR=$(HOME)/bin/pear
# Determine the horde package name from the *.spec file
HORDE_PKGDIR = $(shell grep "^horde_pkgdir=" package.info | sed -e "s/horde_pkgdir='\([A-Za-z0-9\-\_]*\)'\s*/\1/")
# Determine the horde package name from the *.spec file
HORDE_PACKAGE = $(shell grep "^horde_package=" package.info | sed -e "s/horde_package='\([A-Za-z0-9\_-]*\)'.*/\1/")
# Determine the package origin from the *.spec file
PACKAGE_ORIGIN = $(shell grep "^package_origin=" package.info | sed -e "s/package_origin='\([A-Z]*\)'.*/\1/")
# Determine the package version control type from the *.spec file
PACKAGE_VC = $(shell grep "^package_vc=" package.info | sed -e "s/package_vc='[A-Z]*-\([A-Z]*\)'.*/\1/")
# Determine the package name from the *.spec file
PACKAGE = $(shell grep "^package=" package.info | sed -e "s/package='\([A-Za-z0-9\_-]*\)'.*/\1/")
# Determine the package version from the *.spec file
VERSION = $(shell grep "^version=" package.info | sed -e "s/version='\([0-9.a-z]*\)'.*/\1/")
# Determine the file end of the source package
FILEEND = $(shell grep "^pkg_fileend=" package.info | sed -e "s/pkg_fileend='*\([0-9.a-z]*\)'.*/\1/")
# Determine the release number from the *.spec file
RELEASE = $(shell grep "^release=" package.info | sed -e "s/release='\([0-9]*\)'.*/\1/")
# Determine the repository
REPO = $(shell grep "^repo=" package.info | sed -e "s/repo='\([A-Za-z0-9_\-]*\)'.*/\1/")
# Determine the exact commit that should be retrieved from the repository
COMMIT = $(shell grep "^repo_commit=" package.info | sed -e "s/repo_commit='\([A-Za-z0-9_]*\)'.*/\1/")
# Determine the release tag a package derived from a repository checkout should get
RELTAG = $(shell grep "^repo_release=" package.info | sed -e "s/repo_release='*\([0-9]*\)'.*/\1/")
# Determine the download url for the PEAR package from the *.spec file
SOURCE_URL=$(shell grep "^sourceurl=" package.info | sed -e "s/sourceurl='\(.*\)'$$/\1/")
# Additional variables for tweaking the PEAR package.xml
ALTERNATE_CHANNEL= $(shell grep "^alternate_channel=" package.info | sed -e "s/alternate_channel='\(.*\)'$$/\1/")
ALTERNATE_MAINTAINER= $(shell grep "^alternate_maintainer=" package.info | sed -e "s/alternate_maintainer='\(.*\)'$$/\1/")
ALTERNATE_MAINTAINER_SNIPPET= $(shell grep "^alternate_maintainer_snippet=" package.info | sed -e "s/alternate_maintainer_snippet='\(.*\)'$$/\1/")
# Set the default package file end
ifeq "x$(FILEEND)" "x"
FILEEND=tgz
endif
# Generate the full package name
SOURCE_0=$(HORDE_PACKAGE)-$(VERSION).$(FILEEND)
# Get the list of patches if there are any in the patch directory
PATCHES = $(shell ls patches/$(PACKAGE)-$(VERSION)/*.patch 2> /dev/null)
# Get the list of php (config) files if there are any in this directory
PHP_FILES = $(shell ls *.php 2> /dev/null)
# Get the list of template files if there are any in this directory
TEMPLATE_FILES = $(shell ls *.template 2> /dev/null)
# Generate a list of extra files for the package
EXTRA=ChangeLog package.patch $(PHP_FILES) $(TEMPLATE_FILES)
# Temporary repository checkout location
ifeq ($(PACKAGE_VC),CVS)
UPSTREAM=$(UPSTREAM_DIR)/cvs
else
ifeq ($(PACKAGE_VC),GIT)
UPSTREAM=$(UPSTREAM_DIR)/git
endif
endif
# The current date
DATE=$(shell date +%Y-%m-%d)
# CVS information
ifeq ($(REPO),)
CVS_REPO=framework
else
CVS_REPO=$(REPO)
endif
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
# GIT information
ifeq ($(REPO),)
GIT_REPO=horde
else
GIT_REPO=$(REPO)
endif
GIT_REPO_URL=git://dev.horde.org/horde/git/$(GIT_REPO)
GIT_REPO_UP_CMD=git pull origin master
GIT_REPO_CO_CMD=git clone
GIT_REPO_SC_CMD=git checkout
# 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 $(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_UP_CMD); \
$(GIT_REPO_SC_CMD) "$(COMMIT)"; \
else \
cd $(UPSTREAM) && $(GIT_REPO_CO_CMD) $(GIT_REPO_URL); \
cd $(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
ifneq ($(PACKAGE_VC),)
# Short name for the source package as a target for the command line.
.PHONY:source
source: 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
ifneq ($(ALTERNATE_CHANNEL),)
sed -i -e 's#<channel>.*</channel>#<channel>$(ALTERNATE_CHANNEL)</channel>#' tmp/$(PACKAGE)/package.xml
endif
ifneq ($(ALTERNATE_MAINTAINER),)
if [ -z "`grep $(ALTERNATE_MAINTAINER) tmp/$(PACKAGE)/package.xml`" ]; then \
sed -i -e '/lead/,/\/lead/ D' tmp/$(PACKAGE)/package.xml; \
sed -i -e '/date.*\/date/ i\ $(ALTERNATE_MAINTAINER_SNIPPET)' tmp/$(PACKAGE)/package.xml; \
fi
endif
$(PEAR) package tmp/$(PACKAGE)/package.xml
rm -rf tmp
endif
# 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
ifneq ($(ALTERNATE_CHANNEL),)
sed -i -e 's#<channel>.*</channel>#<channel>$(ALTERNATE_CHANNEL)</channel>#' tmp/$(PACKAGE)/package.xml
endif
ifneq ($(ALTERNATE_MAINTAINER),)
if [ -z "`grep $(ALTERNATE_MAINTAINER) tmp/$(PACKAGE)/package.xml`" ]; then \
sed -i -e '/lead/,/\/lead/ D' tmp/$(PACKAGE)/package.xml; \
sed -i -e '/date.*\/date/ i\ $(ALTERNATE_MAINTAINER_SNIPPET)' tmp/$(PACKAGE)/package.xml; \
fi
endif
$(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):
test -d $(KOLABRPMSRC)/$(PACKAGE) || mkdir $(KOLABRPMSRC)/$(PACKAGE)
# Target for the source file in the src rpm directory.
$(KOLABRPMSRC)/$(PACKAGE)/$(SOURCE_0): $(KOLABRPMSRC)/$(PACKAGE) $(SOURCE_0)
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
$(PACKAGE).spec: ../pear.spec.template package.info
source package.info && \
cat ../pear.spec.template | \
sed -e "s#[@]horde_pkgdir[@]#$${horde_pkgdir}#g" \
-e "s#[@]horde_package[@]#$${horde_package}#g" \
-e "s#[@]package[@]#$${package}#g" \
-e "s#[@]package_origin[@]#$${package_origin}#g" \
-e "s#[@]repo_commit[@]#$${repo_commit}#g" \
-e "s#[@]repo_release[@]#$${repo_release}#g" \
-e "s#[@]version[@]#$${version}#g" \
-e "s#[@]release[@]#$${release}#g" \
-e "s#[@]sourceurl[@]#$${sourceurl}#g" \
-e "s#[@]php_lib_loc[@]#$${php_lib_loc}#g" \
-e "s#[@]www_loc[@]#$${www_loc}#g" \
-e "s#[@]summary[@]#$${summary}#g" \
-e "s#[@]license[@]#$${license}#g" \
-e "s#[@]buildprereq[@]#$${buildprereq}#g" \
-e "s#[@]prereq[@]#$${prereq}#g" \
-e "s#[@]description[@]#$${description}#g" > \
$(PACKAGE).spec
# 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
- Previous message: gunnar: server/pear Horde.mk,1.12,1.13
- Next message: gunnar: server/pear/Horde_Util-H4 package.info, NONE, 1.1 .cvsignore, 1.1, 1.2 Makefile, 1.1, 1.2 Horde_Util-H4.spec, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the commits
mailing list