Imported Upstream version 17.0.2 upstream/17.0.2
authorDongHun Kwak <dh0128.kwak@samsung.com>
Mon, 2 Sep 2019 07:14:02 +0000 (16:14 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Mon, 2 Sep 2019 07:14:02 +0000 (16:14 +0900)
13 files changed:
VERSION.cmake
doc/autoinclude/FeatureTest.doc
doc/autoinclude/RepoVariables.doc
libzypp.spec.cmake
package/libzypp.changes
po/pl.po
tests/repo/RepoVariables_test.cc
tools/zypp-NameReqPrv.cc
zypp/RepoInfo.cc
zypp/misc/CheckAccessDeleted.cc
zypp/repo/RepoVariables.cc
zypp/repo/RepoVariables.h
zypp/url/UrlBase.cc

index 19f585a..016c7cb 100644 (file)
@@ -61,8 +61,8 @@
 SET(LIBZYPP_MAJOR "17")
 SET(LIBZYPP_COMPATMINOR "0")
 SET(LIBZYPP_MINOR "0")
-SET(LIBZYPP_PATCH "1")
+SET(LIBZYPP_PATCH "2")
 #
-# LAST RELEASED: 17.0.1 (0)
+# LAST RELEASED: 17.0.2 (0)
 # (The number in parenthesis is LIBZYPP_COMPATMINOR)
 #=======
index 27ab0be..1ed7b82 100644 (file)
@@ -68,6 +68,8 @@ Packages requiring a feature may use the corresponding \c Requires: in their .sp
     <DD>Also support braced variables, shell like default and alternate values.</DD>
     <DT>version 1</DT>
     <DD>Also support user defined repo variables in /etc/zypp/vars.d.</DD>
+    <DT>version 1.1</DT>
+    <DD>Support repo variables in an URIs \c host and \c port component.</DD>
   </DL></DD>
 </DL>
 
index e55ddc5..ac423f7 100644 (file)
@@ -33,6 +33,8 @@ The variable expander also supports shell like definition of default and alterna
 
 \subsection zypp-repoars-userdefined User defined repository variables [requires 'libzypp(repovarexpand) >= 1']
 
-A custom repository variable is defined by creating a file in \c /etc/zypp/vars.d. The variable name equals the file name. The files first line (up to but not including the newline character) defines the variables value.
+A custom repository variable is defined by creating a file in \c /etc/zypp/vars.d. The variable name equals the file name. The files first line (up to but not including the newline character) defines the variables value. Valid variable(file) names consist of alphanumeric chars and '_' only.
+
+Variable substitution within an URIs authority [requires 'libzypp(repovarexpand) >= 1.1'] is limited to \c host and \c port. Bash style definition of default and alternate values is not supported. No variables can be used in an URIs \c scheme, \c user and \c password.
 
 */
index 1d64ab9..76d81aa 100644 (file)
@@ -38,7 +38,7 @@ Provides:       libzypp(plugin:commit) = 1
 Provides:       libzypp(plugin:services) = 1
 Provides:       libzypp(plugin:system) = 1
 Provides:       libzypp(plugin:urlresolver) = 0
-Provides:       libzypp(repovarexpand) = 1
+Provides:       libzypp(repovarexpand) = 1.1
 
 %if 0%{?suse_version}
 Recommends:     logrotate
index e971375..d79bc08 100644 (file)
@@ -1,4 +1,12 @@
 -------------------------------------------------------------------
+Thu Nov 23 12:33:51 CET 2017 - ma@suse.de
+
+- Don't filter procs with a different mnt namespace (bsc#1068708)
+- Support repo variables in an URIs host:port component
+  (bsc#1057640, bsc#1067605)
+- version 17.0.2 (0)
+
+-------------------------------------------------------------------
 Fri Nov 10 15:25:20 CET 2017 - ma@suse.de
 
 - Solvable: fix inconsistent retrieval of mediaNr (bsc#1065677)
index dcd19a9..bc578a2 100644 (file)
--- a/po/pl.po
+++ b/po/pl.po
@@ -8,17 +8,17 @@ msgstr ""
 "Project-Id-Version: zypp\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2017-09-07 12:25+0200\n"
-"PO-Revision-Date: 2017-04-18 10:42+0000\n"
-"Last-Translator: Ewelina Michalowska <ewelina.michalowska@stgambit.com>\n"
-"Language-Team: Polish <https://l10n.opensuse.org/projects/libzypp/master/pl/"
-">\n"
+"PO-Revision-Date: 2017-11-16 22:31+0000\n"
+"Last-Translator: Mariusz Fik <fisiu@opensuse.org>\n"
+"Language-Team: Polish <https://l10n.opensuse.org/projects/libzypp/master/pl/>"
+"\n"
 "Language: pl\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
 "|| n%100>=20) ? 1 : 2;\n"
-"X-Generator: Weblate 2.6\n"
+"X-Generator: Weblate 2.13.1\n"
 
 #: zypp/target/hal/HalException.h:46 zypp/target/hal/HalException.h:55
 #: zypp/target/hal/HalException.h:64
@@ -3726,21 +3726,20 @@ msgstr "Wykonane zostaną następujące czynności:"
 
 #. translators: an annotation to a gpg keys expiry date
 #: zypp/PublicKey.cc:60
-#, fuzzy
 msgid "does not expire"
-msgstr "(nie wygasa)"
+msgstr "nie wygasa"
 
 #. translators: an annotation to a gpg keys expiry date: "expired: 1999-04-12"
 #: zypp/PublicKey.cc:65
 #, boost-format
 msgid "expired: %1%"
-msgstr ""
+msgstr "wygasł: %1%"
 
 #. translators: an annotation to a gpg keys expiry date: "expires: 2111-04-12"
 #: zypp/PublicKey.cc:70
 #, boost-format
 msgid "expires: %1%"
-msgstr ""
+msgstr "wygasa: %1%"
 
 #. translators: an annotation to a gpg keys expiry date
 #: zypp/PublicKey.cc:79
@@ -4715,7 +4714,7 @@ msgstr "Usunięcie klucza publicznego nie powiodło się %1%"
 
 #: zypp/target/rpm/RpmDb.cc:1568
 msgid "Package is not signed!"
-msgstr ""
+msgstr "Pakiet nie jest podpisany!"
 
 #. Translator: %s = name of an rpm package. A list of diffs follows
 #. this message.
@@ -4800,7 +4799,7 @@ msgstr "Plik nie istnieje lub nie można sprawdzić podpisu"
 #. translators: possible rpm package signature check result [brief]
 #: zypp/target/rpm/RpmDb.cc:2397
 msgid "File is unsigned"
-msgstr ""
+msgstr "Plik jest niepodpisany"
 
 #: zypp/thread/Mutex.cc:33
 msgid "Can't initialize mutex attributes"
index b399f5c..06538ae 100644 (file)
@@ -175,6 +175,16 @@ BOOST_AUTO_TEST_CASE(RepVarExpand)
   RepVarExpandTest( "__${D:+\\$X--{${E:-==\\$X{o\\}==}\\}--}__\\${B}${}__", "____\\${B}${}__"         , "__$X--{[E]}--__\\[B]${}__"              );
 }
 
+void varInAuthExpect( const Url & url_r, const std::string & expHost_r, const std::string & expPort_r, const std::string & expPath_r,
+                     const std::string & user_r = std::string(), const std::string & pass_r = std::string() )
+{
+  BOOST_CHECK_EQUAL( url_r.getHost(),     expHost_r );
+  BOOST_CHECK_EQUAL( url_r.getPort(),     expPort_r );
+  BOOST_CHECK_EQUAL( url_r.getPathName(), expPath_r );
+  BOOST_CHECK_EQUAL( url_r.getUsername(), user_r );
+  BOOST_CHECK_EQUAL( url_r.getPassword(), pass_r );
+}
+
 BOOST_AUTO_TEST_CASE(replace_text)
 {
   /* check RepoVariablesStringReplacer */
@@ -207,7 +217,7 @@ BOOST_AUTO_TEST_CASE(replace_text)
   /* check RepoVariablesUrlReplacer */
   repo::RepoVariablesUrlReplacer replacer2;
 
-//   // first of all url with {} must be accepted:
+  // first of all url with {} must be accepted:
   BOOST_CHECK_NO_THROW( Url("ftp://site.org/${arch}/?arch=${arch}") );
   BOOST_CHECK_NO_THROW( Url("ftp://site.org/${arch:-noarch}/?arch=${arch:-noarch}") );
   BOOST_CHECK_NO_THROW( Url("ftp://site.org/${arch:+somearch}/?arch=${arch:+somearch}") );
@@ -223,6 +233,16 @@ BOOST_AUTO_TEST_CASE(replace_text)
 
   BOOST_CHECK_EQUAL(replacer2(Url("http://site.org/update/$releasever/?arch=$arch")).asCompleteString(),
                    "http://site.org/update/13.2/?arch=i686");
+
+  // - bsc#1067605: Allow VAR in Url authority
+  // fake some host name via $arch
+  varInAuthExpect( replacer2(Url("ftp://$arch/path")),      "i686",     "", "/path" );
+  varInAuthExpect( replacer2(Url("ftp://$arch:1234/path")), "i686", "1234", "/path" );
+  // don't expand in user/pass!
+  varInAuthExpect( replacer2(Url("ftp://$arch:$arch@$arch:1234/path")),        "i686", "1234", "/path", "$arch", "$arch" );
+  // No support for complex vars:
+  // BOOST_CHECK_NO_THROW( Url("ftp://${arch:-nosite}/path") );
+  // BOOST_CHECK_NO_THROW( Url("ftp://${arch:+somesite}/path") );
 }
 
 BOOST_AUTO_TEST_CASE(uncached)
index cc8f1d4..7198a76 100644 (file)
@@ -314,21 +314,21 @@ int main( int argc, char * argv[] )
       if ( names )
        q.addAttribute( sat::SolvAttr::name );
       if ( provides )
-       q.addDependency( sat::SolvAttr::provides );
+       q.addDependency( sat::SolvAttr::provides, Capability(qstr) );
       if ( requires )
-       q.addDependency( sat::SolvAttr::requires );
+       q.addDependency( sat::SolvAttr::requires, Capability(qstr) );
       if ( conflicts )
-       q.addDependency( sat::SolvAttr::conflicts );
+       q.addDependency( sat::SolvAttr::conflicts, Capability(qstr) );
       if ( obsoletes )
-       q.addDependency( sat::SolvAttr::obsoletes );
+       q.addDependency( sat::SolvAttr::obsoletes, Capability(qstr) );
       if ( recommends )
-       q.addDependency( sat::SolvAttr::recommends );
+       q.addDependency( sat::SolvAttr::recommends, Capability(qstr) );
       if ( supplements )
-       q.addDependency( sat::SolvAttr::supplements );
+       q.addDependency( sat::SolvAttr::supplements, Capability(qstr) );
       if ( enhacements )
       {
-       q.addDependency( sat::SolvAttr::enhances );
-       q.addDependency( sat::SolvAttr::suggests );
+       q.addDependency( sat::SolvAttr::enhances, Capability(qstr) );
+       q.addDependency( sat::SolvAttr::suggests, Capability(qstr) );
       }
     }
 
index 981a0b8..674c54a 100644 (file)
@@ -313,7 +313,6 @@ namespace zypp
 
     DefaultIntegral<unsigned,defaultPriority> priority;
     mutable bool emptybaseurls;
-    repo::RepoVariablesUrlReplacer replacer;
 
   private:
     Pathname _metadataPath;
index bee525f..07819da 100644 (file)
@@ -179,16 +179,15 @@ namespace zypp
     /// \class FilterRunsInLXC
     /// \brief Functor guessing whether \a PID is running in a container.
     ///
-    /// Asumme a using different \c pid/mnt namespace than \c self.
+    /// Assumme using different \c pid namespace than \c self.
     /////////////////////////////////////////////////////////////////
     struct FilterRunsInLXC
     {
       bool operator()( pid_t pid_r ) const
-      { return( nsIno( pid_r, "pid" ) != pidNS || nsIno( pid_r, "mnt" ) != mntNS ); }
+      { return( nsIno( pid_r, "pid" ) != pidNS ); }
 
       FilterRunsInLXC()
       : pidNS( nsIno( "self", "pid" ) )
-      , mntNS( nsIno( "self", "mnt" ) )
       {}
 
       static inline ino_t nsIno( const std::string & pid_r, const std::string & ns_r )
@@ -198,7 +197,6 @@ namespace zypp
       { return  nsIno( asString(pid_r), ns_r ); }
 
       ino_t pidNS;
-      ino_t mntNS;
     };
 
 #if 0
index 08957a3..552cc31 100644 (file)
@@ -151,7 +151,7 @@ namespace zypp
 
        /** Valid var name char */
        bool isnamech( int ch ) const
-       { return ch == '_' || isalpha( ch ); }
+       { return ch == '_' || isalnum( ch ); }
 
        /** Scan for a valid variable starting at _vbeg (storing the values) */
        bool findVarEnd()
@@ -548,10 +548,15 @@ namespace zypp
 
     Url RepoVariablesUrlReplacer::operator()( const Url & value ) const
     {
-      RepoVarExpand expand;
-      Url newurl( value );
-      newurl.setPathData( expand( value.getPathData(), RepoVarsMap::lookup ) );
-      newurl.setQueryString( expand( value.getQueryString(), RepoVarsMap::lookup ) );
+      static const Url::ViewOptions toReplace = url::ViewOption::DEFAULTS - url::ViewOption::WITH_USERNAME - url::ViewOption::WITH_PASSWORD;
+      const std::string & replaced( RepoVarExpand()( value.asString( toReplace ), RepoVarsMap::lookup ) );
+      Url newurl;
+      if ( !replaced.empty() )
+      {
+       newurl = replaced;
+       newurl.setUsername( value.getUsername( url::E_ENCODED ), url::E_ENCODED );
+       newurl.setPassword( value.getPassword( url::E_ENCODED ), url::E_ENCODED );
+      }
       return newurl;
     }
   } // namespace repo
index 8cab57e..04cd353 100644 (file)
@@ -115,7 +115,7 @@ namespace zypp
     /**
      * \short Functor replacing repository variables
      *
-     * Replaces repository variables in the path and query part of the URL.
+     * Replaces repository variables in the URL (except for user/pass inside authority)
      * \see RepoVariablesStringReplacer
      */
     struct RepoVariablesUrlReplacer : public std::unary_function<const Url &, Url>
index 0f441a8..f4822cd 100644 (file)
@@ -37,7 +37,7 @@
 
 #define RX_VALID_PORT      "^[0-9]{1,5}$"
 
-#define RX_VALID_HOSTNAME  "^[[:alnum:]]+([\\.-][[:alnum:]]+)*$"
+#define RX_VALID_HOSTNAME  "^[[:alnum:]${_}]+([\\.-][[:alnum:]${_}]+)*$"
 
 #define RX_VALID_HOSTIPV4  \
         "^([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})$"
@@ -256,7 +256,7 @@ namespace zypp
 
       config("safe_username",   "~!$&'()*+=,;");
       config("safe_password",   "~!$&'()*+=,:;");
-      config("safe_hostname",   "[:]");
+      config("safe_hostname",   "[:]${_}");
       config("safe_pathname",   "~!$&'()*+=,:@/");
       config("safe_pathparams", "~!$&'()*+=,:;@/");
       config("safe_querystr",   "~!$&'()*+=,:;@/?");