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 83A221392EF for ; Wed, 25 Jun 2014 16:41:30 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1DFE9E0838; Wed, 25 Jun 2014 16:41:20 +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 AC52EE0838 for ; Wed, 25 Jun 2014 16:41:14 +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 7E51133FF8E for ; Wed, 25 Jun 2014 16:41:12 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 8035C1912A for ; Wed, 25 Jun 2014 16:41:10 +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: <1403712360.dd377fc68bfb78c283d35b2173b47ce4837b0d35.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/distroot/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/overlay/pkgdir/distroot/distroot.py X-VCS-Directories: roverlay/overlay/pkgdir/distroot/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: dd377fc68bfb78c283d35b2173b47ce4837b0d35 X-VCS-Branch: master Date: Wed, 25 Jun 2014 16:41:10 +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: bd11864a-3237-4f73-8b91-36bdc967e363 X-Archives-Hash: 0a558bdc9bffe7a52857fe36967ed520 commit: dd377fc68bfb78c283d35b2173b47ce4837b0d35 Author: André Erdmann mailerd de> AuthorDate: Wed Jun 25 16:06:00 2014 +0000 Commit: André Erdmann mailerd de> CommitDate: Wed Jun 25 16:06:00 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=dd377fc6 distroot, handle_file_collision(): restore src_uri_dest ... if the file collision cannot be resolved Also adds some safety checks (distfile name must not be empty and should not be rename_prefix). --- roverlay/overlay/pkgdir/distroot/distroot.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/roverlay/overlay/pkgdir/distroot/distroot.py b/roverlay/overlay/pkgdir/distroot/distroot.py index 654c1f6..9872aad 100644 --- a/roverlay/overlay/pkgdir/distroot/distroot.py +++ b/roverlay/overlay/pkgdir/distroot/distroot.py @@ -657,22 +657,33 @@ class PersistentDistroot ( DistrootBase ): if self.distmap.get_distfile_slot ( package_dir, package_info ): return True else: - distfile = package_info.get_src_uri_dest().rpartition ( os.sep ) - rename_prefix = package_info ['repo_name'].lower() + '_' - - if distfile[2][:len(rename_prefix)] == rename_prefix: + orig_src_uri_dest = package_info.get_src_uri_dest() + # distfile_dirname, distfile_os_sep, distfile_basename + distfile = orig_src_uri_dest.rpartition ( os.sep ) + rename_prefix = package_info ['repo_name'].lower() + '_' + rename_prefix_len = len ( rename_prefix ) + + assert distfile[2] + + if ( + len(distfile[2]) > rename_prefix_len + and distfile[2][:rename_prefix_len] == rename_prefix + ): # already prefixed with the repo name return False + else: package_info.update ( src_uri_dest=( distfile[0] + distfile[1] + rename_prefix + distfile[2] ) ) - #return self.distmap.get_distfile_slot(...) + if self.distmap.get_distfile_slot ( package_dir, package_info ): return True else: + # restore src_uri_dest + package_info.update ( src_uri_dest=orig_src_uri_dest ) return False # --- end of handle_file_collision (...) ---