[101131] trunk/base/src/package1.0/portpkg.tcl

blair at macports.org blair at macports.org
Fri Jan 4 14:36:01 PST 2013


Revision: 101131
          https://trac.macports.org/changeset/101131
Author:   blair at macports.org
Date:     2013-01-04 14:36:01 -0800 (Fri, 04 Jan 2013)
Log Message:
-----------
portpkg: on OS X >= 10.6 using PackageMaker, include epoch in pkg version number.

Modified Paths:
--------------
    trunk/base/src/package1.0/portpkg.tcl

Modified: trunk/base/src/package1.0/portpkg.tcl
===================================================================
--- trunk/base/src/package1.0/portpkg.tcl	2013-01-04 22:35:59 UTC (rev 101130)
+++ trunk/base/src/package1.0/portpkg.tcl	2013-01-04 22:36:01 UTC (rev 101131)
@@ -145,7 +145,8 @@
             }
             set cmdline "PMResourceLocale=${language} $packagemaker --root ${destpath} --out ${pkgpath} ${pkgresources} --info $infofile --target $pkgtarget --domain system --id org.macports.$portname"
             if {${os.major} >= 10} {
-                append cmdline " --version ${portversion}.${portrevision}"
+                set v [mp_version_to_apple_version $portepoch $portversion $portrevision]
+                append cmdline " --version $v"
                 append cmdline " --no-relocate"
             } else {
                 # 10.5 Leopard does not use current language, manually specify
@@ -389,3 +390,29 @@
 "
     close $dfd
 }
+
+# To create Apple packages, Apple version numbers consist of three
+# period separated integers [1][2].  Munki supports any number of
+# integers [3], so incorporate the port epoch, version and revision
+# number in the package version number so that Munki can do upgrades.
+# Munki also requires that version numbers only consist of integers
+# and periods.  So replace all non-periods and non-digits are found in
+# the version number with periods so that any digits following the
+# non-digits can properly version the package.
+# [1] https://developer.apple.com/library/mac/#documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-SW1
+# [2] https://developer.apple.com/library/mac/#documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-SW1
+# [3] https://groups.google.com/d/msg/munki-dev/-DCERUz6rrM/zMbY6iimIGwJ
+proc portpkg::mp_version_to_apple_version {portepoch portversion portrevision} {
+    set v "${portepoch}.${portversion}.${portrevision}"
+
+    # Replace all non-period and non-digit characters with a period.
+    regsub -all -- {[^.0-9]+} $v . v
+
+    # Replace two or more consecutive periods with a single period.
+    regsub -all -- {[.]+} $v . v
+
+    # Trim trailing periods.
+    regsub -- {[.]+$} $v {} v
+
+    return $v
+}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130104/585b35e1/attachment.html>


More information about the macports-changes mailing list