[105575] trunk/base

blair at macports.org blair at macports.org
Thu Apr 25 11:54:06 PDT 2013


Revision: 105575
          https://trac.macports.org/changeset/105575
Author:   blair at macports.org
Date:     2013-04-25 11:54:06 -0700 (Thu, 25 Apr 2013)
Log Message:
-----------
portpkg: support deleting files and directories before building the pkg.

This feature is useful when one wants to shrink the size of the pkg's
and mpkg's for deployment to Macs that will not be used for
development.  One large mpkg was observed to shrink from 504 MB to 271
MB, where we are disting the mpkg using Munki to hundreds of Macs.

Modified Paths:
--------------
    trunk/base/doc/macports.conf.in
    trunk/base/src/macports1.0/macports.tcl
    trunk/base/src/package1.0/portpkg.tcl

Modified: trunk/base/doc/macports.conf.in
===================================================================
--- trunk/base/doc/macports.conf.in	2013-04-25 17:49:57 UTC (rev 105574)
+++ trunk/base/doc/macports.conf.in	2013-04-25 18:54:06 UTC (rev 105575)
@@ -166,3 +166,24 @@
 # linking and can rebuild affected ports. Possible values are
 #'rebuild' (default) or 'report'.
 #revupgrade_mode	rebuild
+
+# When creating a pkg, specify the files and/or directories in
+# ${prefix} to delete after the unarchive stage and before the
+# pkg is created.  If not set, nothing is deleted.
+#
+# Because mpkg's are built from pkg's, any mpkg's will also have
+# the specified files and/or directories omitted.
+#
+# For example
+#
+#   pkg_post_unarchive_deletions include share/doc share/man
+#
+# will delete ${prefix}/include, ${prefix}/share/doc and
+# ${prefix}/share/man.
+#
+# This feature is useful when one wants to shrink the size of the
+# pkg's and mpkg's for deployment to Macs that will not be used
+# for development.  One large mpkg was observed to shrink from
+# 504 MB to 271 MB.
+#
+#pkg_post_unarchive_deletions include share/doc share/man

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2013-04-25 17:49:57 UTC (rev 105574)
+++ trunk/base/src/macports1.0/macports.tcl	2013-04-25 18:54:06 UTC (rev 105575)
@@ -51,7 +51,7 @@
         master_site_local patch_site_local archive_site_local buildfromsource \
         revupgrade_autorun revupgrade_mode revupgrade_check_id_loadcmds \
         host_blacklist preferred_hosts\
-        packagemaker_path default_compilers"
+        packagemaker_path default_compilers pkg_post_unarchive_deletions"
     variable user_options ""
     variable portinterp_options "\
         portdbpath porturl portpath portbuildpath auto_path prefix prefix_frozen portsharepath \
@@ -61,7 +61,8 @@
         configureccache ccache_dir ccache_size configuredistcc configurepipe buildnicevalue buildmakejobs \
         applications_dir current_phase frameworks_dir developer_dir universal_archs build_arch \
         os_arch os_endian os_version os_major os_platform macosx_version macosx_deployment_target \
-        packagemaker_path default_compilers $user_options"
+        packagemaker_path default_compilers \
+        pkg_post_unarchive_deletions $user_options"
 
     # deferred options are only computed when needed.
     # they are not exported to the trace thread.

Modified: trunk/base/src/package1.0/portpkg.tcl
===================================================================
--- trunk/base/src/package1.0/portpkg.tcl	2013-04-25 17:49:57 UTC (rev 105574)
+++ trunk/base/src/package1.0/portpkg.tcl	2013-04-25 18:54:06 UTC (rev 105575)
@@ -111,7 +111,8 @@
 proc portpkg::package_pkg {portname portepoch portversion portrevision} {
     global UI_PREFIX portdbpath destpath workpath prefix description \
     package.flat package.destpath portpath os.version os.major \
-    package.resources package.scripts portpkg::packagemaker portpkg::language
+    package.resources package.scripts portpkg::packagemaker \
+    pkg_post_unarchive_deletions portpkg::language
 
     set portepoch_namestr ""
     if {${portepoch} != "0"} {
@@ -137,6 +138,15 @@
         }
     }
 
+    if {[info exists pkg_post_unarchive_deletions]} {
+        foreach rmfile ${pkg_post_unarchive_deletions} {
+            set full_rmfile "${destpath}${prefix}/${rmfile}"
+            if {[file exists "${full_rmfile}"]} {
+                delete "${full_rmfile}"
+            }
+        }
+    }
+
     if ([file exists "$packagemaker"]) {
 
         ui_debug "Calling $packagemaker for $portname pkg"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130425/8bec601d/attachment.html>


More information about the macports-changes mailing list