[89031] users/ryandesign/scripts/portcheckup

ryandesign at macports.org ryandesign at macports.org
Wed Jan 18 04:02:12 PST 2012


Revision: 89031
          http://trac.macports.org/changeset/89031
Author:   ryandesign at macports.org
Date:     2012-01-18 04:02:11 -0800 (Wed, 18 Jan 2012)
Log Message:
-----------
portcheckup: work correctly for ports using *.setup procedures that don't have the version number in the second argument; improve description

Modified Paths:
--------------
    users/ryandesign/scripts/portcheckup

Modified: users/ryandesign/scripts/portcheckup
===================================================================
--- users/ryandesign/scripts/portcheckup	2012-01-18 11:58:50 UTC (rev 89030)
+++ users/ryandesign/scripts/portcheckup	2012-01-18 12:02:11 UTC (rev 89031)
@@ -2,8 +2,8 @@
 <?php
 
 // Takes the port's CHECKsums and version and UPdates them to those of the
-// specified version. Does not work for ports that use the github portgroup,
-// or for ports that use the php5 portgroup and install multiple modules.
+// specified version. Uses the same checksum types the port used before.
+// Removes any revision lines. Preserves the port's existing whitespace.
 
 define('PROG', basename($_SERVER['argv'][0]));
 
@@ -38,10 +38,12 @@
 $status = rtrim(shell_exec('svn st ' . escapeshellarg($portfile)));
 //empty($status) || error(sprintf(_('port %s has modifications'), $port));
 
+$old_version = rtrim(shell_exec('port info --version --line ' . escapeshellarg($port)));
+
 $portfile_text = file_get_contents($portfile);
 
-$portfile_text = preg_replace('/(?m)^(version\s+|[a-z0-9]+\.setup\s+\S+\s+)\S+(.*)$/', '${1}' . $version . '${2}', $portfile_text);
-$portfile_text = preg_replace('/(?m)^revision\s.+$\n/', '', $portfile_text);
+$portfile_text = preg_replace('/(?m)^(\s*(?:version\s+|[a-z0-9]+\.setup\s+).*)' . preg_quote($old_version, '/') . '(.*)$/', '${1}' . $version . '${2}', $portfile_text);
+$portfile_text = preg_replace('/(?m)^\s*revision\s+\d+\s*$\n/', '', $portfile_text);
 file_put_contents($portfile, $portfile_text);
 
 // Prevent "Portfile is from the future - check date and time of your system".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120118/80d4bdd3/attachment.html>


More information about the macports-changes mailing list