From: "Brian Dolbec" <brian.dolbec@gmail.com> To: gentoo-commits@lists.gentoo.org Subject: [gentoo-commits] proj/layman:gsoc2014 commit in: layman/overlays/ Date: Mon, 16 Jun 2014 03:37:30 +0000 (UTC) [thread overview] Message-ID: <1402792601.a189742b6940cf15e078fd952c1fd9daa61951b0.dol-sen@gentoo> (raw) commit: a189742b6940cf15e078fd952c1fd9daa61951b0 Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org> AuthorDate: Thu Jun 12 21:42:20 2014 +0000 Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> 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):
WARNING: multiple messages have this Message-ID (diff)
From: "Brian Dolbec" <brian.dolbec@gmail.com> To: gentoo-commits@lists.gentoo.org Subject: [gentoo-commits] proj/layman:master commit in: layman/overlays/ Date: Mon, 16 Jun 2014 03:40:20 +0000 (UTC) [thread overview] Message-ID: <1402792601.a189742b6940cf15e078fd952c1fd9daa61951b0.dol-sen@gentoo> (raw) Message-ID: <20140616034020.7cJdJTQgb48wnNq6aSNtE_IJ_6SalMa_aZE9dtRTyTw@z> (raw) commit: a189742b6940cf15e078fd952c1fd9daa61951b0 Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org> AuthorDate: Thu Jun 12 21:42:20 2014 +0000 Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> 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):
next reply other threads:[~2014-06-16 3:37 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-06-16 3:37 Brian Dolbec [this message] 2014-06-16 3:40 ` [gentoo-commits] proj/layman:master commit in: layman/overlays/ Brian Dolbec -- strict thread matches above, loose matches on Subject: below -- 2014-08-15 22:32 [gentoo-commits] proj/layman:gsoc2014 " Devan Franchini 2014-08-15 22:32 Devan Franchini 2014-06-27 4:07 Devan Franchini 2014-06-16 3:40 [gentoo-commits] proj/layman:master " Brian Dolbec 2014-06-16 3:37 ` [gentoo-commits] proj/layman:gsoc2014 " Brian Dolbec 2014-06-16 3:40 [gentoo-commits] proj/layman:master " Brian Dolbec 2014-06-16 3:37 ` [gentoo-commits] proj/layman:gsoc2014 " Brian Dolbec 2014-06-16 3:37 Brian Dolbec 2014-06-16 3:37 Brian Dolbec 2014-06-16 3:37 Brian Dolbec 2014-06-16 3:37 Brian Dolbec 2014-06-16 3:37 Brian Dolbec 2014-06-16 3:37 Brian Dolbec 2014-05-14 23:49 Devan Franchini 2014-05-14 17:32 Devan Franchini 2014-05-14 1:14 Devan Franchini 2014-05-14 0:42 Devan Franchini
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=1402792601.a189742b6940cf15e078fd952c1fd9daa61951b0.dol-sen@gentoo \ --to=brian.dolbec@gmail.com \ --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