public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/ebuild/
Date: Wed, 10 Jul 2013 16:16:52 +0000 (UTC)	[thread overview]
Message-ID: <1373444460.9a3c8889b88e751086616592413a8038dd57e41c.dywi@gentoo> (raw)
Message-ID: <20130710161652.k8W7PrSTsbmdRyhDSKzFBtJVJ-bqVFbaJN48GJW1d2w@z> (raw)

commit:     9a3c8889b88e751086616592413a8038dd57e41c
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jul 10 08:21:00 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Jul 10 08:21:00 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=9a3c8889

ebuild creation: LICENSE variable

create a LICENSE variable if possible and add it to the ebuild

This commit also fixes a case (in)sensitivity issue in UseExpandListValue.

---
 roverlay/ebuild/creation.py | 19 ++++++++-----
 roverlay/ebuild/evars.py    | 65 ++++++++++++++++++++++++++++-----------------
 2 files changed, 53 insertions(+), 31 deletions(-)

diff --git a/roverlay/ebuild/creation.py b/roverlay/ebuild/creation.py
index 52a5034..b2a291e 100644
--- a/roverlay/ebuild/creation.py
+++ b/roverlay/ebuild/creation.py
@@ -96,12 +96,10 @@ class EbuildCreation ( object ):
          raise
    # --- end of run (...) ---
 
-   def _get_ebuild_description ( self ):
+   def _get_ebuild_description ( self, desc ):
       """Creates a DESCRIPTION variable."""
       # FIXME: could be moved to _run_create()
 
-      desc = self.package_info ['desc_data']
-
       description = None
       if USE_FULL_DESCRIPTION:
          # use Title and Description for DESCRIPTION=
@@ -181,8 +179,7 @@ class EbuildCreation ( object ):
       self.status    = 3
       p_info         = self.package_info
       dep_resolution = self.dep_resolution
-
-      # FIXME: selfdep reduction should not remove any package (optional deps!)
+      desc           = self.package_info ['desc_data']
 
       if p_info.end_selfdep_validate():
          ebuild      = ebuilder.Ebuilder()
@@ -209,7 +206,7 @@ class EbuildCreation ( object ):
 #            ebuild.use ( evars.IUSE() )
 
          # DESCRIPTION
-         ebuild.use ( self._get_ebuild_description() )
+         ebuild.use ( self._get_ebuild_description ( desc ) )
 
          # SRC_URI
          ebuild.use ( evars.SRC_URI (
@@ -217,7 +214,15 @@ class EbuildCreation ( object ):
             src_uri_dest = p_info.get ( "src_uri_dest", do_fallback=True )
          ) )
 
-         ebuild_text = ebuild.to_str()
+         # LICENSE (optional)
+         license_str = desc.get ( 'License' )
+         if license_str:
+            ebuild.use ( evars.LICENSE ( license_str ) )
+
+
+         #ebuild_text = ebuild.to_str()
+         ## FIXME: debug rstrip()
+         ebuild_text = ebuild.to_str().rstrip()
 
          p_info.update_now (
             ebuild=ebuild_text,

diff --git a/roverlay/ebuild/evars.py b/roverlay/ebuild/evars.py
index 573647c..138fc04 100644
--- a/roverlay/ebuild/evars.py
+++ b/roverlay/ebuild/evars.py
@@ -14,7 +14,7 @@ is printed as bash array.
 """
 
 __all__ = [ 'DEPEND', 'DESCRIPTION', 'IUSE', 'MISSINGDEPS',
-   'RDEPEND', 'R_SUGGESTS', 'R_SUGGESTS_USE_EXPAND', 'SRC_URI', 'KEYWORDS',
+   'RDEPEND', 'R_SUGGESTS_USE_EXPAND', 'SRC_URI', 'KEYWORDS',
 ]
 
 import collections
@@ -112,45 +112,38 @@ class UseExpandListValue (
          **kw
       )
       self.insert_leading_newline = True
+      # dict { <internal flag name> => <overlay flag name> }
       self.alias_map              = alias_map or None
       self.basename               = basename.rstrip ( '_' ).lower()
       self.sort_flags             = True
 
+      # dict { <overlay flag name> => <list [dep...]> }
+      #self.depdict = dict()
       self.set_value ( deps )
    # --- end of __init__ (...) ---
 
    def _get_depstr_key ( self, dep ):
-      if hasattr ( dep, 'package' ):
-         return dep.package
+      # tries to get the use flag name from dep.dep
+      # str(dep) == dep.dep
+      match = self.__class__.RE_USENAME.match ( dep.dep )
+      if match:
+         return self._get_use_key (
+            ( match.group ( "pn" ) or match.group ( "pf" ) )
+         )
       else:
-         # tries to get the use flag name from dep.dep
-         # str(dep) == dep.dep
-         match = self.__class__.RE_USENAME.match ( dep.dep )
-         if match:
-            return self._get_use_key (
-               ( match.group ( "pn" ) or match.group ( "pf" ) ).lower()
-            )
-         else:
-            raise ValueError (
-               "depstr {!r} cannot be parsed".format ( depstr )
-            )
+         raise ValueError (
+            "depstr {!r} cannot be parsed".format ( depstr )
+         )
    # --- end of _get_depstr_key (...) ---
 
    def _get_use_key ( self, orig_key ):
+      key_low = orig_key.lower()
       if self.alias_map:
-         return self.alias_map.get ( orig_key, orig_key ).lower()
+         return self.alias_map.get ( key_low, key_low ).lower()
       else:
-         return orig_key.lower()
+         return key_low
    # --- end of _get_use_key (...) ---
 
-   def _accept_value ( self, value ):
-      if hasattr ( value, '__iter__' ):
-         if isinstance ( value, str ):
-            raise ValueError ( "x" )
-      else:
-         return False
-   # --- end of _accept_value (...) ---
-
    def set_value ( self, deps ):
       self.depdict = dict()
       if deps: self.add ( deps )
@@ -163,6 +156,9 @@ class UseExpandListValue (
          if hasattr ( item, '__iter__' ) and not isinstance ( item, str ):
             key = self._get_use_key ( str ( item [0] ) )
             val = item [1].dep
+         elif hasattr ( item, 'package' ):
+            key = self._get_use_key ( item.package )
+            val = item.dep
          else:
             key = self._get_depstr_key ( item )
             val = item.dep
@@ -234,6 +230,27 @@ class UseExpandListValue (
 
 # --- end of UseExpandListValue ---
 
+class LICENSE ( roverlay.ebuild.abstractcomponents.EbuildVar ):
+   def __init__ ( self, license_str ):
+      super ( LICENSE, self ).__init__ (
+         name     = 'LICENSE',
+         value    = license_str,
+         priority = 100,
+      )
+   # --- end of __init__ (...) ---
+# --- end of LICENSE ---
+
+
+class HOMEPAGE ( roverlay.ebuild.abstractcomponents.EbuildVar ):
+   def __init__ ( self, homepage ):
+      super ( HOMEPAGE, self ).__init__ (
+         name     = 'HOMEPAGE',
+         value    = homepage,
+         priority = 95,
+      )
+   # --- end of __init__ (...) ---
+# --- end of HOMEPAGE ---
+
 
 class DESCRIPTION ( roverlay.ebuild.abstractcomponents.EbuildVar ):
    """A DESCRIPTION="..." statement."""


             reply	other threads:[~2013-07-10 16:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-10  8:26 André Erdmann [this message]
2013-07-10 16:16 ` [gentoo-commits] proj/R_overlay:master commit in: roverlay/ebuild/ André Erdmann
  -- strict thread matches above, loose matches on Subject: below --
2013-07-10 16:16 André Erdmann
2013-07-10 15:10 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-07-08 22:47 André Erdmann
2013-07-08 22:47 André Erdmann
2013-07-08 22:47 André Erdmann
2013-06-19 18:58 André Erdmann
2013-06-05 18:08 André Erdmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1373444460.9a3c8889b88e751086616592413a8038dd57e41c.dywi@gentoo \
    --to=dywi@mailerd.de \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox