Changeset 2362 in ProjectBuilder
- Timestamp:
- Feb 25, 2019, 12:20:27 PM (6 years ago)
- Location:
- devel
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb-modules/lib/ProjectBuilder/Conf.pm
r2300 r2362 15 15 16 16 use strict; 17 use Carp 'confess';17 use Carp qw/cluck confess/; 18 18 use Data::Dumper; 19 19 use ProjectBuilder::Base; … … 185 185 # Read the content of the config file and cache it in the %h hash then available for queries 186 186 if ($PBCONFVER < 1) { 187 open(CONF,$cf) || c onfess "Unable to open $cf";187 open(CONF,$cf) || cluck "Unable to open $cf" && return($lh); 188 188 # This is the original conf file format for versions up to 0.14 189 189 while(<CONF>) { … … 331 331 confess "No configuration file defined to write into !" if (not defined $conffile); 332 332 confess "No hash defined to read from !" if (not defined $h); 333 open(CONF,"> $conffile") || c onfess "Unable to write into $conffile";333 open(CONF,"> $conffile") || cluck "Unable to write into $conffile" && return; 334 334 335 335 if ($PBCONFVER < 1) { … … 547 547 my $dest = shift; 548 548 549 open(ORIG,$orig) || c onfess "Unable to open $orig";549 open(ORIG,$orig) || cluck "Unable to open $orig" && return; 550 550 confess "Will not erase existing $dest while transforming $orig" if (-f $dest); 551 open(DEST,"> $dest") || c onfess "Unable to write into $dest";551 open(DEST,"> $dest") || cluck "Unable to write into $dest" && return; 552 552 print DEST "---\n"; 553 553 my $pbconfverbkp = $PBCONFVER; -
devel/pb-modules/lib/ProjectBuilder/Distribution.pm
r2361 r2362 14 14 use strict; 15 15 use Data::Dumper; 16 use Carp 'confess';16 use Carp qw/cluck confess/; 17 17 use ProjectBuilder::Version; 18 18 use ProjectBuilder::Base; … … 228 228 while (($d,$r) = each %$single_rel_files) { 229 229 if (defined $ambiguous_rel_files->{$d}) { 230 print STDERR "The key $d is considered as both unambiguous and ambig ous.\n";230 print STDERR "The key $d is considered as both unambiguous and ambiguous.\n"; 231 231 confess "Please fix your configuration file.\n" 232 232 } … … 291 291 if ($found == 0) { 292 292 print STDERR "Unable to find a version in ".join(' ',keys %$ambiguous_rel_files)." (ambiguous)\n"; 293 print STDERR "Please report to the maintainer bruno_at_project-builder.org\n";294 293 confess "Please report to the maintainer bruno_at_project-builder.org\n"; 295 294 } else { … … 450 449 my $oldsep = $/; 451 450 $/ = $sep; 452 open(DESC,"$f") || c onfess "Unable to open $f";451 open(DESC,"$f") || cluck "Unable to open $f" && return(""); 453 452 while (<DESC>) { 454 453 pb_log(4,"read: $_\n"); … … 541 540 my $res = pb_system("dpkg -L $p","Looking for $p","mayfail"); 542 541 next if ($res eq 0); 543 open(CMD,"dpkg -l $p |") or confess "Unable to run dpkg -l $p: $!";542 open(CMD,"dpkg -l $p |") || cluck "Unable to run dpkg -l $p: $!" && next; 544 543 my $ok = 0; 545 544 while (<CMD>) { … … 689 688 $dirdest = "/etc/zypp/repos.d"; 690 689 } else { 691 confess "Unknown location for repository file for '$pbos->{install}' command"; 690 cluck "Unknown location for repository file for '$pbos->{install}' command"; 691 next; 692 692 } 693 693 my $dest = "$dirdest/$bn"; 694 694 return undef if (pb_distro_compare_repo("$ENV{'PBTMP'}/$bn",$dest) == 1); 695 confess "Missing directory $dirdest ($reponame)" unless (-d $dirdest); 695 if (! -d $dirdest) { 696 cluck "Missing directory $dirdest ($reponame)"; 697 return undef; 698 } 696 699 pb_system("sudo mv $ENV{'PBTMP'}/$bn $dest","Adding $reponame repository") if (not -f "$dest"); 697 700 # OpenSUSE does't seem to import keys automatically … … 699 702 if ($pbos->{install} =~ /\bzypper\b/) { 700 703 my $keyfile = undef; 701 open(REPO,"$dest") || c onfess "Unable to open $dest";704 open(REPO,"$dest") || cluck "Unable to open $dest" && next; 702 705 while (<REPO>) { 703 706 $keyfile = $_; … … 728 731 # Check whether GPG keys for this repo are already known and if 729 732 # not add them 730 open(REPO,"$dest") || c onfess "Unable to open $dest";733 open(REPO,"$dest") || cluck "Unable to open $dest" && next; 731 734 my $debrepo; 732 735 while (<REPO>) { … … 744 747 pb_system("wget -O $ENV{'PBTMP'}/Release.gpg $debrepo/Release.gpg","Downloading $debrepo/Release.gpg"); 745 748 my $signature; 746 open(SIGN,"LANGUAGE=C LANG=C gpg --verify $ENV{'PBTMP'}/Release.gpg $ENV{'PBTMP'}/Release 2>&1 |") || c onfess "Unable to verify GPG signature from Release.gpg\n";749 open(SIGN,"LANGUAGE=C LANG=C gpg --verify $ENV{'PBTMP'}/Release.gpg $ENV{'PBTMP'}/Release 2>&1 |") || cluck "Unable to verify GPG signature from Release.gpg\n" && next; 747 750 while(<SIGN>) { 748 751 chomp(); … … 757 760 } 758 761 close(SIGN); 759 open(SIGN,"LANGUAGE=C LANG=C gpg --verify $ENV{'PBTMP'}/Release.gpg $ENV{'PBTMP'}/Release 2>&1 |") || c onfess "Unable to verify GPG signature from $debrepo/Release.gpg\n";762 open(SIGN,"LANGUAGE=C LANG=C gpg --verify $ENV{'PBTMP'}/Release.gpg $ENV{'PBTMP'}/Release 2>&1 |") || cluck "Unable to verify GPG signature from $debrepo/Release.gpg\n" && next; 760 763 while(<SIGN>) { 761 764 chomp(); -
devel/pb/bin/pb
r2357 r2362 1985 1985 my $keyfile = pb_ssh_get(1); 1986 1986 pb_mkdir_p("$ENV{'HOME'}/.abuild"); 1987 open(CONF,"> $ENV{'HOME'}/.abuild/abuild.conf") || c onfess "Unable to create the abuild conf file";1987 open(CONF,"> $ENV{'HOME'}/.abuild/abuild.conf") || cluck "Unable to create the abuild conf file" && return; 1988 1988 print CONF "PACKAGER_PRIVKEY=\"$keyfile\"\n" if (defined $keyfile); 1989 1989 close(CONF); … … 2618 2618 # Remove a potential $ENV{'HOME'} as tdir should be relative to pb's home 2619 2619 if ($cmt =~ /^VE/o) { 2620 $tdir =~ s|\$ENV.+\}/|| or c onfess "for $cmt: $tdir must have \$ENV{'HOME'} in it or the remainder of the code won't work since some parts use relative pathing and others will try absolute. Use a symlink if necessary to place the real files in a different place than under your home directory";2620 $tdir =~ s|\$ENV.+\}/|| or cluck "for $cmt: $tdir must have \$ENV{'HOME'} in it or the remainder of the code won't work since some parts use relative pathing and others will try absolute. Use a symlink if necessary to place the real files in a different place than under your home directory" && return; 2621 2621 } else { 2622 2622 # process, ok if not present. … … 2682 2682 # TODO: we don't do anything with found !! 2683 2683 my $found = pb_ve_docker_get_image($tag{$pbstep}); 2684 c onfess"No image $tag{$pbstep} available in Docker, please create one first\n" if (not defined $found);2684 cluck "No image $tag{$pbstep} available in Docker, please create one first\n" if (not defined $found); 2685 2685 # Now we use that image to do what is needed 2686 2686 # use a dockerfile to ease the creation of next images … … 2723 2723 $homedir = `$cmd1 run --cidfile="$cidfile" $tag{$pbstep} grep -E '^$dkaccount:' /etc/passwd | cut -d: -f6`; 2724 2724 chomp($homedir); 2725 open(CID,"$cidfile") || c onfess "Unable to open $cidfile";2725 open(CID,"$cidfile") || cluck "Unable to open $cidfile" && return; 2726 2726 my $cid = <CID>; 2727 2727 close(CID); … … 2793 2793 my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml","pbpkg"); 2794 2794 my $pbextdir = pb_get_extdir(); 2795 confess "Unable to get package list" if (not defined $pkg); 2795 if (not defined $pkg) { 2796 cluck "Unable to get package list"; 2797 return 2798 } 2796 2799 2797 2800 # We consider 2 specific packages … … 2891 2894 } 2892 2895 my $ts = "$ENV{'PBTMP'}/vebuild/".basename($pbscript2); 2893 open(DOCKER," > $ts") || c onfess "Unable to create $ts";2896 open(DOCKER," > $ts") || cluck "Unable to create $ts" && return; 2894 2897 print DOCKER "#!/bin/bash\n"; 2895 2898 print DOCKER "# Put content from host to guest, copying to have the correct uid/gid and rights to do so\n"; … … 3532 3535 3533 3536 if (($action eq "test") && (! -x "$ENV{'PBDESTDIR'}/pbtest")) { 3534 confess "No test script ($ENV{'PBDESTDIR'}/pbtest) found when in test mode. Aborting ..."; 3537 cluck "No test script ($ENV{'PBDESTDIR'}/pbtest) found when in test mode. Aborting ..."; 3538 next; 3535 3539 } 3536 3540 print SCRIPT "pb --version\n"; … … 3774 3778 # Do not use the one passed potentially with -a 3775 3779 my ($pbac) = pb_conf_get($vtype."login"); 3776 confess "No $vtype"."login defined in your project yml conf file" if ((not defined $pbac) || (not defined $pbac->{$ENV{'PBPROJ'}})); 3780 if ((not defined $pbac) || (not defined $pbac->{$ENV{'PBPROJ'}})) { 3781 cluck "No $vtype"."login defined in your project yml conf file"; 3782 next; 3783 } 3777 3784 3778 3785 my $key = ""; … … 4898 4905 my $bdir; 4899 4906 4900 opendir($bdir,"$dir") || c onfess "Unable to open directory $dir: $!";4907 opendir($bdir,"$dir") || cluck "Unable to open directory $dir: $!" && return; 4901 4908 foreach my $f (readdir($bdir)) { 4902 4909 next if ($f =~ /^\./); … … 5167 5174 if (not defined $ENV{'PBPASSPHRASE'}) { 5168 5175 if (not defined $ENV{'PBPASSFILE'}) { 5169 c onfess("No pbpassphrase nor pbpassfile defined, unable to handle GPG Release file\n");5176 cluck("No pbpassphrase nor pbpassfile defined, unable to handle GPG Release file\n"); 5170 5177 } else { 5171 open(PASS,"$ENV{'PBPASSFILE'}") || c onfess("Unable to open $ENV{'PBPASSFILE'}\n");5178 open(PASS,"$ENV{'PBPASSFILE'}") || cluck("Unable to open $ENV{'PBPASSFILE'}\n") && return; 5172 5179 my $pass = <PASS>; 5173 5180 chomp($pass); -
devel/pb/lib/ProjectBuilder/CMS.pm
r2333 r2362 14 14 15 15 use strict 'vars'; 16 use Carp 'c onfess';16 use Carp 'cluck'; 17 17 use Data::Dumper; 18 18 use English; … … 194 194 if ((defined $testver) && (defined $testver->{$ENV{'PBPROJ'}}) && ($testver->{$ENV{'PBPROJ'}} =~ /true/i)) { 195 195 if (! -f "$dest/ChangeLog") { 196 open(CL,"> $dest/ChangeLog") || c onfess "Unable to create $dest/ChangeLog";196 open(CL,"> $dest/ChangeLog") || cluck "Unable to create $dest/ChangeLog" && return; 197 197 # We need a minimal version for debian type of build 198 198 print CL "\n"; -
devel/pbmkbm/bin/pbmkbm
r2279 r2362 457 457 458 458 my $busycmd = pb_distro_get_param($pbos,pb_conf_get("ospathcmd-busybox")); 459 open(BUSY,"$busycmd |") || c onfess "ERROR: Unable to execute $busycmd";459 open(BUSY,"$busycmd |") || cluck "ERROR: Unable to execute $busycmd" && return; 460 460 my $cmdlist = 0; 461 461 while (<BUSY>) {
Note:
See TracChangeset
for help on using the changeset viewer.