21#include <zypp-core/zyppng/pipelines/Transform>
22#include <zypp-core/zyppng/pipelines/Expected>
23#include <zypp-core/zyppng/pipelines/MTry>
24#include <zypp-media/ng/Provide>
25#include <zypp-media/ng/ProvideSpec>
27#include <zypp/ng/Context>
28#include <zypp/ng/UserRequest>
40 template<
class Executor,
class OpType>
41 struct RepoInfoProvideKeyLogic :
public LogicBase<Executor, OpType> {
45 using ProvideType =
typename ZyppContextType::ProvideType;
46 using MediaHandle =
typename ProvideType::MediaHandle;
62 using zyppng::operators::operator|;
91 executor()->info(
" gpgkey=" + url.
asString() );
105 }
catch (
const std::exception &
e ) {
108 MIL <<
"Key import from url:'"<<url<<
"' failed." << std::endl;
133 executor()->info(
zypp::str::Format(
_(
"Looking for gpg key ID %1% in cache %2%.") ) % _keyIDStr % _targetDirectory_r );
150 ERR <<
"Error importing cached key from file '"<<
dir_r/
str_r<<
"'."<<std::endl;
162 for (
const auto & key:
_tempKeyRing.trustedPublicKeyData()) {
163 MIL <<
"KEY ID in KEYRING: " << key.id() << std::endl;
167 std::ofstream
fout( keyFile.
c_str(), std::ios_base::out | std::ios_base::trunc );
182 ERR <<
"Error when exporting key from temporary keychain." << std::endl;
200 struct AsyncRepoInfoProvideKey :
public RepoInfoProvideKeyLogic<AsyncRepoInfoProvideKey, zyppng::AsyncOp<zypp::Pathname>>
202 using RepoInfoProvideKeyLogic::RepoInfoProvideKeyLogic;
209 struct SyncRepoInfoProvideKey :
public RepoInfoProvideKeyLogic<SyncRepoInfoProvideKey, zyppng::SyncOp<zypp::Pathname>>
211 using RepoInfoProvideKeyLogic::RepoInfoProvideKeyLogic;
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
static const ValueType month
static Date now()
Return the current time.
Base class for Exception.
void dumpTrustedPublicKey(const std::string &id, std::ostream &stream)
void multiKeyImport(const Pathname &keyfile_r, bool trusted_r=false)
Initial import from RpmDb.
std::list< PublicKeyData > trustedPublicKeyData()
Get a list of trusted public key data in the keyring (key data only)
bool isKeyTrusted(const std::string &id)
true if the key id is trusted
@ STRINGEND
Match at string end.
Class representing one GPG Public Keys data.
Class representing one GPG Public Key (PublicKeyData + ASCII armored in a tempfile).
What is known about a repository.
url_set gpgKeyUrls() const
The list of gpgkey URLs defined for this repo.
bool gpgKeyUrlsEmpty() const
Whether gpgkey URLs are defined.
String matching (STRING|SUBSTRING|GLOB|REGEX).
std::string asString() const
Returns a default string representation of the Url object.
std::string getPathName(EEncoding eflag=zypp::url::E_DECODED) const
Returns the path name from the URL.
Typesafe passing of user data via callbacks.
Wrapper class for stat/lstat.
const char * c_str() const
String representation.
std::string basename() const
Return the last component of this path.
Provide a new empty temporary directory and recursively delete it when no longer needed.
std::string asUserString() const
User string: label (alias or name)
A ProvideRes object is a reference counted ownership of a resource in the cache provided by a Provide...
static expected success(ConsParams &&...params)
#define ZYPP_ENABLE_LOGIC_BASE(Executor, OpType)
int unlink(const Pathname &path)
Like 'unlink'.
int dirForEach(const Pathname &dir_r, const StrMatcher &matcher_r, function< bool(const Pathname &, const char *const)> fnc_r)
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
std::string asString(const Patch::Category &obj)
zypp::Pathname provideKey(SyncContextRef ctx, zypp::RepoInfo info, std::string keyID_r, zypp::Pathname targetDirectory_r)
std::conditional_t< isAsync, AsyncOpRef< T >, T > makeReadyResult(T &&result)
ResultType and_then(const expected< T, E > &exp, Function &&f)
zypp::callback::UserData UserData
Container< Ret > transform(Container< Msg, CArgs... > &&val, Transformation &&transformation)
zypp::filesystem::TmpDir _tmpKeyRingDir
zypp::KeyRing _tempKeyRing
const zypp::Pathname _targetDirectory_r
const std::string _keyIDStr
const zypp::RepoInfo _info
const std::string _keyID_r
ZyppContextRefType _zyppContext
static bool info(const std::string &msg_r, const UserData &userData_r=UserData())
send message text
#define ZYPP_CAUGHT(EXCPT)
Drops a logline telling the Exception was caught (in order to handle it).
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.