source: trunk/base/src/ @ 136621

Last change on this file since 136621 was 118559, checked in by cal@…, 6 years ago

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/
because the Tcl library matching the in-tree Tcl interpreter might not be found

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

#!/usr/bin/env port-tclsh

which will cause the contrib script to automatically work on the port
installation currently first in $PATH.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 1.6 KB
2# -*- 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
3# $Id: 118559 2014-04-04 22:02:44Z $
5# move portfiles from sqlite db to filesystem, while deduplicating
6# Takes one argument, which should be TCL_PACKAGE_DIR.
8package require macports 1.0
9package require registry2 2.0
10package require Pextlib 1.0
12umask 022
14array set ui_options {ports_verbose yes}
16mportinit ui_options
18if {[registry::metadata get portfiles_update_needed] == 1} {
19    set portfiles_dir [file join ${macports::registry.path} registry portfiles]
21    registry::write {
22        set installed_ports [registry::entry imaged]
23        foreach portref $installed_ports {
24            set portfile_contents [$portref portfile]
25            if {$portfile_contents ne "" && $portfile_contents ne "0"} {
26                set portfile_partial_dir [file join $portfiles_dir [$portref name]-[$portref version]_[$portref revision]]
27                file mkdir $portfile_partial_dir
28                set portfile_temp_path ${portfile_partial_dir}/Portfile
29                set fd [open $portfile_temp_path w]
30                puts $fd $portfile_contents
31                close $fd
33                set hash_size [sha256 file $portfile_temp_path]-[file size $portfile_temp_path]
34                set portfile_dir [file join $portfile_partial_dir $hash_size]
35                file mkdir $portfile_dir
36                file rename -force $portfile_temp_path $portfile_dir
37                file mtime ${portfile_dir}/Portfile [$portref date]
39                $portref portfile $hash_size
40            }
41        }
42        registry::metadata del portfiles_update_needed
43    }
46exit 0
Note: See TracBrowser for help on using the repository browser.