[147034] branches/vcs-fetch/base/src/port1.0/portfetch.tcl
raimue at macports.org
raimue at macports.org
Wed Mar 23 18:39:09 PDT 2016
Revision: 147034
https://trac.macports.org/changeset/147034
Author: raimue at macports.org
Date: 2016-03-23 18:39:09 -0700 (Wed, 23 Mar 2016)
Log Message:
-----------
Improve mirroring support for fetch.type git
Only mirror if checksums are available, or we would generate a tarball only to
throw it away afterwards. Support file deletion on checksum mismatch and
register generated tarballs in the filemap after mirroring.
Modified Paths:
--------------
branches/vcs-fetch/base/src/port1.0/portfetch.tcl
Modified: branches/vcs-fetch/base/src/port1.0/portfetch.tcl
===================================================================
--- branches/vcs-fetch/base/src/port1.0/portfetch.tcl 2016-03-24 01:15:50 UTC (rev 147033)
+++ branches/vcs-fetch/base/src/port1.0/portfetch.tcl 2016-03-24 01:39:09 UTC (rev 147034)
@@ -421,13 +421,25 @@
return 0
}
-# Check if port can be mirrored
+# Returns true if port can be mirrored
proc portfetch::mirrorable {args} {
global fetch.type
switch -- "${fetch.type}" {
- git { return [git_tarballable] }
+ git {
+ if {[option checksums] eq ""} {
+ ui_debug "port cannot be mirrored, no checksums for ${fetch.type}"
+ return no
+ }
+ if {![git_tarballable]} {
+ ui_debug "port cannot be mirrored, not tarballable for ${fetch.type}"
+ return no
+ }
+ return yes
+ }
standard -
- default { return yes }
+ default {
+ return yes
+ }
}
}
@@ -601,24 +613,40 @@
# Utility function to delete fetched files.
proc portfetch::fetch_deletefiles {args} {
- global distpath
+ global distpath git.file fetch.type
variable fetch_urls
foreach {url_var distfile} $fetch_urls {
if {[file isfile $distpath/$distfile]} {
file delete -force "${distpath}/${distfile}"
}
}
+
+ switch -- "${fetch.type}" {
+ git {
+ if {[git_tarballable] && [file isfile "${distpath}/${git.file}"]} {
+ file delete -force "${distpath}/${git.file}"
+ }
+ }
+ }
}
# Utility function to add files to a list of fetched files.
proc portfetch::fetch_addfilestomap {filemapname} {
- global distpath $filemapname
+ global distpath fetch.type git.file $filemapname
variable fetch_urls
foreach {url_var distfile} $fetch_urls {
if {[file isfile $distpath/$distfile]} {
filemap set $filemapname $distpath/$distfile 1
}
}
+
+ switch -- "${fetch.type}" {
+ git {
+ if {[git_tarballable] && [file isfile "${distpath}/${git.file}"]} {
+ filemap set $filemapname ${distpath}/${git.file} 1
+ }
+ }
+ }
}
# Initialize fetch target and call checkfiles.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160323/24489215/attachment.html>
More information about the macports-changes
mailing list