public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/distroot/
Date: Wed, 25 Jun 2014 16:41:10 +0000 (UTC)	[thread overview]
Message-ID: <1403712360.dd377fc68bfb78c283d35b2173b47ce4837b0d35.dywi@gentoo> (raw)

commit:     dd377fc68bfb78c283d35b2173b47ce4837b0d35
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jun 25 16:06:00 2014 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> 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 (...) ---
 


             reply	other threads:[~2014-06-25 16:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-25 16:41 André Erdmann [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-03-25 22:48 [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/distroot/ André Erdmann
2013-09-03 15:51 André Erdmann
2013-09-03 12:21 André Erdmann
2013-09-02 12:27 André Erdmann
2013-09-02  8:44 André Erdmann
2013-08-30 14:49 André Erdmann
     [not found] <1377779578.666baeaec44ee25a6ab2f355f3556a41587f5440.dywi@gentoo>
2013-08-29 12:36 ` André Erdmann
2013-08-29 12:36 André Erdmann
2013-08-22  9:01 André Erdmann
2013-02-09 20:45 André Erdmann

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=1403712360.dd377fc68bfb78c283d35b2173b47ce4837b0d35.dywi@gentoo \
    --to=dywi@mailerd.de \
    --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: link
Be 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