[Dh-make-php-commits] r340 - trunk

Uwe Steinmann steinm at alioth.debian.org
Fri Feb 12 20:02:25 UTC 2010


Author: steinm
Date: 2010-02-12 20:02:14 +0000 (Fri, 12 Feb 2010)
New Revision: 340

Modified:
   trunk/dh-make-pear
Log:
- added new option --state --rename
- fixed typo in variable name


Modified: trunk/dh-make-pear
===================================================================
--- trunk/dh-make-pear	2010-02-12 20:00:57 UTC (rev 339)
+++ trunk/dh-make-pear	2010-02-12 20:02:14 UTC (rev 340)
@@ -9,7 +9,7 @@
 # at http://www.gnu.org/.
 
 PROGNAME=dh-make-pear
-PROGVERSION=0.2.14
+PROGVERSION=0.2.15
 PREFIX=/usr
 
 DEBPACKAGEPREFIX=php-
@@ -21,7 +21,9 @@
 PHPPKGINFO=${PREFIX}/share/dh-make-php/phppkginfo
 DEBMAINTAINER=
 DEPENDS=
-DEPARCH=all
+DEBARCH=all
+PREFSTATE=stable
+RENAMESOURCE=
 
 . ${PREFIX}/share/dh-make-php/dh-make-php.lib
 
@@ -40,7 +42,9 @@
   --help | -h     show this usage information
   --version | -v  show version of program
   --maintainer    maintainer of the debian package
+  --rename        rename the source tarball instead of symlinking it
   --arch          set architecture (defaults to 'all')
+  --state         set preferred_state for pear download (defaults to 'stable')
   --depends       set more depends aside php
   --prefix        set prefix for package name (default is '${DEBPACKAGEPREFIX}')
   --templatedir   set alternative directory for templates
@@ -72,12 +76,18 @@
 		--arch) # set architecture of debian package
 			DEBARCH="$2"; shift
 			;;
+		--state) # set architecture of debian package
+			PREFSTATE="$2"; shift
+			;;
 		--depends) # set extra depends for debian package
 			DEPENDS=", $2"; shift
 			;;
 		--prefix) # set prefix for name of debian package
 			DEBPACKAGEPREFIX="$2"; shift
 			;;
+		--rename) # rename the source tarball instead of symlinking
+			RENAMESOURCE=yes
+			;;
 		--templatedir) # set alternative template dir
 			DEBTEMPDIR="$2"; shift
 			;;
@@ -96,12 +106,13 @@
 	if [ -f ${PEARPACKAGENAME} ]; then
 		tar xzf ${PEARPACKAGENAME}
 	else
-		if TEMPMSG=$(/usr/bin/pear download ${PEARPACKAGENAME} 2> /dev/null); then
+		if TEMPMSG=$(/usr/bin/pear -D preferred_state=${PREFSTATE} download ${PEARPACKAGENAME}); then
 			echo ${TEMPMSG}
 			PEARPACKAGENAME=$(echo ${TEMPMSG} | awk -F ' ' '{print $2'})
 			tar xzf ${PEARPACKAGENAME}
 		else
 			echo "Downloading pear package '${PEARPACKAGENAME}' failed!";
+			echo "${TEMPMSG}"
 			echo "Check http://pear.php.net/ for available packages.";
 			exit 0
 		fi
@@ -126,7 +137,14 @@
 	echo "Directory '${SRCPACKAGEDIR}' already exits."
 	exit
 fi
-ln -s ${PEARPACKAGENAME} ${DEBPACKAGEPREFIX}${PHP_PKG_LOWNAME}_${VERSION}.orig.tar.gz
+if [ "${RENAMESOURCE}" = "yes" ]; then
+	if [ -e ${DEBPACKAGEPREFIX}${PHP_PKG_LOWNAME}_${VERSION}.orig.tar.gz ]; then
+		rm ${DEBPACKAGEPREFIX}${PHP_PKG_LOWNAME}_${VERSION}.orig.tar.gz
+	fi
+	mv ${PEARPACKAGENAME} ${DEBPACKAGEPREFIX}${PHP_PKG_LOWNAME}_${VERSION}.orig.tar.gz
+else
+	ln -s ${PEARPACKAGENAME} ${DEBPACKAGEPREFIX}${PHP_PKG_LOWNAME}_${VERSION}.orig.tar.gz
+fi
 mkdir ${SRCPACKAGEDIR}
 mv ${PHP_PKG_NAME}-${VERSION} ${SRCPACKAGEDIR}
 mv package.xml ${SRCPACKAGEDIR}
@@ -152,7 +170,7 @@
     -e "s/##maintainer##/${DEBMAINTAINER}/g" \
     -e "s§##summary##§${SUMMARY}§g" \
     -e "s/##depends##/${DEPENDS}/g" \
-    -e "s/##architecture##/${DEPARCH}/g" \
+    -e "s/##architecture##/${DEBARCH}/g" \
 		${DEBTEMPDIR}/control > ${SRCPACKAGEDIR}/debian/control
 		${PHPPKGINFO} ${SRCPACKAGEDIR} description | fmt -w 70|sed -e "s§^[ \t]*$§.§g" -e "s§^§ §g" >> ${SRCPACKAGEDIR}/debian/control
 sed -e "s/##packagename##/${DEBPACKAGEPREFIX}${PHP_PKG_LOWNAME}/g" \




More information about the Dh-make-php-commits mailing list