#
SET(LIBZYPP_MAJOR "14")
SET(LIBZYPP_COMPATMINOR "39")
-SET(LIBZYPP_MINOR "43")
-SET(LIBZYPP_PATCH "4")
+SET(LIBZYPP_MINOR "44")
+SET(LIBZYPP_PATCH "0")
#
-# LAST RELEASED: 14.43.4 (39)
+# LAST RELEASED: 14.44.0 (39)
# (The number in parenthesis is LIBZYPP_COMPATMINOR)
#=======
-------------------------------------------------------------------
+Tue Oct 11 12:32:32 CEST 2016 - ma@suse.de
+
+- RepoInfo: Allow parsing multiple gpgkey= URLs (bsc#1003748)
+- version 14.44.0 (39)
+
+-------------------------------------------------------------------
Fri Sep 16 12:58:46 CEST 2016 - ma@suse.de
- guessPackageSpec: Don't break globbing (fixes openSUSE/zypper#97)
static string fedora_repo = "[fedora]\n"
"name=Fedora $releasever - $basearch\n"
"failovermethod=priority\n"
-"#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/\n"
-"#mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch\n"
+"baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/\n"
+" http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/os2/\n"
+"mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch\n"
"mirrorlist=file:///etc/yum.repos.d/local.mirror\n"
"enabled=1\n"
"gpgcheck=1\n"
-"gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY\n";
+"gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY-$releasever/\n"
+"gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-3\n"
+"file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-4\n";
struct RepoCollector : private base::NonCopyable
{
const RepoInfo & repo( collector.repos.front() );
BOOST_CHECK_EQUAL( 4, repo.baseUrlsSize() );
- cout << repo << endl;
+ // cout << repo << endl;
}
// fedora
{
RepoInfo repo = *collector.repos.begin();
// should have taken the first url if more are present
BOOST_CHECK_EQUAL(Url("file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora"), repo.gpgKeyUrl());
+ BOOST_CHECK_EQUAL( 4, repo.gpgKeyUrlsSize() );
+ // cout << repo << endl;
+ // cout << "------------------------------------------------------------" << endl;
+ // repo.dumpOn( cout ) << endl;
+ // cout << "------------------------------------------------------------" << endl;
+ // repo.dumpAsIniOn( cout ) << endl;
+ // cout << "------------------------------------------------------------" << endl;
+ // repo.dumpAsXmlOn( cout ) << endl;
}
}
{ return !emptybaseurls && !_baseUrls.empty(); }
+ const RepoVariablesReplacedUrlList & gpgKeyUrls() const
+ { return _gpgKeyUrls; }
+
+ RepoVariablesReplacedUrlList & gpgKeyUrls()
+ { return _gpgKeyUrls; }
+
void addContent( const std::string & keyword_r )
{ _keywords.insert( keyword_r ); }
TriBool _validRepoSignature;///< have signed and valid repo metadata
public:
TriBool keeppackages;
- RepoVariablesReplacedUrl _gpgKeyUrl;
RepoVariablesReplacedUrl _mirrorListUrl;
repo::RepoType type;
Pathname path;
mutable RepoVariablesReplacedUrlList _baseUrls;
mutable std::set<std::string> _keywords;
+ RepoVariablesReplacedUrlList _gpgKeyUrls;
+
friend Impl * rwcowClone<Impl>( const Impl * rhs );
/** clone for RWCOW_pointer */
Impl * clone() const
void RepoInfo::setMirrorListUrl( const Url & url_r ) // Raw
{ _pimpl->_mirrorListUrl.raw() = url_r; }
+ void RepoInfo::setGpgKeyUrls( url_set urls )
+ { _pimpl->gpgKeyUrls().raw().swap( urls ); }
+
void RepoInfo::setGpgKeyUrl( const Url & url_r )
- { _pimpl->_gpgKeyUrl.raw() = url_r; }
+ {
+ _pimpl->gpgKeyUrls().raw().clear();
+ _pimpl->gpgKeyUrls().raw().push_back( url_r );
+ }
void RepoInfo::addBaseUrl( const Url & url_r )
{
Url RepoInfo::rawMirrorListUrl() const // Raw
{ return _pimpl->_mirrorListUrl.raw(); }
+ bool RepoInfo::gpgKeyUrlsEmpty() const
+ { return _pimpl->gpgKeyUrls().empty(); }
+
+ RepoInfo::urls_size_type RepoInfo::gpgKeyUrlsSize() const
+ { return _pimpl->gpgKeyUrls().size(); }
+
+ RepoInfo::url_set RepoInfo::gpgKeyUrls() const // Variables replaced!
+ { return _pimpl->gpgKeyUrls().transformed(); }
+
+ RepoInfo::url_set RepoInfo::rawGpgKeyUrls() const // Raw
+ { return _pimpl->gpgKeyUrls().raw(); }
+
Url RepoInfo::gpgKeyUrl() const // Variables replaced!
- { return _pimpl->_gpgKeyUrl.transformed(); }
+ { return( _pimpl->gpgKeyUrls().empty() ? Url() : *_pimpl->gpgKeyUrls().transformedBegin() ); }
Url RepoInfo::rawGpgKeyUrl() const // Raw
- { return _pimpl->_gpgKeyUrl.raw(); }
+ { return( _pimpl->gpgKeyUrls().empty() ? Url() : *_pimpl->gpgKeyUrls().rawBegin() ) ; }
RepoInfo::url_set RepoInfo::baseUrls() const // Variables replaced!
{ return _pimpl->baseUrls().transformed(); }
<< std::endl;
#undef OUTS
- strif( "- gpgkey : ", rawGpgKeyUrl().asString() );
+ for ( const auto & url : _pimpl->gpgKeyUrls().raw() )
+ {
+ str << "- gpgkey : " << url << std::endl;
+ }
if ( ! indeterminate(_pimpl->keeppackages) )
str << "- keeppackages: " << keepPackages() << std::endl;
if ( ! indeterminate(_pimpl->_pkgGpgCheck) )
str << "pkg_gpgcheck=" << (_pimpl->_pkgGpgCheck ? "1" : "0") << endl;
- if ( ! (rawGpgKeyUrl().asString().empty()) )
- str << "gpgkey=" << rawGpgKeyUrl() << endl;
+ {
+ std::string indent( "gpgkey=");
+ for ( const auto & url : _pimpl->gpgKeyUrls().raw() )
+ {
+ str << indent << url << endl;
+ if ( indent[0] != ' ' )
+ indent = " ";
+ }
+ }
if (!indeterminate(_pimpl->keeppackages))
str << "keeppackages=" << keepPackages() << endl;
/** Set the value for \ref validRepoSignature (or \c indeterminate if unsigned). */
void setValidRepoSignature( TriBool value_r );
- /**
- * \short Key to use for gpg checking of this repository
- *
- * \param url Url to the key in ASCII armored format
- *
- * \note This is a just a hint to the application and can
- * be ignored.
- *
- */
+
+ /** Whether gpgkey URLs are defined */
+ bool gpgKeyUrlsEmpty() const;
+ /** Number of gpgkey URLs defined */
+ urls_size_type gpgKeyUrlsSize() const;
+
+ /** The list of gpgkey URLs defined for this repo */
+ url_set gpgKeyUrls() const;
+ /** The list of raw gpgkey URLs defined for this repo (no variables replaced) */
+ url_set rawGpgKeyUrls() const;
+ /** Set a list of gpgkey URLs defined for this repo */
+ void setGpgKeyUrls( url_set urls );
+
+ /** (leagcy API) The 1st gpgkey URL defined for this repo */
Url gpgKeyUrl() const;
- /**
- * The raw gpgKeyUrl (no variables replaced).
- */
+ /** (leagcy API) The 1st raw gpgkey URL defined for this repo (no variables replaced) */
Url rawGpgKeyUrl() const;
- /**
- * \short Key to use for gpg checking of this repository
- *
- * \param url Url to the key in ASCII armored format
- *
- * \note This is a just a hint to the application and can
- * be ignored.
- *
- */
+ /** (leagcy API) Set the gpgkey URL defined for this repo */
void setGpgKeyUrl( const Url &gpgkey );
+
/**
* \short Whether packages downloaded from this repository will be kept in local cache
*/
// cause of the problem of the first URL remembered
if (it == info.baseUrlsBegin())
rexception.remember(e);
+ else
+ rexception.addHistory( e.asUserString() );
+
}
} // for every url
ERR << "No more urls..." << endl;
{
if ( key_r == "baseurl" )
{
- setInBaseurls( true );
+ _inMultiline = MultiLine::baseurl;
_baseurls[section_r].push_back( Url(value_r) );
}
+ else if ( key_r == "gpgkey" )
+ {
+ _inMultiline = MultiLine::gpgkey;
+ legacyStoreUrl( _gpgkeys[section_r], value_r );
+ }
else
{
- setInBaseurls( false );
+ _inMultiline = MultiLine::none;
IniDict::consume( section_r, key_r, value_r );
}
}
virtual void garbageLine( const std::string & section_r, const std::string & line_r )
{
- if ( _inBaseurls )
- _baseurls[section_r].push_back( Url(line_r) );
- else
- IniDict::garbageLine( section_r, line_r ); // throw
+ switch ( _inMultiline )
+ {
+ case MultiLine::baseurl:
+ _baseurls[section_r].push_back( Url(line_r) );
+ break;
+
+ case MultiLine::gpgkey:
+ legacyStoreUrl( _gpgkeys[section_r], line_r );
+ break;
+
+ case MultiLine::none:
+ IniDict::garbageLine( section_r, line_r ); // throw
+ break;
+ }
}
std::list<Url> & baseurls( const std::string & section_r )
{ return _baseurls[section_r]; }
+ std::list<Url> & gpgkeys( const std::string & section_r )
+ { return _gpgkeys[section_r]; }
+
private:
- void setInBaseurls( bool yesno_r )
- { if ( _inBaseurls != yesno_r ) _inBaseurls = yesno_r; }
+ void legacyStoreUrl( std::list<Url> & store_r, const std::string & line_r )
+ {
+ // Legacy:
+ // commit 4ef65a442038caf7a1e310bc719e329b34dbdb67
+ // - split the gpgkey line and take the first one as url to avoid
+ // crash when creating an url from the line, as Fedora hat the
+ // *BRILLIANT* idea of using more than one url per line.
+ std::vector<std::string> keys;
+ str::split( line_r, std::back_inserter(keys) );
+ for ( auto && str : keys )
+ store_r.push_back( Url(std::move(str)) );
+ }
+
+ enum class MultiLine { none, baseurl, gpgkey };
+ MultiLine _inMultiline = MultiLine::none;
- DefaultIntegral<bool,false> _inBaseurls;
std::map<std::string,std::list<Url>> _baseurls;
+ std::map<std::string,std::list<Url>> _gpgkeys;
};
} //namespace
info.setAutorefresh( str::strToTrue( it->second ) );
else if ( it->first == "mirrorlist" && !it->second.empty())
info.setMirrorListUrl(Url(it->second));
- else if ( it->first == "gpgkey" && !it->second.empty())
- {
- std::vector<std::string> keys;
- str::split( it->second, std::back_inserter(keys) );
- if ( ! keys.empty() )
- info.setGpgKeyUrl( Url(*keys.begin()) );
- }
else if ( it->first == "gpgcheck" )
info.setGpgCheck( str::strToTriBool( it->second ) );
else if ( it->first == "repo_gpgcheck" )
info.addBaseUrl( url );
}
+ info.setGpgKeyUrls( std::move(dict.gpgkeys( *its )) );
+
info.setFilepath(is.path());
MIL << info << endl;
// add it to the list.