Changeset 1507 in ProjectBuilder for devel/pb-modules/lib/ProjectBuilder/Distribution.pm
- Timestamp:
- May 9, 2012, 3:33:18 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb-modules/lib/ProjectBuilder/Distribution.pm
r1505 r1507 15 15 use File::Basename; 16 16 use File::Copy; 17 # requires perl 5.004 minimum in VM/VE 18 use File::Compare; 17 19 18 20 # Global vars … … 441 443 } 442 444 445 # Internal 446 sub pb_distro_compare_repo { 447 448 my $src = shift; 449 my $dest = shift; 450 451 if (-f $dest && -s $dest == 0) { 452 pb_log(1, "Overwriting empty file $dest"); 453 } elsif (-f $dest && compare("$src", $dest) == 0) { 454 pb_log(1, "Overwriting identical file $dest"); 455 } elsif (not -f $dest) { 456 pb_log(1, "Creating new $dest"); 457 } else { 458 pb_log(0, "ERROR: destination file $dest exists and is different than source $src\n"); 459 return(0); 460 } 461 # TRUE 462 return(1); 463 } 464 443 465 =item B<pb_distro_setuprepo_gen> 444 466 … … 469 491 # The repo file can be local or remote. download or copy at the right place 470 492 if (($scheme eq "ftp") || ($scheme eq "http")) { 471 pb_system("wget -O $ENV{'PBTMP'}/$bn $i","Do nwloading additional repository file $i");493 pb_system("wget -O $ENV{'PBTMP'}/$bn $i","Downloading additional repository file $i"); 472 494 } else { 473 495 copy($i,$ENV{'PBTMP'}/$bn); … … 484 506 } elsif ($bn =~ /\.repo$/) { 485 507 # Yum repo 508 my $dest = "/etc/yum.repos.d/$bn"; 509 return if (pb_distro_compare_repo($ENV{'PBTMP'}/$bn,$dest)); 486 510 pb_system("sudo mv $ENV{'PBTMP'}/$bn /etc/yum.repos.d","Adding yum repository") if (not -f "/etc/yum.repos.d/$bn"); 487 511 } elsif ($bn =~ /\.addmedia/) { … … 490 514 pb_system("chmod 755 $ENV{'PBTMP'}/$bn ; sudo $ENV{'PBTMP'}/$bn 2>&1 > /dev/null","Adding urpmi repository"); 491 515 } else { 492 pb_log(0," Unable to deal with repository file $i on rpm distro ! Please report to dev team\n");516 pb_log(0,"ERROR: Unable to deal with repository file $i on rpm distro ! Please report to dev team\n"); 493 517 } 494 518 } elsif ($pbos->{'type'} eq "deb") { 495 if (($bn =~ /\.sources.list$/) && (not -f "/etc/apt/sources.list.d/$bn")) { 519 if ($bn =~ /\.sources.list$/) { 520 my $dest = "/etc/apt/sources.list.d/$bn"; 521 return if (pb_distro_compare_repo($ENV{'PBTMP'}/$bn,$dest)); 496 522 pb_system("sudo mv $ENV{'PBTMP'}/$bn /etc/apt/sources.list.d","Adding apt repository"); 497 523 pb_system("sudo apt-get update","Updating apt repository"); 498 524 } else { 499 pb_log(0," Unable to deal with repository file $i on deb distro ! Please report to dev team\n");525 pb_log(0,"ERROR: Unable to deal with repository file $i on deb distro ! Please report to dev team\n"); 500 526 } 501 527 } else { 502 pb_log(0," Unable to deal with repository file $i on that distro ! Please report to dev team\n");528 pb_log(0,"ERROR: Unable to deal with repository file $i on that distro ! Please report to dev team\n"); 503 529 } 504 530 }
Note:
See TracChangeset
for help on using the changeset viewer.