Escape double quotes in urls to avoid invalid ebuild syntax.
authorW. Trevor King <wking@drexel.edu>
Wed, 8 Jun 2011 00:53:20 +0000 (20:53 -0400)
committerW. Trevor King <wking@drexel.edu>
Wed, 8 Jun 2011 00:53:20 +0000 (20:53 -0400)
For example, modulegraph currently lists its url as
  url = http://bitbucket.org/ronaldoussoren/modulegraph"
for which we want to produce
  HOMEPAGE="http://bitbucket.org/ronaldoussoren/modulegraph%22"
not the invalid
  HOMEPAGE="http://bitbucket.org/ronaldoussoren/modulegraph""

g_pypi/ebuild.py

index 1dc55a3f57cd29a45d596669de7f80419ee810ea..151d9845aacb3b735df09f556aed2931f2aee430 100755 (executable)
@@ -141,6 +141,10 @@ class Ebuild:
         self.vars['my_pv'] = ebuild_vars['my_pv']
         self.vars['src_uri'] = ebuild_vars['src_uri']
 
+    def _quote(self, string):
+        """Escape double quotes to ensure valid ebuild syntax.
+        """
+        return string.replace('"', '%22')
 
     def add_metadata(self):
         """
@@ -150,7 +154,7 @@ class Ebuild:
         homepages = ['Home-page', 'home_page', 'home-page']
         for hpage in homepages:
             if self.metadata.has_key(hpage):
-                self.vars['homepage'] = self.metadata[hpage]
+                self.vars['homepage'] = self._quote(self.metadata[hpage])
 
         #There doesn't seem to be any specification for case
         if self.metadata.has_key('Summary'):