14#include <zypp/base/String.h>
15#include <zypp/base/Logger.h>
16#include <zypp/base/Regex.h>
18#include <zypp/Pathname.h>
21#include <zypp/CheckSum.h>
26#undef ZYPP_BASE_LOGGER_LOGGROUP
27#define ZYPP_BASE_LOGGER_LOGGROUP "parser::yum"
51 Reader reader( repomd_file );
52 MIL <<
"Reading " << repomd_file << endl;
103 if ( reader_r->
nodeType() == XML_READER_TYPE_ELEMENT )
106 if ( reader_r->
name() ==
"repomd" )
112 if ( reader_r->
name() ==
"data" )
119 if ( reader_r->
name() ==
"location" )
127 if ( reader_r->
name() ==
"checksum" )
134 if ( reader_r->
name() ==
"header-checksum" )
141 if ( reader_r->
name() ==
"timestamp" )
148 if ( reader_r->
name() ==
"size" )
155 if ( reader_r->
name() ==
"header-size" )
162 if ( reader_r->
name() ==
"content" )
164 const auto & tag = reader_r.
nodeText();
165 if ( tag.c_str() && *tag.c_str() )
171 else if ( reader_r->
nodeType() == XML_READER_TYPE_END_ELEMENT )
174 if ( reader_r->
name() ==
"data" )
207 {
return _pimpl->keywords(); }
211 std::vector<std::pair<std::string,std::string>> ret;
212 for (
const std::string & tag :
keywords() ) {
216 if ( tag.compare( 0,10,
"gpg-pubkey" ) != 0 )
219 static const str::regex rx(
"^(gpg-pubkey([^?]*))(\\?fpr=([[:xdigit:]]{8,}))?$" );
222 std::string keyfile { what[1] };
223 std::string keyident;
224 if ( what.
size(4) != std::string::npos ) {
228 static const str::regex rx(
"^-([[:xdigit:]]{8,})" );
233 DBG <<
"Tag " << tag <<
" does not contain a keyident. ignore it." << endl;
237 ret.push_back( std::make_pair( std::move(keyfile), std::move(keyident) ) );
Interface of repomd.xml file reader.
Store and operate with byte count.
CheckSum getChecksum(Reader &reader_r)
Retrieve a checksum node.
bool consumeNode(Reader &reader_r)
Callback provided to the XML parser.
const std::set< std::string > & keywords() const
repo keywords parsed on the fly
Impl(const Pathname &repomd_file, const ProcessResource &callback)
Ctro taking a ProcessResource callback.
ByteCount getSize(Reader &reader_r)
Retrieve a size node.
std::set< std::string > _keywords
repo keywords parsed on the fly
std::string _typeStr
The resource type string.
OnMediaLocation _location
Location of metadata file.
ProcessResource _callback
Function for processing collected data.
function< bool(OnMediaLocation &&, const std::string &)> ProcessResource
Callback taking OnMediaLocation and the resource type string.
RW_pointer< Impl, rw_pointer::Scoped< Impl > > _pimpl
const std::set< std::string > & keywords() const
repo keywords parsed on the fly
RepomdFileReader(const Pathname &repomd_file, const ProcessResource &callback)
CTOR.
std::vector< std::pair< std::string, std::string > > keyhints() const
gpg key hits shipped in keywords (bsc#1184326)
Regular expression match result.
NodeType nodeType() const
Get the node type of the current node.
XmlString getAttribute(const char *name_r) const
Provides a copy of the attribute value with the specified qualified name.
XmlString name() const
The qualified name of the node, equal to Prefix :LocalName.
xmlTextReader based interface to iterate xml streams.
XmlString nodeText()
If the current node is not empty, advances the reader to the next node, and returns the value.
bool foreachNode(ProcessNode fnc_r)
std::string asString() const
Explicit conversion to std::string.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
bool regex_match(const std::string &s, smatch &matches, const regex ®ex)
\relates regex \ingroup ZYPP_STR_REGEX \relates regex \ingroup ZYPP_STR_REGEX
Easy-to use interface to the ZYPP dependency resolver.