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

jmr at macports.org jmr at macports.org
Thu Mar 29 09:22:42 PDT 2012


Revision: 91317
          https://trac.macports.org/changeset/91317
Author:   jmr at macports.org
Date:     2012-03-29 09:22:41 -0700 (Thu, 29 Mar 2012)
Log Message:
-----------
rearrange pkg code to allow ports to set up package resources in pre-pkg (will be required for flat packages)

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

Modified: trunk/base/src/package1.0/portpkg.tcl
===================================================================
--- trunk/base/src/package1.0/portpkg.tcl	2012-03-29 15:48:23 UTC (rev 91316)
+++ trunk/base/src/package1.0/portpkg.tcl	2012-03-29 16:22:41 UTC (rev 91317)
@@ -38,6 +38,7 @@
 target_runtype ${org.macports.pkg} always
 target_provides ${org.macports.pkg} pkg
 target_requires ${org.macports.pkg} archivefetch unarchive destroot
+target_prerun ${org.macports.pkg} portpkg::pkg_start
 
 namespace eval portpkg {
 }
@@ -48,30 +49,18 @@
 # Set defaults
 default package.destpath {${workpath}}
 default package.flat     false
+#default package.flat     {[expr [vercmp $macosx_deployment_target 10.5] >= 0]}
 
 set_ui_prefix
 
-proc portpkg::pkg_main {args} {
-    global subport version revision package.type package.destpath package.flat UI_PREFIX
+proc portpkg::pkg_start {args} {
+    global packagemaker_path portpkg::packagemaker portpkg::resourcepath \
+           portpkg::language portpkg::pkgpath xcodeversion portpath porturl \
+           package.destpath subport version workpath description \
+           long_description homepage
 
-    ui_msg "$UI_PREFIX [format [msgcat::mc "Creating pkg for %s-%s"] ${subport} ${version}]"
-
-    if {[getuid] == 0 && [geteuid] != 0} {
-        elevateToRoot "pkg"
-    }
-
-    return [package_pkg $subport $version $revision]
-}
-
-proc portpkg::package_pkg {portname portversion portrevision} {
-    global UI_PREFIX portdbpath destpath workpath prefix description \
-    package.destpath package.flat long_description homepage portpath porturl \
-    os.version os.major xcodeversion packagemaker_path
-
-    set pkgpath ${package.destpath}/${portname}-${portversion}.pkg
-
+    set pkgpath "${package.destpath}/${subport}-${version}.pkg"
     if {[file readable $pkgpath] && ([file mtime ${pkgpath}] >= [file mtime ${portpath}/Portfile])} {
-        ui_msg "$UI_PREFIX [format [msgcat::mc "Package for %s-%s is up-to-date"] ${portname} ${portversion}]"
         return 0
     }
 
@@ -95,7 +84,7 @@
     set language "English"
     file mkdir "${resourcepath}/${language}.lproj"
     file attributes "${resourcepath}/${language}.lproj" -permissions 0755
-	
+
     # long_description, description, or homepage may not exist
     foreach variable {long_description description homepage} {
         if {![info exists $variable]} {
@@ -104,9 +93,33 @@
             set pkg_$variable [set $variable]
         }
     }
-    write_welcome_html ${resourcepath}/${language}.lproj/Welcome.html $portname $portversion $pkg_long_description $pkg_description $pkg_homepage
+    write_welcome_html ${resourcepath}/${language}.lproj/Welcome.html $subport $version $pkg_long_description $pkg_description $pkg_homepage
     file copy -force -- [getportresourcepath $porturl "port1.0/package/background.tiff"] ${resourcepath}/${language}.lproj/background.tiff
+}
 
+proc portpkg::pkg_main {args} {
+    global subport version revision UI_PREFIX
+
+    ui_msg "$UI_PREFIX [format [msgcat::mc "Creating pkg for %s-%s"] ${subport} ${version}]"
+
+    if {[getuid] == 0 && [geteuid] != 0} {
+        elevateToRoot "pkg"
+    }
+
+    return [package_pkg $subport $version $revision]
+}
+
+proc portpkg::package_pkg {portname portversion portrevision} {
+    global UI_PREFIX portdbpath destpath workpath prefix description \
+    package.flat portpath os.version os.major \
+    portpkg::packagemaker portpkg::language portpkg::resourcepath \
+    portpkg::pkgpath
+
+    if {[file readable $pkgpath] && ([file mtime ${pkgpath}] >= [file mtime ${portpath}/Portfile])} {
+        ui_msg "$UI_PREFIX [format [msgcat::mc "Package for %s-%s is up-to-date"] ${portname} ${portversion}]"
+        return 0
+    }
+
     foreach dir {etc var tmp} {
         if ([file exists "${destpath}/$dir"]) {
             # certain toplevel directories really are symlinks. leaving them as directories make pax lose the symlinks. that's bad.
@@ -122,7 +135,7 @@
         if {${os.major} >= 9} {
             if {${package.flat}} {
                 set pkgtarget "10.5"
-                set pkgresources ""
+                set pkgresources " --resources ${resourcepath} --scripts ${resourcepath} --title \"$portname-$portversion\""
                 set infofile "${workpath}/PackageInfo"
                 write_package_info ${workpath}/PackageInfo $portname $portversion $portrevision
             } else {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120329/76d65072/attachment.html>


More information about the macports-changes mailing list