From: "André Erdmann" <dywi@mailerd.de> To: gentoo-commits@lists.gentoo.org Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/ Date: Sat, 22 Jun 2013 15:24:19 +0000 (UTC) [thread overview] Message-ID: <1371897084.305933fc8ce3375745927cfda5fca824eb67f004.dywi@gentoo> (raw) commit: 305933fc8ce3375745927cfda5fca824eb67f004 Author: André Erdmann <dywi <AT> mailerd <DOT> de> AuthorDate: Sat Jun 22 10:31:24 2013 +0000 Commit: André Erdmann <dywi <AT> mailerd <DOT> de> CommitDate: Sat Jun 22 10:31:24 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=305933fc roverlay/packageinfo: support revbumps --- roverlay/packageinfo.py | 91 ++++++++++++++++++++++++++++++------------------- 1 file changed, 56 insertions(+), 35 deletions(-) diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py index 83a05ed..b75eb8c 100644 --- a/roverlay/packageinfo.py +++ b/roverlay/packageinfo.py @@ -16,6 +16,8 @@ __all__ = [ 'PackageInfo', ] import re import os.path import logging +# TODO: remove threading/locks here, exclusive access to PackageInfo instances +# should be guaranteed import threading import roverlay.digest @@ -320,10 +322,6 @@ class PackageInfo ( object ): return self._info [key_low] # 'virtual' keys - calculate result - elif key_low == 'name': - # no special name, using package_name - return self._info ['package_name'] - elif key_low == 'package_file': distdir = self.get ( 'distdir', do_fallback=True ) if distdir: @@ -443,14 +441,14 @@ class PackageInfo ( object ): """Returns the DESCRIPTION data for this PackageInfo (by reading the R package file if necessary). """ - if 'desc_data' in self._info: - return self._info ['desc_data'] - - self._writelock_acquire() if 'desc_data' not in self._info: - self._info ['desc_data'] = descriptionreader.read ( self ) + self._writelock_acquire() + if 'desc_data' not in self._info: + self._info ['desc_data'] = descriptionreader.read ( self ) + + self._update_lock.release() + # -- end if; - self._update_lock.release() return self._info ['desc_data'] # --- end of get_desc_data (...) --- @@ -518,12 +516,14 @@ class PackageInfo ( object ): arguments: * newrev -- new revision, (current rev + 1) is used if this is None """ - raise NotImplementedError ( "revbump code" ) if newrev is None: # get old rev and increment it - pass + ## direct dict access + self._info ['rev'] += 1 else: - pass + self._info ['rev'] = int ( newrev ) + + self._reset_version_str() return self # --- end of revbump (...) --- @@ -635,6 +635,19 @@ class PackageInfo ( object ): return None # --- end of get_evars (...) --- + def _reset_version_str ( self ): + rev = self ['rev'] + version = self ['version'] + + if rev > 0: + vstr = '.'.join ( str ( k ) for k in version ) + '-r' + str ( rev ) + else: + vstr = '.'.join ( str ( k ) for k in version ) + + self._info ['ebuild_verstr'] = vstr + #return vstr + # --- end of _reset_version_str (...) --- + def _update ( self, info ): """Updates self._info using the given info dict. @@ -645,15 +658,14 @@ class PackageInfo ( object ): for key, value in info.items(): - if key in self.__class__._UPDATE_KEYS_SIMPLE: - self [key] = value - - elif initial and key in self.__class__._UPDATE_KEYS_SIMPLE_INITIAL: - self [key] = value + if key in self.__class__._UPDATE_KEYS_SIMPLE or ( + initial and key in self.__class__._UPDATE_KEYS_SIMPLE_INITIAL + ): + self._info [key] = value elif key in self.__class__._UPDATE_KEYS_FILTER_NONE: if value is not None: - self [key] = value + self._info [key] = value elif key == 'filename': self._use_filename ( value ) @@ -662,10 +674,10 @@ class PackageInfo ( object ): self._use_pvr ( value ) elif key == 'suggests': - self ['has_suggests'] = value + self._info ['has_suggests'] = value elif key == 'depres_result': - self ['has_suggests'] = value [2] + self._info ['has_suggests'] = value [2] elif key == 'filepath': self._use_filepath ( value ) @@ -720,7 +732,7 @@ class PackageInfo ( object ): try: version = tuple ( int ( z ) for z in version_str.split ( '.' ) ) - self ['version'] = version + self._info ['version'] = version except ValueError as ve: # version string is malformed, cannot use it self.logger.error ( @@ -736,24 +748,33 @@ class PackageInfo ( object ): # removing illegal chars from the package_name ebuild_name = strutil.fix_ebuild_name ( package_name ) - if ebuild_name != package_name: - self ['name'] = ebuild_name - - self ['ebuild_verstr'] = version_str - # for DescriptionReader - self ['package_name'] = package_name + self._info ['package_name'] = package_name - self ['package_filename'] = filename_with_ext + self._info ['rev'] = 0 + self._info ['name'] = ebuild_name + self._info ['ebuild_verstr'] = version_str + self._info ['package_filename'] = filename_with_ext # --- end of _use_filename (...) --- def _use_pvr ( self, pvr ): - # 0.1_pre2-r17 -> ( 0, 1 ) - pv = pvr.partition ( '-' ) [0] - self ['version'] = tuple ( - int ( z ) for z in ( pv.partition ( '_' ) [0].split ( '.' ) ) - ) - self ['ebuild_verstr'] = pvr + # 0.1_pre2-r17 -> ( ( 0, 1 ), ( 17 ) ) + pv_str, DONT_CARE, pr_str = pvr.partition ( '-r' ) + pv, DONT_CARE, pv_suffix = pv_str.partition ( '_' ) + + if pv_suffix: + # not supported + raise NotImplementedError ( + "version suffix {!r} cannot be preserved for $PVR {!r}".format ( + pv_suffix, pvr + ) + ) + # non-digit chars in pv are unsupported, too + + self._info ['version'] = tuple ( int ( z ) for z in pv.split ( '.' ) ) + self._info ['rev'] = int ( pr_str ) if pr_str else 0 + + self._info ['ebuild_verstr'] = pvr # --- end of _use_pvr (...) --- def _remove_auto ( self, ebuild_status ):
WARNING: multiple messages have this Message-ID (diff)
From: "André Erdmann" <dywi@mailerd.de> To: gentoo-commits@lists.gentoo.org Subject: [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/ Date: Sat, 22 Jun 2013 15:14:26 +0000 (UTC) [thread overview] Message-ID: <1371897084.305933fc8ce3375745927cfda5fca824eb67f004.dywi@gentoo> (raw) Message-ID: <20130622151426.4ScADC0c3hA7beX7kgSYFEQk9hMWTNDYSE2qujmuWoQ@z> (raw) commit: 305933fc8ce3375745927cfda5fca824eb67f004 Author: André Erdmann <dywi <AT> mailerd <DOT> de> AuthorDate: Sat Jun 22 10:31:24 2013 +0000 Commit: André Erdmann <dywi <AT> mailerd <DOT> de> CommitDate: Sat Jun 22 10:31:24 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=305933fc roverlay/packageinfo: support revbumps --- roverlay/packageinfo.py | 91 ++++++++++++++++++++++++++++++------------------- 1 file changed, 56 insertions(+), 35 deletions(-) diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py index 83a05ed..b75eb8c 100644 --- a/roverlay/packageinfo.py +++ b/roverlay/packageinfo.py @@ -16,6 +16,8 @@ __all__ = [ 'PackageInfo', ] import re import os.path import logging +# TODO: remove threading/locks here, exclusive access to PackageInfo instances +# should be guaranteed import threading import roverlay.digest @@ -320,10 +322,6 @@ class PackageInfo ( object ): return self._info [key_low] # 'virtual' keys - calculate result - elif key_low == 'name': - # no special name, using package_name - return self._info ['package_name'] - elif key_low == 'package_file': distdir = self.get ( 'distdir', do_fallback=True ) if distdir: @@ -443,14 +441,14 @@ class PackageInfo ( object ): """Returns the DESCRIPTION data for this PackageInfo (by reading the R package file if necessary). """ - if 'desc_data' in self._info: - return self._info ['desc_data'] - - self._writelock_acquire() if 'desc_data' not in self._info: - self._info ['desc_data'] = descriptionreader.read ( self ) + self._writelock_acquire() + if 'desc_data' not in self._info: + self._info ['desc_data'] = descriptionreader.read ( self ) + + self._update_lock.release() + # -- end if; - self._update_lock.release() return self._info ['desc_data'] # --- end of get_desc_data (...) --- @@ -518,12 +516,14 @@ class PackageInfo ( object ): arguments: * newrev -- new revision, (current rev + 1) is used if this is None """ - raise NotImplementedError ( "revbump code" ) if newrev is None: # get old rev and increment it - pass + ## direct dict access + self._info ['rev'] += 1 else: - pass + self._info ['rev'] = int ( newrev ) + + self._reset_version_str() return self # --- end of revbump (...) --- @@ -635,6 +635,19 @@ class PackageInfo ( object ): return None # --- end of get_evars (...) --- + def _reset_version_str ( self ): + rev = self ['rev'] + version = self ['version'] + + if rev > 0: + vstr = '.'.join ( str ( k ) for k in version ) + '-r' + str ( rev ) + else: + vstr = '.'.join ( str ( k ) for k in version ) + + self._info ['ebuild_verstr'] = vstr + #return vstr + # --- end of _reset_version_str (...) --- + def _update ( self, info ): """Updates self._info using the given info dict. @@ -645,15 +658,14 @@ class PackageInfo ( object ): for key, value in info.items(): - if key in self.__class__._UPDATE_KEYS_SIMPLE: - self [key] = value - - elif initial and key in self.__class__._UPDATE_KEYS_SIMPLE_INITIAL: - self [key] = value + if key in self.__class__._UPDATE_KEYS_SIMPLE or ( + initial and key in self.__class__._UPDATE_KEYS_SIMPLE_INITIAL + ): + self._info [key] = value elif key in self.__class__._UPDATE_KEYS_FILTER_NONE: if value is not None: - self [key] = value + self._info [key] = value elif key == 'filename': self._use_filename ( value ) @@ -662,10 +674,10 @@ class PackageInfo ( object ): self._use_pvr ( value ) elif key == 'suggests': - self ['has_suggests'] = value + self._info ['has_suggests'] = value elif key == 'depres_result': - self ['has_suggests'] = value [2] + self._info ['has_suggests'] = value [2] elif key == 'filepath': self._use_filepath ( value ) @@ -720,7 +732,7 @@ class PackageInfo ( object ): try: version = tuple ( int ( z ) for z in version_str.split ( '.' ) ) - self ['version'] = version + self._info ['version'] = version except ValueError as ve: # version string is malformed, cannot use it self.logger.error ( @@ -736,24 +748,33 @@ class PackageInfo ( object ): # removing illegal chars from the package_name ebuild_name = strutil.fix_ebuild_name ( package_name ) - if ebuild_name != package_name: - self ['name'] = ebuild_name - - self ['ebuild_verstr'] = version_str - # for DescriptionReader - self ['package_name'] = package_name + self._info ['package_name'] = package_name - self ['package_filename'] = filename_with_ext + self._info ['rev'] = 0 + self._info ['name'] = ebuild_name + self._info ['ebuild_verstr'] = version_str + self._info ['package_filename'] = filename_with_ext # --- end of _use_filename (...) --- def _use_pvr ( self, pvr ): - # 0.1_pre2-r17 -> ( 0, 1 ) - pv = pvr.partition ( '-' ) [0] - self ['version'] = tuple ( - int ( z ) for z in ( pv.partition ( '_' ) [0].split ( '.' ) ) - ) - self ['ebuild_verstr'] = pvr + # 0.1_pre2-r17 -> ( ( 0, 1 ), ( 17 ) ) + pv_str, DONT_CARE, pr_str = pvr.partition ( '-r' ) + pv, DONT_CARE, pv_suffix = pv_str.partition ( '_' ) + + if pv_suffix: + # not supported + raise NotImplementedError ( + "version suffix {!r} cannot be preserved for $PVR {!r}".format ( + pv_suffix, pvr + ) + ) + # non-digit chars in pv are unsupported, too + + self._info ['version'] = tuple ( int ( z ) for z in pv.split ( '.' ) ) + self._info ['rev'] = int ( pr_str ) if pr_str else 0 + + self._info ['ebuild_verstr'] = pvr # --- end of _use_pvr (...) --- def _remove_auto ( self, ebuild_status ):
next reply other threads:[~2013-06-22 15:24 UTC|newest] Thread overview: 160+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-06-22 15:24 André Erdmann [this message] 2013-06-22 15:14 ` [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/ André Erdmann -- strict thread matches above, loose matches on Subject: below -- 2015-01-26 17:41 [gentoo-commits] proj/R_overlay:master " André Erdmann 2015-01-26 17:41 André Erdmann 2014-07-18 16:20 André Erdmann 2014-07-18 2:50 [gentoo-commits] proj/R_overlay:wip/addition_control " André Erdmann 2014-07-18 16:20 ` [gentoo-commits] proj/R_overlay:master " 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 2014-07-16 15:14 André Erdmann 2014-06-05 22:09 André Erdmann 2014-04-01 16:38 André Erdmann 2014-02-16 16:30 André Erdmann 2014-02-15 19:49 André Erdmann 2014-02-15 19:49 André Erdmann 2014-01-25 18:14 André Erdmann 2013-12-11 18:40 André Erdmann 2013-12-11 18:40 André Erdmann 2013-09-23 15:30 André Erdmann 2013-09-20 15:57 André Erdmann 2013-09-19 15:00 André Erdmann 2013-09-17 16:40 André Erdmann 2013-09-17 16:40 André Erdmann 2013-09-17 16:40 André Erdmann 2013-09-17 16:40 André Erdmann 2013-09-16 13:43 André Erdmann 2013-09-13 15:10 André Erdmann 2013-09-12 16:36 André Erdmann 2013-09-12 16:36 André Erdmann 2013-09-12 16:36 André Erdmann 2013-09-11 11:14 André Erdmann 2013-09-11 10:19 André Erdmann 2013-09-10 14:40 André Erdmann 2013-09-10 14:40 André Erdmann 2013-09-10 14:40 André Erdmann 2013-09-10 14:40 André Erdmann 2013-09-06 17:27 André Erdmann 2013-09-06 17:27 André Erdmann 2013-09-03 15:50 André Erdmann 2013-09-02 12:27 André Erdmann 2013-09-02 8:44 André Erdmann 2013-08-30 14:49 André Erdmann 2013-08-30 14:49 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-27 15:39 André Erdmann 2013-08-23 13:52 André Erdmann 2013-08-23 13:52 André Erdmann 2013-08-23 13:52 André Erdmann 2013-08-19 15:42 André Erdmann 2013-08-16 14:05 André Erdmann 2013-08-16 11:02 André Erdmann 2013-08-16 10:43 André Erdmann 2013-08-16 10:43 André Erdmann 2013-08-14 14:56 André Erdmann 2013-08-14 14:56 André Erdmann 2013-08-13 8:56 André Erdmann 2013-08-13 8:56 André Erdmann 2013-08-13 8:56 André Erdmann 2013-08-12 8:28 André Erdmann 2013-08-12 8:18 André Erdmann 2013-08-07 16:10 André Erdmann 2013-08-02 14:30 André Erdmann 2013-08-02 10:34 André Erdmann 2013-08-02 10:34 André Erdmann 2013-08-01 12:44 André Erdmann 2013-08-01 12:44 André Erdmann 2013-07-29 14:56 André Erdmann 2013-07-29 8:55 André Erdmann 2013-07-26 13:02 André Erdmann 2013-07-23 7:51 André Erdmann 2013-07-23 7:51 André Erdmann 2013-07-19 18:00 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann 2013-07-23 7:51 ` [gentoo-commits] proj/R_overlay:master " André Erdmann 2013-07-17 18:05 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann 2013-07-17 18:05 ` [gentoo-commits] proj/R_overlay:master " André Erdmann 2013-07-15 22:31 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann 2013-07-16 16:36 ` [gentoo-commits] proj/R_overlay:master " André Erdmann 2013-07-12 13:57 André Erdmann 2013-06-22 15:24 André Erdmann 2013-06-22 15:24 André Erdmann 2013-06-22 15:24 André Erdmann 2013-06-19 18:58 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann 2013-06-22 15:24 ` [gentoo-commits] proj/R_overlay:master " André Erdmann 2013-06-19 18:58 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann 2013-06-19 18:59 ` [gentoo-commits] proj/R_overlay:master " André Erdmann 2013-06-13 16:34 André Erdmann 2013-06-05 18:08 [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 2013-06-13 16:34 ` [gentoo-commits] proj/R_overlay:master " André Erdmann 2013-06-04 21:06 André Erdmann 2013-04-25 16:44 André Erdmann 2013-04-25 16:44 André Erdmann 2013-03-05 11:27 André Erdmann 2013-02-09 20:45 André Erdmann 2013-02-05 17:48 André Erdmann 2013-02-05 17:48 André Erdmann 2013-01-30 20:16 André Erdmann 2013-01-30 20:16 André Erdmann 2013-01-28 23:54 André Erdmann 2013-01-28 23:54 André Erdmann 2013-01-28 23:54 André Erdmann 2012-10-02 10:04 André Erdmann 2012-08-20 11:16 André Erdmann 2012-08-13 18:07 André Erdmann 2012-08-09 9:26 André Erdmann 2012-08-08 23:46 André Erdmann 2012-08-08 23:46 André Erdmann 2012-08-07 8:50 André Erdmann 2012-08-02 15:14 André Erdmann 2012-08-01 7:25 André Erdmann 2012-07-31 17:51 André Erdmann 2012-07-30 8:52 André Erdmann 2012-07-30 8:52 André Erdmann 2012-07-24 16:59 [gentoo-commits] proj/R_overlay:overlay_wip " André Erdmann 2012-07-30 8:52 ` [gentoo-commits] proj/R_overlay:master " André Erdmann 2012-07-18 16:49 [gentoo-commits] proj/R_overlay:overlay_wip " André Erdmann 2012-07-30 8:52 ` [gentoo-commits] proj/R_overlay:master " André Erdmann 2012-07-16 16:15 André Erdmann 2012-07-16 16:15 André Erdmann 2012-07-16 16:15 [gentoo-commits] proj/R_overlay:depres_wip " André Erdmann 2012-07-16 16:15 ` [gentoo-commits] proj/R_overlay:master " André Erdmann 2012-07-10 17:43 André Erdmann 2012-07-09 17:19 André Erdmann 2012-07-04 18:21 André Erdmann 2012-07-04 18:21 André Erdmann 2012-07-03 17:48 André Erdmann 2012-06-28 13:29 André Erdmann 2012-06-26 15:42 André Erdmann 2012-06-25 18:19 André Erdmann 2012-06-21 16:55 André Erdmann 2012-06-20 19:03 André Erdmann 2012-06-20 19:03 André Erdmann 2012-06-18 16:27 André Erdmann 2012-06-15 20:34 André Erdmann 2012-06-15 20:34 André Erdmann 2012-06-15 20:34 André Erdmann 2012-06-15 20:34 André Erdmann 2012-06-15 20:34 André Erdmann 2012-06-15 20:34 André Erdmann 2012-06-12 17:17 André Erdmann 2012-06-06 19:52 André Erdmann 2012-06-06 19:52 André Erdmann 2012-06-06 19:52 André Erdmann 2012-06-05 17:30 André Erdmann 2012-06-04 19:07 André Erdmann 2012-06-04 19:07 André Erdmann 2012-06-04 15:43 André Erdmann 2012-06-01 16:19 André Erdmann 2012-06-01 16:19 André Erdmann 2012-06-01 15:46 André Erdmann 2012-05-31 18:24 André Erdmann 2012-05-30 20:15 André Erdmann 2012-05-30 19:36 André Erdmann 2012-05-30 19:36 André Erdmann 2012-05-30 16:09 André Erdmann 2012-05-30 16:09 André Erdmann 2012-05-30 16:09 André Erdmann 2012-05-30 16:09 André Erdmann 2012-05-30 10:58 André Erdmann 2012-05-30 10:58 André Erdmann 2012-05-30 10:58 André Erdmann 2012-05-30 10:58 André Erdmann 2012-05-29 17:09 André Erdmann 2012-05-29 17:09 André Erdmann 2012-05-29 17:09 André Erdmann 2012-05-29 17:09 André Erdmann 2012-05-29 17:09 André Erdmann 2012-05-26 13:14 André Erdmann 2012-05-26 13:14 André Erdmann
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1371897084.305933fc8ce3375745927cfda5fca824eb67f004.dywi@gentoo \ --to=dywi@mailerd.de \ --cc=gentoo-commits@lists.gentoo.org \ --cc=gentoo-dev@lists.gentoo.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox