From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Pocnu-0005iz-LR for garchives@archives.gentoo.org; Sun, 13 Feb 2011 14:19:58 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E17DAE0603; Sun, 13 Feb 2011 14:19:51 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id B0D4DE0603 for ; Sun, 13 Feb 2011 14:19:51 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 17F2C1B4027 for ; Sun, 13 Feb 2011 14:19:51 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 802458006A for ; Sun, 13 Feb 2011 14:19:50 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/egencache X-VCS-Directories: bin/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: ef41f7367c57a69fe88f37d2e31d48a59394aac4 Date: Sun, 13 Feb 2011 14:19:50 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: f39a374f63ca47c8aebf063d9827e945 commit: ef41f7367c57a69fe88f37d2e31d48a59394aac4 Author: Zac Medico gentoo org> AuthorDate: Sun Feb 13 14:18:00 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Feb 13 14:18:00 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Def41f736 egencache: --preserve-comments allow missing file This will fix bug #354687. --- bin/egencache | 30 ++++++++++++++++++++++++++---- 1 files changed, 26 insertions(+), 4 deletions(-) diff --git a/bin/egencache b/bin/egencache index 89d2fde..e5685c4 100755 --- a/bin/egencache +++ b/bin/egencache @@ -396,11 +396,33 @@ class GenUseLocalDesc(object): mode=3D'w', encoding=3D_encodings['repo.content'], errors=3D'replace') except IOError as e: + if not self._preserve_comments or \ + os.path.isfile(desc_path): + writemsg_level( + "ERROR: failed to open output file %s: %s\n" \ + % (desc_path, e), level=3Dlogging.ERROR, noiselevel=3D-1) + self.returncode |=3D 2 + return + + # Open in r+b mode failed because the file doesn't + # exist yet. We can probably recover if we disable + # preserve_comments mode now. writemsg_level( - "ERROR: failed to open output file %s: %s\n" % (desc_path,e,), - level=3Dlogging.ERROR, noiselevel=3D-1) - self.returncode |=3D 2 - return + "WARNING: --preserve-comments enabled, but " + \ + "output file not found: %s\n" % (desc_path,), + level=3Dlogging.WARNING, noiselevel=3D-1) + self._preserve_comments =3D False + try: + output =3D codecs.open(_unicode_encode(desc_path, + encoding=3D_encodings['fs'], errors=3D'strict'), + mode=3D'w', encoding=3D_encodings['repo.content'], + errors=3D'replace') + except IOError as e: + writemsg_level( + "ERROR: failed to open output file %s: %s\n" \ + % (desc_path, e), level=3Dlogging.ERROR, noiselevel=3D-1) + self.returncode |=3D 2 + return else: output =3D sys.stdout =20