[118559] trunk/base
cal at macports.org
cal at macports.org
Fri Apr 4 15:02:44 PDT 2014
Revision: 118559
https://trac.macports.org/changeset/118559
Author: cal at macports.org
Date: 2014-04-04 15:02:44 -0700 (Fri, 04 Apr 2014)
Log Message:
-----------
base: remove macports_fastload.tcl, use correct Tcl, install port-tclsh for contrib software, specify LD_LIBRARY_PATH for intree Tcl for Linux, see #43208
macports_fastload.tcl contained two blocks of code: The first one was dead
because it was only used with Tcl < 8.5, the second one sourced the pkgIndex.tcl
files of all MacPorts Tcl packages. That was previously necessary to ensure
`package require macports 1.0` would load the code from the correct prefix and
might also have improved performance because $auto_path of /usr/bin/tclsh
contains 10 entries. With our local copy of Tcl, the number of files read is
around 100 at most, so I think that's a non-issue from a performance POV. We
don't need the preloading to select the correct MacPorts prefix, because the
selection of the Tcl interpreter now does that for us correctly.
For this to work correctly, every Tcl file must now be executed with the correct
Tcl interpreter -- that replaces sourcing macports_fastload.tcl from the correct
prefix. Some of our install scripts still used /usr/bin/env tclsh.
This change also solves a potential build problem on Linux in src/pkg_mkindex.sh
because the Tcl library matching the in-tree Tcl interpreter might not be found
without LD_LIBRARY_PATH.
Furthermore, this adds a $prefix/bin/port-tclsh wrapper script that should be
used by contrib tools that need to use the MacPorts API. The shebang line should
be
#!/usr/bin/env port-tclsh
which will cause the contrib script to automatically work on the port
installation currently first in $PATH.
Modified Paths:
--------------
trunk/base/configure.ac
trunk/base/src/Makefile.in
trunk/base/src/macports1.0/Makefile.in
trunk/base/src/macports1.0/tests/macports.test
trunk/base/src/macports1.0/tests/macports_dlist.test
trunk/base/src/macports1.0/tests/macports_util.test
trunk/base/src/package1.0/tests/portarchivefetch.test
trunk/base/src/package1.0/tests/portdmg.test
trunk/base/src/package1.0/tests/portdpkg.test
trunk/base/src/package1.0/tests/portmdmg.test
trunk/base/src/package1.0/tests/portmpkg.test
trunk/base/src/package1.0/tests/portpkg.test
trunk/base/src/pkg_mkindex.sh.in
trunk/base/src/port/Makefile.in
trunk/base/src/port/port.tcl
trunk/base/src/port/portindex.tcl
trunk/base/src/port/portmirror.tcl
trunk/base/src/port1.0/tests/portactivate.test
trunk/base/src/port1.0/tests/portchecksum.test
trunk/base/src/port1.0/tests/portclean.test
trunk/base/src/port1.0/tests/portdeactivate.test
trunk/base/src/port1.0/tests/portdepends.test
trunk/base/src/port1.0/tests/portdistcheck.test
trunk/base/src/port1.0/tests/portinstall.test
trunk/base/src/port1.0/tests/portload.test
trunk/base/src/port1.0/tests/portmain.test
trunk/base/src/port1.0/tests/portpatch.test
trunk/base/src/port1.0/tests/porttest.test
trunk/base/src/port1.0/tests/portuninstall.test
trunk/base/src/port1.0/tests/portutil.test
Added Paths:
-----------
trunk/base/src/dedup_portfiles.tcl.in
trunk/base/src/images_to_archives.tcl.in
trunk/base/src/port/port-tclsh.in
trunk/base/src/upgrade_sources_conf_default.tcl.in
Removed Paths:
-------------
trunk/base/src/dedup_portfiles.tcl
trunk/base/src/images_to_archives.tcl
trunk/base/src/macports1.0/macports_fastload.tcl.in
trunk/base/src/upgrade_sources_conf_default.tcl
Property Changed:
----------------
trunk/base/src/
trunk/base/src/port/
Modified: trunk/base/configure.ac
===================================================================
--- trunk/base/configure.ac 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/configure.ac 2014-04-04 22:02:44 UTC (rev 118559)
@@ -417,7 +417,6 @@
src/machista1.0/Makefile
src/macports1.0/Makefile
src/macports1.0/macports_autoconf.tcl
- src/macports1.0/macports_fastload.tcl
src/macports1.0/macports_test_autoconf.tcl
src/package1.0/Makefile
src/package1.0/package_test_autoconf.tcl
@@ -433,6 +432,9 @@
vendor/Makefile
])
+AC_CONFIG_FILES([src/dedup_portfiles.tcl], [chmod +x src/dedup_portfiles.tcl])
+AC_CONFIG_FILES([src/images_to_archives.tcl], [chmod +x src/images_to_archives.tcl])
AC_CONFIG_FILES([src/pkg_mkindex.sh], [chmod +x src/pkg_mkindex.sh])
+AC_CONFIG_FILES([src/upgrade_sources_conf_default.tcl], [chmod +x src/upgrade_sources_conf_default.tcl])
AC_OUTPUT
Property changes on: trunk/base/src
___________________________________________________________________
Modified: svn:ignore
- config.h
Makefile
pkg_mkindex.sh
+ config.h
Makefile
pkg_mkindex.sh
dedup_portfiles.tcl
images_to_archives.tcl
upgrade_sources_conf_default.tcl
Modified: trunk/base/src/Makefile.in
===================================================================
--- trunk/base/src/Makefile.in 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/Makefile.in 2014-04-04 22:02:44 UTC (rev 118559)
@@ -20,6 +20,7 @@
rm -f config.h
rm -f Makefile
rm -f pkg_mkindex.sh
+ rm -f dedup_portfiles.tcl images_to_archives.tcl
test::
Deleted: trunk/base/src/dedup_portfiles.tcl
===================================================================
--- trunk/base/src/dedup_portfiles.tcl 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/dedup_portfiles.tcl 2014-04-04 22:02:44 UTC (rev 118559)
@@ -1,47 +0,0 @@
-#!/usr/bin/env tclsh
-# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
-# $Id$
-
-# move portfiles from sqlite db to filesystem, while deduplicating
-# Takes one argument, which should be TCL_PACKAGE_DIR.
-
-source [file join [lindex $argv 0] macports1.0 macports_fastload.tcl]
-package require macports 1.0
-package require registry2 2.0
-package require Pextlib 1.0
-
-umask 022
-
-array set ui_options {ports_verbose yes}
-
-mportinit ui_options
-
-if {[registry::metadata get portfiles_update_needed] == 1} {
- set portfiles_dir [file join ${macports::registry.path} registry portfiles]
-
- registry::write {
- set installed_ports [registry::entry imaged]
- foreach portref $installed_ports {
- set portfile_contents [$portref portfile]
- if {$portfile_contents ne "" && $portfile_contents ne "0"} {
- set portfile_partial_dir [file join $portfiles_dir [$portref name]-[$portref version]_[$portref revision]]
- file mkdir $portfile_partial_dir
- set portfile_temp_path ${portfile_partial_dir}/Portfile
- set fd [open $portfile_temp_path w]
- puts $fd $portfile_contents
- close $fd
-
- set hash_size [sha256 file $portfile_temp_path]-[file size $portfile_temp_path]
- set portfile_dir [file join $portfile_partial_dir $hash_size]
- file mkdir $portfile_dir
- file rename -force $portfile_temp_path $portfile_dir
- file mtime ${portfile_dir}/Portfile [$portref date]
-
- $portref portfile $hash_size
- }
- }
- registry::metadata del portfiles_update_needed
- }
-}
-
-exit 0
Copied: trunk/base/src/dedup_portfiles.tcl.in (from rev 118558, trunk/base/src/dedup_portfiles.tcl)
===================================================================
--- trunk/base/src/dedup_portfiles.tcl.in (rev 0)
+++ trunk/base/src/dedup_portfiles.tcl.in 2014-04-04 22:02:44 UTC (rev 118559)
@@ -0,0 +1,46 @@
+#!@TCLSH@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# $Id$
+
+# move portfiles from sqlite db to filesystem, while deduplicating
+# Takes one argument, which should be TCL_PACKAGE_DIR.
+
+package require macports 1.0
+package require registry2 2.0
+package require Pextlib 1.0
+
+umask 022
+
+array set ui_options {ports_verbose yes}
+
+mportinit ui_options
+
+if {[registry::metadata get portfiles_update_needed] == 1} {
+ set portfiles_dir [file join ${macports::registry.path} registry portfiles]
+
+ registry::write {
+ set installed_ports [registry::entry imaged]
+ foreach portref $installed_ports {
+ set portfile_contents [$portref portfile]
+ if {$portfile_contents ne "" && $portfile_contents ne "0"} {
+ set portfile_partial_dir [file join $portfiles_dir [$portref name]-[$portref version]_[$portref revision]]
+ file mkdir $portfile_partial_dir
+ set portfile_temp_path ${portfile_partial_dir}/Portfile
+ set fd [open $portfile_temp_path w]
+ puts $fd $portfile_contents
+ close $fd
+
+ set hash_size [sha256 file $portfile_temp_path]-[file size $portfile_temp_path]
+ set portfile_dir [file join $portfile_partial_dir $hash_size]
+ file mkdir $portfile_dir
+ file rename -force $portfile_temp_path $portfile_dir
+ file mtime ${portfile_dir}/Portfile [$portref date]
+
+ $portref portfile $hash_size
+ }
+ }
+ registry::metadata del portfiles_update_needed
+ }
+}
+
+exit 0
Deleted: trunk/base/src/images_to_archives.tcl
===================================================================
--- trunk/base/src/images_to_archives.tcl 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/images_to_archives.tcl 2014-04-04 22:02:44 UTC (rev 118559)
@@ -1,160 +0,0 @@
-#!/usr/bin/env tclsh
-# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
-# $Id$
-
-# convert existing port image directories into compressed archive versions
-# Takes one argument, which should be TCL_PACKAGE_DIR.
-
-source [file join [lindex $argv 0] macports1.0 macports_fastload.tcl]
-package require macports 1.0
-package require registry 1.0
-package require registry2 2.0
-package require Pextlib 1.0
-
-umask 022
-
-array set ui_options {ports_verbose yes}
-
-mportinit ui_options
-
-# always converting to tbz2 should be fine as both these programs are
-# needed elsewhere and assumed to be available
-set tarcmd [macports::findBinary tar ${macports::autoconf::tar_path}]
-set bzip2cmd [macports::findBinary bzip2 ${macports::autoconf::bzip2_path}]
-
-if {[catch {set ilist [registry::installed]}]} {
- # no ports installed
- puts "No ports installed to convert."
- exit 0
-}
-
-puts "This could take a while..."
-
-# list of ports we successfully create an archive of, to be used to update
-# the registry only after we know all creation attempts were successful.
-set archived_list {}
-set installed_len [llength $ilist]
-set counter 0
-
-foreach installed $ilist {
- incr counter
- set iname [lindex $installed 0]
- set iversion [lindex $installed 1]
- set irevision [lindex $installed 2]
- set ivariants [lindex $installed 3]
- set iepoch [lindex $installed 5]
- set iref [registry::open_entry $iname $iversion $irevision $ivariants $iepoch]
- set installtype [registry::property_retrieve $iref installtype]
- if {$installtype eq "image"} {
- set location [registry::property_retrieve $iref location]
- if {$location == 0} {
- set location [registry::property_retrieve $iref imagedir]
- }
- } else {
- set location ""
- }
-
- if {$location eq "" || ![file isfile $location]} {
- # no image archive present, so make one
- set archs [registry::property_retrieve $iref archs]
- if {$archs eq "" || $archs == 0} {
- set archs ${macports::os_arch}
- }
- # look for any existing archive in the old location
- set oldarchiverootname "${iname}-${iversion}_${irevision}${ivariants}.[join $archs -]"
- set archivetype tbz2
- set oldarchivedir [file join ${macports::portdbpath} packages ${macports::os_platform}_${macports::os_major}]
- set olderarchivedir [file join ${macports::portdbpath} packages ${macports::os_platform}]
- if {[llength $archs] == 1} {
- set oldarchivedir [file join $oldarchivedir $archs $iname]
- set olderarchivedir [file join $olderarchivedir $archs]
- } else {
- set oldarchivedir [file join $oldarchivedir universal $iname]
- set olderarchivedir [file join $olderarchivedir universal]
- }
- set found 0
- foreach adir [list $oldarchivedir $olderarchivedir] {
- foreach type {tbz2 tbz tgz tar txz tlz xar zip cpgz cpio} {
- set oldarchivefullpath "[file join $adir $oldarchiverootname].${type}"
- if {[file isfile $oldarchivefullpath]} {
- set found 1
- set archivetype $type
- break
- }
- }
- if {$found} {break}
- }
-
- # compute new name and location of archive
- set archivename "${iname}-${iversion}_${irevision}${ivariants}.${macports::os_platform}_${macports::os_major}.[join $archs -].${archivetype}"
- ui_msg "Processing ${counter} of ${installed_len}: ${archivename}"
- if {$installtype eq "image"} {
- set targetdir [file dirname $location]
- } else {
- set targetdir [file join ${macports::registry.path} software ${iname}]
- }
- if {$location eq "" || ![file isdirectory $location]} {
- set contents [$iref imagefiles]
- }
- file mkdir $targetdir
- set newlocation [file join $targetdir $archivename]
-
- if {$found} {
- file rename $oldarchivefullpath $newlocation
- } elseif {$installtype eq "image" && [file isdirectory $location]} {
- # create archive from image dir
- system -W $location "$tarcmd -cjf $newlocation * > ${targetdir}/error.log 2>&1"
- file delete -force ${targetdir}/error.log
- } else {
- # direct mode (or missing image dir), create archive from installed files
- # we tell tar to read filenames from a file so as not to run afoul of command line length limits
- set fd [open ${targetdir}/tarlist w]
- foreach entry $contents {
- puts $fd $entry
- }
- close $fd
- system "$tarcmd -cjf $newlocation -T ${targetdir}/tarlist > ${targetdir}/error.log 2>&1"
- file delete -force ${targetdir}/tarlist ${targetdir}/error.log
- }
-
- lappend archived_list [list $installtype $iref $location $newlocation]
- }
-}
-
-set archived_len [llength $archived_list]
-set counter 0
-
-registry::write {
- foreach archived $archived_list {
- incr counter
- ui_msg "Updating registry: ${counter} of ${archived_len}"
- set installtype [lindex $archived 0]
- set iref [lindex $archived 1]
- set newlocation [lindex $archived 3]
-
- if {$installtype eq "direct"} {
- # change receipt to image
- $iref installtype image
- $iref state imaged
- $iref activate [$iref imagefiles]
- $iref state installed
- }
-
- # set the new location in the registry and delete the old dir
- $iref location $newlocation
- }
-}
-
-set counter 0
-foreach archived $archived_list {
- incr counter
- set location [lindex $archived 2]
- ui_msg "Deleting ${counter} of ${archived_len}: ${location}"
- if {$location ne "" && [file isdirectory $location]} {
- if {[catch {file delete -force $location} result]} {
- ui_warn "Failed to delete ${location}: $result"
- }
- }
-}
-
-exit 0
Copied: trunk/base/src/images_to_archives.tcl.in (from rev 118296, trunk/base/src/images_to_archives.tcl)
===================================================================
--- trunk/base/src/images_to_archives.tcl.in (rev 0)
+++ trunk/base/src/images_to_archives.tcl.in 2014-04-04 22:02:44 UTC (rev 118559)
@@ -0,0 +1,159 @@
+#!@TCLSH@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
+# $Id$
+
+# convert existing port image directories into compressed archive versions
+# Takes one argument, which should be TCL_PACKAGE_DIR.
+
+package require macports 1.0
+package require registry 1.0
+package require registry2 2.0
+package require Pextlib 1.0
+
+umask 022
+
+array set ui_options {ports_verbose yes}
+
+mportinit ui_options
+
+# always converting to tbz2 should be fine as both these programs are
+# needed elsewhere and assumed to be available
+set tarcmd [macports::findBinary tar ${macports::autoconf::tar_path}]
+set bzip2cmd [macports::findBinary bzip2 ${macports::autoconf::bzip2_path}]
+
+if {[catch {set ilist [registry::installed]}]} {
+ # no ports installed
+ puts "No ports installed to convert."
+ exit 0
+}
+
+puts "This could take a while..."
+
+# list of ports we successfully create an archive of, to be used to update
+# the registry only after we know all creation attempts were successful.
+set archived_list {}
+set installed_len [llength $ilist]
+set counter 0
+
+foreach installed $ilist {
+ incr counter
+ set iname [lindex $installed 0]
+ set iversion [lindex $installed 1]
+ set irevision [lindex $installed 2]
+ set ivariants [lindex $installed 3]
+ set iepoch [lindex $installed 5]
+ set iref [registry::open_entry $iname $iversion $irevision $ivariants $iepoch]
+ set installtype [registry::property_retrieve $iref installtype]
+ if {$installtype eq "image"} {
+ set location [registry::property_retrieve $iref location]
+ if {$location == 0} {
+ set location [registry::property_retrieve $iref imagedir]
+ }
+ } else {
+ set location ""
+ }
+
+ if {$location eq "" || ![file isfile $location]} {
+ # no image archive present, so make one
+ set archs [registry::property_retrieve $iref archs]
+ if {$archs eq "" || $archs == 0} {
+ set archs ${macports::os_arch}
+ }
+ # look for any existing archive in the old location
+ set oldarchiverootname "${iname}-${iversion}_${irevision}${ivariants}.[join $archs -]"
+ set archivetype tbz2
+ set oldarchivedir [file join ${macports::portdbpath} packages ${macports::os_platform}_${macports::os_major}]
+ set olderarchivedir [file join ${macports::portdbpath} packages ${macports::os_platform}]
+ if {[llength $archs] == 1} {
+ set oldarchivedir [file join $oldarchivedir $archs $iname]
+ set olderarchivedir [file join $olderarchivedir $archs]
+ } else {
+ set oldarchivedir [file join $oldarchivedir universal $iname]
+ set olderarchivedir [file join $olderarchivedir universal]
+ }
+ set found 0
+ foreach adir [list $oldarchivedir $olderarchivedir] {
+ foreach type {tbz2 tbz tgz tar txz tlz xar zip cpgz cpio} {
+ set oldarchivefullpath "[file join $adir $oldarchiverootname].${type}"
+ if {[file isfile $oldarchivefullpath]} {
+ set found 1
+ set archivetype $type
+ break
+ }
+ }
+ if {$found} {break}
+ }
+
+ # compute new name and location of archive
+ set archivename "${iname}-${iversion}_${irevision}${ivariants}.${macports::os_platform}_${macports::os_major}.[join $archs -].${archivetype}"
+ ui_msg "Processing ${counter} of ${installed_len}: ${archivename}"
+ if {$installtype eq "image"} {
+ set targetdir [file dirname $location]
+ } else {
+ set targetdir [file join ${macports::registry.path} software ${iname}]
+ }
+ if {$location eq "" || ![file isdirectory $location]} {
+ set contents [$iref imagefiles]
+ }
+ file mkdir $targetdir
+ set newlocation [file join $targetdir $archivename]
+
+ if {$found} {
+ file rename $oldarchivefullpath $newlocation
+ } elseif {$installtype eq "image" && [file isdirectory $location]} {
+ # create archive from image dir
+ system -W $location "$tarcmd -cjf $newlocation * > ${targetdir}/error.log 2>&1"
+ file delete -force ${targetdir}/error.log
+ } else {
+ # direct mode (or missing image dir), create archive from installed files
+ # we tell tar to read filenames from a file so as not to run afoul of command line length limits
+ set fd [open ${targetdir}/tarlist w]
+ foreach entry $contents {
+ puts $fd $entry
+ }
+ close $fd
+ system "$tarcmd -cjf $newlocation -T ${targetdir}/tarlist > ${targetdir}/error.log 2>&1"
+ file delete -force ${targetdir}/tarlist ${targetdir}/error.log
+ }
+
+ lappend archived_list [list $installtype $iref $location $newlocation]
+ }
+}
+
+set archived_len [llength $archived_list]
+set counter 0
+
+registry::write {
+ foreach archived $archived_list {
+ incr counter
+ ui_msg "Updating registry: ${counter} of ${archived_len}"
+ set installtype [lindex $archived 0]
+ set iref [lindex $archived 1]
+ set newlocation [lindex $archived 3]
+
+ if {$installtype eq "direct"} {
+ # change receipt to image
+ $iref installtype image
+ $iref state imaged
+ $iref activate [$iref imagefiles]
+ $iref state installed
+ }
+
+ # set the new location in the registry and delete the old dir
+ $iref location $newlocation
+ }
+}
+
+set counter 0
+foreach archived $archived_list {
+ incr counter
+ set location [lindex $archived 2]
+ ui_msg "Deleting ${counter} of ${archived_len}: ${location}"
+ if {$location ne "" && [file isdirectory $location]} {
+ if {[catch {file delete -force $location} result]} {
+ ui_warn "Failed to delete ${location}: $result"
+ }
+ }
+}
+
+exit 0
Modified: trunk/base/src/macports1.0/Makefile.in
===================================================================
--- trunk/base/src/macports1.0/Makefile.in 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/macports1.0/Makefile.in 2014-04-04 22:02:44 UTC (rev 118559)
@@ -2,7 +2,7 @@
VPATH = @srcdir@
SRCS= macports.tcl macports_dlist.tcl macports_util.tcl \
- macports_autoconf.tcl macports_fastload.tcl
+ macports_autoconf.tcl
OBJS= macports.o get_systemconfiguration_proxies.o sysctl.o
SHLIB_NAME= MacPorts${SHLIB_SUFFIX}
@@ -22,7 +22,7 @@
$(TCLSH) $(srcdir)/tests/test.tcl -nocolor
distclean:: clean
- rm -f macports_autoconf.tcl macports_fastload.tcl macports_test_autoconf.tcl ${SHLIB_NAME}
+ rm -f macports_autoconf.tcl macports_test_autoconf.tcl ${SHLIB_NAME}
rm -f Makefile
install:: all
Deleted: trunk/base/src/macports1.0/macports_fastload.tcl.in
===================================================================
--- trunk/base/src/macports1.0/macports_fastload.tcl.in 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/macports1.0/macports_fastload.tcl.in 2014-04-04 22:02:44 UTC (rev 118559)
@@ -1,83 +0,0 @@
-# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
-# macports_fastload.tcl.in
-# $Id$
-#
-# Copyright (c) 2005-2007, 2009-2010 The MacPorts Project
-# Copyright (c) 2004-2005 Paul Guyot, The MacPorts Project.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. Neither the name of The MacPorts Project nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-# This script is here to fast load all the MacPorts related packages.
-# This avoids the very expensive globbing of Tcl' package mechanism.
-# Please note that this is not required and base/ should work even if some
-# packages are moved as long as their new location is in Tcl's package paths.
-# However, this file also defines a workaround to avoid conflicts between a /
-# installation of MacPorts and a user installation of MacPorts (on the same box).
-# (this workaround isn't required on 10.4.2).
-#
-# The package command that's replaced in this code works somewhat differently
-# than the original version. In particular, users with multiple copies of a
-# package such as portuninstall (due to obsolete files being left from previous
-# installations) may experience problems due to different package loading
-# behavior.
-#
-if { [regexp {\d+\.\d+\.\d+} [info patchlevel]] &&
- ([package vcompare [info patchlevel] 8.4.7] < 0) } {
- global allpackages
- if {![info exists allpackages]} {
- # Only patch once.
- array set allpackages {}
- rename package package_native
- proc package {args} {
- global allpackages
- if {([lindex $args 0] == "ifneeded") && ([llength $args] == 4)} {
- set package_name [lindex $args 1]
- set package_version [lindex $args 2]
- set package_key ${package_name}::${package_version}
- if {![info exists allpackages($package_key)]} {
- set allpackages($package_key) 1
- set result [eval package_native $args]
- } else {
- set result ""
- }
- } else {
- set result [eval package_native $args]
- }
- return $result
- }
- }
-}
-
-set sharetcldir [file normalize [file join [file dirname [info script]] ..]]
-if {[file exists $sharetcldir]} {
- foreach dir [glob -directory $sharetcldir *] {
- set pkgindex [file join $dir pkgIndex.tcl]
- if [file exists $pkgindex] {
- source $pkgindex
- }
- }
-}
Modified: trunk/base/src/macports1.0/tests/macports.test
===================================================================
--- trunk/base/src/macports1.0/tests/macports.test 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/macports1.0/tests/macports.test 2014-04-04 22:02:44 UTC (rev 118559)
@@ -7,7 +7,6 @@
set pwd [file dirname [file normalize $argv0]]
source ../macports_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
package require macports 1.0
# clean leftovers from interrupted tests
Modified: trunk/base/src/macports1.0/tests/macports_dlist.test
===================================================================
--- trunk/base/src/macports1.0/tests/macports_dlist.test 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/macports1.0/tests/macports_dlist.test 2014-04-04 22:02:44 UTC (rev 118559)
@@ -4,7 +4,6 @@
namespace import tcltest::*
source ../macports_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
package require macports 1.0
# Debug options
Modified: trunk/base/src/macports1.0/tests/macports_util.test
===================================================================
--- trunk/base/src/macports1.0/tests/macports_util.test 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/macports1.0/tests/macports_util.test 2014-04-04 22:02:44 UTC (rev 118559)
@@ -4,7 +4,6 @@
namespace import tcltest::*
source ../macports_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
package require macports 1.0
Modified: trunk/base/src/package1.0/tests/portarchivefetch.test
===================================================================
--- trunk/base/src/package1.0/tests/portarchivefetch.test 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/package1.0/tests/portarchivefetch.test 2014-04-04 22:02:44 UTC (rev 118559)
@@ -6,7 +6,6 @@
set pwd [file dirname [file normalize $argv0]]
source ../package_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
package require macports 1.0
array set ui_options {}
Modified: trunk/base/src/package1.0/tests/portdmg.test
===================================================================
--- trunk/base/src/package1.0/tests/portdmg.test 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/package1.0/tests/portdmg.test 2014-04-04 22:02:44 UTC (rev 118559)
@@ -6,7 +6,6 @@
set pwd [file dirname [file normalize $argv0]]
source ../package_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
package require macports 1.0
array set ui_options {}
Modified: trunk/base/src/package1.0/tests/portdpkg.test
===================================================================
--- trunk/base/src/package1.0/tests/portdpkg.test 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/package1.0/tests/portdpkg.test 2014-04-04 22:02:44 UTC (rev 118559)
@@ -6,7 +6,6 @@
set pwd [file dirname [file normalize $argv0]]
source ../package_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
package require macports 1.0
array set ui_options {}
Modified: trunk/base/src/package1.0/tests/portmdmg.test
===================================================================
--- trunk/base/src/package1.0/tests/portmdmg.test 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/package1.0/tests/portmdmg.test 2014-04-04 22:02:44 UTC (rev 118559)
@@ -6,7 +6,6 @@
set pwd [file dirname [file normalize $argv0]]
source ../package_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
package require macports 1.0
array set ui_options {}
Modified: trunk/base/src/package1.0/tests/portmpkg.test
===================================================================
--- trunk/base/src/package1.0/tests/portmpkg.test 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/package1.0/tests/portmpkg.test 2014-04-04 22:02:44 UTC (rev 118559)
@@ -6,7 +6,6 @@
set pwd [file dirname [file normalize $argv0]]
source ../package_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
package require macports 1.0
array set ui_options {}
Modified: trunk/base/src/package1.0/tests/portpkg.test
===================================================================
--- trunk/base/src/package1.0/tests/portpkg.test 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/package1.0/tests/portpkg.test 2014-04-04 22:02:44 UTC (rev 118559)
@@ -6,7 +6,6 @@
set pwd [file dirname [file normalize $argv0]]
source ../package_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
package require macports 1.0
array set ui_options {}
Modified: trunk/base/src/pkg_mkindex.sh.in
===================================================================
--- trunk/base/src/pkg_mkindex.sh.in 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/pkg_mkindex.sh.in 2014-04-04 22:02:44 UTC (rev 118559)
@@ -30,6 +30,7 @@
TCLSH=@INTREE_TCLSH@
GREP=@GREP@
+LIB_PATH=`dirname $TCLSH`
if [ $# = 0 ]; then
echo "Usage: $0 <directory list>"
@@ -37,7 +38,8 @@
fi
for dir in $@; do
- echo "pkg_mkIndex -verbose -- $dir *.tcl *.dylib *.so" | env DYLD_LIBRARY_PATH=`dirname $TCLSH` $TCLSH 2>&1 \
+ echo "pkg_mkIndex -verbose -- $dir *.tcl *.dylib *.so" \
+ | env DYLD_LIBRARY_PATH=$LIB_PATH LD_LIBRARY_PATH=$LIB_PATH $TCLSH 2>&1 \
| $GREP "^warning: " && exit 1
done
Property changes on: trunk/base/src/port
___________________________________________________________________
Modified: svn:ignore
- Makefile
port
portall
portindex
portmirror
+ Makefile
port
portall
portindex
portmirror
port-tclsh
Modified: trunk/base/src/port/Makefile.in
===================================================================
--- trunk/base/src/port/Makefile.in 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/port/Makefile.in 2014-04-04 22:02:44 UTC (rev 118559)
@@ -3,7 +3,7 @@
INSTALLDIR= ${DESTDIR}${prefix}
TOPSRCDIR= ../..
-SCRIPTS= portmirror portindex port
+SCRIPTS= portmirror portindex port port-tclsh
edit = sed \
-e 's, at TCLSH\@,$(TCLSH),g' \
@@ -24,6 +24,9 @@
port: port.tcl ../../Mk/macports.autoconf.mk
${edit} $(srcdir)/port.tcl > $@
+port-tclsh: port-tclsh.in ../../Mk/macports.autoconf.mk
+ ${edit} $(srcdir)/port-tclsh.in > $@
+
mkdirs:
< ../../doc/prefix.mtree $(MTREE) -U -d -e -p ${INSTALLDIR} > /dev/null
< ../../doc/base.mtree $(MTREE) -U -d -e -p ${INSTALLDIR} > /dev/null
@@ -39,6 +42,6 @@
install: all mkdirs
$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}/bin
$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}/var/macports
- $(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 555 port portindex portmirror ${INSTALLDIR}/bin/
+ $(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 555 port portindex portmirror port-tclsh ${INSTALLDIR}/bin/
$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 $(srcdir)/port-help.tcl ${INSTALLDIR}/var/macports/
cd ${INSTALLDIR}/bin && $(LN_S) -f port portf
Added: trunk/base/src/port/port-tclsh.in
===================================================================
--- trunk/base/src/port/port-tclsh.in (rev 0)
+++ trunk/base/src/port/port-tclsh.in 2014-04-04 22:02:44 UTC (rev 118559)
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec @TCLSH@ "$@"
Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/port/port.tcl 2014-04-04 22:02:44 UTC (rev 118559)
@@ -43,7 +43,6 @@
set portclient::progress::hasTermAnsiSend yes
}
-source [file join "@macports_tcl_dir@" macports1.0 macports_fastload.tcl]
package require macports
package require Pextlib 1.0
Modified: trunk/base/src/port/portindex.tcl
===================================================================
--- trunk/base/src/port/portindex.tcl 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/port/portindex.tcl 2014-04-04 22:02:44 UTC (rev 118559)
@@ -4,7 +4,6 @@
# if requested
# $Id$
-source [file join "@macports_tcl_dir@" macports1.0 macports_fastload.tcl]
package require macports
package require Pextlib
Modified: trunk/base/src/port/portmirror.tcl
===================================================================
--- trunk/base/src/port/portmirror.tcl 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/port/portmirror.tcl 2014-04-04 22:02:44 UTC (rev 118559)
@@ -8,7 +8,6 @@
# Updates the distfiles to current distfiles by deleting old stuff.
# Uses the database.
-source [file join "@macports_tcl_dir@" macports1.0 macports_fastload.tcl]
package require macports
package require Pextlib
Modified: trunk/base/src/port1.0/tests/portactivate.test
===================================================================
--- trunk/base/src/port1.0/tests/portactivate.test 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/port1.0/tests/portactivate.test 2014-04-04 22:02:44 UTC (rev 118559)
@@ -6,7 +6,6 @@
set pwd [file dirname [file normalize $argv0]]
source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
package require macports 1.0
array set ui_options {}
Modified: trunk/base/src/port1.0/tests/portchecksum.test
===================================================================
--- trunk/base/src/port1.0/tests/portchecksum.test 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/port1.0/tests/portchecksum.test 2014-04-04 22:02:44 UTC (rev 118559)
@@ -6,7 +6,6 @@
set pwd [file dirname [file normalize $argv0]]
source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
package require macports 1.0
array set ui_options {}
Modified: trunk/base/src/port1.0/tests/portclean.test
===================================================================
--- trunk/base/src/port1.0/tests/portclean.test 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/port1.0/tests/portclean.test 2014-04-04 22:02:44 UTC (rev 118559)
@@ -6,7 +6,6 @@
set pwd [file dirname [file normalize $argv0]]
source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
package require macports 1.0
array set ui_options {}
Modified: trunk/base/src/port1.0/tests/portdeactivate.test
===================================================================
--- trunk/base/src/port1.0/tests/portdeactivate.test 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/port1.0/tests/portdeactivate.test 2014-04-04 22:02:44 UTC (rev 118559)
@@ -6,7 +6,6 @@
set pwd [file dirname [file normalize $argv0]]
source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
package require macports 1.0
array set ui_options {}
Modified: trunk/base/src/port1.0/tests/portdepends.test
===================================================================
--- trunk/base/src/port1.0/tests/portdepends.test 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/port1.0/tests/portdepends.test 2014-04-04 22:02:44 UTC (rev 118559)
@@ -6,7 +6,6 @@
set pwd [file dirname [file normalize $argv0]]
source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
package require macports 1.0
array set ui_options {}
Modified: trunk/base/src/port1.0/tests/portdistcheck.test
===================================================================
--- trunk/base/src/port1.0/tests/portdistcheck.test 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/port1.0/tests/portdistcheck.test 2014-04-04 22:02:44 UTC (rev 118559)
@@ -6,7 +6,6 @@
set pwd [file dirname [file normalize $argv0]]
source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
package require macports 1.0
array set ui_options {}
Modified: trunk/base/src/port1.0/tests/portinstall.test
===================================================================
--- trunk/base/src/port1.0/tests/portinstall.test 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/port1.0/tests/portinstall.test 2014-04-04 22:02:44 UTC (rev 118559)
@@ -6,7 +6,6 @@
set pwd [file dirname [file normalize $argv0]]
source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
package require macports 1.0
array set ui_options {}
Modified: trunk/base/src/port1.0/tests/portload.test
===================================================================
--- trunk/base/src/port1.0/tests/portload.test 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/port1.0/tests/portload.test 2014-04-04 22:02:44 UTC (rev 118559)
@@ -6,7 +6,6 @@
set pwd [file dirname [file normalize $argv0]]
source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
package require macports 1.0
array set ui_options {}
Modified: trunk/base/src/port1.0/tests/portmain.test
===================================================================
--- trunk/base/src/port1.0/tests/portmain.test 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/port1.0/tests/portmain.test 2014-04-04 22:02:44 UTC (rev 118559)
@@ -6,7 +6,6 @@
set pwd [file dirname [file normalize $argv0]]
source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
package require macports 1.0
array set ui_options {}
Modified: trunk/base/src/port1.0/tests/portpatch.test
===================================================================
--- trunk/base/src/port1.0/tests/portpatch.test 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/port1.0/tests/portpatch.test 2014-04-04 22:02:44 UTC (rev 118559)
@@ -6,7 +6,6 @@
set pwd [file dirname [file normalize $argv0]]
source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
package require macports 1.0
array set ui_options {}
Modified: trunk/base/src/port1.0/tests/porttest.test
===================================================================
--- trunk/base/src/port1.0/tests/porttest.test 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/port1.0/tests/porttest.test 2014-04-04 22:02:44 UTC (rev 118559)
@@ -6,7 +6,6 @@
set pwd [file dirname [file normalize $argv0]]
source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
package require macports 1.0
array set ui_options {}
Modified: trunk/base/src/port1.0/tests/portuninstall.test
===================================================================
--- trunk/base/src/port1.0/tests/portuninstall.test 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/port1.0/tests/portuninstall.test 2014-04-04 22:02:44 UTC (rev 118559)
@@ -6,7 +6,6 @@
set pwd [file dirname [file normalize $argv0]]
source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
package require macports 1.0
array set ui_options {}
Modified: trunk/base/src/port1.0/tests/portutil.test
===================================================================
--- trunk/base/src/port1.0/tests/portutil.test 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/port1.0/tests/portutil.test 2014-04-04 22:02:44 UTC (rev 118559)
@@ -3,12 +3,10 @@
package require tcltest 2
namespace import tcltest::*
-source ../../macports1.0/macports_fastload.tcl
set pwd [file dirname [file normalize $argv0]]
source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
package require macports 1.0
array set ui_options {}
Deleted: trunk/base/src/upgrade_sources_conf_default.tcl
===================================================================
--- trunk/base/src/upgrade_sources_conf_default.tcl 2014-04-04 21:54:33 UTC (rev 118558)
+++ trunk/base/src/upgrade_sources_conf_default.tcl 2014-04-04 22:02:44 UTC (rev 118559)
@@ -1,121 +0,0 @@
-#!/usr/bin/env tclsh
-#
-# $Id$
-#
-# Upgrade sources.conf for a given prefix (passed as the first and only
-# argument).
-#
-# For an rsync: repository, if it is the standard MacPorts one and not
-# already tagged, then make it default, if another wasn't already default.
-# For a file:// respository, if it is an svn checkout from the MacPorts
-# server, then make it default if another hasn't already been tagged.
-#
-
-if {[llength $::argv] == 0} {
- puts "Usage: ${::argv0} <prefix>"
- exit 1
-}
-
-set prefix [lindex $::argv 0]
-set sourcesConf ${prefix}/etc/macports/sources.conf
-if {[catch {set sourcesConfChannel [open $sourcesConf r]}]} {
- exit 0
-}
-
-if {[file executable /usr/bin/mktemp]} {
- set mktemp /usr/bin/mktemp
-} elseif {[file executable /bin/mktemp]} {
- set mktemp /bin/mktemp
-} else {
- set mktemp mktemp
-}
-
-set mktempChannel [open "|$mktemp -t macports_sources_upgrade.XXXXXXXXXX" r]
-set tempfile [read -nonewline $mktempChannel]
-close $mktempChannel
-
-set tempfileChannel [open $tempfile w]
-set defaultSeen false
-set defaultWritten false
-
-while {[gets $sourcesConfChannel line] >= 0} {
- set addDefault false
- if {!$defaultSeen && ![regexp {^\s*#|^$} $line]} {
- if {[regexp {^([\w-]+://\S+)(?:\s+\[(\w+(?:,\w+)*)\])?$} $line -> url flags]} {
- set flags [split $flags ,]
- if {[lsearch $flags default] >= 0} {
- set defaultSeen true
- } elseif {[regexp {rsync://rsync\.(macports|darwinports)\.org/(release|dpupdate)/d?ports} $url]} {
- set addDefault true
- } elseif {[regexp {file://(/.+)} $url -> filepath]} {
- if {[file exists [file join ${filepath} .svn]]} {
- if {![info exists svnCmd]} {
- set svnCmd ""
- foreach path [concat [list ${prefix}/bin] [split $env(PATH) :]] {
- if {[file executable ${path}/svn]} {
- set svnCmd ${path}/svn
- break
- }
- }
- }
- if {$svnCmd eq ""} {
- puts "WARNING: Unable to check svn URL for '$filepath' because no svn command could be found; please manually verify $sourcesConf!"
- continue
- }
- if {![catch {set svnChannel [open "|$svnCmd info ${filepath}" r]} err]} {
- set svnURL {}
- while {[gets $svnChannel svnLine] >= 0} {
- regexp {^URL: (.*)} $svnLine -> svnURL
- }
- if {[catch {close $svnChannel} err]} {
- puts $err
- puts "WARNING: Unable to check svn URL for '$filepath'; please manually verify $sourcesConf!"
- }
- if {[regexp {^https?://svn\.(macports|macosforge)\.org/repository/macports/trunk/dports} $svnURL]} {
- set addDefault true
- }
- } else {
- puts $err
- puts "WARNING: Unable to check svn URL for '$filepath'; please manually verify $sourcesConf!"
- }
- }
- }
- if {$addDefault} {
- lappend flags default
- set line "$url \[[join $flags ,]\]"
- set defaultSeen true
- set defaultWritten true
- }
- }
- }
- puts $tempfileChannel $line
-}
-close $tempfileChannel
-close $sourcesConfChannel
-
-if {$defaultWritten} {
- set attributes [file attributes ${sourcesConf}]
- if {[catch {file rename ${sourcesConf} "${sourcesConf}.mpsaved"}]} {
- file rename -force ${sourcesConf} "${sourcesConf}.mpsaved_[clock seconds]"
- }
- file rename ${tempfile} ${sourcesConf}
- eval file attributes ${sourcesConf} $attributes
-} else {
- file delete ${tempfile}
- if {!$defaultSeen} {
- puts "[string repeat - 72]
-Warning, your source config file at:
-
- $sourcesConf
-
-needs to have a \[default\] tag added to the primary MacPorts repository,
-however the proper entry could not be determined. Please add the tag
-manually by either appending \[default\] to the end of the correct line,
-or if there are already tags, adding it to the list, e.g.
-\[nosync,default\].
-[string repeat - 72]"
- }
-}
-
-exit 0
-
Copied: trunk/base/src/upgrade_sources_conf_default.tcl.in (from rev 118296, trunk/base/src/upgrade_sources_conf_default.tcl)
===================================================================
--- trunk/base/src/upgrade_sources_conf_default.tcl.in (rev 0)
+++ trunk/base/src/upgrade_sources_conf_default.tcl.in 2014-04-04 22:02:44 UTC (rev 118559)
@@ -0,0 +1,121 @@
+#!@TCLSH@
+#
+# $Id$
+#
+# Upgrade sources.conf for a given prefix (passed as the first and only
+# argument).
+#
+# For an rsync: repository, if it is the standard MacPorts one and not
+# already tagged, then make it default, if another wasn't already default.
+# For a file:// respository, if it is an svn checkout from the MacPorts
+# server, then make it default if another hasn't already been tagged.
+#
+
+if {[llength $::argv] == 0} {
+ puts "Usage: ${::argv0} <prefix>"
+ exit 1
+}
+
+set prefix [lindex $::argv 0]
+set sourcesConf ${prefix}/etc/macports/sources.conf
+if {[catch {set sourcesConfChannel [open $sourcesConf r]}]} {
+ exit 0
+}
+
+if {[file executable /usr/bin/mktemp]} {
+ set mktemp /usr/bin/mktemp
+} elseif {[file executable /bin/mktemp]} {
+ set mktemp /bin/mktemp
+} else {
+ set mktemp mktemp
+}
+
+set mktempChannel [open "|$mktemp -t macports_sources_upgrade.XXXXXXXXXX" r]
+set tempfile [read -nonewline $mktempChannel]
+close $mktempChannel
+
+set tempfileChannel [open $tempfile w]
+set defaultSeen false
+set defaultWritten false
+
+while {[gets $sourcesConfChannel line] >= 0} {
+ set addDefault false
+ if {!$defaultSeen && ![regexp {^\s*#|^$} $line]} {
+ if {[regexp {^([\w-]+://\S+)(?:\s+\[(\w+(?:,\w+)*)\])?$} $line -> url flags]} {
+ set flags [split $flags ,]
+ if {[lsearch $flags default] >= 0} {
+ set defaultSeen true
+ } elseif {[regexp {rsync://rsync\.(macports|darwinports)\.org/(release|dpupdate)/d?ports} $url]} {
+ set addDefault true
+ } elseif {[regexp {file://(/.+)} $url -> filepath]} {
+ if {[file exists [file join ${filepath} .svn]]} {
+ if {![info exists svnCmd]} {
+ set svnCmd ""
+ foreach path [concat [list ${prefix}/bin] [split $env(PATH) :]] {
+ if {[file executable ${path}/svn]} {
+ set svnCmd ${path}/svn
+ break
+ }
+ }
+ }
+ if {$svnCmd eq ""} {
+ puts "WARNING: Unable to check svn URL for '$filepath' because no svn command could be found; please manually verify $sourcesConf!"
+ continue
+ }
+ if {![catch {set svnChannel [open "|$svnCmd info ${filepath}" r]} err]} {
+ set svnURL {}
+ while {[gets $svnChannel svnLine] >= 0} {
+ regexp {^URL: (.*)} $svnLine -> svnURL
+ }
+ if {[catch {close $svnChannel} err]} {
+ puts $err
+ puts "WARNING: Unable to check svn URL for '$filepath'; please manually verify $sourcesConf!"
+ }
+ if {[regexp {^https?://svn\.(macports|macosforge)\.org/repository/macports/trunk/dports} $svnURL]} {
+ set addDefault true
+ }
+ } else {
+ puts $err
+ puts "WARNING: Unable to check svn URL for '$filepath'; please manually verify $sourcesConf!"
+ }
+ }
+ }
+ if {$addDefault} {
+ lappend flags default
+ set line "$url \[[join $flags ,]\]"
+ set defaultSeen true
+ set defaultWritten true
+ }
+ }
+ }
+ puts $tempfileChannel $line
+}
+close $tempfileChannel
+close $sourcesConfChannel
+
+if {$defaultWritten} {
+ set attributes [file attributes ${sourcesConf}]
+ if {[catch {file rename ${sourcesConf} "${sourcesConf}.mpsaved"}]} {
+ file rename -force ${sourcesConf} "${sourcesConf}.mpsaved_[clock seconds]"
+ }
+ file rename ${tempfile} ${sourcesConf}
+ eval file attributes ${sourcesConf} $attributes
+} else {
+ file delete ${tempfile}
+ if {!$defaultSeen} {
+ puts "[string repeat - 72]
+Warning, your source config file at:
+
+ $sourcesConf
+
+needs to have a \[default\] tag added to the primary MacPorts repository,
+however the proper entry could not be determined. Please add the tag
+manually by either appending \[default\] to the end of the correct line,
+or if there are already tags, adding it to the list, e.g.
+\[nosync,default\].
+[string repeat - 72]"
+ }
+}
+
+exit 0
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140404/3548566b/attachment-0001.html>
More information about the macports-changes
mailing list