Ignore:
Timestamp:
Feb 20, 2017, 7:40:29 AM (3 years ago)
Author:
Bruno Cornec
Message:

Import GPG key files on OpenSUSE as zypper doesn't do it alone it seems

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/lib/ProjectBuilder/Distribution.pm

    r2177 r2178  
    618618            confess "Missing directory $dirdest ($reponame)" unless (-d $dirdest);
    619619            pb_system("sudo mv $ENV{'PBTMP'}/$bn $dest","Adding $reponame repository") if (not -f "$dest");
     620            # OpenSUSE does't seem to import keys automatically
     621            # :-(
     622            if ($pbos->{install} =~ /\bzypper\b/) {
     623                my $keyfile = undef;
     624                open(REPO,"$dest") || confess "Unable to open $dest";
     625                while (<REPO>) {
     626                    if ($_ =~ /^gpgkey=/) {
     627                        $keyfile = $_;
     628                        $keyfile =~ 's|gpgkey=||';
     629                    }
     630                }
     631                close(REPO);
     632                if (defined $keyfile) {
     633                    pb_system("wget -O $ENV{'PBTMP'}/$bn $keyfile","Downloading GPG key file $keyfile");
     634                    pb_system("rpm --import $ENV{'PBTMP'}/$bn","Importing GPG key file $i");
     635                    unlink("$ENV{'PBTMP'}/$bn");
     636                }
     637            }
    620638        } elsif ($bn =~ /\.addmedia/) {
    621639            # URPMI repo
Note: See TracChangeset for help on using the changeset viewer.