Gentoo Archives: gentoo-commits

From: "André Erdmann" <dywi@×××××××.de>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/distroot/
Date: Wed, 25 Jun 2014 16:41:30
Message-Id: 1403712360.dd377fc68bfb78c283d35b2173b47ce4837b0d35.dywi@gentoo
1 commit: dd377fc68bfb78c283d35b2173b47ce4837b0d35
2 Author: André Erdmann <dywi <AT> mailerd <DOT> de>
3 AuthorDate: Wed Jun 25 16:06:00 2014 +0000
4 Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
5 CommitDate: Wed Jun 25 16:06:00 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=dd377fc6
7
8 distroot, handle_file_collision(): restore src_uri_dest
9
10 ... if the file collision cannot be resolved
11
12 Also adds some safety checks (distfile name must not be empty and should not
13 be rename_prefix).
14
15 ---
16 roverlay/overlay/pkgdir/distroot/distroot.py | 21 ++++++++++++++++-----
17 1 file changed, 16 insertions(+), 5 deletions(-)
18
19 diff --git a/roverlay/overlay/pkgdir/distroot/distroot.py b/roverlay/overlay/pkgdir/distroot/distroot.py
20 index 654c1f6..9872aad 100644
21 --- a/roverlay/overlay/pkgdir/distroot/distroot.py
22 +++ b/roverlay/overlay/pkgdir/distroot/distroot.py
23 @@ -657,22 +657,33 @@ class PersistentDistroot ( DistrootBase ):
24 if self.distmap.get_distfile_slot ( package_dir, package_info ):
25 return True
26 else:
27 - distfile = package_info.get_src_uri_dest().rpartition ( os.sep )
28 - rename_prefix = package_info ['repo_name'].lower() + '_'
29 -
30 - if distfile[2][:len(rename_prefix)] == rename_prefix:
31 + orig_src_uri_dest = package_info.get_src_uri_dest()
32 + # distfile_dirname, distfile_os_sep, distfile_basename
33 + distfile = orig_src_uri_dest.rpartition ( os.sep )
34 + rename_prefix = package_info ['repo_name'].lower() + '_'
35 + rename_prefix_len = len ( rename_prefix )
36 +
37 + assert distfile[2]
38 +
39 + if (
40 + len(distfile[2]) > rename_prefix_len
41 + and distfile[2][:rename_prefix_len] == rename_prefix
42 + ):
43 # already prefixed with the repo name
44 return False
45 +
46 else:
47 package_info.update (
48 src_uri_dest=(
49 distfile[0] + distfile[1] + rename_prefix + distfile[2]
50 )
51 )
52 - #return self.distmap.get_distfile_slot(...)
53 +
54 if self.distmap.get_distfile_slot ( package_dir, package_info ):
55 return True
56 else:
57 + # restore src_uri_dest
58 + package_info.update ( src_uri_dest=orig_src_uri_dest )
59 return False
60 # --- end of handle_file_collision (...) ---