| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Slackware::Slackget::PkgTools; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1045
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
30
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
35
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require Slackware::Slackget::Status ; |
|
7
|
1
|
|
|
1
|
|
6
|
use File::Copy ; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
93
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use constant { |
|
10
|
1
|
|
|
|
|
5214
|
PKG_INSTALL_OK => 0x43001, |
|
11
|
|
|
|
|
|
|
PKG_UPGRADE_OK => 0x43003, |
|
12
|
|
|
|
|
|
|
PKG_REMOVE_OK => 0x43005, |
|
13
|
|
|
|
|
|
|
PKG_INSTALL_FAIL => 0x43002, |
|
14
|
|
|
|
|
|
|
PKG_UPGRADE_FAIL => 0x43004, |
|
15
|
|
|
|
|
|
|
PKG_REMOVE_FAIL => 0x43006, |
|
16
|
|
|
|
|
|
|
PKG_NOT_FOUND_INSTALL_FAIL => 0x43007, |
|
17
|
|
|
|
|
|
|
PKG_NOT_FOUND_UPGRADE_FAIL => 0x43008, |
|
18
|
|
|
|
|
|
|
PKG_NOT_FOUND_REMOVE_FAIL => 0x43009, |
|
19
|
|
|
|
|
|
|
PKG_UNKNOWN_FAIL => 0x43010, |
|
20
|
1
|
|
|
1
|
|
5
|
}; |
|
|
1
|
|
|
|
|
2
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 NAME |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Slackware::Slackget::PkgTools - A wrapper for the pkgtools action(installpkg, upgradepkg and removepkg) |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 VERSION |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Version 1.0.21 |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
our $VERSION = '1.0.21'; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
This class is anoter wrapper for slack-get. It encapsulates the pkgtools system call. |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
use Slackware::Slackget::PkgTools; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my $pkgtool = Slackware::Slackget::PkgTools->new($config); |
|
41
|
|
|
|
|
|
|
$pkgtool->install($package1); |
|
42
|
|
|
|
|
|
|
$pkgtool->remove($package_list); |
|
43
|
|
|
|
|
|
|
foreach (@{$packagelist->get_all}) |
|
44
|
|
|
|
|
|
|
{ |
|
45
|
|
|
|
|
|
|
print "Status for ",$_->name," : ",$_->status()->to_string,"\n"; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
$pkgtool->upgrade($package_list); |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub new |
|
52
|
|
|
|
|
|
|
{ |
|
53
|
0
|
|
|
0
|
1
|
|
my ($class,$config,%args) = @_ ; |
|
54
|
0
|
0
|
0
|
|
|
|
return undef if(!defined($config) && ref($config) ne 'Slackware::Slackget::Config') ; |
|
55
|
0
|
|
|
|
|
|
my $self={}; |
|
56
|
0
|
|
|
|
|
|
$self->{CONF} = $config ; |
|
57
|
0
|
|
|
|
|
|
$self->{SUCCESS_STATUS} = { |
|
58
|
|
|
|
|
|
|
Slackware::Slackget::PkgTools::PKG_INSTALL_OK => "Package have been installed successfully.", |
|
59
|
|
|
|
|
|
|
Slackware::Slackget::PkgTools::PKG_UPGRADE_OK => "Package have been upgraded successfully.", |
|
60
|
|
|
|
|
|
|
Slackware::Slackget::PkgTools::PKG_REMOVE_OK => "Package have been removed successfully.", |
|
61
|
|
|
|
|
|
|
}; |
|
62
|
0
|
|
|
|
|
|
$self->{ERROR_STATUS}={ |
|
63
|
|
|
|
|
|
|
Slackware::Slackget::PkgTools::PKG_NOT_FOUND_INSTALL_FAIL => "Can't install package : new package not found in the cache.", |
|
64
|
|
|
|
|
|
|
Slackware::Slackget::PkgTools::PKG_NOT_FOUND_REMOVE_FAIL => "Can't remove package : no such package installed.", |
|
65
|
|
|
|
|
|
|
Slackware::Slackget::PkgTools::PKG_NOT_FOUND_UPGRADE_FAIL => "Can't upgrade package : new package not found in the cache.", |
|
66
|
|
|
|
|
|
|
Slackware::Slackget::PkgTools::PKG_INSTALL_FAIL => "Can't install package : an error occured during $self->{CONF}->{common}->{pkgtools}->{'installpkg-binary'} system call", |
|
67
|
|
|
|
|
|
|
Slackware::Slackget::PkgTools::PKG_REMOVE_FAIL => "Can't remove package : an error occured during $self->{CONF}->{common}->{pkgtools}->{'removepkg-binary'} system call", |
|
68
|
|
|
|
|
|
|
Slackware::Slackget::PkgTools::PKG_UPGRADE_FAIL => "Can't upgrade package : an error occured during $self->{CONF}->{common}->{pkgtools}->{'upgradepkg-binary'} system call", |
|
69
|
|
|
|
|
|
|
Slackware::Slackget::PkgTools::PKG_UNKNOWN_FAIL => "An error occured in the Slackware::Slackget::PkgTool class (during installpkg, upgradepkg or removepkg) but the class is unable to understand the error.", |
|
70
|
|
|
|
|
|
|
}; |
|
71
|
0
|
|
|
|
|
|
$self->{DATA} = { |
|
72
|
|
|
|
|
|
|
'info-output' => undef, |
|
73
|
|
|
|
|
|
|
'connection-id' => 0, |
|
74
|
|
|
|
|
|
|
'fake_mode' => 0, |
|
75
|
|
|
|
|
|
|
}; |
|
76
|
0
|
0
|
|
|
|
|
$self->{DATA}->{'fake_mode'} = $args{'fake_mode'} if(defined($args{'fake_mode'})); |
|
77
|
0
|
|
|
|
|
|
bless($self,$class); |
|
78
|
|
|
|
|
|
|
# |
|
79
|
|
|
|
|
|
|
# use Data::Dumper; |
|
80
|
|
|
|
|
|
|
# print Dumper($self); |
|
81
|
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
return $self; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 new |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Take a Slackware::Slackget::Config object as argument : |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
my $pkgtool = new Slackware::Slackget::PkgTool ($config); |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
** IMPORTANT NOTE ** : in the old time, when this module was poorly coded (by me) it was taking care of sending network messages. |
|
94
|
|
|
|
|
|
|
This is obviously not its role, so it do not do that anymore. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 FUNCTIONS |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Slackware::Slackget::PkgTools methods used the followings status : |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
0 : Package have been installed successfully. |
|
103
|
|
|
|
|
|
|
1 : Package have been upgraded successfully. |
|
104
|
|
|
|
|
|
|
2 : Package have been removed successfully. |
|
105
|
|
|
|
|
|
|
3 : Can't install package : new package not found in the cache. |
|
106
|
|
|
|
|
|
|
4 : Can't remove package : no such package installed. |
|
107
|
|
|
|
|
|
|
5 : Can't upgrade package : new package not found in the cache. |
|
108
|
|
|
|
|
|
|
6 : Can't install package : an error occured during system call |
|
109
|
|
|
|
|
|
|
7 : Can't remove package : an error occured during system call |
|
110
|
|
|
|
|
|
|
8 : Can't upgrade package : an error occured during system call |
|
111
|
|
|
|
|
|
|
9 : Package scheduled for install on next reboot. |
|
112
|
|
|
|
|
|
|
10 : An error occured in the Slackware::Slackget::PkgTool class (during installpkg, upgradepkg or removepkg) but the class is unable to understand the error. |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 install |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Take a single Slackware::Slackget::Package object or a single Slackware::Slackget::PackageList as argument and call installpkg on all this packages. |
|
117
|
|
|
|
|
|
|
Return 1 or undef if an error occured. But methods from the Slackware::Slackget::PkgTools class don't return on the first error, it will try to install all packages. Additionnally, for each package, set a status. |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
$pkgtool->install($package_list); |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=cut |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub install { |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub _install_package |
|
126
|
|
|
|
|
|
|
{ |
|
127
|
0
|
|
|
0
|
|
|
my ($self,$pkg) = @_; |
|
128
|
0
|
|
|
|
|
|
my $status = new Slackware::Slackget::Status (success_codes => $self->{SUCCESS_STATUS}, error_codes => $self->{ERROR_STATUS}); |
|
129
|
0
|
0
|
|
|
|
|
if( -e "$self->{CONF}->{common}->{'update-directory'}/package-cache/lock/".$pkg->get_id.".tgz") |
|
130
|
|
|
|
|
|
|
{ |
|
131
|
0
|
|
|
|
|
|
print "\tTrying to install package: $self->{CONF}->{common}->{'update-directory'}/package-cache/lock/".$pkg->get_id.".tgz\n"; |
|
132
|
0
|
0
|
|
|
|
|
if(system("$self->{CONF}->{common}->{pkgtools}->{'installpkg-binary'} $self->{CONF}->{common}->{'update-directory'}/package-cache/lock/".$pkg->get_id.".tgz")==0) |
|
133
|
|
|
|
|
|
|
{ |
|
134
|
0
|
|
|
|
|
|
print "Slackware::Slackget::install: package successfully installed.\n"; |
|
135
|
0
|
|
|
|
|
|
$status->current(PKG_INSTALL_OK); |
|
136
|
0
|
|
|
|
|
|
return $status ; |
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
else |
|
139
|
|
|
|
|
|
|
{ |
|
140
|
0
|
|
|
|
|
|
print "Slackware::Slackget::install: an error occured while installing package.\n"; |
|
141
|
0
|
|
|
|
|
|
$status->current(PKG_INSTALL_FAIL); |
|
142
|
0
|
|
|
|
|
|
return $status ; |
|
143
|
|
|
|
|
|
|
} |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
else |
|
146
|
|
|
|
|
|
|
{ |
|
147
|
0
|
|
|
|
|
|
$status->current(PKG_NOT_FOUND_INSTALL_FAIL); |
|
148
|
0
|
|
|
|
|
|
print "\tUnable to install package: $self->{CONF}->{common}->{'update-directory'}/package-cache/lock/".$pkg->get_id.".tgz\n"; |
|
149
|
0
|
|
|
|
|
|
return $status ; |
|
150
|
|
|
|
|
|
|
} |
|
151
|
|
|
|
|
|
|
} |
|
152
|
0
|
|
|
0
|
1
|
|
my ($self,$object) = @_; |
|
153
|
0
|
0
|
|
|
|
|
if( -e $object ){ |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
154
|
0
|
|
|
|
|
|
print "Slackware::Slackget::install: installing package from a file name (not a Slackware::Slackget::Package)\n"; |
|
155
|
0
|
|
|
|
|
|
my $status = new Slackware::Slackget::Status (success_codes => $self->{SUCCESS_STATUS}, error_codes => $self->{ERROR_STATUS}); |
|
156
|
0
|
0
|
|
|
|
|
if(system("$self->{CONF}->{common}->{pkgtools}->{'installpkg-binary'} $object")==0) |
|
157
|
|
|
|
|
|
|
{ |
|
158
|
0
|
|
|
|
|
|
$status->current(PKG_INSTALL_OK); |
|
159
|
0
|
|
|
|
|
|
return $status ; |
|
160
|
|
|
|
|
|
|
} |
|
161
|
|
|
|
|
|
|
else |
|
162
|
|
|
|
|
|
|
{ |
|
163
|
0
|
|
|
|
|
|
$status->current(PKG_INSTALL_FAIL); |
|
164
|
0
|
|
|
|
|
|
return $status ; |
|
165
|
|
|
|
|
|
|
} |
|
166
|
0
|
|
|
|
|
|
return $status ; |
|
167
|
|
|
|
|
|
|
} |
|
168
|
|
|
|
|
|
|
elsif(ref($object) eq 'Slackware::Slackget::PackageList') |
|
169
|
|
|
|
|
|
|
{ |
|
170
|
|
|
|
|
|
|
# print "[install] Do the job for a Slackware::Slackget::PackageList\n"; |
|
171
|
0
|
|
|
|
|
|
foreach my $pack ( @{ $object->get_all() }) |
|
|
0
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
{ |
|
173
|
|
|
|
|
|
|
# print "[install] sending ",$pack->get_id," to _install_package.\n"; |
|
174
|
0
|
|
|
|
|
|
$pack->status($self->_install_package($pack)); |
|
175
|
|
|
|
|
|
|
} |
|
176
|
|
|
|
|
|
|
# print "[install] end of the install loop.\n"; |
|
177
|
|
|
|
|
|
|
} |
|
178
|
|
|
|
|
|
|
elsif(ref($object) eq 'Slackware::Slackget::Package') |
|
179
|
|
|
|
|
|
|
{ |
|
180
|
|
|
|
|
|
|
# print "[install] Do the job for a Slackware::Slackget::Package '$object'\n"; |
|
181
|
0
|
|
|
|
|
|
$object->status($self->_install_package($object)); |
|
182
|
|
|
|
|
|
|
} |
|
183
|
|
|
|
|
|
|
else |
|
184
|
|
|
|
|
|
|
{ |
|
185
|
0
|
|
|
|
|
|
return undef; |
|
186
|
|
|
|
|
|
|
} |
|
187
|
|
|
|
|
|
|
# print "[Slackware::Slackget::PkgTools DEBUG] all job processed.\n"; |
|
188
|
|
|
|
|
|
|
} |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head2 upgrade |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
Take a single Slackware::Slackget::Package object or a single Slackware::Slackget::PackageList as argument and call upgradepkg on all this packages. |
|
193
|
|
|
|
|
|
|
Return 1 or undef if an error occured. But methods from the Slackware::Slackget::PkgTools class don't return on the first error, it will try to install all packages. Additionnally, for each package, set a status. |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
$pkgtool->install($package_list) ; |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=cut |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
sub upgrade { |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
sub _upgrade_package |
|
202
|
|
|
|
|
|
|
{ |
|
203
|
0
|
|
|
0
|
|
|
my ($self,$pkg) = @_; |
|
204
|
0
|
|
|
|
|
|
my $status = new Slackware::Slackget::Status (success_codes => $self->{SUCCESS_STATUS}, error_codes => $self->{ERROR_STATUS}); |
|
205
|
|
|
|
|
|
|
#$self->{CONF}->{common}->{'update-directory'}/".$server->shortname."/cache/ |
|
206
|
0
|
0
|
|
|
|
|
if( -e "$self->{CONF}->{common}->{'update-directory'}/package-cache/lock/".$pkg->get_id.".tgz") |
|
207
|
|
|
|
|
|
|
{ |
|
208
|
0
|
|
|
|
|
|
print "\tTrying to upgrade package: $self->{CONF}->{common}->{'update-directory'}/package-cache/lock/".$pkg->get_id.".tgz\n"; |
|
209
|
0
|
0
|
|
|
|
|
if(system("$self->{CONF}->{common}->{pkgtools}->{'upgradepkg-binary'} $self->{CONF}->{common}->{'update-directory'}/package-cache/lock/".$pkg->get_id.".tgz")==0) |
|
210
|
|
|
|
|
|
|
{ |
|
211
|
0
|
|
|
|
|
|
$status->current(PKG_UPGRADE_OK); |
|
212
|
0
|
|
|
|
|
|
return $status ; |
|
213
|
|
|
|
|
|
|
} |
|
214
|
|
|
|
|
|
|
else |
|
215
|
|
|
|
|
|
|
{ |
|
216
|
0
|
|
|
|
|
|
$status->current(PKG_UPGRADE_FAIL); |
|
217
|
0
|
|
|
|
|
|
return $status ; |
|
218
|
|
|
|
|
|
|
} |
|
219
|
|
|
|
|
|
|
} |
|
220
|
|
|
|
|
|
|
else |
|
221
|
|
|
|
|
|
|
{ |
|
222
|
0
|
|
|
|
|
|
$status->current(PKG_NOT_FOUND_UPGRADE_FAIL); |
|
223
|
0
|
|
|
|
|
|
print "\tUnable to upgrade package: $self->{CONF}->{common}->{'update-directory'}/package-cache/lock/".$pkg->get_id.".tgz\n"; |
|
224
|
0
|
|
|
|
|
|
return $status ; |
|
225
|
|
|
|
|
|
|
} |
|
226
|
|
|
|
|
|
|
} |
|
227
|
0
|
|
|
0
|
1
|
|
my ($self,$object) = @_; |
|
228
|
0
|
0
|
|
|
|
|
if( -e $object ){ |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
229
|
0
|
|
|
|
|
|
my $status = new Slackware::Slackget::Status (success_codes => $self->{SUCCESS_STATUS}, error_codes => $self->{ERROR_STATUS}); |
|
230
|
0
|
0
|
|
|
|
|
if(system("$self->{CONF}->{common}->{pkgtools}->{'upgradepkg-binary'} $object")==0) |
|
231
|
|
|
|
|
|
|
{ |
|
232
|
0
|
|
|
|
|
|
$status->current(PKG_UPGRADE_OK); |
|
233
|
0
|
|
|
|
|
|
return $status ; |
|
234
|
|
|
|
|
|
|
} |
|
235
|
|
|
|
|
|
|
else |
|
236
|
|
|
|
|
|
|
{ |
|
237
|
0
|
|
|
|
|
|
$status->current(PKG_UPGRADE_FAIL); |
|
238
|
0
|
|
|
|
|
|
return $status ; |
|
239
|
|
|
|
|
|
|
} |
|
240
|
0
|
|
|
|
|
|
return $status ; |
|
241
|
|
|
|
|
|
|
} |
|
242
|
|
|
|
|
|
|
elsif(ref($object) eq 'Slackware::Slackget::PackageList') |
|
243
|
|
|
|
|
|
|
{ |
|
244
|
|
|
|
|
|
|
# print "Do the job for a Slackware::Slackget::PackageList\n"; |
|
245
|
0
|
|
|
|
|
|
foreach my $pack ( @{ $object->get_all() }) |
|
|
0
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
{ |
|
247
|
0
|
|
|
|
|
|
$pack->status($self->_upgrade_package($pack)); |
|
248
|
|
|
|
|
|
|
} |
|
249
|
|
|
|
|
|
|
} |
|
250
|
|
|
|
|
|
|
elsif(ref($object) eq 'Slackware::Slackget::Package') |
|
251
|
|
|
|
|
|
|
{ |
|
252
|
0
|
|
|
|
|
|
print "Slackware::Slackget::upgrade: Do the job for a Slackware::Slackget::Package\n"; |
|
253
|
0
|
|
|
|
|
|
$object->status($self->_upgrade_package($object)); |
|
254
|
|
|
|
|
|
|
} |
|
255
|
|
|
|
|
|
|
else |
|
256
|
|
|
|
|
|
|
{ |
|
257
|
0
|
|
|
|
|
|
print "Slackware::Slackget::upgrade: returning an undefined value for because \$object do not match required types.\n"; |
|
258
|
0
|
|
|
|
|
|
return undef; |
|
259
|
|
|
|
|
|
|
} |
|
260
|
|
|
|
|
|
|
} |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=head2 remove |
|
263
|
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
Take a single Slackware::Slackget::Package object or a single Slackware::Slackget::PackageList as argument and call installpkg on all this packages. |
|
265
|
|
|
|
|
|
|
Return 1 or undef if an error occured. But methods from the Slackware::Slackget::PkgTools class don't return on the first error, it will try to install all packages. Additionnally, for each package, set a status. |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
$pkgtool->remove($package_list); |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
=cut |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
sub remove { |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
sub _remove_package |
|
274
|
|
|
|
|
|
|
{ |
|
275
|
0
|
|
|
0
|
|
|
my ($self,$pkg) = @_; |
|
276
|
0
|
|
|
|
|
|
my $status = new Slackware::Slackget::Status (success_codes => $self->{SUCCESS_STATUS}, error_codes => $self->{ERROR_STATUS}); |
|
277
|
|
|
|
|
|
|
#$self->{CONF}->{common}->{'update-directory'}/".$server->shortname."/cache/ |
|
278
|
0
|
0
|
|
|
|
|
if( -e "$self->{CONF}->{common}->{'packages-history-dir'}/".$pkg->get_id) |
|
279
|
|
|
|
|
|
|
{ |
|
280
|
|
|
|
|
|
|
# print "\tTrying to remove package: ".$pkg->get_id."\n"; |
|
281
|
|
|
|
|
|
|
# TODO: the error output is not logged anymore in the PkgTools calls. It must be fixed. |
|
282
|
0
|
0
|
|
|
|
|
if(system("$self->{CONF}->{common}->{pkgtools}->{'removepkg-binary'} ".$pkg->get_id)==0) |
|
283
|
|
|
|
|
|
|
{ |
|
284
|
0
|
|
|
|
|
|
print "[Slackware::Slackget::PkgTools] (removepkg) setting (success) status ",PKG_REMOVE_OK,"\n"; |
|
285
|
0
|
|
|
|
|
|
$status->current(PKG_REMOVE_OK); |
|
286
|
0
|
|
|
|
|
|
return $status ; |
|
287
|
|
|
|
|
|
|
} |
|
288
|
|
|
|
|
|
|
else |
|
289
|
|
|
|
|
|
|
{ |
|
290
|
0
|
|
|
|
|
|
print "[Slackware::Slackget::PkgTools] (removepkg) setting (failed) status ",PKG_REMOVE_FAIL,"\n"; |
|
291
|
0
|
|
|
|
|
|
$status->current(PKG_REMOVE_FAIL); |
|
292
|
0
|
|
|
|
|
|
return $status ; |
|
293
|
|
|
|
|
|
|
} |
|
294
|
|
|
|
|
|
|
} |
|
295
|
|
|
|
|
|
|
else |
|
296
|
|
|
|
|
|
|
{ |
|
297
|
0
|
|
|
|
|
|
print "[Slackware::Slackget::PkgTools] (removepkg) setting (fail) status ",PKG_NOT_FOUND_REMOVE_FAIL,"\n"; |
|
298
|
0
|
|
|
|
|
|
$status->current(PKG_NOT_FOUND_REMOVE_FAIL); |
|
299
|
0
|
|
|
|
|
|
return $status ; |
|
300
|
|
|
|
|
|
|
} |
|
301
|
|
|
|
|
|
|
} |
|
302
|
0
|
|
|
0
|
1
|
|
my ($self,$object) = @_; |
|
303
|
0
|
0
|
|
|
|
|
if(ref($object) eq 'Slackware::Slackget::PackageList') |
|
|
|
0
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
{ |
|
305
|
|
|
|
|
|
|
# print "Do the job for a Slackware::Slackget::PackageList\n"; |
|
306
|
0
|
|
|
|
|
|
foreach my $pack ( @{ $object->get_all() }) |
|
|
0
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
{ |
|
308
|
0
|
|
|
|
|
|
$pack->status($self->_remove_package($pack)); |
|
309
|
|
|
|
|
|
|
} |
|
310
|
|
|
|
|
|
|
} |
|
311
|
|
|
|
|
|
|
elsif(ref($object) eq 'Slackware::Slackget::Package') |
|
312
|
|
|
|
|
|
|
{ |
|
313
|
|
|
|
|
|
|
# print "Do the job for a Slackware::Slackget::Package\n"; |
|
314
|
0
|
|
|
|
|
|
$object->status($self->_remove_package($object)); |
|
315
|
|
|
|
|
|
|
} |
|
316
|
|
|
|
|
|
|
else |
|
317
|
|
|
|
|
|
|
{ |
|
318
|
0
|
|
|
|
|
|
return undef; |
|
319
|
|
|
|
|
|
|
} |
|
320
|
|
|
|
|
|
|
} |
|
321
|
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
=head1 AUTHOR |
|
323
|
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
DUPUIS Arnaud, C<< >> |
|
325
|
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
=head1 BUGS |
|
327
|
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
|
329
|
|
|
|
|
|
|
C, or through the web interface at |
|
330
|
|
|
|
|
|
|
L. |
|
331
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
|
332
|
|
|
|
|
|
|
your bug as I make changes. |
|
333
|
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
=head1 SUPPORT |
|
335
|
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
337
|
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
perldoc Slackware::Slackget |
|
339
|
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
You can also look for information at: |
|
342
|
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
=over 4 |
|
344
|
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
=item * Infinity Perl website |
|
346
|
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
L |
|
348
|
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
=item * slack-get specific website |
|
350
|
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
L |
|
352
|
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
354
|
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
L |
|
356
|
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
358
|
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
L |
|
360
|
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
362
|
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
L |
|
364
|
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
=item * Search CPAN |
|
366
|
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
L |
|
368
|
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
=back |
|
370
|
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
372
|
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
Thanks to Bertrand Dupuis (yes my brother) for his contribution to the documentation. |
|
374
|
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
376
|
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
378
|
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
Copyright 2005 DUPUIS Arnaud, All Rights Reserved. |
|
380
|
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
382
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
383
|
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
=cut |
|
385
|
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
1; # End of Slackware::Slackget::PkgTools |