/[gentoo-perl]/up2date-ng/trunk/bin/up2date-ng.pl
Gentoo

Diff of /up2date-ng/trunk/bin/up2date-ng.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 22 Revision 23
4# 4#
5# up2date-ng.pl 5# up2date-ng.pl
6# 6#
7# date : 2006-04-22 7# date : 2006-04-22
8# author : Christian Hartmann <ian@gentoo.org> 8# author : Christian Hartmann <ian@gentoo.org>
9# version : 0.13 9# version : 0.14
10# license : GPL-2 10# license : GPL-2
11# description : Scripts that compares the versions of perl packages in portage 11# description : Scripts that compares the versions of perl packages in portage
12# with the version of the packages on CPAN 12# with the version of the packages on CPAN
13# 13#
14# header : $Header: $ 14# header : $Header: $
30use Term::ANSIColor; 30use Term::ANSIColor;
31use Getopt::Long; 31use Getopt::Long;
32Getopt::Long::Configure("bundling"); 32Getopt::Long::Configure("bundling");
33 33
34# - init vars & contants > 34# - init vars & contants >
35my $VERSION = "0.13"; 35my $VERSION = "0.14";
36my $portdir = getParamFromFile(getFileContents("/etc/make.conf"),"PORTDIR","lastseen") || "/usr/portage"; 36my $portdir = getParamFromFile(getFileContents("/etc/make.conf"),"PORTDIR","lastseen") || "/usr/portage";
37my @scan_portage_categories = qw(dev-perl perl-core); 37my @scan_portage_categories = qw(dev-perl perl-core);
38my $package_mask_file = "up2date_package.mask"; 38my $package_mask_file = "up2date_package.mask";
39my $package_altname_file = "up2date_package.altname";
39my @timeData = localtime(time); 40my @timeData = localtime(time);
40my %modules = (); 41my %modules = ();
41my @tmp_availableVersions = (); 42my @tmp_availableVersions = ();
42my @packages2update = (); 43my @packages2update = ();
43my @tmp_v = (); 44my @tmp_v = ();
44my %pmask = (); 45my %pmask = ();
46my %paltname = ();
47my @need_packagealtname = ();
45my $p_modulename = ""; 48my $p_modulename = "";
46my $xml_packagelist_table = ""; 49my $xml_packagelist_table = "";
47my $mail_packagelist_table = ""; 50my $mail_packagelist_table = "";
48my $html_packagelist_table = ""; 51my $html_packagelist_table = "";
49my $cat_pkg = ""; 52my $cat_pkg = "";
93 96
94 $pmask{'all'} = getFileContents($package_mask_file); 97 $pmask{'all'} = getFileContents($package_mask_file);
95 98
96 foreach my $line (split(/\n/,$pmask{'all'})) 99 foreach my $line (split(/\n/,$pmask{'all'}))
97 { 100 {
101 $line=~s/^[ |\t]+//; # leading whitespaces and tabs
98 $line=~s/[ |\t]+$//; # remove trailing whitespaces and tabs 102 $line=~s/[ |\t]+$//; # trailing whitespaces and tabs
99 103 $line=~s/#(.*)//g; # remove comments
104
105 if ($line ne "")
106 {
100 if (substr($line,0,2) eq ">=") 107 if (substr($line,0,2) eq ">=")
101 { 108 {
102 # - block package versions greater/equal then given version (e.g. >=dev-perl/Video-Info-0.999) > 109 # - block package versions greater/equal then given version (e.g. >=dev-perl/Video-Info-0.999) >
103 $tmp=substr($line,2,length($line)-2); 110 $tmp=substr($line,2,length($line)-2);
104 $tmp=~s/([a-zA-Z\-]+)\/([a-zA-Z\-]+)-([0-9a-zA-Z\._\-]+)/$1\/$2/; 111 $tmp=~s/([a-zA-Z\-]+)\/([a-zA-Z\-]+)-([0-9a-zA-Z\._\-]+)/$1\/$2/;
105 $pmask{'package'}{$tmp}{'version'}=$3; 112 $pmask{'package'}{$tmp}{'version'}=$3;
106 $pmask{'package'}{$tmp}{'operator'}=">="; 113 $pmask{'package'}{$tmp}{'operator'}=">=";
107 } 114 }
108 elsif (substr($line,0,1) eq ">") 115 elsif (substr($line,0,1) eq ">")
109 { 116 {
110 # - block package versions greater then given version (e.g. >dev-perl/Video-Info-0.993) > 117 # - block package versions greater then given version (e.g. >dev-perl/Video-Info-0.993) >
111 $tmp=substr($line,1,length($line)-1); 118 $tmp=substr($line,1,length($line)-1);
112 $tmp=~s/([a-zA-Z\-]+)\/([a-zA-Z\-]+)-([0-9a-zA-Z\._\-]+)/$1\/$2/; 119 $tmp=~s/([a-zA-Z\-]+)\/([a-zA-Z\-]+)-([0-9a-zA-Z\._\-]+)/$1\/$2/;
113 $pmask{'package'}{$tmp}{'version'}=$3; 120 $pmask{'package'}{$tmp}{'version'}=$3;
114 $pmask{'package'}{$tmp}{'operator'}=">"; 121 $pmask{'package'}{$tmp}{'operator'}=">";
115 } 122 }
116 elsif (substr($line,0,1) eq "=") 123 elsif (substr($line,0,1) eq "=")
117 { 124 {
118 # - block one package version (e.g. =dev-perl/Video-Info-0.999) > 125 # - block one package version (e.g. =dev-perl/Video-Info-0.999) >
119 $tmp=substr($line,1,length($line)-1); 126 $tmp=substr($line,1,length($line)-1);
120 $tmp=~s/([a-zA-Z\-]+)\/([a-zA-Z\-]+)-([0-9a-zA-Z\._\-]+)/$1\/$2/; 127 $tmp=~s/([a-zA-Z\-]+)\/([a-zA-Z\-]+)-([0-9a-zA-Z\._\-]+)/$1\/$2/;
121 $pmask{'package'}{$tmp}{'version'}=$3; 128 $pmask{'package'}{$tmp}{'version'}=$3;
122 $pmask{'package'}{$tmp}{'operator'}="="; 129 $pmask{'package'}{$tmp}{'operator'}="=";
123 } 130 }
124 else 131 else
125 { 132 {
126 # - block whole package (e.g. dev-perl/Video-Info) > 133 # - block whole package (e.g. dev-perl/Video-Info) >
127 $tmp=$line; 134 $tmp=$line;
128 $pmask{'package'}{$tmp}{'operator'}="*"; 135 $pmask{'package'}{$tmp}{'operator'}="*";
129 $pmask{'package'}{$tmp}{'version'}=0; 136 $pmask{'package'}{$tmp}{'version'}=0;
130 } 137 }
131 138
132 if ($DEBUG) 139 if ($DEBUG)
133 { 140 {
134 print "package: ".$tmp."\n"; 141 print "package: ".$tmp."\n";
135 print "pmask{'package'}{'".$tmp."'}{'version'} : ".$pmask{'package'}{$tmp}{'version'}."\n"; 142 print "pmask{'package'}{'".$tmp."'}{'version'} : ".$pmask{'package'}{$tmp}{'version'}."\n";
136 print "pmask{'package'}{'".$tmp."'}{'operator'}: ".$pmask{'package'}{$tmp}{'operator'}."\n"; 143 print "pmask{'package'}{'".$tmp."'}{'operator'}: ".$pmask{'package'}{$tmp}{'operator'}."\n";
137 print "\n"; 144 print "\n";
145 }
138 } 146 }
139 } 147 }
140} 148}
141else 149else
142{ 150{
143 print $green." *".$reset." No package.mask file available - Skipping\n"; 151 print $green." *".$reset." No package.mask file available - Skipping\n";
152}
153
154# - Parse up2date_package.mask >
155if (-f $package_altname_file)
156{
157 print $green." *".$reset." parsing ".$package_altname_file."\n";
158
159 $paltname{'all'} = getFileContents($package_altname_file);
160
161 foreach my $line (split(/\n/,$paltname{'all'}))
162 {
163 $line=~s/^[ |\t]+//; # leading whitespaces and tabs
164 $line=~s/[ |\t]+$//; # trailing whitespaces and tabs
165 $line=~s/#(.*)//g; # remove comments
166
167 if ($line ne "" && $line ne " ")
168 {
169 $line=~s/[ |\t]+/ /; # remove multiple whitespaces and tabs
170 my @tmp=split(/ /,$line);
171
172 # - set $paltname{'portage'}{<portage-packagename>} = <cpan-packagename> (in lowercase) >
173 $paltname{'portage'}{lc($tmp[0])}=lc($tmp[1]);
174
175 if ($DEBUG) { print $tmp[0]." ".$paltname{'portage'}{lc($tmp[0])}."\n"; }
176 }
177 }
178}
179else
180{
181 print $green." *".$reset." No package.altname file available - Skipping\n";
144} 182}
145 183
146# - get package/version info from portage and cpan > 184# - get package/version info from portage and cpan >
147print "\n"; 185print "\n";
148print $green." *".$reset." getting infos from CPAN\n"; 186print $green." *".$reset." getting infos from CPAN\n";
159 $p_modulename=~s/-/::/g; 197 $p_modulename=~s/-/::/g;
160 198
161 if (! defined $modules{'cpan_lc'}{$p_modulename}) 199 if (! defined $modules{'cpan_lc'}{$p_modulename})
162 { 200 {
163 # - Could not find a matching package name - probably not a CPAN-module > 201 # - Could not find a matching package name - probably not a CPAN-module >
164 if ($DEBUG) { print "ERROR: Could not find CPAN-Module ('".$p_modulename."') for package '".$p_original_modulename."'!\n"; } 202 if ($DEBUG) { print "- Could not find CPAN-Module ('".$p_modulename."') for package '".$p_original_modulename."'!\n"; }
165 }
166 else
167 {
168 # - Package found >
169
170 # - Convert portage version >
171 @tmp_v=split(/\./,$modules{'portage_lc'}{$p_original_modulename});
172 if ($#tmp_v > 1)
173 { 203
174 if ($DEBUG) { print " converting version -> ".$modules{'portage_lc'}{$p_original_modulename}; } 204 # - Look for an entry in up2date_package.altname for this package >
175 $modules{'portage_lc'}{$p_original_modulename}=$tmp_v[0]."."; 205 if ($paltname{'portage'}{$p_original_modulename})
176 for (1..$#tmp_v) { $modules{'portage_lc'}{$p_original_modulename}.= $tmp_v[$_]; }
177 if ($DEBUG) { print " -> ".$modules{'portage_lc'}{$p_original_modulename}."\n"; }
178 }
179
180 # - Convert CPAN version >
181 @tmp_v=split(/\./,$modules{'cpan_lc'}{$p_modulename});
182 if ($#tmp_v > 1)
183 {
184 if ($DEBUG) { print " converting version -> ".$modules{'cpan_lc'}{$p_modulename}; }
185 $modules{'cpan_lc'}{$p_modulename}=$tmp_v[0].".";
186 for (1..$#tmp_v) { $modules{'cpan_lc'}{$p_modulename}.= $tmp_v[$_]; }
187 if ($DEBUG) { print " -> ".$modules{'cpan_lc'}{$p_modulename}."\n"; }
188 }
189
190 # - Portage package matches CPAN package >
191 if ($modules{'cpan_lc'}{$p_modulename} > $modules{'portage_lc'}{$p_original_modulename})
192 {
193 # - package needs some lovin - check if package/version has been masked >
194 $cat_pkg = $modules{'portage'}{$p_original_modulename}{'category'}."/".$modules{'portage'}{$p_original_modulename}{'name'};
195
196 if (defined $pmask{'package'}{$cat_pkg}{'operator'})
197 { 206 {
198 # - package is masked > 207 # - found entry in package.altname >
199 if ($pmask{'package'}{$tmp}{'operator'} eq "*") 208 if ($paltname{'portage'}{$p_original_modulename} ne "-")
209 {
210 if ($DEBUG) { print "- Found entry for this package. Using '".$paltname{'portage'}{$p_original_modulename}."' now.\n"; }
211
212 $p_modulename=$paltname{'portage'}{$p_original_modulename};
213
214 if (! defined $modules{'cpan_lc'}{$p_modulename})
200 { 215 {
201 # - all versions of this package have been masked - skip > 216 # - entry in package.altname does not match >
202 if ($DEBUG) { print "All versions of this package have been masked - skip\n"; } 217 if ($DEBUG) { print "- Could not find CPAN-Module for given entry ('".$paltname{'portage'}{$p_original_modulename}."')! Please correct! Skipping..\n"; }
218 push(@need_packagealtname,$modules{'portage'}{$p_original_modulename}{'name'});
203 next; 219 next;
204 } 220 }
221 }
222 else
223 {
224 # - Package has been marked as "non-CPAN-module" >
225 if ($DEBUG) { print "- Package '".$p_modulename."' has been marked as non-CPAN-module. Skipping.\n"; }
226 next;
227 }
228 }
229 else
230 {
231 # - no entry in package.altname found for $p_modulename >
232 if ($DEBUG) { print "- No entry in package.altname found for package '".$p_modulename."'!\n"; }
233 push(@need_packagealtname,$modules{'portage'}{$p_original_modulename}{'name'});
234 next;
235 }
236 }
237
238 # - Package found >
239
240 # - Convert portage version >
241 @tmp_v=split(/\./,$modules{'portage_lc'}{$p_original_modulename});
242 if ($#tmp_v > 1)
243 {
244 if ($DEBUG) { print " converting version -> ".$modules{'portage_lc'}{$p_original_modulename}; }
245 $modules{'portage_lc'}{$p_original_modulename}=$tmp_v[0].".";
246 for (1..$#tmp_v) { $modules{'portage_lc'}{$p_original_modulename}.= $tmp_v[$_]; }
247 if ($DEBUG) { print " -> ".$modules{'portage_lc'}{$p_original_modulename}."\n"; }
248 }
249
250 # - Convert CPAN version >
251 @tmp_v=split(/\./,$modules{'cpan_lc'}{$p_modulename});
252 if ($#tmp_v > 1)
253 {
254 if ($DEBUG) { print " converting version -> ".$modules{'cpan_lc'}{$p_modulename}; }
255 $modules{'cpan_lc'}{$p_modulename}=$tmp_v[0].".";
256 for (1..$#tmp_v) { $modules{'cpan_lc'}{$p_modulename}.= $tmp_v[$_]; }
257 if ($DEBUG) { print " -> ".$modules{'cpan_lc'}{$p_modulename}."\n"; }
258 }
259
260 # - Portage package matches CPAN package >
261 if ($modules{'cpan_lc'}{$p_modulename} > $modules{'portage_lc'}{$p_original_modulename})
262 {
263 # - package needs some lovin - check if package/version has been masked >
264 $cat_pkg = $modules{'portage'}{$p_original_modulename}{'category'}."/".$modules{'portage'}{$p_original_modulename}{'name'};
265
266 if (defined $pmask{'package'}{$cat_pkg}{'operator'})
267 {
268 # - package is masked >
269 if ($pmask{'package'}{$tmp}{'operator'} eq "*")
270 {
271 # - all versions of this package have been masked - skip >
272 if ($DEBUG) { print "All versions of this package have been masked - skip\n"; }
273 next;
274 }
205 elsif ($pmask{'package'}{$tmp}{'operator'} eq ">=") 275 elsif ($pmask{'package'}{$tmp}{'operator'} eq ">=")
276 {
277 # - all versions greater/equal than {'version'} have been masked >
278 if ($modules{'cpan_lc'}{$p_modulename} >= $pmask{'package'}{$tmp}{'version'})
206 { 279 {
207 # - all versions greater/equal than {'version'} have been masked >
208 if ($modules{'cpan_lc'}{$p_modulename} >= $pmask{'package'}{$tmp}{'version'})
209 {
210 # - cpan version has been masked - skip > 280 # - cpan version has been masked - skip >
211 if ($DEBUG) { print "cpan version has been masked - skip\n"; } 281 if ($DEBUG) { print "cpan version has been masked - skip\n"; }
212 next; 282 next;
213 }
214 } 283 }
284 }
215 elsif ($pmask{'package'}{$tmp}{'operator'} eq ">") 285 elsif ($pmask{'package'}{$tmp}{'operator'} eq ">")
286 {
287 # - all versions greater than {'version'} have been masked >
288 if ($modules{'cpan_lc'}{$p_modulename} > $pmask{'package'}{$tmp}{'version'})
216 { 289 {
217 # - all versions greater than {'version'} have been masked >
218 if ($modules{'cpan_lc'}{$p_modulename} > $pmask{'package'}{$tmp}{'version'})
219 {
220 # - cpan version has been masked - skip > 290 # - cpan version has been masked - skip >
221 if ($DEBUG) { print "cpan version has been masked - skip\n"; } 291 if ($DEBUG) { print "cpan version has been masked - skip\n"; }
222 next; 292 next;
223 }
224 } 293 }
294 }
225 elsif ($pmask{'package'}{$tmp}{'operator'} eq "=") 295 elsif ($pmask{'package'}{$tmp}{'operator'} eq "=")
296 {
297 # - this version has been masked >
298 if ($modules{'cpan_lc'}{$p_modulename} == $pmask{'package'}{$tmp}{'version'})
226 { 299 {
227 # - this version has been masked >
228 if ($modules{'cpan_lc'}{$p_modulename} == $pmask{'package'}{$tmp}{'version'})
229 {
230 # - cpan version has been masked - skip > 300 # - cpan version has been masked - skip >
231 if ($DEBUG) { print "cpan version has been masked - skip\n"; } 301 if ($DEBUG) { print "cpan version has been masked - skip\n"; }
232 next; 302 next;
233 }
234 } 303 }
235 } 304 }
305 }
236 306
237 if ($verbose) { print $modules{'portage'}{$p_original_modulename}{'category'}."/".$modules{'portage'}{$p_original_modulename}{'name'}." needs updating. Ebuild: ".$modules{'portage_lc'}{$p_original_modulename}."; CPAN: ".$modules{'cpan_lc'}{$p_modulename}."\n"; } 307 if ($verbose) { print $modules{'portage'}{$p_original_modulename}{'category'}."/".$modules{'portage'}{$p_original_modulename}{'name'}." needs updating. Ebuild: ".$modules{'portage_lc'}{$p_original_modulename}."; CPAN: ".$modules{'cpan_lc'}{$p_modulename}."\n"; }
238 308
239 # - store packagename - it needs to be updated > 309 # - store packagename - it needs to be updated >
240 push(@packages2update,$modules{'portage'}{$p_original_modulename}{'category'}."/".$modules{'portage'}{$p_original_modulename}{'name'}); 310 push(@packages2update,$modules{'portage'}{$p_original_modulename}{'category'}."/".$modules{'portage'}{$p_original_modulename}{'name'});
241 311
242 if ($generate_xml) 312 if ($generate_xml)
243 { 313 {
244 $xml_packagelist_table .= " <tr>\n"; 314 $xml_packagelist_table .= " <tr>\n";
245 $xml_packagelist_table .= " <ti>".$modules{'portage'}{$p_original_modulename}{'name'}."</ti>\n"; 315 $xml_packagelist_table .= " <ti>".$modules{'portage'}{$p_original_modulename}{'name'}."</ti>\n";
246 $xml_packagelist_table .= " <ti>".$modules{'portage_lc'}{$p_original_modulename}."</ti>\n"; 316 $xml_packagelist_table .= " <ti>".$modules{'portage_lc'}{$p_original_modulename}."</ti>\n";
247 $xml_packagelist_table .= " <ti>".$modules{'cpan_lc'}{$p_modulename}."</ti>\n"; 317 $xml_packagelist_table .= " <ti>".$modules{'cpan_lc'}{$p_modulename}."</ti>\n";
248 $xml_packagelist_table .= " </tr>\n"; 318 $xml_packagelist_table .= " </tr>\n";
249 } 319 }
250 320
251 if ($generate_mail) 321 if ($generate_mail)
252 { 322 {
253 $mail_packagelist_table .= " ".$modules{'portage'}{$p_original_modulename}{'name'}; 323 $mail_packagelist_table .= " ".$modules{'portage'}{$p_original_modulename}{'name'};
254 for(0..(35-length($modules{'portage_lc'}{$p_original_modulename})-length($p_original_modulename))) 324 for(0..(35-length($modules{'portage_lc'}{$p_original_modulename})-length($p_original_modulename)))
255 { 325 {
256 $mail_packagelist_table .= " "; 326 $mail_packagelist_table .= " ";
257 } 327 }
258 $mail_packagelist_table .= " ".$modules{'portage_lc'}{$p_original_modulename}; 328 $mail_packagelist_table .= " ".$modules{'portage_lc'}{$p_original_modulename};
259 for(0..(20-length($modules{'cpan_lc'}{$p_modulename}))) 329 for(0..(20-length($modules{'cpan_lc'}{$p_modulename})))
260 { 330 {
261 $mail_packagelist_table .= " "; 331 $mail_packagelist_table .= " ";
262 } 332 }
263 $mail_packagelist_table .= " ".$modules{'cpan_lc'}{$p_modulename}; 333 $mail_packagelist_table .= " ".$modules{'cpan_lc'}{$p_modulename};
264 $mail_packagelist_table .= "\n"; 334 $mail_packagelist_table .= "\n";
265 } 335 }
266 336
267 if ($generate_html) 337 if ($generate_html)
268 { 338 {
269 $html_packagelist_table .= "\t\t\t<tr>\n"; 339 $html_packagelist_table .= "\t\t\t<tr>\n";
270 $html_packagelist_table .= "\t\t\t\t<td>".$modules{'portage'}{$p_original_modulename}{'name'}."</td>\n"; 340 $html_packagelist_table .= "\t\t\t\t<td>".$modules{'portage'}{$p_original_modulename}{'name'}."</td>\n";
271 $html_packagelist_table .= "\t\t\t\t<td>".$modules{'portage_lc'}{$p_original_modulename}."</td>\n"; 341 $html_packagelist_table .= "\t\t\t\t<td>".$modules{'portage_lc'}{$p_original_modulename}."</td>\n";
272 $html_packagelist_table .= "\t\t\t\t<td>".$modules{'cpan_lc'}{$p_modulename}."</td>\n"; 342 $html_packagelist_table .= "\t\t\t\t<td>".$modules{'cpan_lc'}{$p_modulename}."</td>\n";
273 $html_packagelist_table .= "\t\t\t</tr>\n"; 343 $html_packagelist_table .= "\t\t\t</tr>\n";
274 } 344 }
275 } 345 }
276 else 346 else
277 { 347 {
278 if ($DEBUG) { print $p_original_modulename.".. ok\n"; } 348 if ($DEBUG) { print $p_original_modulename." is uptodate\n"; }
279 }
280 } 349 }
281} 350}
282 351
283print "\n"; 352print "\n";
284print $green." *".$reset." total packages suspected as outdated: ".($#packages2update+1)."\n"; 353print $green." *".$reset." total packages suspected as outdated: ".($#packages2update+1)."\n";
296 365
297 print $green." *".$reset." creating outdated-cpan-packages.xml\n"; 366 print $green." *".$reset." creating outdated-cpan-packages.xml\n";
298 open(FH,">outdated-cpan-packages.xml") || die ("Cannot open/write to file outdated-cpan-packages.xml"); 367 open(FH,">outdated-cpan-packages.xml") || die ("Cannot open/write to file outdated-cpan-packages.xml");
299 print FH $xml; 368 print FH $xml;
300 close(FH); 369 close(FH);
301 print $green." *".$reset." done!\n"; 370 print $green." *".$reset." done!\n\n";
302} 371}
303 372
304# - Generate mail > 373# - Generate mail >
305if ($generate_mail) 374if ($generate_mail)
306{ 375{
311 380
312 print $green." *".$reset." creating outdated-cpan-packages.mail\n"; 381 print $green." *".$reset." creating outdated-cpan-packages.mail\n";
313 open(FH,">outdated-cpan-packages.mail") || die ("Cannot open/write to file outdated-cpan-packages.mail"); 382 open(FH,">outdated-cpan-packages.mail") || die ("Cannot open/write to file outdated-cpan-packages.mail");
314 print FH $mail; 383 print FH $mail;
315 close(FH); 384 close(FH);
316 print $green." *".$reset." done!\n"; 385 print $green." *".$reset." done!\n\n";
317} 386}
318 387
319# - Generate html > 388# - Generate html >
320if ($generate_html) 389if ($generate_html)
321{ 390{
328 397
329 print $green." *".$reset." creating outdated-cpan-packages.html\n"; 398 print $green." *".$reset." creating outdated-cpan-packages.html\n";
330 open(FH,">outdated-cpan-packages.html") || die ("Cannot open/write to file outdated-cpan-packages.html"); 399 open(FH,">outdated-cpan-packages.html") || die ("Cannot open/write to file outdated-cpan-packages.html");
331 print FH $html; 400 print FH $html;
332 close(FH); 401 close(FH);
333 print $green." *".$reset." done!\n"; 402 print $green." *".$reset." done!\n\n";
334} 403}
335 404
336# - Generate packagelist > 405# - Generate packagelist >
337if ($generate_packagelist) 406if ($generate_packagelist)
338{ 407{
342 foreach (@packages2update) 411 foreach (@packages2update)
343 { 412 {
344 print FH $_."\n"; 413 print FH $_."\n";
345 } 414 }
346 close(FH); 415 close(FH);
347 print $green." *".$reset." done!\n"; 416 print $green." *".$reset." done!\n\n";
417}
418
419# - Any packages not found? Do we need additional entries in package.altname? >
420if ($#need_packagealtname >= 0)
421{
422 print $yellow." *".$reset." ".($#need_packagealtname+1)." packages were found where a package.altname entry is missing or wrong:\n";
423 foreach (@need_packagealtname)
424 {
425 print " - ".$_."\n";
426 }
427 print " Please add entries for these packages to the package.altname file.\n";
348} 428}
349 429
350print "\n"; 430print "\n";
351exit(0); 431exit(0);
352 432
378 } 458 }
379 459
380 # - get highest version > 460 # - get highest version >
381 if ($#tmp_availableVersions>-1) 461 if ($#tmp_availableVersions>-1)
382 { 462 {
383 $modules{'portage_lc'}{lc($tp)}=(sort(@tmp_availableVersions))[$#tmp_availableVersions]; 463 $modules{'portage_lc_realversion'}{lc($tp)}=(sort(@tmp_availableVersions))[$#tmp_availableVersions];
464 $modules{'portage_lc'}{lc($tp)}=$modules{'portage_lc_realversion'}{lc($tp)};
465
466 # - get rid of -rX >
467 $modules{'portage_lc'}{lc($tp)}=~s/([a-zA-Z0-9\-_\/]+)-r[0-9+]/$1/;
468 $modules{'portage_lc'}{lc($tp)}=~s/([a-zA-Z0-9\-_\/]+)-rc[0-9+]/$1/;
469 $modules{'portage_lc'}{lc($tp)}=~s/([a-zA-Z0-9\-_\/]+)_p[0-9+]/$1/;
470
471 # - get rid of other stuff we don't want >
472 $modules{'portage_lc'}{lc($tp)}=~s/([a-zA-Z0-9\-_\/]+)_alpha/$1/;
473 $modules{'portage_lc'}{lc($tp)}=~s/([a-zA-Z0-9\-_\/]+)_beta/$1/;
474 $modules{'portage_lc'}{lc($tp)}=~s/[a-zA-Z]+$//;
475
384 $modules{'portage'}{lc($tp)}{'name'}=$tp; 476 $modules{'portage'}{lc($tp)}{'name'}=$tp;
385 $modules{'portage'}{lc($tp)}{'category'}=$tc; 477 $modules{'portage'}{lc($tp)}{'category'}=$tc;
386 } 478 }
387 } 479 }
388 } 480 }
531} 623}
532 624
533 625
534# Description: 626# Description:
535# Returns version of an ebuild. (Without -rX string etc.) 627# Returns version of an ebuild. (Without -rX string etc.)
536# $version = getEbuildVersionSpecial("/path/to/ebuild"); 628# $version = getEbuildVersionSpecial("foo-1.23-r1.ebuild");
537sub getEbuildVersionSpecial 629sub getEbuildVersionSpecial
538{ 630{
539 my $ebuildVersion = shift; 631 my $ebuildVersion = shift;
540 $ebuildVersion =~ s/([a-zA-Z0-9\-_\/]+)-([0-9a-zA-Z\._\-]+)\.ebuild/$2/; 632 $ebuildVersion=substr($ebuildVersion,0,length($ebuildVersion)-7);
541 633 $ebuildVersion =~ s/^([a-zA-Z0-9\-_\/\+]*)-([0-9\.]+[a-zA-Z]?)([\-r|\-rc|_alpha|_beta|_pre|_p]?)/$2$3/;
542 # - get rid of -rX > 634
543 $ebuildVersion=~s/([a-zA-Z0-9\-_\/]+)-r[0-9+]/$1/;
544 $ebuildVersion=~s/([a-zA-Z0-9\-_\/]+)-rc[0-9+]/$1/;
545 $ebuildVersion=~s/([a-zA-Z0-9\-_\/]+)_p[0-9+]/$1/;
546
547 # - get rid of other stuff we don't want >
548 $ebuildVersion=~s/([a-zA-Z0-9\-_\/]+)_alpha/$1/;
549 $ebuildVersion=~s/([a-zA-Z0-9\-_\/]+)_beta/$1/;
550 $ebuildVersion=~s/[a-zA-Z]+$//;
551
552 return $ebuildVersion; 635 return $ebuildVersion;
553} 636}
554 637
555sub getCPANPackages 638sub getCPANPackages
556{ 639{
607 690
608up2date-ng - Compare module versions (ebuild vs CPAN) 691up2date-ng - Compare module versions (ebuild vs CPAN)
609 692
610=head1 VERSION 693=head1 VERSION
611 694
612This document refers to version 0.13 of up2date-ng 695This document refers to version 0.14 of up2date-ng
613 696
614=head1 SYNOPSIS 697=head1 SYNOPSIS
615 698
616up2date-ng [option]... 699up2date-ng [option]...
617 700

Legend:
Removed from v.22  
changed lines
  Added in v.23

  ViewVC Help
Powered by ViewVC 1.1.20