[90783] users/pixilla/tools/pear2port.sh

pixilla at macports.org pixilla at macports.org
Wed Mar 14 09:04:19 PDT 2012


Revision: 90783
          https://trac.macports.org/changeset/90783
Author:   pixilla at macports.org
Date:     2012-03-14 09:04:16 -0700 (Wed, 14 Mar 2012)
Log Message:
-----------
Add channel support.

Modified Paths:
--------------
    users/pixilla/tools/pear2port.sh

Modified: users/pixilla/tools/pear2port.sh
===================================================================
--- users/pixilla/tools/pear2port.sh	2012-03-14 15:20:09 UTC (rev 90782)
+++ users/pixilla/tools/pear2port.sh	2012-03-14 16:04:16 UTC (rev 90783)
@@ -8,28 +8,45 @@
     echo "Error: No package name given!"
     echo "Try something like:"
     echo "  \$ VERBOSE=yes MAINTAINERS=\"$(users) openmaintainer\" ${0} Auth"
-    echo "Or, for a version other than the most recent version"
-    echo "  \$ VERBOSE=yes MAINTAINERS=\"$(users) openmaintainer\" ${0} Auth 0.3.1"
+    echo "To specify a channel (default pear.php.net)"
+    echo "  \$ VERBOSE=yes MAINTAINERS=\"$(users) openmaintainer\" ${0} Auth pear.php.net"
+    echo "To specify a channel (required) and a version (defaults to current version)"
+    echo "  \$ VERBOSE=yes MAINTAINERS=\"$(users) openmaintainer\" ${0} Auth pear.php.net 0.3.1"
     exit 
 fi
 [ "x${VERBOSE}" == "xyes" ] && echo "Package: ${package}"
 
 if [ "x${2}" == "x" ]
 then
+channel=pear.php.net
+else
+channel=${2}
+fi
+[ "x${VERBOSE}" == "xyes" ] && echo "Channel: ${channel}"
+
+if [ "x${3}" == "x" ]
+then
+/opt/local/lib/php/pear/bin/pear \
+    -C /Users/brad/misc/sandbox/pear/makepearports/pear.conf \
+    -c /Users/brad/misc/sandbox/pear/makepearports/pear.conf \
+    config-set default_channel ${channel}
 version=\
-$(curl -s http://pear.php.net/package/${package}/download | \
-grep -o -P "http://download.pear.php.net/package/${package}-((?!${EXTRACT_SUFFIX}).*)${EXTRACT_SUFFIX}" | \
-sed -e "s/.*\///g" -e "s/${package}-//g" -e "s/${EXTRACT_SUFFIX}//g")
+$(/opt/local/lib/php/pear/bin/pear \
+    -C /Users/brad/misc/sandbox/pear/makepearports/pear.conf \
+    -c /Users/brad/misc/sandbox/pear/makepearports/pear.conf \
+    remote-info ${package} | \
+grep "Latest" | \
+awk '{print $2}')
 else
-version=${2}
+version=${3}
 fi
 [ "x${VERBOSE}" == "xyes" ] && echo "Version: ${version}"
 
 if [ "x${version}" == "x" ]
 then
-    echo "Error: Could not determine version!"
+    echo "Error: Could not determine version for ${package}!"
     echo "Version: ${version}"
-    exit 
+    exit
 fi
 distname=${package}-${version}
 
@@ -43,7 +60,7 @@
 PortSystem          1.0
 PortGroup           php5pear 1.0
 
-php5pear.setup      ${package} ${version}
+php5pear.setup      ${package} ${version} ${channel}
 categories-append   net www
 platforms           darwin
 maintainers         ${MAINTAINERS}
@@ -55,25 +72,25 @@
 
 sleep 1
 [ "x${VERBOSE}" == "xyes" ] && echo "port -o fetch..."
-sudo port -o fetch > /dev/null 2>&1
+[ "x${VERBOSE}" == "xyes" ] && sudo port -o fetch || sudo port -o fetch > /dev/null 2>&1
 distfile=$(port -o distfiles | grep "\[${distname}${EXTRACT_SUFFIX}\]" | awk '{print $2}')
-distfile_sha1=$(openssl sha1 ${distfile} | awk '{print $2}')
 distfile_rmd160=$(openssl rmd160 ${distfile} | awk '{print $2}')
+distfile_sha256=$(openssl sha256 ${distfile} | awk '{print $2}')
 cat << EOF >> Portfile
-checksums           sha1    ${distfile_sha1} \\
-                    rmd160  ${distfile_rmd160}
+checksums           rmd160  ${distfile_rmd160} \\
+                    sha256  ${distfile_sha256}
 EOF
 
 [ "x${VERBOSE}" == "xyes" ] && echo "removing sources..."
 
 [ "x${VERBOSE}" == "xyes" ] && echo "port -o extract..."
-sudo port -o extract > /dev/null 2>&1
+[ "x${VERBOSE}" == "xyes" ] && sudo port -o extract || sudo port -o extract > /dev/null 2>&1
 deps=''
 count=0
 IFS=$'\n'
 [ "x${VERBOSE}" == "xyes" ] && echo "port -o build to check for deps..."
 sleep 1
-for dep in $(sudo port -o -v build | grep -P "${package} requires package")
+for dep in $(sudo port -o -v build | grep -P "${package} requires package" | grep -v -E '"pear/PEAR"|"pear/Archive_Tar"|"pear/Structures_Graph"|"pear/Console_Getopt"|"pear/XML_Util"')
 do
     depname=$(echo $dep | awk '{print $5}' | sed -e "s/pecl\//php5\//g" -e "s/\"//g" -e "s/\//-/g")
     count=$((count+1))
@@ -92,7 +109,7 @@
 fi
 unset IFS
 [ "x${VERBOSE}" == "xyes" ] && echo "port -o clean..."
-sudo port -o clean > /dev/null 2>&1
-[ "x${VERBOSE}" == "xyes" ] &&echo "final Portfile..."
+[ "x${VERBOSE}" == "xyes" ] && sudo port -o clean || sudo port -o clean > /dev/null 2>&1
+[ "x${VERBOSE}" == "xyes" ] && echo "final Portfile..."
 cat Portfile
 cd ..
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120314/9ae0af77/attachment.html>


More information about the macports-changes mailing list