From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 149FD13800E for ; Mon, 30 Jul 2012 08:53:51 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1A320E06F3; Mon, 30 Jul 2012 08:52:49 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id D016CE06EC for ; Mon, 30 Jul 2012 08:52:48 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 467CC1B400C for ; Mon, 30 Jul 2012 08:52:48 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 6E909E5449 for ; Mon, 30 Jul 2012 08:52:45 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1343231321.4a1edc718a09b2ce5499753c7d3bbb47d837b1ed.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/rpackage/descriptionreader.py X-VCS-Directories: roverlay/rpackage/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: 4a1edc718a09b2ce5499753c7d3bbb47d837b1ed X-VCS-Branch: master Date: Mon, 30 Jul 2012 08:52:45 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 3715b6f5-564b-456c-9821-d4826d184742 X-Archives-Hash: a73146ebdc463421636ea0cc9328ff7f commit: 4a1edc718a09b2ce5499753c7d3bbb47d837b1ed Author: André Erdmann mailerd de> AuthorDate: Wed Jul 25 15:48:41 2012 +0000 Commit: André Erdmann mailerd de> CommitDate: Wed Jul 25 15:48:41 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=4a1edc71 workaround for Z compressed files --- roverlay/rpackage/descriptionreader.py | 48 +++++++++++++++++++++---------- 1 files changed, 32 insertions(+), 16 deletions(-) diff --git a/roverlay/rpackage/descriptionreader.py b/roverlay/rpackage/descriptionreader.py index bfb50bb..52e9d2e 100644 --- a/roverlay/rpackage/descriptionreader.py +++ b/roverlay/rpackage/descriptionreader.py @@ -208,17 +208,16 @@ class DescriptionReader ( object ): if tarfile.is_tarfile ( filepath ): # filepath is a tarball, open tar handle + file handle - th = tarfile.open ( filepath, 'r' ) + th = tarfile.open ( filepath, mode='r' ) if pkg_name: - fh = th.extractfile ( os.path.join ( - pkg_name, - config.get ( 'DESCRIPTION.file_name' ) - ) ) + fh = th.extractfile ( + pkg_name + os.path.sep + config.get ( 'DESCRIPTION.file_name' ) + ) else: fh = th.extractfile ( config.get ( 'DESCRIPTION.file_name' ) ) else: - # open file handle only + # open file handle only (!! .Z compressed tar files, FIXME) fh = open ( filepath, 'r' ) @@ -270,6 +269,8 @@ class DescriptionReader ( object ): comment_chars = config.get ( 'DESCRIPTION.comment_chars', '#' ) + non_ascii_warned = False + for line in desc_lines: field_context_ref = None @@ -347,11 +348,25 @@ class DescriptionReader ( object ): # reaching this branch means that # (a) line has no leading whitespace # (b) line has no separator (:) - # this should not occur in description files (bad syntax?) - self.logger.warning ( - "Unexpected line in description file: '%s'." - % line_components [0] - ) + # this should not occur in description files (bad syntax, + # unknown compression (.Z!)) + + # !!! FIXME: handle .Z files properly or at least + # deny to read them + # remove non ascii-chars (could confuse the terminal) + ascii_str = util.ascii_filter ( line_components [0] ) + if len ( ascii_str ) == len ( line_components [0] ): + self.logger.warning ( + "Unexpected line in description file: {!r}.".format ( + line_components [0] + ) ) + elif not non_ascii_warned: + # probably compressed text + self.logger.warning ( + 'Unexpected non-ascii line in description ' + 'file (compressed text?)!' + ) + non_ascii_warned = True # -- end for -- @@ -383,14 +398,15 @@ class DescriptionReader ( object ): if read_data is None: self.logger.warning ( - "Failed to read file '%s'." % self.fileinfo ['package_file'] - ) + "Failed to read file {f!r}.".format ( + f=self.fileinfo ['package_file'] + ) ) elif self._verify_read_data ( read_data ): self.logger.debug ( - "Successfully read file '%s' with data = %s." - % ( self.fileinfo ['package_file'], read_data ) - ) + "Successfully read file {f} with data = {d}.".format ( + f=self.fileinfo ['package_file'], d=read_data + ) ) self.desc_data = read_data # else have log entries from _verify() From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 2106E13800E for ; Wed, 25 Jul 2012 15:57:34 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 191B5E06C0; Wed, 25 Jul 2012 15:57:22 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id CF130E06C0 for ; Wed, 25 Jul 2012 15:57:21 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 0DB361B4709 for ; Wed, 25 Jul 2012 15:57:21 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id A9700E5442 for ; Wed, 25 Jul 2012 15:57:18 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1343231321.4a1edc718a09b2ce5499753c7d3bbb47d837b1ed.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:overlay_wip commit in: roverlay/rpackage/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/rpackage/descriptionreader.py X-VCS-Directories: roverlay/rpackage/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: 4a1edc718a09b2ce5499753c7d3bbb47d837b1ed X-VCS-Branch: overlay_wip Date: Wed, 25 Jul 2012 15:57:18 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 67640ff0-1776-4754-8d14-1a3f150f30ae X-Archives-Hash: 01e20eb8563eb28f2898cee8c8ff0e9a Message-ID: <20120725155718.DIAaoXNqe_0DmS-X8oHvp3k5d8HWqsIEcDurfo9L-88@z> commit: 4a1edc718a09b2ce5499753c7d3bbb47d837b1ed Author: André Erdmann mailerd de> AuthorDate: Wed Jul 25 15:48:41 2012 +0000 Commit: André Erdmann mailerd de> CommitDate: Wed Jul 25 15:48:41 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=4a1edc71 workaround for Z compressed files --- roverlay/rpackage/descriptionreader.py | 48 +++++++++++++++++++++---------- 1 files changed, 32 insertions(+), 16 deletions(-) diff --git a/roverlay/rpackage/descriptionreader.py b/roverlay/rpackage/descriptionreader.py index bfb50bb..52e9d2e 100644 --- a/roverlay/rpackage/descriptionreader.py +++ b/roverlay/rpackage/descriptionreader.py @@ -208,17 +208,16 @@ class DescriptionReader ( object ): if tarfile.is_tarfile ( filepath ): # filepath is a tarball, open tar handle + file handle - th = tarfile.open ( filepath, 'r' ) + th = tarfile.open ( filepath, mode='r' ) if pkg_name: - fh = th.extractfile ( os.path.join ( - pkg_name, - config.get ( 'DESCRIPTION.file_name' ) - ) ) + fh = th.extractfile ( + pkg_name + os.path.sep + config.get ( 'DESCRIPTION.file_name' ) + ) else: fh = th.extractfile ( config.get ( 'DESCRIPTION.file_name' ) ) else: - # open file handle only + # open file handle only (!! .Z compressed tar files, FIXME) fh = open ( filepath, 'r' ) @@ -270,6 +269,8 @@ class DescriptionReader ( object ): comment_chars = config.get ( 'DESCRIPTION.comment_chars', '#' ) + non_ascii_warned = False + for line in desc_lines: field_context_ref = None @@ -347,11 +348,25 @@ class DescriptionReader ( object ): # reaching this branch means that # (a) line has no leading whitespace # (b) line has no separator (:) - # this should not occur in description files (bad syntax?) - self.logger.warning ( - "Unexpected line in description file: '%s'." - % line_components [0] - ) + # this should not occur in description files (bad syntax, + # unknown compression (.Z!)) + + # !!! FIXME: handle .Z files properly or at least + # deny to read them + # remove non ascii-chars (could confuse the terminal) + ascii_str = util.ascii_filter ( line_components [0] ) + if len ( ascii_str ) == len ( line_components [0] ): + self.logger.warning ( + "Unexpected line in description file: {!r}.".format ( + line_components [0] + ) ) + elif not non_ascii_warned: + # probably compressed text + self.logger.warning ( + 'Unexpected non-ascii line in description ' + 'file (compressed text?)!' + ) + non_ascii_warned = True # -- end for -- @@ -383,14 +398,15 @@ class DescriptionReader ( object ): if read_data is None: self.logger.warning ( - "Failed to read file '%s'." % self.fileinfo ['package_file'] - ) + "Failed to read file {f!r}.".format ( + f=self.fileinfo ['package_file'] + ) ) elif self._verify_read_data ( read_data ): self.logger.debug ( - "Successfully read file '%s' with data = %s." - % ( self.fileinfo ['package_file'], read_data ) - ) + "Successfully read file {f} with data = {d}.".format ( + f=self.fileinfo ['package_file'], d=read_data + ) ) self.desc_data = read_data # else have log entries from _verify()