22 #include <zypp-core/ng/pipelines/Transform> 23 #include <zypp-core/ng/pipelines/Expected> 24 #include <zypp-core/ng/pipelines/MTry> 26 #include <zypp-media/ng/ProvideSpec> 27 #include <zypp/ng/Context> 28 #include <zypp/ng/UserRequest> 37 struct FetchGpgKeysLogic {
39 using ZyppContextRefType =ContextRef;
40 using ZyppContextType = Context;
41 using ProvideType =
typename ZyppContextType::ProvideType;
42 using MediaHandle =
typename ProvideType::MediaHandle;
45 FetchGpgKeysLogic( ZyppContextRefType &&zyppContext,
zypp::RepoInfo &&info )
50 MaybeAwaitable<expected<void>> execute () {
52 using zyppng::operators::operator|;
57 if ( gpgKeyUrls.empty() ) {
61 MIL <<
"No gpgkey URL specified, but d.o.o server detected. Trying to generate the key file path." << std::endl;
68 gpgKeyUrls.push_back( bUrl );
72 gpgKeyUrls.push_back( bUrl );
76 MIL <<
"Repo type is not known, unable to generate the gpgkey Url on the fly." << std::endl;
82 if ( gpgKeyUrls.empty () )
94 return std::move(gpgKeyUrls)
102 if ( !key.isValid() )
106 _reports.zyppContext()->keyRing()->importKey(key,
false);
108 }
catch (
const std::exception & e ) {
111 MIL <<
"Key import from url:'"<<url<<
"' failed." << std::endl;
118 | []( std::list<expected<void>> && ) {
133 FetchGpgKeysLogic impl( std::move(ctx), std::move(info) );
134 zypp_co_return zypp_co_await( impl.execute () );
Pathname path() const
Repository path.
url_set gpgKeyUrls() const
The list of gpgkey URLs defined for this repo.
auto transform(Transformation &&transformation)
MaybeAwaitable< expected< void > > fetchGpgKeys(ContextRef ctx, zypp::RepoInfo info)
void appendPathName(const Pathname &path_r, EEncoding eflag_r=zypp::url::E_DECODED)
Extend the path name.
std::set< std::string > _keysDownloaded
What is known about a repository.
std::string asUserString() const
User string: label (alias or name)
urls_const_iterator baseUrlsBegin() const
iterator that points at begin of repository urls
bool baseUrlsEmpty() const
whether repository urls are available
const zypp::RepoInfo _info
std::string asString() const
Returns a default string representation of the Url object.
static expected success(ConsParams &&...params)
static bool urlSupportsMirrorLink(const zypp::Url &url)
#define ZYPP_CAUGHT(EXCPT)
Drops a logline telling the Exception was caught (in order to handle it).
Class representing one GPG Public Key (PublicKeyData + ASCII armored in a tempfile).
Base class for Exception.
auto and_then(Fun &&function)
#define ZYPP_FWD_CURRENT_EXCPT()
Drops a logline and returns the current Exception as a std::exception_ptr.
repo::RepoType type() const
Type of repository,.