public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/
@ 2013-06-22 15:24 André Erdmann
  2013-06-22 15:14 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
  0 siblings, 1 reply; 6+ messages in thread
From: André Erdmann @ 2013-06-22 15:24 UTC (permalink / raw
  To: gentoo-commits

commit:     b3c06fe525a85dbd2820c14a47cd7628739fa78b
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Sat Jun 22 10:19:38 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Sat Jun 22 10:19:38 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=b3c06fe5

overlay, scan(): don't filter all exceptions

---
 roverlay/overlay/root.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/roverlay/overlay/root.py b/roverlay/overlay/root.py
index a3b02f1..35ab5ad 100644
--- a/roverlay/overlay/root.py
+++ b/roverlay/overlay/root.py
@@ -682,6 +682,8 @@ class Overlay ( object ):
          for cat in scan_categories():
             try:
                cat.scan ( **kw )
+            except ( RuntimeError, SystemError, KeyboardInterrupt, ):
+               raise
             except Exception as e:
                self.logger.exception ( e )
    # --- end of scan (...) ---


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/overlay/
@ 2013-07-10 15:10 André Erdmann
  0 siblings, 0 replies; 6+ messages in thread
From: André Erdmann @ 2013-07-10 15:10 UTC (permalink / raw
  To: gentoo-commits

commit:     35368b2daf90b7be2a76f2af4608961bcbc1eb46
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jul 10 14:02:22 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Jul 10 14:02:22 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=35368b2d

roverlay/overlay/root: remove/replace debug code

---
 roverlay/overlay/root.py | 31 +++++++++++++------------------
 1 file changed, 13 insertions(+), 18 deletions(-)

diff --git a/roverlay/overlay/root.py b/roverlay/overlay/root.py
index 0c291da..099d6d5 100644
--- a/roverlay/overlay/root.py
+++ b/roverlay/overlay/root.py
@@ -1,6 +1,6 @@
 # R overlay -- overlay package, overlay root
 # -*- coding: utf-8 -*-
-# Copyright (C) 2012 André Erdmann <dywi@mailerd.de>
+# Copyright (C) 2012, 2013 André Erdmann <dywi@mailerd.de>
 # Distributed under the terms of the GNU General Public License;
 # either version 2 of the License, or (at your option) any later version.
 
@@ -703,10 +703,9 @@ class Overlay ( object ):
       ##     drop p
       ##
 
-      #FIXME: PKG_REMOVED*: debug code
-      print ( "REMOVE_BROKEN_PACKAGES: 'balance' ... " )
-      PKG_REMOVED     = list()
-      PKG_REMOVED_ADD = PKG_REMOVED.append
+
+      #PKG_REMOVED     = list()
+      #PKG_REMOVED_ADD = PKG_REMOVED.append
 
 
       num_pkg_removed = 0
@@ -714,21 +713,17 @@ class Overlay ( object ):
          for pkgdir in cat._subdirs.values():
             for pvr, p_info in pkgdir._packages.items():
                if not p_info.is_valid():
-                  # FIXME: debug print
-                  PKG_REMOVED_ADD ( "{}-{}".format ( pkgdir.name, pvr ) )
+                  #PKG_REMOVED_ADD ( "{}-{}".format ( pkgdir.name, pvr ) )
                   pkgdir.purge_package ( pvr )
                   num_pkg_removed += 1
       # -- end for cat;
 
-      print ( "REMOVE_BROKEN_PACKAGES: 'finalize' ... " )
-
-      #FIXME: PKG_REMOVED*
-      if PKG_REMOVED:
-         with open ( "/tmp/roverlay_selfdep_redux.dbg", 'wt' ) as DEBUG_FH:
-            for line in PKG_REMOVED:
-               DEBUG_FH.write ( line )
-               DEBUG_FH.write ( '\n' )
 
+#      if PKG_REMOVED:
+#         with open ( "/tmp/roverlay_selfdep_redux.dbg", 'wt' ) as DEBUG_FH:
+#            for line in PKG_REMOVED:
+#               DEBUG_FH.write ( line )
+#               DEBUG_FH.write ( '\n' )
 
       # FIXME: debug prints (use logging, ...)
 
@@ -736,13 +731,13 @@ class Overlay ( object ):
          # remove_empty_categories() could be done in the loop above
          self.remove_empty_categories()
 
-         print (
-            'REMOVE_BROKEN_PACKAGES: {:d} ebuilds have been removed'.format (
+         self.logger.info (
+            'remove_broken_packages: {:d} ebuilds have been dropped.'.format (
                num_pkg_removed
             )
          )
       else:
-         print ( "REMOVE_BROKEN_PACKAGES: nothing done ;)" )
+         self.logger.info ( 'remove_broken_packages: no ebuilds removed.' )
 
       return num_pkg_removed
    # --- end of remove_broken_packages (...) ---


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/overlay/
@ 2013-07-05 17:56 André Erdmann
  0 siblings, 0 replies; 6+ messages in thread
From: André Erdmann @ 2013-07-05 17:56 UTC (permalink / raw
  To: gentoo-commits

commit:     d7d43b9c1ba13d14233ea1daf8eabcc2b61134d9
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul  5 17:55:42 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul  5 17:55:42 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=d7d43b9c

"selfdep reduction": add debug print() statements

---
 roverlay/overlay/root.py | 36 +++++++++++++++++++++++++++++++-----
 1 file changed, 31 insertions(+), 5 deletions(-)

diff --git a/roverlay/overlay/root.py b/roverlay/overlay/root.py
index c754cd3..698170d 100644
--- a/roverlay/overlay/root.py
+++ b/roverlay/overlay/root.py
@@ -678,6 +678,10 @@ class Overlay ( object ):
    # --- end of iter_package_info (...) ---
 
    def remove_bad_packages ( self ):
+      #FIXME: debug print
+      print ( "REMOVE_BAD_PACKAGES: starting selfdep reduction ... " )
+      print ( "REMOVE_BAD_PACKAGES: 'prepare' ... " )
+
       #
       # "prepare"
       #
@@ -696,6 +700,8 @@ class Overlay ( object ):
       # -- end for cat;
       del add_selfdeps
 
+      print ( "REMOVE_BAD_PACKAGES: 'link' ... " )
+
       ##
       ## link:
       ## foreach selfdep in S loop
@@ -712,6 +718,8 @@ class Overlay ( object ):
                )
       # -- end for selfdep;
 
+      print ( "REMOVE_BAD_PACKAGES: 'reduce' ... " )
+
       #
       # "reduce"
       #
@@ -737,6 +745,8 @@ class Overlay ( object ):
          num_removed_total += num_removed
       # -- end while num_removed;
 
+      print ( "REMOVE_BAD_PACKAGES: 'balance' ... " )
+
       #
       # "balance"
       #
@@ -744,15 +754,33 @@ class Overlay ( object ):
       ##     drop p
       ##
 
+      #FIXME: PKG_REMOVED*: debug code
+      PKG_REMOVED     = list()
+      PKG_REMOVED_ADD = PKG_REMOVED.append
+
+
       num_pkg_removed = 0
       for cat in self._categories.values():
          for pkgdir in cat._subdirs.values():
             for pvr, p_info in pkgdir._packages.items():
                if not p_info.has_valid_selfdeps():
+                  # FIXME: debug print
+                  PKG_REMOVED_ADD ( "{}-{}".format ( pkgdir.name, pvr ) )
                   pkgdir.purge_package ( pvr )
                   num_pkg_removed += 1
       # -- end for cat;
 
+      print ( "REMOVE_BAD_PACKAGES: 'finalize' ... " )
+
+      #FIXME: PKG_REMOVED*
+      if PKG_REMOVED:
+         with open ( "/tmp/roverlay_selfdep_redux.dbg", 'wt' ) as DEBUG_FH:
+            for line in PKG_REMOVED:
+               DEBUG_FH.write ( line )
+               DEBUG_FH.write ( '\n' )
+
+
+      # FIXME: debug prints (use logging, ...)
 
       if num_pkg_removed > 0:
          # remove_empty_categories() could be done in the loop above
@@ -760,15 +788,13 @@ class Overlay ( object ):
 
          print (
             'REMOVE_BAD_PACKAGES: found {:d} unsatisfied selfdeps, '
-            'which caused {:d} \'broken\' ebuild to be removed.'.format (
-               num_removed_total
+            'which caused {:d} \'broken\' ebuilds to be removed.'.format (
+               num_removed_total, num_pkg_removed
             )
          )
       elif num_removed_total > 0:
          raise Exception (
-            "num_removed_total > 0, but no packages removed?!".format (
-               num_removed_total
-            )
+            "num_removed_total > 0, but no packages removed?!"
          )
       else:
          print ( "REMOVE_BAD_PACKAGES: nothing done." )


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/
@ 2013-06-18 14:12 André Erdmann
  2013-06-15  8:59 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
  0 siblings, 1 reply; 6+ messages in thread
From: André Erdmann @ 2013-06-18 14:12 UTC (permalink / raw
  To: gentoo-commits

commit:     dea12476091298811456b8c8f6ca596ae195e7ee
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Sat Jun 15 08:58:16 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Sat Jun 15 08:58:16 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=dea12476

overlay: write/update USE_EXPAND description files

---
 roverlay/overlay/header.py |  13 ++++
 roverlay/overlay/root.py   | 168 ++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 171 insertions(+), 10 deletions(-)

diff --git a/roverlay/overlay/header.py b/roverlay/overlay/header.py
index 6cd1f1f..8c7c05a 100644
--- a/roverlay/overlay/header.py
+++ b/roverlay/overlay/header.py
@@ -29,6 +29,19 @@ class EbuildHeader ( object ):
       return self._cached_header
    # --- end of get (...) ---
 
+   def get_use_expand_header ( self, use_expand_name ):
+      if self.default_header:
+         return (
+            self.default_header + '\n'
+            + (
+               '# This file contains descriptions of the {} '
+               'USE_EXPAND flags.'.format ( use_expand_name )
+            ) + '\n'
+         )
+      else:
+         return None
+   # --- end of get_use_expand_header (...) ---
+
    def _make ( self ):
       if self.eclasses:
          inherit = 'inherit ' + ' '.join ( sorted ( self.eclasses ) )

diff --git a/roverlay/overlay/root.py b/roverlay/overlay/root.py
index 98d0b26..71156df 100644
--- a/roverlay/overlay/root.py
+++ b/roverlay/overlay/root.py
@@ -17,6 +17,7 @@ due do double-linkage between PackageInfo and PackageDir.
 
 __all__ = [ 'Overlay', ]
 
+import errno
 import logging
 import os
 import shutil
@@ -313,13 +314,18 @@ class Overlay ( object ):
 
          # profiles/desc/<r_suggests>.desc
          # !!! (late) config access (FIXME)
+
+         use_expand_name = roverlay.config.get_or_fail (
+            "EBUILD.USE_EXPAND.name"
+         ).rstrip ( "_" )
+
          self._write_rsuggests_use_desc (
             (
                self._profiles_dir + os.sep + 'desc' + os.sep
-               + roverlay.config.get_or_fail (
-                  "EBUILD.USE_EXPAND.name"
-               ).rstrip ( "_" ).lower()+ '.desc'
-            )
+               + use_expand_name.lower() + '.desc'
+            ),
+            use_expand_name.upper(),
+            roverlay.config.get ( 'OVERLAY.backup_desc', True )
          )
 
          # profiles/use.desc
@@ -342,12 +348,154 @@ class Overlay ( object ):
          raise
    # --- end of _init_overlay (...) ---
 
-   def _write_rsuggests_use_desc ( self, desc_file ):
-      # TODO
-      #open ( desc_file, "r" ), errno == errno.ENOENT (2)
-      self.logger.error (
-         "Cannot write {!r}: code is missing ;)".format ( desc_file )
-      )
+   def _write_rsuggests_use_desc (
+      self, desc_file, use_expand_name, backup_file, rewrite=False
+   ):
+      """Creates a USE_EXPAND description file.
+
+      Reads the old file (if it exists) and imports its header / flag desc.
+
+      arguments:
+      * desc_file       -- path to the file that should be written/read
+      * use_expand_name -- name of the USE_EXPAND variable, e.g. R_SUGGESTS
+      * backup_file     -- move desc_file to backup_file before overwriting it
+                           This can also be an int i (=> desc_file + '.<i>')
+                           or a bool (if True => desc_file + '.bak').
+      * rewrite         -- force recreation of the desc file
+      """
+      FLAG_SEPA  = ' - '
+      DESC_UNDEF = 'unknown'
+
+      def do_backup ( dest, makedir=False ):
+         self.logger.debug ( "Moving old desc file to {!r}".format ( dest ) )
+         if makedir:
+            roverlay.util.dodir ( os.path.dirname ( dest ), mkdir_p=True )
+         shutil.move ( desc_file, dest )
+      # --- end of do_backup (...) ---
+
+      def read_desc_file():
+         """Reads the old desc file (if it exists).
+         Returns a 3-tuple ( list header, dict flags, bool file_existed ).
+
+         arguments:
+         * @implicit desc_file --
+
+         Passes all exceptions (IOError, ...) but "file does not exist".
+         """
+
+         FH     = None
+         header = list()
+         # flags := dict { <flag name> => <desc>|None }
+         flags  = dict()
+         fexist = False
+         try:
+            FH = open ( desc_file, 'rt' )
+
+            addto_header = True
+
+            for line in FH.readlines():
+               rsline = line.rstrip()
+               if rsline and rsline [0] != '#':
+                  flag, sepa, desc = rsline.partition ( FLAG_SEPA )
+                  # <desc> == DESC_UNDEF -- ignore
+                  flags [flag]     = desc if sepa else None
+                  addto_header     = False
+               elif addto_header is True:
+                  header.append ( rsline )
+               elif rsline:
+                  self.logger.warning (
+                     "dropping line from {f!r}: {l}".format (
+                        f=desc_file, l=rsline
+                     )
+                  )
+            # -- end for
+
+            FH.close()
+            fexist = True
+         except IOError as ioerr:
+            if ioerr.errno == errno.ENOENT:
+               pass
+            else:
+               raise
+         finally:
+            if FH: FH.close()
+
+         return ( header, flags, fexist )
+      # --- end of read_desc_file ---
+
+      def gen_desc ( header, flags ):
+         """Creates new text lines for the desc file.
+
+         arguments:
+         * @implicit use_expand_name --
+         * header -- header line(s) to use (a default header will be created
+                     if this is empty)
+         * flags  -- flag=>desc dict
+         """
+         NEWLINE = '\n'
+
+         if header:
+            for line in header:
+               yield line
+               yield NEWLINE
+            #yield NEWLINE
+         else:
+            defheader = self._header.get_use_expand_header ( use_expand_name )
+            if defheader:
+               yield defheader
+               yield NEWLINE
+
+         for flag, desc in sorted ( flags.items(), key=lambda e: e[0] ):
+            if desc:
+               yield flag + FLAG_SEPA + desc
+            else:
+               yield flag + FLAG_SEPA + DESC_UNDEF
+            yield NEWLINE
+      # --- end of gen_desc (...) ---
+
+      header, old_flags, can_backup = read_desc_file()
+
+      if self._incremental:
+         # incremental: add new flags
+         #  Create dict flag=>None that contains all new flags
+         #  and copy old_flags "over" it.
+         #
+         flags = dict.fromkeys ( self._rsuggests_flags )
+         flags.update ( old_flags )
+      else:
+         # not incremental: discard old flags
+         #  Create a dict that contains the new flags only and use desc
+         #  from old_flags if available.
+         #
+         flags = {
+            flag: old_flags.get ( flag, None )
+            for flag in self._rsuggests_flags
+         }
+      # -- end if
+
+      # don't rewrite the desc file if nothing has changed
+      if rewrite or (
+         frozenset ( flags.keys() ) != frozenset ( old_flags.keys() )
+      ):
+         if can_backup:
+            if backup_file is True:
+               do_backup ( desc_file + '.bak' )
+            elif isinstance ( backup_file, int ):
+               do_backuo ( desc_file + '.' + str ( backup_file ) )
+            elif backup_file:
+               do_backup ( str ( backup_file ), makedir=True )
+         # -- end if
+
+         self.logger.debug ( "writing desc file {!r}".format ( desc_file ) )
+
+         roverlay.util.dodir ( os.path.dirname ( desc_file ) )
+         with open ( desc_file, 'wt' ) as FH:
+            for line in gen_desc ( header, flags ):
+               FH.write ( line )
+      else:
+         self.logger.debug (
+            "not writing desc file {!r} (nothing changed)".format ( desc_file )
+         )
    # --- end of _write_rsuggests_use_desc (...) ---
 
    def add ( self, package_info ):


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/
@ 2013-06-13 16:34 André Erdmann
  2013-06-05 18:08 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
  0 siblings, 1 reply; 6+ messages in thread
From: André Erdmann @ 2013-06-13 16:34 UTC (permalink / raw
  To: gentoo-commits

commit:     fc3eeb0f06119515f8db68311183172923423ded
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jun  5 18:02:09 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Jun  5 18:02:09 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=fc3eeb0f

overlay: fix dynpool rules, remove moved ebuilds

---
 roverlay/overlay/category.py | 44 +++++++++++++++++++-----
 roverlay/overlay/creator.py  |  6 ++++
 roverlay/overlay/root.py     | 82 ++++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 120 insertions(+), 12 deletions(-)

diff --git a/roverlay/overlay/category.py b/roverlay/overlay/category.py
index 2d9b93d..baca2d1 100644
--- a/roverlay/overlay/category.py
+++ b/roverlay/overlay/category.py
@@ -90,6 +90,12 @@ class Category ( object ):
       )
    # --- end of add (...) ---
 
+   def drop_package ( self, name ):
+      p = self._subdirs [name]
+      del self._subdirs [name]
+      p.fs_destroy()
+   # --- end of drop_package (...) ---
+
    def empty ( self ):
       """Returns True if this category contains 0 ebuilds."""
       return (
@@ -98,6 +104,11 @@ class Category ( object ):
       )
    # --- end of empty (...) ---
 
+   def get_nonempty ( self, name ):
+      subdir = self._subdirs.get ( name, None )
+      return subdir if ( subdir and not subdir.empty() ) else None
+   # --- end of has_nonempty (...) ---
+
    def has ( self, subdir ):
       return subdir in self._subdirs
    # --- end of has (...) ---
@@ -106,22 +117,37 @@ class Category ( object ):
       return os.path.isdir ( self.physical_location + os.sep + _dir )
    # --- end of has_category (...) ---
 
-   def list_packages ( self, for_deprules=False ):
+   def list_package_names ( self ):
+      for name, subdir in self._subdirs.items():
+         if not subdir.empty():
+            yield name
+   # --- end of list_package_names (...) ---
+
+   def list_packages ( self,
+      for_deprules=False, is_default_category=False
+   ):
       """Lists all packages in this category.
       Yields <category>/<package name> or a dict (see for_deprules below).
 
       arguments:
-      * for_deprules -- if set and True:
-                         yield keyword args for dependency rules
+      * for_deprules        -- if set and True:
+                                yield keyword args for dependency rules
+      * is_default_category -- bool indicating whether this category is the
+                               default one or not
       """
-
-      for name, subdir in self._subdirs.items():
-         if not subdir.empty():
-            if for_deprules:
+      if for_deprules:
+         for name, subdir in self._subdirs.items():
+            if not subdir.empty():
                yield dict (
-                  dep_str=name, resolving_package=self.name + os.sep + name
+                  dep_str           = name,
+                  resolving_package = ( self.name + "/" + name ),
+                  is_selfdep        = is_default_category,
+                  # prefer packages from the default category (really?)
+                  priority          = 80 if is_default_category else 90,
                )
-            else:
+      else:
+         for name, subdir in self._subdirs.items():
+            if not subdir.empty():
                yield self.name + os.sep + name
    # --- end of list_packages (...) ---
 

diff --git a/roverlay/overlay/creator.py b/roverlay/overlay/creator.py
index 8833aef..5ad86d4 100644
--- a/roverlay/overlay/creator.py
+++ b/roverlay/overlay/creator.py
@@ -274,6 +274,12 @@ class OverlayCreator ( object ):
       del self.package_rules
    # --- end of release_package_rules (...) ---
 
+   def remove_moved_ebuilds ( self, reverse ):
+      """See overlay.root.Overlay.remove_moved_ebuilds()."""
+      if self.overlay.remove_duplicate_ebuilds ( reverse=reverse ):
+         self.depresolver.reload_pools()
+   # --- end of remove_moved_ebuilds (...) ---
+
    def add_package ( self, package_info ):
       """Adds a PackageInfo to the package queue.
 

diff --git a/roverlay/overlay/root.py b/roverlay/overlay/root.py
index 3adbb6e..b9030d2 100644
--- a/roverlay/overlay/root.py
+++ b/roverlay/overlay/root.py
@@ -259,7 +259,9 @@ class Overlay ( object ):
          write_profiles_file ( 'repo_name', self.name + '\n' )
 
          # profiles/categories
-         cats = '\n'.join ( self._categories.keys() )
+         cats = '\n'.join (
+            k for k, v in self._categories.items() if not v.empty()
+         )
          if cats:
             write_profiles_file ( 'categories', cats + '\n' )
 
@@ -319,6 +321,78 @@ class Overlay ( object ):
       return os.path.isdir ( self.physical_location + os.sep + _dir )
    # --- end of has_category (...) ---
 
+   def find_duplicate_packages ( self, _default_category=None ):
+      default_category = (
+         _default_category if _default_category is None
+         else self._categories.get ( self.default_category, None )
+      )
+
+      if default_category:
+         duplicate_pkg  = set()
+
+         for category in self._categories.values():
+            if category is not default_category:
+               for name in category.list_package_names():
+                  if default_category.get_nonempty ( name ):
+                     duplicate_pkg.add ( name )
+         # -- end for;
+
+         return frozenset ( duplicate_pkg )
+      else:
+         return None
+   # --- end of find_duplicate_packages (...) ---
+
+   def remove_duplicate_ebuilds ( self, reverse ):
+      default_category = self._categories.get ( self.default_category, None )
+      if default_category:
+         if reverse:
+            d_pkg = self.find_duplicate_packages (
+               _default_category=default_category
+            )
+            for pkg_name in d_pkg:
+               default_category.drop_package ( pkg_name )
+
+         else:
+            d_pkg = set()
+            for category in self._categories.values():
+               if category is not default_category:
+                  for name in category.list_package_names():
+                     if default_category.get_nonempty ( name ):
+                        d_pkg.add ( name )
+                        category.drop_package ( pkg_name )
+            # -- end for category;
+
+         # -- end if;
+
+         if d_pkg:
+            self.remove_empty_categories()
+
+            self.logger.info (
+               '{} ebuilds have been removed from the default category, '
+               'the overlay might be broken now!'.format ( len ( d_pkg ) )
+            )
+            return True
+         else:
+            return False
+      else:
+         return False
+
+   # --- end of remove_duplicate_ebuilds (...) ---
+
+   def remove_empty_categories ( self ):
+      catlist = self._categories.items()
+      for cat in catlist:
+         cat[1].remove_empty()
+         if cat[1].empty():
+            del self._categories [cat[0]]
+
+            try:
+               os.rmdir ( cat [1].physical_location )
+            except OSError as ose:
+               self.logger.exception ( ose )
+
+   # --- end of remove_empty_categories (...) ---
+
    def list_packages ( self, for_deprules=True ):
       for cat in self._categories.values():
          for package in cat.list_packages ( for_deprules=for_deprules ):
@@ -326,9 +400,11 @@ class Overlay ( object ):
    # --- end of list_packages (...) ---
 
    def list_rule_kwargs ( self ):
-      # FIXME/TODO: depres has to recognize categories
       for cat in self._categories.values():
-         for kwargs in cat.list_packages ( for_deprules=True ):
+         for kwargs in cat.list_packages (
+            for_deprules        = True,
+            is_default_category = ( cat.name is self.default_category )
+         ):
             yield kwargs
    # --- end of list_rule_kwargs (...) ---
 


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-07-10 15:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-22 15:24 [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/ André Erdmann
2013-06-22 15:14 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
  -- strict thread matches above, loose matches on Subject: below --
2013-07-10 15:10 André Erdmann
2013-07-05 17:56 André Erdmann
2013-06-18 14:12 [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-06-15  8:59 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-06-13 16:34 [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-06-05 18:08 ` [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox