You've already forked macports-base
mirror of
https://github.com/macports/macports-base.git
synced 2026-07-12 18:18:43 -07:00
Allow deferred loading of code for running targets
A Portfile interpreter created by mportopen will only end up actually executing a subset of all targets, and may not execute any. Therefore, splitting the code for running targets from that which is needed just to parse the Portfile improves the speed of mportopen and reduces the memory used by each open mport (which can really add up when installing ports with large dependency graphs). Initially only the portfetch code has been split, creating the new portfetch_run package.
This commit is contained in:
@@ -476,7 +476,7 @@ proc portarchivefetch::fetchfiles {{async no} args} {
|
||||
write_statefile target "org.macports.${target}" $target_state_fd
|
||||
}
|
||||
# Cancel any async distfile fetch that may be in progress
|
||||
portfetch::_async_cleanup
|
||||
catch {portfetch::_async_cleanup}
|
||||
return 0
|
||||
}
|
||||
if {[tbool ports_binary_only] || [_archive_available]} {
|
||||
|
||||
@@ -12,7 +12,8 @@ SRCS= port.tcl portchecksum.tcl portconfigure.tcl portextract.tcl \
|
||||
portlint.tcl portclean.tcl porttest.tcl portactivate.tcl portbump.tcl \
|
||||
portdeactivate.tcl portstartupitem.tcl porttrace.tcl portlivecheck.tcl \
|
||||
portdistcheck.tcl portmirror.tcl portload.tcl portunload.tcl portreload.tcl \
|
||||
portdistfiles.tcl fetch_common.tcl portsandbox.tcl
|
||||
portdistfiles.tcl fetch_common.tcl portsandbox.tcl \
|
||||
portfetch_run.tcl
|
||||
|
||||
include $(srcdir)/../../Mk/macports.subdir.mk
|
||||
|
||||
@@ -32,12 +33,9 @@ distclean:: clean
|
||||
|
||||
install:: all
|
||||
$(INSTALL) -d -o "${DSTUSR}" -g "${DSTGRP}" -m "${DSTMODE}" "${DESTDIR}${INSTALLDIR}"
|
||||
$(SILENT)set -x; for file in ${SRCS}; do \
|
||||
$(SILENT)set -x; for file in ${SRCS} ${SRCS_AUTOCONF}; do \
|
||||
$(INSTALL) -o "${DSTUSR}" -g "${DSTGRP}" -m 444 "$(srcdir)/$$file" "${DESTDIR}${INSTALLDIR}"; \
|
||||
done
|
||||
$(SILENT)set -x; for file in ${SRCS_AUTOCONF}; do \
|
||||
$(INSTALL) -o "${DSTUSR}" -g "${DSTGRP}" -m 444 "$$file" "${DESTDIR}${INSTALLDIR}"; \
|
||||
done
|
||||
$(INSTALL) -o "${DSTUSR}" -g "${DSTGRP}" -m 444 pkgIndex.tcl "${DESTDIR}${INSTALLDIR}"
|
||||
|
||||
test::
|
||||
|
||||
+5
-597
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -50,6 +50,26 @@ namespace eval portmirror {
|
||||
# if the checksum isn't correct.
|
||||
# It also records the path in a database.
|
||||
|
||||
# Utility function to delete fetched files.
|
||||
proc portmirror::fetch_deletefiles {args} {
|
||||
global distpath portfetch::fetch_urls
|
||||
foreach {url_var distfile} $fetch_urls {
|
||||
if {[file isfile $distpath/$distfile]} {
|
||||
file delete ${distpath}/${distfile}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Utility function to add files to a list of fetched files.
|
||||
proc portmirror::fetch_addfilestomap {filemapname} {
|
||||
global distpath $filemapname portfetch::fetch_urls
|
||||
foreach {url_var distfile} $fetch_urls {
|
||||
if {[file isfile $distpath/$distfile]} {
|
||||
filemap set $filemapname $distpath/$distfile 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc portmirror::mirror_main {args} {
|
||||
global fetch.type mirror_filemap portdbpath subport license
|
||||
|
||||
@@ -73,7 +93,7 @@ proc portmirror::mirror_main {args} {
|
||||
# checksum the files.
|
||||
if {[catch {portchecksum::checksum_main $args} result]} {
|
||||
# delete the files.
|
||||
portfetch::fetch_deletefiles $args
|
||||
fetch_deletefiles $args
|
||||
exec_with_available_privileges {
|
||||
filemap close mirror_filemap
|
||||
}
|
||||
@@ -81,7 +101,7 @@ proc portmirror::mirror_main {args} {
|
||||
}
|
||||
|
||||
# add the list of files.
|
||||
portfetch::fetch_addfilestomap mirror_filemap
|
||||
fetch_addfilestomap mirror_filemap
|
||||
}
|
||||
|
||||
# close the filemap.
|
||||
|
||||
@@ -1358,6 +1358,14 @@ proc lipo {} {
|
||||
########### Internal Dependency Manipulation Procedures ###########
|
||||
set ports_dry_last_skipped ""
|
||||
|
||||
# Load any extra code needed to run the given target
|
||||
proc portutil::target_load {ditem} {
|
||||
set runpkg [ditem_key $ditem runpkg]
|
||||
if {$runpkg ne {}} {
|
||||
package require $runpkg
|
||||
}
|
||||
}
|
||||
|
||||
proc target_run {ditem} {
|
||||
global target_state_fd workpath portpath ports_trace PortInfo ports_dryrun \
|
||||
ports_dry_last_skipped worksrcpath subport env portdbpath \
|
||||
@@ -1377,6 +1385,7 @@ proc target_run {ditem} {
|
||||
}
|
||||
|
||||
if {$procedure ne ""} {
|
||||
portutil::target_load $ditem
|
||||
set targetname [ditem_key $ditem name]
|
||||
set target [ditem_key $ditem provides]
|
||||
portsandbox::set_profile $target
|
||||
@@ -2341,6 +2350,10 @@ proc target_init {ditem args} {
|
||||
ditem_append $ditem init {*}$args
|
||||
}
|
||||
|
||||
proc target_runpkg {ditem pkg} {
|
||||
ditem_key $ditem runpkg $pkg
|
||||
}
|
||||
|
||||
##### variant class #####
|
||||
|
||||
# constructor for variant objects
|
||||
@@ -3596,6 +3609,7 @@ proc portutil::_eval_archive_available {{async no}} {
|
||||
}
|
||||
lappend sites_entries $primary_mirror
|
||||
# Build list of URLs to check for the archive and its signature.
|
||||
package require fetch_common
|
||||
set sites [list]
|
||||
set urls [list]
|
||||
foreach sites_entry $sites_entries {
|
||||
|
||||
Reference in New Issue
Block a user