public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
@ 2013-01-28 23:54 André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2013-01-28 23:54 UTC (permalink / raw
  To: gentoo-commits

commit:     2961d3624bf9decc5330067f3083a8e0ff80ddb5
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Jan 28 22:35:34 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Jan 28 23:37:04 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=2961d362

roverlay/overlay/pkgdir: manifest impl choices

Removed the 'external:' prefix in _PACKAGE_DIR_IMPLEMENTATIONS,
added short names for the available implementations and added
'portage'.

---
 roverlay/overlay/pkgdir/__init__.py |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/roverlay/overlay/pkgdir/__init__.py b/roverlay/overlay/pkgdir/__init__.py
index e140ef7..cc4b79b 100644
--- a/roverlay/overlay/pkgdir/__init__.py
+++ b/roverlay/overlay/pkgdir/__init__.py
@@ -20,10 +20,12 @@ _package_dir_module = None
 _package_dir_class  = None
 
 _PACKAGE_DIR_IMPLEMENTATIONS = {
-   'none'             : 'packagedir_base',
-   'default'          : 'packagedir_ebuildmanifest',
-   'external:ebuild'  : 'packagedir_ebuildmanifest',
-#   'external:portage' : 'packagedir_portagemanifest',
+   'none'    : 'packagedir_base',
+   'default' : 'packagedir_ebuildmanifest',
+   'e'       : 'packagedir_ebuildmanifest',
+   'ebuild'  : 'packagedir_ebuildmanifest',
+   'p'       : 'packagedir_portagemanifest',
+   'portage' : 'packagedir_portagemanifest',
 }
 
 def _configure():


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
@ 2013-01-28 23:54 André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2013-01-28 23:54 UTC (permalink / raw
  To: gentoo-commits

commit:     e30e6406aacc718f49eaa58723465107afa39aa8
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Jan 28 22:43:37 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Jan 28 23:37:04 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=e30e6406

roverlay/overlay/pkgdir: portagemanifest

A Manifest file creation that uses the portage python libs directly.

This has the following advantages over the "ebuild" implementation:
* create more than one Manifest at once (thread safe)
* faster file creation time (direct "create Manifest" function call
  instead of calling an external executable a few thousand times)

The downsides are:
* highly EXPERIMENTAL (currently)
* less stable to changes in portage (written for portage version 2.1.11.31)

---
 .../overlay/pkgdir/packagedir_portagemanifest.py   |  163 ++++++++++++++++++++
 1 files changed, 163 insertions(+), 0 deletions(-)

diff --git a/roverlay/overlay/pkgdir/packagedir_portagemanifest.py b/roverlay/overlay/pkgdir/packagedir_portagemanifest.py
new file mode 100644
index 0000000..bf9efee
--- /dev/null
+++ b/roverlay/overlay/pkgdir/packagedir_portagemanifest.py
@@ -0,0 +1,163 @@
+__all__ = [ 'PackageDir', ]
+
+import os
+import shlex
+
+import portage.manifest
+
+import logging
+logging.getLogger ( __name__ ).warning ( "experimental code" )
+del logging
+
+import roverlay.config
+import roverlay.strutil
+import roverlay.packageinfo
+import roverlay.overlay.pkgdir.packagedir_base
+import roverlay.overlay.pkgdir.symlink.distroot
+
+class PackageDir ( roverlay.overlay.pkgdir.packagedir_base.PackageDirBase ):
+
+	MANIFEST_THREADSAFE = True
+
+	def _scan_add_package ( self, efile, pvr ):
+		"""Called for each ebuild that is found during scan().
+		Creates a PackageInfo for the ebuild and adds it to self._packages.
+
+		arguments:
+		* efile -- full path to the ebuild file
+		* pvr   -- version ($PVR) of the ebuild
+		"""
+
+		# read SRC_URI from the ebuild file which is the only way to get
+		# the correct package name
+		src_uri = None
+		with open ( efile, 'r' ) as FH:
+			reader                   = shlex.shlex ( FH )
+			reader.whitespace_split  = False
+			reader.wordchars        += ' ,./$()[]:+-@*~<>'
+
+			# assumption: only one SRC_URI= statement per ebuild
+			# (true for roverlay ebuilds)
+			mode  = 0
+			token = reader.get_token()
+			while token:
+				if mode == 0 and token == 'SRC_URI':
+					mode = 1
+				elif mode == 1 and token == '=':
+					mode = 2
+				elif mode == 2:
+					mode = 3
+					src_uri = tuple (
+						roverlay.strutil.split_whitespace (
+							roverlay.strutil.unquote ( token )
+						)
+					)
+
+				# break loop if SRC_URI parsed
+				token = reader.get_token() if mode < 3 else None
+			# --- while;
+			del token, reader, mode
+		# --- with;
+
+		if src_uri:
+			# another assumption: src_uri [0] is the name of the R package
+			package_filename = src_uri [0].rpartition ( '/' ) [2]
+
+			p = roverlay.packageinfo.PackageInfo (
+				physical_only=True, pvr=pvr, ebuild_file=efile,
+				package_filename=package_filename
+			)
+		else:
+			p = roverlay.packageinfo.PackageInfo (
+				physical_only=True, pvr=pvr, ebuild_file=efile
+			)
+
+			self._packages [ p ['ebuild_verstr'] ] = p
+	# --- end of _scan_add_package (...) ---
+
+	def write_manifest ( self, ignore_empty=False ):
+		"""Generates and writes the Manifest file for this package.
+
+		expects: called after writing metadata/ebuilds
+
+		returns: success (True/False)
+
+		raises:
+		* Exception if no ebuild exists
+		"""
+
+		# the "package_filename" key is also required
+		pkgs_for_manifest = frozenset (
+			p for p in self._packages.values()
+				if p.has ( 'ebuild_filename', 'package_file' )
+		)
+
+		# TODO: this needs proper testing
+		# * the written Manifest file must not differ from the one generated by
+		#   ebuild(1) (the order of the entries is not important, though)
+		# * safe for incremental usage?
+		# * correct usage of the portage libs (also see other comments below)
+		# * what happens if an ebuild has been removed?
+		# * ...
+		#
+		if pkgs_for_manifest:
+			symlink_distdir = roverlay.overlay.pkgdir.symlink.distroot.\
+				SymlinkDistroot.get_configured().get ( self.name )
+
+			# allow_missing=True -- don't write empty Manifest files
+			manifest = portage.manifest.Manifest (
+				self.physical_location,
+				str ( symlink_distdir ),
+				allow_missing=True,
+			)
+
+			# metadata.xml
+			# os.path.basename ( self._metadata.filepath )
+			manifest.addFile ( 'MISC', 'metadata.xml' )
+
+			for p in pkgs_for_manifest:
+				ebuild_filename  = p ['ebuild_filename']
+				package_filename = p ['package_filename']
+
+				if not manifest.hasFile ( 'EBUILD', ebuild_filename ):
+					manifest.addFile ( 'EBUILD', ebuild_filename )
+
+				if not manifest.hasFile ( 'DIST', package_filename ):
+					symlink_distdir.add ( p ['package_file'], package_filename )
+					manifest.addFile (
+						'DIST',
+						package_filename,
+						# TODO:
+						# ignoreMissing for DIST files, else addFile raises
+						# FileNotFound -- is this the correct way to add DIST files?
+						ignoreMissing=True
+					)
+
+			# ??? FIXME: (read) portage api docs
+			#
+			# manifest.create -- recreate from scratch (required?)
+			# -> assumeDistHashesSometimes:
+			#     use existing checksums for non-existent DIST files (required?)
+			#
+			#manifest.create ( assumeDistHashesSometimes=True )
+			#manifest.create ( assumeDistHashesSometimes=False )
+
+			manifest.write()
+			self._need_manifest = False
+
+			return True
+
+		elif ignore_empty:
+
+			return True
+
+		else:
+			raise Exception (
+				'In {mydir}: No ebuild written so far! '
+				'I really don\'t know what do to!'.format (
+					mydir=self.physical_location
+			) )
+
+		# @unreachable
+		return False
+	# --- end of write_manifest (...) ---


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
@ 2013-02-05 20:39 André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2013-02-05 20:39 UTC (permalink / raw
  To: gentoo-commits

commit:     793dfbfa26aab0f3f7e57cc08ab5fa32038be9c7
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Feb  5 20:37:30 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Feb  5 20:37:30 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=793dfbfa

packagedir_portagemanifest: fix indent typo

Fixed an indention mistake in _scan_add_package() that caused incremental
overlay creation to malfunction.

---
 .../overlay/pkgdir/packagedir_portagemanifest.py   |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/roverlay/overlay/pkgdir/packagedir_portagemanifest.py b/roverlay/overlay/pkgdir/packagedir_portagemanifest.py
index bf9efee..9c8aca3 100644
--- a/roverlay/overlay/pkgdir/packagedir_portagemanifest.py
+++ b/roverlay/overlay/pkgdir/packagedir_portagemanifest.py
@@ -1,3 +1,9 @@
+# R overlay -- overlay package, package directory (portage manifest)
+# -*- coding: utf-8 -*-
+# Copyright (C) 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.
+
 __all__ = [ 'PackageDir', ]
 
 import os
@@ -71,8 +77,9 @@ class PackageDir ( roverlay.overlay.pkgdir.packagedir_base.PackageDirBase ):
 			p = roverlay.packageinfo.PackageInfo (
 				physical_only=True, pvr=pvr, ebuild_file=efile
 			)
+		# --- if;
 
-			self._packages [ p ['ebuild_verstr'] ] = p
+		self._packages [ p ['ebuild_verstr'] ] = p
 	# --- end of _scan_add_package (...) ---
 
 	def write_manifest ( self, ignore_empty=False ):


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
@ 2013-02-09 20:45 André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2013-02-09 20:45 UTC (permalink / raw
  To: gentoo-commits

commit:     374baf90abb3abb3795e47e4f9e65ada264b0915
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Sat Feb  9 20:41:04 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Sat Feb  9 20:41:04 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=374baf90

portagemanifest: always add pkg file to DISTDIR

Always add package files to the distdir even if <manifest>.hasFile() returns
True (which is what ebuildmanifest does).
This can only happen when running "roverlay --no-incremental" after deleting
the distdir manually.

---
 .../overlay/pkgdir/packagedir_portagemanifest.py   |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/roverlay/overlay/pkgdir/packagedir_portagemanifest.py b/roverlay/overlay/pkgdir/packagedir_portagemanifest.py
index b9781a9..9dc2182 100644
--- a/roverlay/overlay/pkgdir/packagedir_portagemanifest.py
+++ b/roverlay/overlay/pkgdir/packagedir_portagemanifest.py
@@ -130,6 +130,14 @@ class PackageDir ( roverlay.overlay.pkgdir.packagedir_base.PackageDirBase ):
 					# FileNotFound -- is this the correct way to add DIST files?
 					ignoreMissing=True
 				)
+			else:
+				# ebuildmanifest adds all package files to the distdir without
+				# doing the check above (if hasFile())
+				# be "fully compatible" and do that here, too
+				try:
+					distdir.add ( p ['package_file'], package_filename )
+				except Exception as err:
+					self.logger.exception ( err )
 
 		# ??? FIXME: (read) portage api docs
 		#


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
@ 2013-04-25 16:44 André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2013-04-25 16:44 UTC (permalink / raw
  To: gentoo-commits

commit:     944d1a9f5986aae3a03587e541aa43e82af105a5
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Apr 25 15:01:14 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Apr 25 15:01:14 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=944d1a9f

overlay/pkgdir: misc, fix for portagemanifest

Changes:
* self._need_manifest is now set by PackageDirBase.write_manifest()
* replaced debug print with debug log statement in PackagDirBase
* portagemanifest: dont fail if metadata.xml does not exist

---
 roverlay/overlay/pkgdir/packagedir_base.py         |   13 +++++++++----
 .../overlay/pkgdir/packagedir_ebuildmanifest.py    |    6 +-----
 .../overlay/pkgdir/packagedir_portagemanifest.py   |   19 +++++++++++++++----
 3 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/roverlay/overlay/pkgdir/packagedir_base.py b/roverlay/overlay/pkgdir/packagedir_base.py
index 3c9b623..95da017 100644
--- a/roverlay/overlay/pkgdir/packagedir_base.py
+++ b/roverlay/overlay/pkgdir/packagedir_base.py
@@ -195,15 +195,16 @@ class PackageDirBase ( object ):
 		try:
 			self._lock.acquire()
 			pvr = package_info ['ebuild_verstr']
-			# FIXME debug print
-			print ( "removing {PVR} from {PN}".format ( PVR=pvr, PN=self.name ) )
+			self.logger.debug (
+				"removing {PVR} from {PN}".format ( PVR=pvr, PN=self.name )
+			)
 			del self._packages [pvr]
 			self.generate_metadata ( skip_if_existent=False )
 		except KeyError:
 			pass
 		finally:
 			self._lock.release()
-	# --- end of uncreateable_ebuild (...) ---
+	# --- end of ebuild_uncreateable (...) ---
 
 	def empty ( self ):
 		"""Returns True if no ebuilds stored, else False.
@@ -637,7 +638,11 @@ class PackageDirBase ( object ):
 
 		if pkgs_for_manifest:
 			self.logger.debug ( "Writing Manifest" )
-			return self._write_manifest ( pkgs_for_manifest )
+			if self._write_manifest ( pkgs_for_manifest ):
+				self._need_manifest = False
+				return True
+			else:
+				return False
 		elif ignore_empty:
 			return True
 		else:

diff --git a/roverlay/overlay/pkgdir/packagedir_ebuildmanifest.py b/roverlay/overlay/pkgdir/packagedir_ebuildmanifest.py
index 5fec14b..0014147 100644
--- a/roverlay/overlay/pkgdir/packagedir_ebuildmanifest.py
+++ b/roverlay/overlay/pkgdir/packagedir_ebuildmanifest.py
@@ -25,9 +25,5 @@ class PackageDir ( packagedir_base.PackageDirBase ):
 		returns: success (True/False)
 		"""
 
-		if manifest.create_manifest ( pkgs_for_manifest, nofail=False ):
-			self._need_manifest = False
-			return True
-		else:
-			return False
+		return manifest.create_manifest ( pkgs_for_manifest, nofail=False )
 	# --- end of write_manifest (...) ---

diff --git a/roverlay/overlay/pkgdir/packagedir_portagemanifest.py b/roverlay/overlay/pkgdir/packagedir_portagemanifest.py
index 9dc2182..588bdc0 100644
--- a/roverlay/overlay/pkgdir/packagedir_portagemanifest.py
+++ b/roverlay/overlay/pkgdir/packagedir_portagemanifest.py
@@ -10,6 +10,7 @@ import os
 import shlex
 
 import portage.manifest
+import portage.exception
 
 import logging
 logging.getLogger ( __name__ ).warning ( "experimental code" )
@@ -109,8 +110,20 @@ class PackageDir ( roverlay.overlay.pkgdir.packagedir_base.PackageDirBase ):
 		)
 
 		# metadata.xml
-		# os.path.basename ( self._metadata.filepath )
-		manifest.addFile ( 'MISC', 'metadata.xml' )
+		#os.path.basename ( self._metadata.filepath )
+		try:
+			manifest.addFile ( 'MISC', 'metadata.xml' )
+		except portage.exception.FileNotFound as f404:
+			# package dir has no metadata.xml file
+			#
+			# This happens for a few package dirs that dont contain any package
+			# with enough information required for metadata creation
+			#
+			# packagedir_ebuildmanifest accepts this case without complaining,
+			# so ignore it here, too.
+			#
+			pass
+
 
 		for p in pkgs_for_manifest:
 
@@ -149,7 +162,5 @@ class PackageDir ( roverlay.overlay.pkgdir.packagedir_base.PackageDirBase ):
 		#manifest.create ( assumeDistHashesSometimes=False )
 
 		manifest.write()
-		self._need_manifest = False
-
 		return True
 	# --- end of write_manifest (...) ---


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
@ 2013-06-13 16:34 André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2013-06-13 16:34 UTC (permalink / raw
  To: gentoo-commits

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

overlay/pkgdir: fs_destroy()

This function removes all ebuilds of a package from the overlay.

---
 roverlay/overlay/pkgdir/packagedir_base.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/roverlay/overlay/pkgdir/packagedir_base.py b/roverlay/overlay/pkgdir/packagedir_base.py
index 8fb6ca4..62dd7c7 100644
--- a/roverlay/overlay/pkgdir/packagedir_base.py
+++ b/roverlay/overlay/pkgdir/packagedir_base.py
@@ -105,6 +105,8 @@ class PackageDirBase ( object ):
       """Called for each ebuild that is found during scan().
       Creates a PackageInfo for the ebuild and adds it to self._packages.
 
+      PackageInfo objects added this way are not affected by package rules.
+
       arguments:
       * efile -- full path to the ebuild file
       * pvr   -- version ($PVR) of the ebuild
@@ -353,6 +355,15 @@ class PackageDirBase ( object ):
          return None
    # --- end of purge_package (...) ---
 
+   def fs_destroy ( self ):
+      pvr_list = list ( self._packages.keys() )
+      for pvr in pvr_list:
+         self.purge_package ( pvr )
+
+      assert not self.empty()
+      self.fs_cleanup()
+   # --- end of fs_destroy (...) ---
+
    def scan ( self, **kw ):
       """Scans the filesystem location of this package for existing
       ebuilds and adds them.


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
@ 2013-07-10 16:16 André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2013-07-10 16:16 UTC (permalink / raw
  To: gentoo-commits

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

pkgdir_base: fixup

* unused variables removed: HASHES, SUPPRESS_EXCEPTIONS
* added DOEBUILD_FETCH to set the doebuild fetch function (class-wide)
* get_distdir(), fetch_src_for_ebuild() added

---
 roverlay/overlay/pkgdir/packagedir_base.py | 39 +++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 14 deletions(-)

diff --git a/roverlay/overlay/pkgdir/packagedir_base.py b/roverlay/overlay/pkgdir/packagedir_base.py
index 63adfb4..53ebc42 100644
--- a/roverlay/overlay/pkgdir/packagedir_base.py
+++ b/roverlay/overlay/pkgdir/packagedir_base.py
@@ -1,6 +1,6 @@
 # R overlay -- overlay package, package directory
 # -*- 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.
 
@@ -37,6 +37,8 @@ import roverlay.overlay.additionsdir
 import roverlay.overlay.pkgdir.distroot.static
 import roverlay.overlay.pkgdir.metadata
 
+# TODO: proper reading of $SRC_URI when importing (or scanning) ebuilds
+#        This would make manifest creation being more controlled
 
 class PackageDirBase ( object ):
    """The PackageDir base class that implements most functionality except
@@ -44,10 +46,9 @@ class PackageDirBase ( object ):
 
    #DISTROOT =
    #DISTMAP  =
-   EBUILD_SUFFIX       = '.ebuild'
    #FETCHENV =
-   #HASHES   =
-   SUPPRESS_EXCEPTIONS = True
+
+   EBUILD_SUFFIX  = '.ebuild'
 
    # MANIFEST_THREADSAFE (tri-state)
    # * None  -- unknown (e.g. write_manifest() not implemented)
@@ -56,6 +57,12 @@ class PackageDirBase ( object ):
    #
    MANIFEST_THREADSAFE = None
 
+   # DOEBUILD_FETCH
+   #  doebuild function that fetches $SRC_URI
+   #  can be overridden by subclasses if e.g. on-the-fly manifest creation
+   #  is required, too
+   DOEBUILD_FETCH = roverlay.tools.ebuild.doebuild_fetch
+
    @classmethod
    def init_base_cls ( cls ):
       # env for calling "ebuild <ebuild file> fetch"
@@ -66,9 +73,6 @@ class PackageDirBase ( object ):
 
       cls.DISTROOT = roverlay.overlay.pkgdir.distroot.static.get_configured()
       cls.DISTMAP  = roverlay.recipe.distmap.access()
-      # FIXME/TODO: config
-      #cls.HASHES = frozenset ({ 'sha256', 'sha512', 'whirlpool', })
-      cls.HASHES = frozenset ({ 'sha256', })
       cls.FETCHENV = fetch_env
    # --- end of init_cls (...) ---
 
@@ -581,6 +585,18 @@ class PackageDirBase ( object ):
       return success
    # --- end of write (...) ---
 
+   def get_distdir ( self ):
+      return self.DISTROOT.get_distdir ( self.name )
+   # --- end of get_distdir (...) ---
+
+   def fetch_src_for_ebuild ( self, efile ):
+      return self.DOEBUILD_FETCH (
+         ebuild_file = efile,
+         logger      = self.logger,
+         env         = self.FETCHENV.get_env ( self.get_distdir().get_root() )
+      )
+   # --- end of fetch_src_for_ebuild (...) ---
+
    def import_ebuilds ( self, eview, overwrite, nosync=False ):
       """Imports ebuilds from an additions dir into this package dir.
 
@@ -625,12 +641,7 @@ class PackageDirBase ( object ):
             self._need_manifest = True
 
             # fetch SRC_URI using ebuild(1)
-            if not nosync and not roverlay.tools.ebuild.doebuild_fetch (
-               efile_dest, self.logger,
-               self.FETCHENV.get_env (
-                  self.DISTROOT.get_distdir ( self.name ).get_root()
-               )
-            ):
+            if not nosync and not self.fetch_src_for_ebuild ( efile_dest ):
                raise Exception ( "doebuild_fetch() failed." )
 
             # imported ebuilds cannot be used for generating metadata.xml
@@ -810,7 +821,6 @@ class PackageDirBase ( object ):
 
             # generate hashes here (benefit from threading)
             # FIXME/TODO: ^ actually faster?
-            ##p_info.make_hashes ( self.HASHES )
             p_info.make_distmap_hash()
 
             self._need_manifest = True
@@ -884,6 +894,7 @@ class PackageDirBase ( object ):
             return True
          else:
             return False
+
       elif (
          hasattr ( self, '_write_import_manifest' )
          and self._write_import_manifest()


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
@ 2013-07-10 16:16 André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2013-07-10 16:16 UTC (permalink / raw
  To: gentoo-commits

commit:     d0803a228f07e2c535dac48b21d07499d0a6e8db
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jul 10 15:07:16 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Jul 10 15:07:16 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=d0803a22

remove portagemanifest

---
 .../overlay/pkgdir/packagedir_portagemanifest.py   | 183 ---------------------
 1 file changed, 183 deletions(-)

diff --git a/roverlay/overlay/pkgdir/packagedir_portagemanifest.py b/roverlay/overlay/pkgdir/packagedir_portagemanifest.py
deleted file mode 100644
index f4527a1..0000000
--- a/roverlay/overlay/pkgdir/packagedir_portagemanifest.py
+++ /dev/null
@@ -1,183 +0,0 @@
-# R overlay -- overlay package, package directory (portage manifest)
-# -*- coding: utf-8 -*-
-# Copyright (C) 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.
-
-__all__ = [ 'PackageDir', ]
-
-import os
-import shlex
-
-import portage.manifest
-import portage.exception
-
-import logging
-logging.getLogger ( __name__ ).warning (
-   "experimental code, importing ebuilds doesn't work!"
-)
-del logging
-
-import roverlay.config
-import roverlay.strutil
-import roverlay.packageinfo
-import roverlay.overlay.pkgdir.packagedir_base
-import roverlay.overlay.pkgdir.distroot
-
-class PackageDir ( roverlay.overlay.pkgdir.packagedir_base.PackageDirBase ):
-   # FIXME: portagemanifest is broken, it cannot create Manifest files for
-   # package dirs with imported ebuilds
-
-   MANIFEST_THREADSAFE = True
-
-   def import_ebuilds ( self, *args, **kwargs ):
-      raise NotImplementedError (
-         "ebuild imports not supported by portagemanifest!"
-      )
-   # --- end of import_ebuilds (...) ---
-
-   def _scan_add_package ( self, efile, pvr ):
-      """Called for each ebuild that is found during scan().
-      Creates a PackageInfo for the ebuild and adds it to self._packages.
-
-      arguments:
-      * efile -- full path to the ebuild file
-      * pvr   -- version ($PVR) of the ebuild
-      """
-
-      # read SRC_URI from the ebuild file which is the only way to get
-      # the correct package name
-      src_uri = None
-      with open ( efile, 'r' ) as FH:
-         reader                   = shlex.shlex ( FH )
-         reader.whitespace_split  = False
-         reader.wordchars        += ' ,./$()[]:+-@*~<>'
-
-         # assumption: only one SRC_URI= statement per ebuild
-         # (true for roverlay ebuilds)
-         mode  = 0
-         token = reader.get_token()
-         while token:
-            if mode == 0 and token == 'SRC_URI':
-               mode = 1
-            elif mode == 1 and token == '=':
-               mode = 2
-            elif mode == 2:
-               mode = 3
-               src_uri = tuple (
-                  roverlay.strutil.split_whitespace (
-                     roverlay.strutil.unquote ( token )
-                  )
-               )
-
-            # break loop if SRC_URI parsed
-            token = reader.get_token() if mode < 3 else None
-         # --- while;
-         del token, reader, mode
-      # --- with;
-
-      # another assumption:
-      #  name of the R package is src_uri[2] if src_uri[1] == '->', else [0]
-      #
-      if src_uri:
-         # > 2, > 1? ebuild would be broken if $SRC_URI ends with '->'
-         #if len ( src_uri ) > 2 and src_uri [1] == '->':
-         if len ( src_uri ) > 1 and src_uri [1] == '->':
-            package_filename = src_uri[2]
-         else:
-            package_filename = src_uri[0].rpartition ( '/' ) [2]
-
-         p = roverlay.packageinfo.PackageInfo (
-            physical_only=True, pvr=pvr, ebuild_file=efile,
-            package_filename=package_filename
-         )
-      else:
-         p = roverlay.packageinfo.PackageInfo (
-            physical_only=True, pvr=pvr, ebuild_file=efile
-         )
-      # --- if;
-
-      self._packages [ p ['ebuild_verstr'] ] = p
-   # --- end of _scan_add_package (...) ---
-
-   def _write_manifest ( self, pkgs_for_manifest ):
-      """Generates and writes the Manifest file for this package.
-
-      expects: called after writing metadata/ebuilds
-
-      returns: True
-      """
-
-      # TODO: this needs proper testing
-      # * the written Manifest file must not differ from the one generated by
-      #   ebuild(1) (the order of the entries is not important, though)
-      # * safe for incremental usage?
-      # * correct usage of the portage libs (also see other comments below)
-      # * what happens if an ebuild has been removed?
-      # * ...
-      #
-
-      distdir = self.DISTROOT.get_distdir ( self.name )
-
-      # allow_missing=True -- don't write empty Manifest files
-      manifest = portage.manifest.Manifest (
-         self.physical_location,
-         distdir.get_root(),
-         allow_missing=True,
-      )
-
-      # metadata.xml
-      #os.path.basename ( self._metadata.filepath )
-      try:
-         manifest.addFile ( 'MISC', 'metadata.xml' )
-      except portage.exception.FileNotFound as f404:
-         # package dir has no metadata.xml file
-         #
-         # This happens for a few package dirs that dont contain any package
-         # with enough information required for metadata creation
-         #
-         # packagedir_ebuildmanifest accepts this case without complaining,
-         # so ignore it here, too.
-         #
-         pass
-
-
-      for p in pkgs_for_manifest:
-
-         ebuild_filename  = p ['ebuild_filename']
-         package_filename = p ['package_src_destpath']
-
-         if not manifest.hasFile ( 'EBUILD', ebuild_filename ):
-            manifest.addFile ( 'EBUILD', ebuild_filename )
-
-         if not manifest.hasFile ( 'DIST', package_filename ):
-            distdir.add ( p ['package_file'], package_filename, p )
-            manifest.addFile (
-               'DIST',
-               package_filename,
-               # TODO:
-               # ignoreMissing for DIST files, else addFile raises
-               # FileNotFound -- is this the correct way to add DIST files?
-               ignoreMissing=True
-            )
-         else:
-            # ebuildmanifest adds all package files to the distdir without
-            # doing the check above (if hasFile())
-            # be "fully compatible" and do that here, too
-            try:
-               distdir.add ( p ['package_file'], package_filename, p )
-            except Exception as err:
-               self.logger.exception ( err )
-
-      # ??? FIXME: (read) portage api docs
-      #
-      # manifest.create -- recreate from scratch (required?)
-      # -> assumeDistHashesSometimes:
-      #     use existing checksums for non-existent DIST files (required?)
-      #
-      #manifest.create ( assumeDistHashesSometimes=True )
-      #manifest.create ( assumeDistHashesSometimes=False )
-
-      manifest.write()
-      return True
-   # --- end of write_manifest (...) ---


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
  2013-07-10 16:16 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
@ 2013-07-10 16:16 ` André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2013-07-10 16:16 UTC (permalink / raw
  To: gentoo-commits

commit:     d02a12fa7114abeb9cb53afc390f81d9e6657d03
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jul 10 15:12:12 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Jul 10 15:12:12 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=d02a12fa

use newmanifest by default

---
 roverlay/overlay/pkgdir/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/roverlay/overlay/pkgdir/__init__.py b/roverlay/overlay/pkgdir/__init__.py
index fd49431..90dfb6e 100644
--- a/roverlay/overlay/pkgdir/__init__.py
+++ b/roverlay/overlay/pkgdir/__init__.py
@@ -21,7 +21,7 @@ _package_dir_class  = None
 
 _PACKAGE_DIR_IMPLEMENTATIONS = {
    'none'    : 'packagedir_base',
-   'default' : 'packagedir_ebuildmanifest',
+   'default' : 'packagedir_newmanifest',
    'e'       : 'packagedir_ebuildmanifest',
    'ebuild'  : 'packagedir_ebuildmanifest',
    'next'    : 'packagedir_newmanifest',


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
  2013-07-10 16:16 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
@ 2013-07-10 16:16 ` André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2013-07-10 16:16 UTC (permalink / raw
  To: gentoo-commits

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

roverlay/overlay/pkgdir: create all hashes at once

---
 roverlay/overlay/pkgdir/packagedir_base.py           | 4 ----
 roverlay/overlay/pkgdir/packagedir_ebuildmanifest.py | 1 +
 roverlay/overlay/pkgdir/packagedir_newmanifest.py    | 2 ++
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/roverlay/overlay/pkgdir/packagedir_base.py b/roverlay/overlay/pkgdir/packagedir_base.py
index 53ebc42..ad00a05 100644
--- a/roverlay/overlay/pkgdir/packagedir_base.py
+++ b/roverlay/overlay/pkgdir/packagedir_base.py
@@ -819,10 +819,6 @@ class PackageDirBase ( object ):
             or patch_ebuild ( efile, pvr, patchview.get_patches ( pvr ) )
          ):
 
-            # generate hashes here (benefit from threading)
-            # FIXME/TODO: ^ actually faster?
-            p_info.make_distmap_hash()
-
             self._need_manifest = True
 
             # update metadata for each successfully written ebuild

diff --git a/roverlay/overlay/pkgdir/packagedir_ebuildmanifest.py b/roverlay/overlay/pkgdir/packagedir_ebuildmanifest.py
index 9766606..71cfd23 100644
--- a/roverlay/overlay/pkgdir/packagedir_ebuildmanifest.py
+++ b/roverlay/overlay/pkgdir/packagedir_ebuildmanifest.py
@@ -102,6 +102,7 @@ class PackageDir ( roverlay.overlay.pkgdir.packagedir_base.PackageDirBase ):
          # TODO: optimize this further?
          # -> "not has physical_only?"
          #     (should be covered by "has package_file")
+         p_info.make_distmap_hash()
          distdir.add ( p ['package_file'], p ['package_src_destpath'], p )
       # -- end for;
 

diff --git a/roverlay/overlay/pkgdir/packagedir_newmanifest.py b/roverlay/overlay/pkgdir/packagedir_newmanifest.py
index 04d202d..ae6c059 100644
--- a/roverlay/overlay/pkgdir/packagedir_newmanifest.py
+++ b/roverlay/overlay/pkgdir/packagedir_newmanifest.py
@@ -89,6 +89,8 @@ class PackageDir ( roverlay.overlay.pkgdir.packagedir_base.PackageDirBase ):
       #
       distdir = self.DISTROOT.get_distdir ( self.name )
       for p in pkgs_for_manifest:
+         # order is important here
+         # add_package_entry() calls multihash with all required digests
          manifest.add_package_entry ( p )
          distdir.add ( p ['package_file'], p ['package_src_destpath'], p )
       # -- end for;


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
@ 2013-08-06 16:02 André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2013-08-06 16:02 UTC (permalink / raw
  To: gentoo-commits

commit:     22a7fcdf561170edf77897bd2d8388d6dffc2b23
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Aug  6 11:04:25 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Aug  6 11:04:25 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=22a7fcdf

roverlay/overlay/pkgdir: remove unused imports

---
 roverlay/overlay/pkgdir/packagedir_ebuildmanifest.py | 7 -------
 roverlay/overlay/pkgdir/packagedir_newmanifest.py    | 5 +----
 2 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/roverlay/overlay/pkgdir/packagedir_ebuildmanifest.py b/roverlay/overlay/pkgdir/packagedir_ebuildmanifest.py
index 4a4755c..ee02a11 100644
--- a/roverlay/overlay/pkgdir/packagedir_ebuildmanifest.py
+++ b/roverlay/overlay/pkgdir/packagedir_ebuildmanifest.py
@@ -6,13 +6,6 @@
 
 __all__ = [ 'PackageDir', ]
 
-import os
-import threading
-
-
-import roverlay.config
-import roverlay.tools.ebuild
-import roverlay.tools.ebuildenv
 
 import roverlay.overlay.pkgdir.packagedir_base
 

diff --git a/roverlay/overlay/pkgdir/packagedir_newmanifest.py b/roverlay/overlay/pkgdir/packagedir_newmanifest.py
index 5d04eb7..005663f 100644
--- a/roverlay/overlay/pkgdir/packagedir_newmanifest.py
+++ b/roverlay/overlay/pkgdir/packagedir_newmanifest.py
@@ -6,12 +6,9 @@
 
 __all__ = [ 'PackageDir', ]
 
-import os
-import threading
+import os.path
 
 
-import roverlay.config
-
 import roverlay.overlay.pkgdir.manifest.file
 from roverlay.overlay.pkgdir.manifest.file import ManifestFile
 


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
@ 2013-08-07 16:10 André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2013-08-07 16:10 UTC (permalink / raw
  To: gentoo-commits

commit:     c57368477489d93a0e799d7c5710974fd112d8ba
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Aug  7 15:46:20 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Aug  7 15:46:20 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=c5736847

import ebuilds: fix manifest creation

---
 roverlay/overlay/pkgdir/packagedir_base.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/roverlay/overlay/pkgdir/packagedir_base.py b/roverlay/overlay/pkgdir/packagedir_base.py
index 5c0d5fd..81978cd 100644
--- a/roverlay/overlay/pkgdir/packagedir_base.py
+++ b/roverlay/overlay/pkgdir/packagedir_base.py
@@ -798,6 +798,8 @@ class PackageDirBase ( object ):
             if pvr not in self._packages:
                import_ebuild_efile ( pvr, efile, fname )
 
+      # -- end if
+
 
       # import metadata.xml from eview
       #  in conjunction with overwrite=False, metadata.xml won't get
@@ -813,7 +815,7 @@ class PackageDirBase ( object ):
             #self._need_metadata = False
       # -- end metadata.xml import
 
-      if self.DOEBUILD_IMPORTMANIFEST:
+      if imported_ebuild_files and self.DOEBUILD_IMPORTMANIFEST:
          #self.do_ebuildmanifest ( next ( iter ( imported_ebuild_files ) ))
          self.do_ebuildmanifest ( imported_ebuild_files [0] )
    # --- end of import_ebuilds (...) ---


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
@ 2013-08-28  9:38 André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2013-08-28  9:38 UTC (permalink / raw
  To: gentoo-commits

commit:     bc8d1a63647274a4260e4518b748ae91418c703c
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Aug 28 09:38:26 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Aug 28 09:38:26 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=bc8d1a63

roverlay/overlay/pkgdir: add TODO note

---
 roverlay/overlay/pkgdir/packagedir_base.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/roverlay/overlay/pkgdir/packagedir_base.py b/roverlay/overlay/pkgdir/packagedir_base.py
index 81978cd..425f31b 100644
--- a/roverlay/overlay/pkgdir/packagedir_base.py
+++ b/roverlay/overlay/pkgdir/packagedir_base.py
@@ -222,6 +222,14 @@ class PackageDirBase ( object ):
                   )
 
                else:
+                  # TODO: get a distmap "slot"
+                  #  else collision can occur when using >1 category,
+                  #  e.g. per-repo categories
+                  #
+                  #  solutions:
+                  #  (a) automatic renaming (preferably before revbumping)
+                  #  (b) ignore packages
+                  #
                   self.logger.debug (
                      "'{PN}-{PVR}.ebuild' exists as file, skipping.".format (
                         PN=self.name, PVR=shortver


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
@ 2013-08-28 15:54 André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2013-08-28 15:54 UTC (permalink / raw
  To: gentoo-commits

commit:     c55acecf0d7d58ec898a5c9bbd36086fc5ee52f6
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Aug 28 15:51:47 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Aug 28 15:51:47 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=c55acecf

overlay: (partially) parse ebuild files

This commit adds a parser that parses an ebuild file partially. More concrete,
it reads $SRC_URI, which is required distmap-related operations, e.g. for
reliably handling package file collisions due to multiple categories.

---
 roverlay/overlay/pkgdir/ebuildparser.py | 283 ++++++++++++++++++++++++++++++++
 1 file changed, 283 insertions(+)

diff --git a/roverlay/overlay/pkgdir/ebuildparser.py b/roverlay/overlay/pkgdir/ebuildparser.py
new file mode 100644
index 0000000..79e6f15
--- /dev/null
+++ b/roverlay/overlay/pkgdir/ebuildparser.py
@@ -0,0 +1,283 @@
+# R overlay -- overlay package, package directory, "minimal" ebuild parser
+# -*- coding: utf-8 -*-
+# 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.
+
+from __future__ import print_function
+
+import os
+import shlex
+import string
+
+import roverlay.util.objects
+import roverlay.strutil
+
+
+STR_FORMATTER = string.Formatter()
+VFORMAT       = STR_FORMATTER.vformat
+
+class ParserException ( Exception ):
+   pass
+# --- end of ParserException ---
+
+
+class SrcUriEntry ( object ):
+
+   def __init__ ( self, src_uri, output_file=None ):
+      super ( SrcUriEntry, self ).__init__()
+      self.uri = src_uri
+      if output_file:
+         self.have_local = True
+         self.local_file = output_file
+      else:
+         self.have_local = False
+         self.local_file = src_uri.rpartition ( '/' ) [-1]
+   # --- end of __init__ (...) ---
+
+   def __str__ ( self ):
+      if self.have_local:
+         return "{URI} -> {f}".format ( URI=self.uri, f=self.local_file )
+      else:
+         return self.uri
+   # --- end of __str__ (...) ---
+
+# --- end of SrcUriEntry ---
+
+
+
+class EbuildParser ( object ):
+
+   @classmethod
+   def from_file ( cls, filepath, vartable=None ):
+      instance = cls ( filepath, vartable=vartable )
+      instance.read()
+      return instance
+   # --- end of from_file (...) ---
+
+   def __init__ ( self, filepath, vartable=None ):
+      super ( EbuildParser, self ).__init__()
+      self.filepath = filepath
+      self.vartable = vartable
+   # --- end of __init__ (...) ---
+
+   def _read_tokens ( self, breakparse=None ):
+      with open ( self.filepath, 'rt' ) as FH:
+         reader                  = shlex.shlex ( FH )
+         reader.whitespace_split = False
+         reader.wordchars        += ' ,./$()[]:+-@*~<>'
+
+         token = reader.get_token()
+         if breakparse is None:
+            while token:
+               yield token
+               token = reader.get_token()
+         else:
+            while token and not breakparse ( token ):
+               yield token
+               token = reader.get_token()
+   # --- end of _read_tokens (...) ---
+
+   def _read_variables ( self, do_unquote=True ):
+      # assumption: no (important) variables after the first function
+
+
+      # read all tokens and store them in a list
+      #  this allows to look back/ahead
+      tokens = list ( self._read_tokens (
+         breakparse=( lambda s: ( len(s) > 2 and s[-2:] == '()' ) )
+      ) )
+
+
+      varname = None
+      data    = dict()
+
+      last_index    = len ( tokens ) - 1
+      ignore_next   = False
+      is_bash_array = False
+      # 0 -> no value read, 1-> have value(s), 2 -> reject token
+      value_mode    = 0
+
+      for index, token in enumerate ( tokens ):
+         if ignore_next:
+            ignore_next = False
+            pass
+
+         elif index < last_index and tokens [index+1] == '=':
+            # lookahead result: token is a varname
+            ignore_next   = True
+            is_bash_array = False
+            value_mode    = 0
+            varname       = token
+            data [token]  = None
+
+         elif value_mode == 0:
+            if value_mode == 0 and token == '()':
+               is_bash_array  = True
+               value_mode     = 2
+               data [varname] = []
+
+            elif value_mode == 0 and token == '(':
+               is_bash_array  = True
+               value_mode     = 1
+               data [varname] = []
+
+            else:
+               data [varname] = token
+               value_mode     = 1
+
+         elif value_mode > 1:
+            pass
+
+         elif is_bash_array:
+            # impiles value_mode != 0
+
+            if token == ')':
+               value_mode = 2
+            else:
+               data [varname].append ( token )
+
+#         else:
+#            pass
+
+
+      if do_unquote:
+         return {
+            varname: (
+               roverlay.strutil.unquote ( value ) if isinstance ( value, str )
+               else list (
+                  roverlay.strutil.unquote ( item ) for item in value
+               )
+            )
+            for varname, value in data.items()
+         }
+      else:
+         return data
+   # --- end of _read_variables (...) ---
+
+   def _get_src_uri_entries ( self, value ):
+      assert isinstance ( value, str )
+
+      src_uri         = None
+      want_local_file = False
+
+      for s in value.split():
+         if not s or s[-1] == '?' or s in { '(', ')' }:
+            pass
+
+         elif want_local_file:
+            yield SrcUriEntry ( src_uri, s )
+            want_local_file = False
+            src_uri = None
+
+         elif s == '->':
+            if src_uri is None:
+               raise Exception (
+                  "SRC_URI: arrow operator -> without preceding URI"
+               )
+            else:
+               want_local_file = True
+
+         else:
+            if src_uri is not None:
+               yield SrcUriEntry ( src_uri )
+            src_uri = s
+
+      # -- end for
+
+      if want_local_file:
+         raise Exception ( "SRC_URI: arrow operator -> without local file" )
+
+      elif src_uri is not None:
+         yield SrcUriEntry ( src_uri )
+   # --- end of _get_src_uri_entries (...) ---
+
+   @roverlay.util.objects.abstractmethod
+   def read ( self ):
+      pass
+   # --- end of read (...) ---
+
+# --- end of EbuildParser ---
+
+
+class SrcUriParser ( EbuildParser ):
+
+   def __init__ ( self, filepath, vartable=None ):
+      super ( SrcUriParser, self ).__init__ ( filepath, vartable=vartable )
+      self.src_uri = None
+   # --- end of __init__ (...) ---
+
+   def iter_entries ( self ):
+      if self.src_uri:
+         for entry in self.src_uri:
+            yield entry
+   # --- end of _iterate (...) ---
+
+   def iter_local_files ( self, ignore_unparseable=False ):
+      def convert_chars_with_vars ( text ):
+         mode = 0
+         for index, char in enumerate ( text ):
+
+            if mode == 0:
+               if char == '$':
+                  mode = 1
+               else:
+                  yield char
+
+            elif mode == 1:
+               if char == '{':
+                  yield char
+                  mode = 2
+               else:
+                  raise ParserException (
+                     'cannot convert variable starting at '
+                     'position {:d} in {}'.format ( index, text )
+                  )
+
+            elif mode == 2 and char in { '/', }:
+               raise ParserException (
+                  'unsupported char {} inside variable at '
+                  'position {:d} in {}'.format ( char, index, text )
+               )
+
+            else:
+               yield char
+      # --- end of convert_chars_with_vars (...) ---
+
+      varstr = lambda s: VFORMAT (
+         ''.join ( convert_chars_with_vars ( s ) ), (), self.vartable
+      )
+
+      if self.src_uri:
+         for entry in self.src_uri:
+            local_file = entry.local_file
+            if '$' in local_file:
+               # TODO: need vartable (dict(P->,PN->))
+               #
+               if ignore_unparseable:
+                  try:
+                     yield varstr ( local_file )
+                  except ParserException:
+                     if not ignore_unparseable:
+                        raise
+               else:
+                  yield varstr ( local_file )
+
+            else:
+               yield local_file
+   # --- end of iter_local_files (...) ---
+
+   def __iter__ ( self ):
+      return self.iter_entries()
+   # --- end of __iter__ (...) ---
+
+   def read ( self ):
+      data = self._read_variables()
+
+      if 'SRC_URI' in data:
+         self.src_uri = list (
+            self._get_src_uri_entries ( data ['SRC_URI'] )
+         )
+   # --- end of read (...) ---
+
+# --- end of SrcUriParser ---


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
@ 2013-08-29 12:36 André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2013-08-29 12:36 UTC (permalink / raw
  To: gentoo-commits

commit:     ac19c19971cad69ca2400b86b62fc8e12f728260
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Aug 29 07:44:27 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Aug 29 07:44:27 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=ac19c199

ebuildparser: minor cleanup

---
 roverlay/overlay/pkgdir/ebuildparser.py | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/roverlay/overlay/pkgdir/ebuildparser.py b/roverlay/overlay/pkgdir/ebuildparser.py
index 79e6f15..367a4ec 100644
--- a/roverlay/overlay/pkgdir/ebuildparser.py
+++ b/roverlay/overlay/pkgdir/ebuildparser.py
@@ -45,7 +45,6 @@ class SrcUriEntry ( object ):
 # --- end of SrcUriEntry ---
 
 
-
 class EbuildParser ( object ):
 
    @classmethod
@@ -252,14 +251,11 @@ class SrcUriParser ( EbuildParser ):
          for entry in self.src_uri:
             local_file = entry.local_file
             if '$' in local_file:
-               # TODO: need vartable (dict(P->,PN->))
-               #
                if ignore_unparseable:
                   try:
                      yield varstr ( local_file )
                   except ParserException:
-                     if not ignore_unparseable:
-                        raise
+                     pass
                else:
                   yield varstr ( local_file )
 


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
@ 2013-08-29 12:36 André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2013-08-29 12:36 UTC (permalink / raw
  To: gentoo-commits

commit:     0004c002c9082ea81b515b806dc0da6cca0a741c
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Aug 29 09:20:53 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Aug 29 09:20:53 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=0004c002

ebuildparser: handle vartable=None

---
 roverlay/overlay/pkgdir/ebuildparser.py | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/roverlay/overlay/pkgdir/ebuildparser.py b/roverlay/overlay/pkgdir/ebuildparser.py
index 367a4ec..3f27b65 100644
--- a/roverlay/overlay/pkgdir/ebuildparser.py
+++ b/roverlay/overlay/pkgdir/ebuildparser.py
@@ -48,8 +48,12 @@ class SrcUriEntry ( object ):
 class EbuildParser ( object ):
 
    @classmethod
-   def from_file ( cls, filepath, vartable=None ):
+   def from_file ( cls, filepath, vartable=None, unquote_value=None ):
       instance = cls ( filepath, vartable=vartable )
+
+      if unquote_value is not None:
+         instance.unquote_value = bool ( unquote_value )
+
       instance.read()
       return instance
    # --- end of from_file (...) ---
@@ -58,6 +62,7 @@ class EbuildParser ( object ):
       super ( EbuildParser, self ).__init__()
       self.filepath = filepath
       self.vartable = vartable
+      self.unquote_value = True
    # --- end of __init__ (...) ---
 
    def _read_tokens ( self, breakparse=None ):
@@ -77,7 +82,7 @@ class EbuildParser ( object ):
                token = reader.get_token()
    # --- end of _read_tokens (...) ---
 
-   def _read_variables ( self, do_unquote=True ):
+   def _read_variables ( self ):
       # assumption: no (important) variables after the first function
 
 
@@ -140,7 +145,7 @@ class EbuildParser ( object ):
 #            pass
 
 
-      if do_unquote:
+      if self.unquote_value:
          return {
             varname: (
                roverlay.strutil.unquote ( value ) if isinstance ( value, str )
@@ -243,9 +248,12 @@ class SrcUriParser ( EbuildParser ):
                yield char
       # --- end of convert_chars_with_vars (...) ---
 
-      varstr = lambda s: VFORMAT (
-         ''.join ( convert_chars_with_vars ( s ) ), (), self.vartable
-      )
+      if self.vartable is None:
+         varstr = lambda s:  ''.join ( convert_chars_with_vars ( s ) )
+      else:
+         varstr = lambda s: VFORMAT (
+            ''.join ( convert_chars_with_vars ( s ) ), (), self.vartable
+         )
 
       if self.src_uri:
          for entry in self.src_uri:


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
@ 2013-08-29 12:36 André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2013-08-29 12:36 UTC (permalink / raw
  To: gentoo-commits

commit:     fcc2ea15a521f82319570ca2bb54928a39514e0c
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Aug 29 12:34:27 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Aug 29 12:35:05 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=fcc2ea15

packagedir_base: set distfile owner while scanning

+ use overlay base object

calling set_distfile_owner() is a no-op, currently.

---
 roverlay/overlay/pkgdir/packagedir_base.py | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/roverlay/overlay/pkgdir/packagedir_base.py b/roverlay/overlay/pkgdir/packagedir_base.py
index 425f31b..e8567b9 100644
--- a/roverlay/overlay/pkgdir/packagedir_base.py
+++ b/roverlay/overlay/pkgdir/packagedir_base.py
@@ -33,14 +33,14 @@ import roverlay.tools.ebuildenv
 import roverlay.tools.patch
 
 import roverlay.overlay.additionsdir
-
+import roverlay.overlay.base
 import roverlay.overlay.pkgdir.distroot.static
 import roverlay.overlay.pkgdir.metadata
 
 # TODO: proper reading of $SRC_URI when importing (or scanning) ebuilds
 #        This would make manifest creation being more controlled
 
-class PackageDirBase ( object ):
+class PackageDirBase ( roverlay.overlay.base.OverlayObject ):
    """The PackageDir base class that implements most functionality except
    for Manifest file creation."""
 
@@ -108,12 +108,14 @@ class PackageDirBase ( object ):
       * parent                 (pointer to) the object that is creating this
                                instance
       """
-      self.logger              = logger.getChild ( name )
+      super ( PackageDirBase, self ).__init__ (
+         name, logger, directory, parent
+      )
+
       self.name                = name
       self._lock               = threading.RLock()
       # { <version> : <PackageInfo> }
       self._packages           = dict()
-      self.physical_location   = directory
       self.get_header          = get_header
       self.runtime_incremental = runtime_incremental
 
@@ -134,6 +136,10 @@ class PackageDirBase ( object ):
       self._need_metadata    = False
    # --- end of __init__ (...) ---
 
+   def set_category ( self, category ):
+      self.set_parent ( category )
+   # --- end of set_category (...) ---
+
    def iter_package_info ( self, pkg_filter=None ):
       if pkg_filter is None:
          return self._packages.values()
@@ -163,7 +169,7 @@ class PackageDirBase ( object ):
          return False
    # --- end of remove_ebuild_file (...) ---
 
-   def _scan_add_package ( self, efile, pvr ):
+   def _scan_add_package ( self, efile, pvr, LINK_DISTMAP=False ):
       """Called for each ebuild that is found during scan().
       Creates a PackageInfo for the ebuild and adds it to self._packages.
 
@@ -176,7 +182,11 @@ class PackageDirBase ( object ):
       p = roverlay.packageinfo.PackageInfo (
          physical_only=True, pvr=pvr, ebuild_file=efile, name=self.name
       )
-      # TODO/FIXME: parse SRC_URI, knowledge of distfile path would be good...
+
+      # link distfiles to distmap
+      for distfile in p.parse_ebuild_distfiles ( self.get_parent().name ):
+         self.DISTROOT.set_distfile_owner ( self.get_ref(), distfile )
+
       self._packages [ p ['ebuild_verstr'] ] = p
       return p
    # --- end of _scan_add_package (...) ---
@@ -254,10 +264,10 @@ class PackageDirBase ( object ):
       if added:
          # add a link to this PackageDir into the package info,
          # !! package_info <-> self (double-linked)
-         package_info.overlay_package_ref = weakref.ref ( self )
+         package_info.overlay_package_ref = self.get_ref()
          return True
       elif added is None:
-         return weakref.ref ( self )
+         return self.get_ref()
       else:
          return added
    # --- end of add (...) ---
@@ -486,7 +496,8 @@ class PackageDirBase ( object ):
                      "$PN {!r} does not match directory name, ignoring {!r}.".\
                      format ( pn, f )
                   )
-            except:
+            except Exception as err:
+               self.logger.exception ( err )
                self.logger.warning (
                   "ebuild {!r} has an invalid file name!".format ( f )
                )


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
@ 2013-08-30 15:28 André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2013-08-30 15:28 UTC (permalink / raw
  To: gentoo-commits

commit:     c94d39f60a74bd6b88e7f4ca11b058a858c9523b
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Aug 30 15:26:27 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Aug 30 15:26:27 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=c94d39f6

packagedir_base: fix typo

---
 roverlay/overlay/pkgdir/packagedir_base.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/roverlay/overlay/pkgdir/packagedir_base.py b/roverlay/overlay/pkgdir/packagedir_base.py
index 67488b4..2b669bc 100644
--- a/roverlay/overlay/pkgdir/packagedir_base.py
+++ b/roverlay/overlay/pkgdir/packagedir_base.py
@@ -225,12 +225,12 @@ class PackageDirBase ( roverlay.overlay.base.OverlayObject ):
                elif allow_postpone:
                   added = None
 
-               elif not self.DISTMAP.handle_file_collision (
+               elif not self.DISTROOT.handle_file_collision (
                   self, package_info
                ):
                   added = False
 
-               elif self.DISTROOT.check_revbump_necessary ( package_info ):
+               elif self.DISTMAP.check_revbump_necessary ( package_info ):
                   # resolve by recursion
                   added = self.add (
                      package_info.revbump(), add_if_physical=False, _lock=False


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
@ 2013-09-03 15:51 André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2013-09-03 15:51 UTC (permalink / raw
  To: gentoo-commits

commit:     ec995af8e83d2759bf61ee0f83c0786babd11df4
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Sep  3 15:44:49 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Sep  3 15:46:44 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=ec995af8

packagedir: get distfiles of imported ebuilds

link distfiles of imported ebuilds to the distroot/distmap so that
the distmap does not need to be regenerated (for that reason) in an additional
run.

TODO.

---
 roverlay/overlay/pkgdir/packagedir_base.py | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/roverlay/overlay/pkgdir/packagedir_base.py b/roverlay/overlay/pkgdir/packagedir_base.py
index 22e60e7..3948d4c 100644
--- a/roverlay/overlay/pkgdir/packagedir_base.py
+++ b/roverlay/overlay/pkgdir/packagedir_base.py
@@ -37,9 +37,6 @@ import roverlay.overlay.base
 import roverlay.overlay.pkgdir.distroot.static
 import roverlay.overlay.pkgdir.metadata
 
-# TODO: proper reading of $SRC_URI when importing (or scanning) ebuilds
-#        This would make manifest creation being more controlled
-
 class PackageDirBase ( roverlay.overlay.base.OverlayObject ):
    """The PackageDir base class that implements most functionality except
    for Manifest file creation."""
@@ -779,7 +776,7 @@ class PackageDirBase ( roverlay.overlay.base.OverlayObject ):
 
             # create PackageInfo and register it
             p = roverlay.packageinfo.PackageInfo (
-               imported=True, pvr=pvr, ebuild_file=efile_dest
+               imported=True, pvr=pvr, ebuild_file=efile_dest, name=self.name
             )
             self._packages [ p ['ebuild_verstr'] ] = p
 
@@ -812,7 +809,23 @@ class PackageDirBase ( roverlay.overlay.base.OverlayObject ):
 
             stats_ebuild_imported()
             efile_imported ( efile_dest )
-            return p
+
+
+         # link files to distroot/distmap (if possible)
+         for distfile in p.parse_ebuild_distfiles (
+            self.get_parent().name,
+            ignore_unparseable=True, yield_unparseable=True
+         ):
+            if distfile is None:
+               # need distmap sync
+               raise Exception (
+                  "TODO/FIXME: want distmap sync after import."
+               )
+            else:
+               self.DISTROOT.set_distfile_owner ( self.get_ref(), distfile )
+         # -- end for
+
+         return p
       # --- end of import_ebuild_efile (...) ---
 
       if not self._packages:


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
@ 2013-09-17 13:49 André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2013-09-17 13:49 UTC (permalink / raw
  To: gentoo-commits

commit:     e3d569207defdb63ca7c1c3fa8f672321ed5070d
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Sep 16 15:20:26 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Sep 16 15:21:11 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=e3d56920

packagedir_base: add note about incorrect stats

---
 roverlay/overlay/pkgdir/packagedir_base.py | 36 ++++++++++++++++++++----------
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/roverlay/overlay/pkgdir/packagedir_base.py b/roverlay/overlay/pkgdir/packagedir_base.py
index 870a419..27f395c 100644
--- a/roverlay/overlay/pkgdir/packagedir_base.py
+++ b/roverlay/overlay/pkgdir/packagedir_base.py
@@ -787,6 +787,29 @@ class PackageDirBase ( roverlay.overlay.base.OverlayObject ):
             if not nosync and not self.fetch_src_for_ebuild ( efile_dest ):
                raise Exception ( "doebuild_fetch() failed." )
 
+            # link files to distroot/distmap
+            #
+            #  NOTE: the stats count imported ebuilds without any src file
+            #        (nosync=True and $SRC_URI not empty) as successful
+            #        (stats_ebuild_imported() below), whereas these ebuilds
+            #        will be ignored when running roverlay again.
+            #
+            #        This could be fixed by checking whether
+            #        DISTROOT.set_distfile_owner() returns a virtual entry,
+            #        but use-dependent could be virtual, too.
+            #
+            for distfile in p.parse_ebuild_distfiles (
+               self.get_parent().name,
+               ignore_unparseable=True, yield_unparseable=True
+            ):
+               if distfile is None:
+                  self.DISTROOT.need_distmap_sync()
+               else:
+                  self.DISTROOT.set_distfile_owner (
+                     self.get_ref(), distfile
+                  )
+            # -- end for
+
          except:
             # this package dir is "broken" now,
             # so a new manifest would be good...
@@ -809,18 +832,7 @@ class PackageDirBase ( roverlay.overlay.base.OverlayObject ):
 
             stats_ebuild_imported()
             efile_imported ( efile_dest )
-
-
-         # link files to distroot/distmap (if possible)
-         for distfile in p.parse_ebuild_distfiles (
-            self.get_parent().name,
-            ignore_unparseable=True, yield_unparseable=True
-         ):
-            if distfile is None:
-               self.DISTROOT.need_distmap_sync()
-            else:
-               self.DISTROOT.set_distfile_owner ( self.get_ref(), distfile )
-         # -- end for
+         # -- end try
 
          return p
       # --- end of import_ebuild_efile (...) ---


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
@ 2014-07-18 16:20 André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2014-07-18 16:20 UTC (permalink / raw
  To: gentoo-commits

commit:     15d8948ab2be08eb2cd7b6bd4bca182629d5f43d
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul 18 00:06:32 2014 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul 18 00:06:32 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=15d8948a

overlay/pkgdir/packagedir_base: add COULDFIX note

---
 roverlay/overlay/pkgdir/packagedir_base.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/roverlay/overlay/pkgdir/packagedir_base.py b/roverlay/overlay/pkgdir/packagedir_base.py
index c0c6dd6..e25ef61 100644
--- a/roverlay/overlay/pkgdir/packagedir_base.py
+++ b/roverlay/overlay/pkgdir/packagedir_base.py
@@ -15,6 +15,10 @@ Each PackageDir instance represents one package name (e.g. "seewave").
 
 __all__ = [ 'PackageDirBase', ]
 
+# TODO COULDFIX, incremental overlay creation: "revision-lookaround"
+#  remember highest $PR per $PV and add_package() with $PR+1
+#  (not an issue as long as all -r0,-r1,...,-rn exist)
+#
 
 import os
 import shutil


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
  2014-07-18  2:28 [gentoo-commits] proj/R_overlay:wip/addition_control " André Erdmann
@ 2014-07-18 16:20 ` André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2014-07-18 16:20 UTC (permalink / raw
  To: gentoo-commits

commit:     cee38967b3dbe82dc952d9fbb980ab09018416bf
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul 18 02:23:15 2014 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul 18 02:23:15 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=cee38967

roverlay/overlay/pkgdir/packagedir_base: fix import

---
 roverlay/overlay/pkgdir/packagedir_base.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/roverlay/overlay/pkgdir/packagedir_base.py b/roverlay/overlay/pkgdir/packagedir_base.py
index e25ef61..7a8a29f 100644
--- a/roverlay/overlay/pkgdir/packagedir_base.py
+++ b/roverlay/overlay/pkgdir/packagedir_base.py
@@ -29,8 +29,8 @@ import weakref
 import roverlay.config
 import roverlay.packageinfo
 import roverlay.util
-import roverlay.util.portage_regex
-from roverlay.util.portage_regex import RE_PF
+import roverlay.util.portage_regex.default
+from roverlay.util.portage_regex.default import RE_PF
 
 import roverlay.recipe.distmap
 


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
  2014-08-23 19:03 André Erdmann
@ 2014-07-29 18:29 ` André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2014-07-29 18:29 UTC (permalink / raw
  To: gentoo-commits

commit:     48857ff9eae7795dc1eb2563b7f41dd89526ad03
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Jul 29 18:25:57 2014 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Jul 29 18:28:17 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=48857ff9

roverlay/overlay/pkgdir/packagedir_base: fix

Clear "replace-only" addition control flag when revbumping.
Otherwise, the revbumped package gets denied.

---
 roverlay/overlay/pkgdir/packagedir_base.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/roverlay/overlay/pkgdir/packagedir_base.py b/roverlay/overlay/pkgdir/packagedir_base.py
index 7a8a29f..ae3f10a 100644
--- a/roverlay/overlay/pkgdir/packagedir_base.py
+++ b/roverlay/overlay/pkgdir/packagedir_base.py
@@ -389,7 +389,7 @@ class PackageDirBase ( roverlay.overlay.base.OverlayObject ):
             or self.DISTMAP.check_revbump_necessary ( package_info )
          ):
             # resolve by recursion,
-            #  keep addition_control as-is
+            #  clear "replace-only" addition_control
             assert package_info.overlay_addition_override is addition_override
 
             if (addition_override & _PKG_REVBUMP_ON_COLLISION):
@@ -403,8 +403,11 @@ class PackageDirBase ( roverlay.overlay.base.OverlayObject ):
                #
             # -- end if
 
+            package_info.revbump()
+            package_info.overlay_addition_override &= ~_PKG_REPLACE_ONLY
+
             return package_add_main (
-               package_info    = package_info.revbump(),
+               package_info    = package_info,
                add_if_physical = add_if_physical,
                allow_postpone  = allow_postpone
             )


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
@ 2014-08-23 19:03 André Erdmann
  2014-07-29 18:29 ` André Erdmann
  0 siblings, 1 reply; 26+ messages in thread
From: André Erdmann @ 2014-08-23 19:03 UTC (permalink / raw
  To: gentoo-commits

commit:     48857ff9eae7795dc1eb2563b7f41dd89526ad03
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Jul 29 18:25:57 2014 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Jul 29 18:28:17 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=48857ff9

roverlay/overlay/pkgdir/packagedir_base: fix

Clear "replace-only" addition control flag when revbumping.
Otherwise, the revbumped package gets denied.

---
 roverlay/overlay/pkgdir/packagedir_base.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/roverlay/overlay/pkgdir/packagedir_base.py b/roverlay/overlay/pkgdir/packagedir_base.py
index 7a8a29f..ae3f10a 100644
--- a/roverlay/overlay/pkgdir/packagedir_base.py
+++ b/roverlay/overlay/pkgdir/packagedir_base.py
@@ -389,7 +389,7 @@ class PackageDirBase ( roverlay.overlay.base.OverlayObject ):
             or self.DISTMAP.check_revbump_necessary ( package_info )
          ):
             # resolve by recursion,
-            #  keep addition_control as-is
+            #  clear "replace-only" addition_control
             assert package_info.overlay_addition_override is addition_override
 
             if (addition_override & _PKG_REVBUMP_ON_COLLISION):
@@ -403,8 +403,11 @@ class PackageDirBase ( roverlay.overlay.base.OverlayObject ):
                #
             # -- end if
 
+            package_info.revbump()
+            package_info.overlay_addition_override &= ~_PKG_REPLACE_ONLY
+
             return package_add_main (
-               package_info    = package_info.revbump(),
+               package_info    = package_info,
                add_if_physical = add_if_physical,
                allow_postpone  = allow_postpone
             )


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
@ 2015-01-26 17:41 André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2015-01-26 17:41 UTC (permalink / raw
  To: gentoo-commits

commit:     04626808fe9582affa83f85665b4b45dbf0ebe3f
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Dec  9 22:26:32 2014 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Dec  9 22:26:32 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=04626808

packagedir, scan_ebuilds(): fix logging of PN!=name

---
 roverlay/overlay/pkgdir/packagedir_base.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/roverlay/overlay/pkgdir/packagedir_base.py b/roverlay/overlay/pkgdir/packagedir_base.py
index ae3f10a..d398914 100644
--- a/roverlay/overlay/pkgdir/packagedir_base.py
+++ b/roverlay/overlay/pkgdir/packagedir_base.py
@@ -719,7 +719,7 @@ class PackageDirBase ( roverlay.overlay.base.OverlayObject ):
                      self.logger.warning (
                         (
                            'PN {!r} does not match directory name, '
-                           'ignoring {!r}.'.format ( pn, f )
+                           'ignoring {!r}.'.format ( match_vars ['PN'], f )
                         )
                      )
                   # -- end if <PN>


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

* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
@ 2016-02-18 16:33 André Erdmann
  0 siblings, 0 replies; 26+ messages in thread
From: André Erdmann @ 2016-02-18 16:33 UTC (permalink / raw
  To: gentoo-commits

commit:     25f6d2967ec621ecdcd65d2beab405a357e870e4
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Feb 18 16:18:51 2016 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Feb 18 16:18:51 2016 +0000
URL:        https://gitweb.gentoo.org/proj/R_overlay.git/commit/?id=25f6d296

pkgdir: set default add-policy (bug 574782)

In roverlay/overlay/pkgdir/packagedir_base.py,
PackageDirBase.add_package().package_try_replace():

package_info.overlay_addition_override needs to be set
to an integer value before calling package_try_replace(),
because it is used in a bitwise operation:

   package_info.overlay_addition_override &= ~_PKG_REPLACE_ONLY

which raises a TypeError if overlay_addition_override is None.

When running roverlay without bytecode optimizations ("python -O"),
the bug gets catched a bit earlier due to a failing assertion,
as shown in #574782.

X-Gentoo-Bug: 574782
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=574782

 roverlay/overlay/pkgdir/packagedir_base.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/roverlay/overlay/pkgdir/packagedir_base.py b/roverlay/overlay/pkgdir/packagedir_base.py
index d398914..344173e 100644
--- a/roverlay/overlay/pkgdir/packagedir_base.py
+++ b/roverlay/overlay/pkgdir/packagedir_base.py
@@ -435,9 +435,12 @@ class PackageDirBase ( roverlay.overlay.base.OverlayObject ):
             )
          # -- end if
 
-         addition_override = (
-            package_info.overlay_addition_override or _PKG_DEFAULT_BEHAVIOR
-         )
+         # in absence of dynamic addition control,
+         # set the default mode flags if addition_override is not configured
+         if package_info.overlay_addition_override is None:
+            package_info.overlay_addition_override = _PKG_DEFAULT_BEHAVIOR
+
+         addition_override = package_info.overlay_addition_override
 
          if addition_override & _PKG_FORCE_DENY:
             log_addition_control_action ( _PKG_FORCE_DENY, shortver )


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

end of thread, other threads:[~2016-02-18 16:33 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-28  9:38 [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/ André Erdmann
  -- strict thread matches above, loose matches on Subject: below --
2016-02-18 16:33 André Erdmann
2015-01-26 17:41 André Erdmann
2014-08-23 19:03 André Erdmann
2014-07-29 18:29 ` André Erdmann
2014-07-18 16:20 André Erdmann
2014-07-18  2:28 [gentoo-commits] proj/R_overlay:wip/addition_control " André Erdmann
2014-07-18 16:20 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-09-17 13:49 André Erdmann
2013-09-03 15:51 André Erdmann
2013-08-30 15:28 André Erdmann
2013-08-29 12:36 André Erdmann
2013-08-29 12:36 André Erdmann
2013-08-29 12:36 André Erdmann
2013-08-28 15:54 André Erdmann
2013-08-07 16:10 André Erdmann
2013-08-06 16:02 André Erdmann
2013-07-10 16:16 André Erdmann
2013-07-10 16:16 André Erdmann
2013-07-10 16:16 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-07-10 16:16 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-07-10 16:16 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-07-10 16:16 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-06-13 16:34 André Erdmann
2013-04-25 16:44 André Erdmann
2013-02-09 20:45 André Erdmann
2013-02-05 20:39 André Erdmann
2013-01-28 23:54 André Erdmann
2013-01-28 23:54 André Erdmann

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