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 508AF13877A for ; Mon, 16 Jun 2014 03:40:31 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B0250E0BCC; Mon, 16 Jun 2014 03:40:24 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 2C75DE0B8F for ; Mon, 16 Jun 2014 03:40:23 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 113A933FDD1 for ; Mon, 16 Jun 2014 03:40:22 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 322DB188A1 for ; Mon, 16 Jun 2014 03:40:20 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1402792601.a189742b6940cf15e078fd952c1fd9daa61951b0.dol-sen@gentoo> Subject: [gentoo-commits] proj/layman:master commit in: layman/overlays/ X-VCS-Repository: proj/layman X-VCS-Files: layman/overlays/tar.py X-VCS-Directories: layman/overlays/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: a189742b6940cf15e078fd952c1fd9daa61951b0 X-VCS-Branch: master Date: Mon, 16 Jun 2014 03:40:20 +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: 15023d36-15e6-4f4b-a99a-7530f4d1393f X-Archives-Hash: 0719c3d0be7a06f4a7a047a4c5248c00 Message-ID: <20140616034020.7cJdJTQgb48wnNq6aSNtE_IJ_6SalMa_aZE9dtRTyTw@z> commit: a189742b6940cf15e078fd952c1fd9daa61951b0 Author: Devan Franchini gentoo org> AuthorDate: Thu Jun 12 21:42:20 2014 +0000 Commit: Brian Dolbec gmail com> CommitDate: Sun Jun 15 00:36:41 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=a189742b tar.py: Adds file:// support for tar overlays --- layman/overlays/tar.py | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/layman/overlays/tar.py b/layman/overlays/tar.py index fc15c56..e5d10b6 100644 --- a/layman/overlays/tar.py +++ b/layman/overlays/tar.py @@ -99,6 +99,7 @@ class TarOverlay(OverlaySource): def _extract(self, base, tar_url, dest_dir): ext = '.tar.noidea' + clean_tar = True for i in [('tar.%s' % e) for e in ('bz2', 'gz', 'lzma', 'xz', 'Z')] \ + ['tgz', 'tbz', 'taz', 'tlz', 'txz']: candidate_ext = '.%s' % i @@ -106,33 +107,38 @@ class TarOverlay(OverlaySource): ext = candidate_ext break - # setup the ssl-fetch output map - connector_output = { - 'info': self.output.debug, - 'error': self.output.error, - 'kwargs-info': {'level': 2}, - 'kwargs-error':{'level': None}, - } + if 'file://' not in tar_url: + # setup the ssl-fetch output map + connector_output = { + 'info': self.output.debug, + 'error': self.output.error, + 'kwargs-info': {'level': 2}, + 'kwargs-error':{'level': None}, + } - fetcher = Connector(connector_output, self.proxies, USERAGENT) + fetcher = Connector(connector_output, self.proxies, USERAGENT) - success, tar, timestamp = fetcher.fetch_content(tar_url) + success, tar, timestamp = fetcher.fetch_content(tar_url) - pkg = path([base, self.parent.name + ext]) + pkg = path([base, self.parent.name + ext]) - try: - with fileopen(pkg, 'w+b') as out_file: - out_file.write(tar) + try: + with fileopen(pkg, 'w+b') as out_file: + out_file.write(tar) - except Exception as error: - raise Exception('Failed to store tar package in ' - + pkg + '\nError was:' + str(error)) + except Exception as error: + raise Exception('Failed to store tar package in ' + + pkg + '\nError was:' + str(error)) + else: + clean_tar = False + pkg = tar_url.replace('file://', '') # tar -v -x -f SOURCE -C TARGET args = ['-v', '-x', '-f', pkg, '-C', dest_dir] result = self.run_command(self.command(), args, cmd=self.type) - os.unlink(pkg) + if clean_tar: + os.unlink(pkg) return result def _add_unchecked(self, base):