27#undef ZYPP_BASE_LOGGER_LOGGROUP
28#define ZYPP_BASE_LOGGER_LOGGROUP "parser::yum"
52 Reader reader( repomd_file );
53 MIL <<
"Reading " << repomd_file << endl;
104 if ( reader_r->
nodeType() == XML_READER_TYPE_ELEMENT )
107 if ( reader_r->
name() ==
"repomd" )
113 if ( reader_r->
name() ==
"data" )
120 if ( reader_r->
name() ==
"location" )
128 if ( reader_r->
name() ==
"checksum" )
135 if ( reader_r->
name() ==
"header-checksum" )
142 if ( reader_r->
name() ==
"timestamp" )
149 if ( reader_r->
name() ==
"size" )
156 if ( reader_r->
name() ==
"header-size" )
163 if ( reader_r->
name() ==
"content" )
165 const auto & tag = reader_r.
nodeText();
166 if ( tag.c_str() && *tag.c_str() )
172 else if ( reader_r->
nodeType() == XML_READER_TYPE_END_ELEMENT )
175 if ( reader_r->
name() ==
"data" )
208 {
return _pimpl->keywords(); }
212 std::vector<std::pair<std::string,std::string>> ret;
213 for (
const std::string & tag :
keywords() ) {
217 if ( tag.compare( 0,10,
"gpg-pubkey" ) != 0 )
220 static const str::regex rx(
"^(gpg-pubkey([^?]*))(\\?fpr=([[:xdigit:]]{8,}))?$" );
223 std::string keyfile { what[1] };
224 std::string keyident;
225 if ( what.
size(4) != std::string::npos ) {
229 static const str::regex rx(
"^-([[:xdigit:]]{8,})" );
234 DBG <<
"Tag " << tag <<
" does not contain a keyident. ignore it." << endl;
238 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
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.
Impl(const Pathname &repomd_file, ProcessResource &&callback)
Ctro taking a ProcessResource callback.
RW_pointer< Impl, rw_pointer::Scoped< Impl > > _pimpl
function< bool(OnMediaLocation &&, const std::string &)> ProcessResource
Callback taking OnMediaLocation and the resource type string.
RepomdFileReader(const Pathname &repomd_file, ProcessResource callback)
CTOR.
const std::set< std::string > & keywords() const
repo keywords parsed on the fly
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(const 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
TInt strtonum(const C_Str &str)
Parsing numbers from string.
Easy-to use interface to the ZYPP dependency resolver.