Skip to content

Commit

Permalink
Introduce extract.rename_filter
Browse files Browse the repository at this point in the history
The idea is allow to use `extract.rename yes` for a `Portfile` which
downloads multiple artifacts from different sources by suggesting the
filter which should be used to detect main artifact name.

Example of Portfile which required it `retdec`.
  • Loading branch information
catap committed Apr 24, 2023
1 parent 5643919 commit e7b3a2d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/port1.0/portextract.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace eval portextract {
}

# define options
options extract.only extract.mkdir extract.rename extract.asroot
options extract.only extract.mkdir extract.rename extract.rename_filter extract.asroot
commands extract

# Set up defaults
Expand All @@ -58,6 +58,7 @@ default extract.pre_args -dc
default extract.post_args {| ${portutil::autoconf::tar_command} -xf -}
default extract.mkdir no
default extract.rename no
default extract.rename_filter {*}

set_ui_prefix

Expand Down Expand Up @@ -161,7 +162,7 @@ proc portextract::extract_main {args} {
if {[option extract.rename] && ![file exists [option worksrcpath]]} {
global workpath distname
# rename whatever directory exists in $workpath to $distname
set worksubdirs [glob -nocomplain -types d -directory $workpath *]
set worksubdirs [glob -nocomplain -types d -directory $workpath ${extract.rename_filter}]
if {[llength $worksubdirs] == 1} {
set origpath [lindex $worksubdirs 0]
set newpath [file join $workpath $distname]
Expand Down

0 comments on commit e7b3a2d

Please sign in to comment.