Ticket #788: patch-portfetch.2.tcl

File patch-portfetch.2.tcl, 1.5 KB (added by tp62@…, 21 years ago)

Correct patch for portfetch.tcl

Line 
1--- portfetch.tcl.old   Tue Jan  6 03:53:17 2004
2+++ portfetch.tcl       Tue Jan  6 04:33:32 2004
3@@ -70,18 +70,20 @@
4 default distfiles {[suffix $distname]}
5 
6 # Option-executed procedures
7-namespace eval options { }
8-proc options::use_bzip2 {args} {
9-    global use_bzip2 extract.suffix
10-    if {[tbool use_bzip2]} {
11-        set extract.suffix .tar.bz2
12-    }
13-}
14+option_proc use_bzip2 fix_extract_suffix
15+option_proc use_zip fix_extract_suffix
16 
17-proc options::use_zip {args} {
18-    global use_zip extract.suffix
19-    if {[tbool use_zip]} {
20-        set extract.suffix .zip
21+proc fix_extract_suffix {option action args} {
22+    global extract.suffix
23+    if {[string equal ${action} "set"] && [tbool args]} {
24+        switch $option {
25+            use_bzip2 {
26+                set extract.suffix .tar.bz2
27+            }
28+            use_zip {
29+                set extract.suffix .zip
30+            }
31+        }
32     }
33 }
34 
35@@ -93,17 +95,11 @@
36 
37 # Given a distname, return a suffix based on the use_zip / use_bzip2 / extract.suffix options
38 proc suffix {distname} {
39-    global extract.suffix use_bzip2 use_zip fetch.type
40+    global extract.suffix fetch.type
41     if {"${fetch.type}" == "cvs"} {
42         return ""
43     }
44-    if {[tbool use_bzip2]} {
45-       return ${distname}.tar.bz2
46-    } elseif {[tbool use_zip]} {
47-       return ${distname}.zip
48-    } else {
49-       return ${distname}${extract.suffix}
50-    }
51+    return ${distname}${extract.suffix}
52 }
53 
54 # Given a site url and the name of the distfile, assemble url and