19 #include <zypp-common/PublicKey.h> 23 #include <zypp-core/zyppng/pipelines/Transform> 24 #include <zypp-core/zyppng/pipelines/Expected> 25 #include <zypp-core/zyppng/pipelines/MTry> 26 #include <zypp-media/ng/Provide> 27 #include <zypp-media/ng/ProvideSpec> 29 #include <zypp/ng/Context> 30 #include <zypp/ng/UserRequest> 39 template<
class Executor,
class OpType>
40 struct FetchGpgKeysLogic :
public LogicBase<Executor, OpType> {
42 using ZyppContextRefType = MaybeAsyncContextRef<OpType>;
43 using ZyppContextType = remove_smart_ptr_t<ZyppContextRefType>;
44 using ProvideType =
typename ZyppContextType::ProvideType;
45 using MediaHandle =
typename ProvideType::MediaHandle;
46 using ProvideRes =
typename ProvideType::Res;
48 FetchGpgKeysLogic( ZyppContextRefType &&zyppContext,
zypp::RepoInfo &&info )
55 MaybeAsyncRef<expected<void>> execute () {
57 using zyppng::operators::operator|;
62 if ( gpgKeyUrls.empty() ) {
66 MIL <<
"No gpgkey URL specified, but d.o.o server detected. Trying to generate the key file path." << std::endl;
73 gpgKeyUrls.push_back( bUrl );
77 gpgKeyUrls.push_back( bUrl );
81 MIL <<
"Repo type is not known, unable to generate the gpgkey Url on the fly." << std::endl;
87 if ( gpgKeyUrls.empty () )
99 return std::move(gpgKeyUrls)
104 |
and_then( [
this, url]( ProvideRes f ) -> expected<void> {
106 zypp::PublicKey key(f.file());
107 if ( !key.isValid() )
111 _reports.zyppContext()->keyRing()->multiKeyImport(f.file(),
false);
113 }
catch (
const std::exception & e ) {
116 MIL <<
"Key import from url:'"<<url<<
"' failed." << std::endl;
123 | [
this]( std::list<expected<void>> && ) {
Pathname path() const
Repository path.
url_set gpgKeyUrls() const
The list of gpgkey URLs defined for this repo.
auto transform(Transformation &&transformation)
void appendPathName(const Pathname &path_r, EEncoding eflag_r=zypp::url::E_DECODED)
Extend the path name.
std::set< std::string > _keysDownloaded
JobReportHelper< ZyppContextRefType > _reports
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
expected< void > fetchGpgKeys(SyncContextRef ctx, zypp::RepoInfo info)
const zypp::RepoInfo _info
std::string asString() const
Returns a default string representation of the Url object.
#define ZYPP_ENABLE_LOGIC_BASE(Executor, OpType)
std::conditional_t< isAsync, AsyncOpRef< T >, T > makeReadyResult(T &&result)
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).
std::shared_ptr< AsyncOp< T > > AsyncOpRef
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,.