Skip to content

Commit

Permalink
fetch: Support sparse checkouts with svn.subdirs
Browse files Browse the repository at this point in the history
  • Loading branch information
raimue committed Mar 21, 2018
1 parent 0877d10 commit a10c4dc
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions src/port1.0/portfetch.tcl
Expand Up @@ -51,7 +51,7 @@ options master_sites patch_sites extract.suffix distfiles patchfiles use_bzip2 u
master_sites.mirror_subdir patch_sites.mirror_subdir \
bzr.cmd bzr.url bzr.revision bzr.file bzr.file_prefix \
cvs.cmd cvs.root cvs.password cvs.module cvs.tag cvs.date cvs.file cvs.file_prefix \
svn.cmd svn.url svn.revision svn.file svn.file_prefix \
svn.cmd svn.url svn.revision svn.subdirs svn.file svn.file_prefix \
git.cmd git.url git.branch git.file git.file_prefix git.fetch_submodules \
hg.cmd hg.url hg.tag hg.file hg.file_prefix

Expand All @@ -76,6 +76,7 @@ default cvs.file_prefix {${distname}}
default svn.cmd {[portfetch::find_svn_path]}
default svn.url ""
default svn.revision ""
default svn.subdirs ""
default svn.file {${distname}.${fetch.type}.tar.bz2}
default svn.file_prefix {${distname}}

Expand Down Expand Up @@ -580,7 +581,7 @@ proc portfetch::svn_proxy_args {url} {
proc portfetch::svnfetch {args} {
global UI_PREFIX \
distpath workpath worksrcpath \
svn.cmd svn.args svn.revision svn.url svn.file svn.file_prefix \
svn.cmd svn.args svn.revision svn.url svn.subdirs svn.file svn.file_prefix \
name distname fetch.type

set generatedfile "${distpath}/${svn.file}"
Expand All @@ -602,10 +603,26 @@ proc portfetch::svnfetch {args} {
ui_info "$UI_PREFIX Checking out ${fetch.type} repository"
set tmppath [mkdtemp "/tmp/macports.portfetch.${name}.XXXXXXXX"]
set tmpxprt [file join ${tmppath} export]
set cmdstring "${svn.cmd} --non-interactive ${proxy_args} export ${svn.url} ${tmpxprt}/${svn.file_prefix} 2>&1"
if {[catch {system $cmdstring} result]} {
delete ${tmppath}
return -code error [msgcat::mc "Subversion checkout failed"]
if {![info exists svn.subdirs]} {
set cmdstring "${svn.cmd} --non-interactive ${proxy_args} export ${svn.url} ${tmpxprt}/${svn.file_prefix} 2>&1"
if {[catch {system $cmdstring} result]} {
delete ${tmppath}
return -code error [msgcat::mc "Subversion checkout failed"]
}
} else {
set cmdstring "${svn.cmd} --non-interactive ${proxy_args} checkout --depth empty ${svn.url} ${tmpxprt}/${svn.file_prefix} 2>&1"
if {[catch {system $cmdstring} result]} {
delete ${tmppath}
return -code error [msgcat::mc "Subversion checkout failed"]
}
foreach dir ${svn.subdirs} {
set cmdstring "${svn.cmd} --non-interactive ${proxy_args} update --depth infinity ${tmpxprt}/${svn.file_prefix}/${dir} 2>&1"
if {[catch {system $cmdstring} result]} {
delete ${tmppath}
return -code error [msgcat::mc "Subversion update for subdir $dir failed"]
}
}
file delete -force ${tmpxprt}/${svn.file_prefix}/.svn
}

if {![svn_tarballable]} {
Expand Down

0 comments on commit a10c4dc

Please sign in to comment.