1 | Index: src/port1.0/portdestroot.tcl |
---|
2 | =================================================================== |
---|
3 | RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/port1.0/portdestroot.tcl,v |
---|
4 | retrieving revision 1.23 |
---|
5 | diff -a -u -u -r1.23 portdestroot.tcl |
---|
6 | --- src/port1.0/portdestroot.tcl 19 Feb 2005 17:05:59 -0000 1.23 |
---|
7 | +++ src/port1.0/portdestroot.tcl 16 Apr 2005 09:40:48 -0000 |
---|
8 | @@ -118,90 +118,90 @@ |
---|
9 | catch {system "find \"${destroot}\" -depth -type d ${exclude_phrase} -exec rmdir -- \{\} \\; 2>/dev/null"} |
---|
10 | |
---|
11 | # Compress all manpages with gzip (instead) |
---|
12 | - set manpath "${destroot}${prefix}/share/man" |
---|
13 | - if {[file isdirectory ${manpath}] && [file type ${manpath}] == "directory"} { |
---|
14 | - ui_info "$UI_PREFIX [format [msgcat::mc "Compressing man pages for %s"] ${portname}]" |
---|
15 | - set found 0 |
---|
16 | - set manlinks [list] |
---|
17 | - foreach mandir [readdir "${manpath}"] { |
---|
18 | - if {![regexp {^man(.)$} ${mandir} match manindex]} { continue } |
---|
19 | - set mandirpath [file join ${manpath} ${mandir}] |
---|
20 | - if {[file isdirectory ${mandirpath}] && [file type ${mandirpath}] == "directory"} { |
---|
21 | - ui_debug "Scanning ${mandir}" |
---|
22 | - foreach manfile [readdir ${mandirpath}] { |
---|
23 | - set manfilepath [file join ${mandirpath} ${manfile}] |
---|
24 | - if {[file isfile ${manfilepath}] && [file type ${manfilepath}] == "file"} { |
---|
25 | - if {[regexp "^(.*\[.\]${manindex}\[a-z\]*)\[.\]gz\$" ${manfile} gzfile manfile]} { |
---|
26 | - set found 1 |
---|
27 | - system "cd ${manpath} && \ |
---|
28 | + foreach manpath "${destroot}${prefix}/share/man ${destroot}${prefix}/man" { |
---|
29 | + if {[file isdirectory ${manpath}] && [file type ${manpath}] == "directory"} { |
---|
30 | + ui_info "$UI_PREFIX [format [msgcat::mc "Compressing man pages for %s"] ${portname}]" |
---|
31 | + set found 0 |
---|
32 | + set manlinks [list] |
---|
33 | + foreach mandir [readdir "${manpath}"] { |
---|
34 | + if {![regexp {^man(.)$} ${mandir} match manindex]} { continue } |
---|
35 | + set mandirpath [file join ${manpath} ${mandir}] |
---|
36 | + if {[file isdirectory ${mandirpath}] && [file type ${mandirpath}] == "directory"} { |
---|
37 | + ui_debug "Scanning ${mandir}" |
---|
38 | + foreach manfile [readdir ${mandirpath}] { |
---|
39 | + set manfilepath [file join ${mandirpath} ${manfile}] |
---|
40 | + if {[file isfile ${manfilepath}] && [file type ${manfilepath}] == "file"} { |
---|
41 | + if {[regexp "^(.*\[.\]${manindex}\[a-z\]*)\[.\]gz\$" ${manfile} gzfile manfile]} { |
---|
42 | + set found 1 |
---|
43 | + system "cd ${manpath} && \ |
---|
44 | gunzip -f [file join ${mandir} ${gzfile}] && \ |
---|
45 | gzip -9vf [file join ${mandir} ${manfile}]" |
---|
46 | - } elseif {[regexp "^(.*\[.\]${manindex}\[a-z\]*)\[.\]bz2\$" ${manfile} bz2file manfile]} { |
---|
47 | - set found 1 |
---|
48 | - system "cd ${manpath} && \ |
---|
49 | + } elseif {[regexp "^(.*\[.\]${manindex}\[a-z\]*)\[.\]bz2\$" ${manfile} bz2file manfile]} { |
---|
50 | + set found 1 |
---|
51 | + system "cd ${manpath} && \ |
---|
52 | bunzip2 -f [file join ${mandir} ${bz2file}] && \ |
---|
53 | gzip -9vf [file join ${mandir} ${manfile}]" |
---|
54 | - } elseif {[regexp "\[.\]${manindex}\[a-z\]*\$" ${manfile}]} { |
---|
55 | - set found 1 |
---|
56 | - system "cd ${manpath} && \ |
---|
57 | + } elseif {[regexp "\[.\]${manindex}\[a-z\]*\$" ${manfile}]} { |
---|
58 | + set found 1 |
---|
59 | + system "cd ${manpath} && \ |
---|
60 | gzip -9vf [file join ${mandir} ${manfile}]" |
---|
61 | - } |
---|
62 | - set gzmanfile ${manfile}.gz |
---|
63 | - set gzmanfilepath [file join ${mandirpath} ${gzmanfile}] |
---|
64 | - if {[file exists ${gzmanfilepath}]} { |
---|
65 | - set desired 00444 |
---|
66 | - set current [file attributes ${gzmanfilepath} -permissions] |
---|
67 | - if {$current != $desired} { |
---|
68 | - ui_info "[file join ${mandir} ${gzmanfile}]: changing permissions from $current to $desired" |
---|
69 | - file attributes ${gzmanfilepath} -permissions $desired |
---|
70 | } |
---|
71 | + set gzmanfile ${manfile}.gz |
---|
72 | + set gzmanfilepath [file join ${mandirpath} ${gzmanfile}] |
---|
73 | + if {[file exists ${gzmanfilepath}]} { |
---|
74 | + set desired 00444 |
---|
75 | + set current [file attributes ${gzmanfilepath} -permissions] |
---|
76 | + if {$current != $desired} { |
---|
77 | + ui_info "[file join ${mandir} ${gzmanfile}]: changing permissions from $current to $desired" |
---|
78 | + file attributes ${gzmanfilepath} -permissions $desired |
---|
79 | + } |
---|
80 | + } |
---|
81 | + } elseif {[file type ${manfilepath}] == "link"} { |
---|
82 | + lappend manlinks [file join ${mandir} ${manfile}] |
---|
83 | } |
---|
84 | - } elseif {[file type ${manfilepath}] == "link"} { |
---|
85 | - lappend manlinks [file join ${mandir} ${manfile}] |
---|
86 | } |
---|
87 | } |
---|
88 | } |
---|
89 | - } |
---|
90 | - if {$found == 1} { |
---|
91 | - # check man page links and rename/repoint them if necessary |
---|
92 | - foreach manlink $manlinks { |
---|
93 | - set manlinkpath [file join $manpath $manlink] |
---|
94 | - # if link destination is not gzipped, check it |
---|
95 | - set manlinksrc [file readlink $manlinkpath] |
---|
96 | - if {![regexp "\[.\]gz\$" ${manlinksrc}]} { |
---|
97 | - set mandir [file dirname $manlink] |
---|
98 | - set mandirpath [file join $manpath $mandir] |
---|
99 | - set pwd [pwd] |
---|
100 | - if {[catch {cd $mandirpath} err]} { |
---|
101 | - puts $err |
---|
102 | - return |
---|
103 | - } |
---|
104 | - # if gzipped destination exists, fix link |
---|
105 | - if {[file isfile ${manlinksrc}.gz]} { |
---|
106 | - # if actual link name does not end with gz, rename it |
---|
107 | - if {![regexp "\[.\]gz\$" ${manlink}]} { |
---|
108 | - ui_debug "renaming link: $manlink to ${manlink}.gz" |
---|
109 | - file rename $manlinkpath ${manlinkpath}.gz |
---|
110 | - set manlink ${manlink}.gz |
---|
111 | - set manlinkpath [file join $manpath $manlink] |
---|
112 | + if {$found == 1} { |
---|
113 | + # check man page links and rename/repoint them if necessary |
---|
114 | + foreach manlink $manlinks { |
---|
115 | + set manlinkpath [file join $manpath $manlink] |
---|
116 | + # if link destination is not gzipped, check it |
---|
117 | + set manlinksrc [file readlink $manlinkpath] |
---|
118 | + if {![regexp "\[.\]gz\$" ${manlinksrc}]} { |
---|
119 | + set mandir [file dirname $manlink] |
---|
120 | + set mandirpath [file join $manpath $mandir] |
---|
121 | + set pwd [pwd] |
---|
122 | + if {[catch {cd $mandirpath} err]} { |
---|
123 | + puts $err |
---|
124 | + return |
---|
125 | } |
---|
126 | - # repoint the link |
---|
127 | - ui_debug "repointing link: $manlink from $manlinksrc to ${manlinksrc}.gz" |
---|
128 | - file delete $manlinkpath |
---|
129 | - system "ln -s \"${manlinksrc}.gz\" \"$manlinkpath\"" |
---|
130 | + # if gzipped destination exists, fix link |
---|
131 | + if {[file isfile ${manlinksrc}.gz]} { |
---|
132 | + # if actual link name does not end with gz, rename it |
---|
133 | + if {![regexp "\[.\]gz\$" ${manlink}]} { |
---|
134 | + ui_debug "renaming link: $manlink to ${manlink}.gz" |
---|
135 | + file rename $manlinkpath ${manlinkpath}.gz |
---|
136 | + set manlink ${manlink}.gz |
---|
137 | + set manlinkpath [file join $manpath $manlink] |
---|
138 | + } |
---|
139 | + # repoint the link |
---|
140 | + ui_debug "repointing link: $manlink from $manlinksrc to ${manlinksrc}.gz" |
---|
141 | + file delete $manlinkpath |
---|
142 | + system "ln -s \"${manlinksrc}.gz\" \"$manlinkpath\"" |
---|
143 | + } |
---|
144 | + cd $pwd |
---|
145 | } |
---|
146 | - cd $pwd |
---|
147 | } |
---|
148 | + } else { |
---|
149 | + ui_debug "No man pages found to compress." |
---|
150 | } |
---|
151 | - } else { |
---|
152 | - ui_debug "No man pages found to compress." |
---|
153 | } |
---|
154 | } |
---|
155 | - |
---|
156 | - if [file exists "${destroot}${prefix}/share/info/dir"] { |
---|
157 | - ui_debug "Deleting stray info/dir file." |
---|
158 | - file delete "${destroot}${prefix}/share/info/dir" |
---|
159 | - } |
---|
160 | + if [file exists "${destroot}${prefix}/share/info/dir"] { |
---|
161 | + ui_debug "Deleting stray info/dir file." |
---|
162 | + file delete "${destroot}${prefix}/share/info/dir" |
---|
163 | + } |
---|
164 | # Restore umask |
---|
165 | umask $oldmask |
---|
166 | |
---|