#8794 closed enhancement (wontfix)
request for review: adding file autodetection to portextract.tcl
Reported by: | erickt@… | Owned by: | macports-tickets@… |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | base | Version: | 1.2 |
Keywords: | Cc: | erickt@…, markd@… | |
Port: |
Description (last modified by ryandesign (Ryan Carsten Schmidt))
I ran into a case where a file had both tar.bz2 and tar.gz files (vim 7). I discovered that it's a bit obnoxious trying to get darwinports to extract both types of files at the same time. So, I added file autodetection to the extraction code. Since I'm a new committer, I don't want to go right ahead to make changes. So, could someone check my patch? It should be backwards compatible. Thanks!
-e
Index: portextract.tcl =================================================================== RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/port1.0/portextract.tcl,v retrieving revision 1.41 diff -r1.41 portextract.tcl 43c43 < options extract.only --- > options extract.only 45a46,47 > default extract.autodetect yes > 52,54c54 < default extract.cmd gzip < default extract.pre_args -dc < default extract.post_args {"| ${portutil::autoconf::tar_command} -xf -"} --- > default extract.cmd "" 59c59 < global extract.only extract.dir extract.cmd extract.pre_args extract.post_args distfiles use_bzip2 use_zip workpath --- > global extract.autodetect extract.only extract.dir extract.cmd extract.pre_args extract.post_args distfiles use_bzip2 use_zip workpath 61,66c61,75 < if {[tbool use_bzip2]} { < option extract.cmd [binaryInPath "bzip2"] < } elseif {[tbool use_zip]} { < option extract.cmd [binaryInPath "unzip"] < option extract.pre_args -q < option extract.post_args "-d [option extract.dir]" --- > # if we specified an extraction command, assume we don't want autodetection > if {[option extract.autodetect] != "yes" || [option extract.cmd] != ""} { > option extract.autodetect "no" > > if {[tbool use_bzip2]} { > option extract.cmd [binaryInPath "bzip2"] > } elseif {[tbool use_zip]} { > option extract.cmd [binaryInPath "unzip"] > option extract.pre_args -q > option extract.post_args "-d [option extract.dir]" > } else { > option extract.cmd [binaryInPath "gzip"] > option extract.pre_args -dc > option extract.post_args {"| ${portutil::autoconf::tar_command} -xf -"} > } 77c86 < global UI_PREFIX --- > global UI_PREFIX 85a95,118 > > if {[option extract.autodetect] == "yes"} { > option extract.pre_args "" > option extract.post_args "" > > if {[regexp {(\.tgz)|(\.tar\.gz)$} $distfile]} { > option extract.cmd $portutil::autoconf::tar_command > option extract.pre_args -zxf > } elseif {[regexp {\.tar\.bz2$} $distfile]} { > option extract.cmd $portutil::autoconf::tar_command > option extract.pre_args -jxf > } elseif {[string equal -nocase [file extension $distfile] ".zip"]} { > option extract.cmd [binaryInPath "zip"] > option extract.pre_args -q > option extract.post_args "-d [option extract.dir]" > } elseif {[string equal -nocase [file extension $distfile] ".gz"]} { > option extract.cmd [binaryInPath "gzip"] > option extract.pre_args -dc > option extract.post_args " > [option extract.dir]/[string range $distfile 0 end-3]" > } else { > return -code error "unknown file type: $distfile" > } > } >
Change History (6)
comment:1 Changed 18 years ago by markd@…
Type: | defect → enhancement |
---|
comment:2 Changed 18 years ago by markd@…
Cc: | erickt@… markd@… added |
---|
This feature would be nice. Can you attach a file or patch since the pasted information is unreadable here?
comment:3 Changed 18 years ago by erickt@…
Hello Mark,
Unfortunately this was so long ago I don't really remember what I was trying to accomplish with this that couldn't be done by a custom extract block. What functionality are you looking for?
comment:4 Changed 18 years ago by markd@…
I was trying to avoid doing a custom extract block. :) If this won't be acted on can we close it?
comment:6 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | erickt@dslextreme.com,markd@macports.org → erickt@dslextreme.com, markd@macports.org |
---|---|
Description: | modified (diff) |
Changing type to enhancement.