line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Enbld::Target::Symlink; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
79
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
69
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
15
|
use File::Spec; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
80
|
|
7
|
2
|
|
|
2
|
|
12
|
use File::Path qw/make_path/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
1512
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
require Enbld::Home; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# directory list for symbolic link |
13
|
|
|
|
|
|
|
our $dir_list = { |
14
|
|
|
|
|
|
|
'bin' => { |
15
|
|
|
|
|
|
|
'dir' => 'bin', |
16
|
|
|
|
|
|
|
'omit' => undef, |
17
|
|
|
|
|
|
|
}, |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
'sbin' => { |
20
|
|
|
|
|
|
|
'dir' => 'sbin', |
21
|
|
|
|
|
|
|
'omit' => undef, |
22
|
|
|
|
|
|
|
}, |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
'lib' => { |
25
|
|
|
|
|
|
|
'dir' => 'lib', |
26
|
|
|
|
|
|
|
'omit' => [ 'pkgconfig', 'perl5' ], |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
'pkgconfig' => { |
30
|
|
|
|
|
|
|
'dir' => File::Spec->catdir( 'lib', 'pkgconfig' ), |
31
|
|
|
|
|
|
|
'omit' => undef, |
32
|
|
|
|
|
|
|
}, |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
'include' => { |
35
|
|
|
|
|
|
|
'dir' => 'include', |
36
|
|
|
|
|
|
|
'omit' => undef, |
37
|
|
|
|
|
|
|
}, |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
'script' => { |
40
|
|
|
|
|
|
|
'dir' => 'script', |
41
|
|
|
|
|
|
|
'omit' => undef, |
42
|
|
|
|
|
|
|
}, |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
'support-files' => { |
45
|
|
|
|
|
|
|
'dir' => 'support-files', |
46
|
|
|
|
|
|
|
'omit' => undef, |
47
|
|
|
|
|
|
|
}, |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
'man-man1' => { |
50
|
|
|
|
|
|
|
'dir' => File::Spec->catdir( 'man', 'man1' ), |
51
|
|
|
|
|
|
|
'omit' => undef, |
52
|
|
|
|
|
|
|
}, |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
'man-man3' => { |
55
|
|
|
|
|
|
|
'dir' => File::Spec->catdir( 'man', 'man3' ), |
56
|
|
|
|
|
|
|
'omit' => undef, |
57
|
|
|
|
|
|
|
}, |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
'share-man1' => { |
60
|
|
|
|
|
|
|
'dir' => File::Spec->catdir( 'share', 'man', 'man1' ), |
61
|
|
|
|
|
|
|
'omit' => undef, |
62
|
|
|
|
|
|
|
}, |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
'share-man3' => { |
65
|
|
|
|
|
|
|
'dir' => File::Spec->catdir( 'share', 'man', 'man3' ), |
66
|
|
|
|
|
|
|
'omit' => undef, |
67
|
|
|
|
|
|
|
}, |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
'share' => { |
70
|
|
|
|
|
|
|
'dir' => 'share', |
71
|
|
|
|
|
|
|
'omit' => [ 'emacs', 'info', 'man', 'doc', 'aclocal' ], |
72
|
|
|
|
|
|
|
}, |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
'doc' => { |
75
|
|
|
|
|
|
|
'dir' => File::Spec->catdir( 'share', 'doc' ), |
76
|
|
|
|
|
|
|
'omit' => undef, |
77
|
|
|
|
|
|
|
}, |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
'site-lisp' => { |
80
|
|
|
|
|
|
|
'dir' => File::Spec->catdir( 'share', 'emacs', 'site-lisp' ), |
81
|
|
|
|
|
|
|
'omit' => undef, |
82
|
|
|
|
|
|
|
}, |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
'aclocal' => { |
85
|
|
|
|
|
|
|
'dir' => File::Spec->catdir( 'share', 'aclocal' ), |
86
|
|
|
|
|
|
|
'omit' => undef, |
87
|
|
|
|
|
|
|
}, |
88
|
|
|
|
|
|
|
}; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub delete_symlink { |
91
|
28
|
|
|
28
|
0
|
106
|
my ( $pkg, $old_depository ) = @_; |
92
|
|
|
|
|
|
|
|
93
|
28
|
|
|
|
|
52
|
foreach my $dir ( sort keys %{ $dir_list } ) { |
|
28
|
|
|
|
|
647
|
|
94
|
420
|
|
|
|
|
1803
|
my $installed = File::Spec->catdir( |
95
|
|
|
|
|
|
|
Enbld::Home->home, |
96
|
|
|
|
|
|
|
$dir_list->{$dir}{dir} |
97
|
|
|
|
|
|
|
); |
98
|
|
|
|
|
|
|
|
99
|
420
|
100
|
|
|
|
5850
|
next unless ( -d $installed ); |
100
|
|
|
|
|
|
|
|
101
|
8
|
|
|
|
|
383
|
opendir( my $dh, $installed ); |
102
|
8
|
|
|
|
|
297
|
my @list = grep { !/^\.{1,2}$/ } readdir $dh; |
|
24
|
|
|
|
|
160
|
|
103
|
8
|
|
|
|
|
150
|
closedir $dh; |
104
|
|
|
|
|
|
|
|
105
|
8
|
|
|
|
|
101
|
chdir $installed; |
106
|
|
|
|
|
|
|
|
107
|
8
|
|
|
|
|
22
|
foreach my $file ( @list ) { |
108
|
8
|
50
|
|
|
|
120
|
next unless ( -l $file ); |
109
|
|
|
|
|
|
|
|
110
|
8
|
|
|
|
|
54
|
my $link = readlink( $file ); |
111
|
|
|
|
|
|
|
|
112
|
8
|
100
|
|
|
|
131
|
if ( index( $link, $old_depository ) == 0 ) { |
113
|
5
|
|
|
|
|
353
|
unlink $file; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub create_symlink { |
120
|
27
|
|
|
27
|
0
|
77
|
my ( $pkg, $new_depository ) = @_; |
121
|
|
|
|
|
|
|
|
122
|
27
|
|
|
|
|
47
|
foreach my $dir ( sort keys %{$dir_list} ) { |
|
27
|
|
|
|
|
244
|
|
123
|
405
|
|
|
|
|
1976
|
my $link_from_path = |
124
|
|
|
|
|
|
|
File::Spec->catdir( $new_depository, $dir_list->{$dir}{dir} ); |
125
|
|
|
|
|
|
|
|
126
|
405
|
100
|
|
|
|
5531
|
next unless ( -d $link_from_path ); |
127
|
|
|
|
|
|
|
|
128
|
27
|
|
|
|
|
989
|
opendir( my $dh, $link_from_path ); |
129
|
27
|
|
|
|
|
736
|
my @list = grep { !/^\.{1,2}$/ } readdir $dh; |
|
81
|
|
|
|
|
445
|
|
130
|
27
|
|
|
|
|
202
|
closedir $dh; |
131
|
|
|
|
|
|
|
|
132
|
27
|
|
|
|
|
254
|
my $link_to_path = File::Spec->catdir( |
133
|
|
|
|
|
|
|
Enbld::Home->home, |
134
|
|
|
|
|
|
|
$dir_list->{$dir}{dir} |
135
|
|
|
|
|
|
|
); |
136
|
|
|
|
|
|
|
|
137
|
27
|
100
|
|
|
|
369
|
unless ( -d $link_to_path ) { |
138
|
20
|
|
|
|
|
4472
|
make_path( $link_to_path ); |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
27
|
|
|
|
|
75
|
foreach my $file ( @list ) { |
142
|
27
|
50
|
|
|
|
45
|
next if ( grep {/^$file$/ } @{$dir_list->{$dir}{omit}} ); |
|
0
|
|
|
|
|
0
|
|
|
27
|
|
|
|
|
132
|
|
143
|
|
|
|
|
|
|
|
144
|
27
|
|
|
|
|
364
|
my $symlink = File::Spec->catfile( $link_to_path, $file ); |
145
|
|
|
|
|
|
|
|
146
|
27
|
100
|
|
|
|
580
|
if ( -l $symlink ) { |
147
|
3
|
|
|
|
|
232
|
unlink $symlink; |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
27
|
50
|
|
|
|
301
|
unless ( -e $symlink ) { |
151
|
27
|
|
|
|
|
1413
|
symlink File::Spec->catfile( $link_from_path, $file ), $symlink; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
1; |