public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "vivo75@gmail.com" <vivo75@gmail.com>
To: gentoo-portage-dev@lists.gentoo.org
Subject: Re: [gentoo-portage-dev] Is portage (/usr)/bin-merge safe?
Date: Sun, 02 Jun 2013 13:14:41 +0200	[thread overview]
Message-ID: <51AB2921.2060906@gmail.com> (raw)
In-Reply-To: <pan$7796a$b69709b7$19290aaf$1cb9a749@cox.net>

On 06/01/13 07:36, Duncan wrote:
> As in subject, is portage bin/usr-bin merge safe?
>
> It appears most of my clashing files are /usr/bin/* -> /bin/* symlinks.  
> (That's just bin, I've not looked at sbin.)
Most but not all, I'm also quite sure in the past I've encountered one
(and only one) files collision (not symlinks), cannot remember which though.
>
> Does portage "just do the right thing" if the dirs are linked to each 
> other?
Trust the answers of Zac and Mike on this ;-)
>
> Meanwhile, a quick eyeball of the results says 50-60% of the hits are 
> coreutils, so if portage doesn't handle it automatically, fixing it for 
> just that one package, even just using a USE flag instead of trying to 
> detect it automatically, would kill a majority of the birds with a single 
> stone.
>
> (Since I don't have a separate /usr anyway, I've been thinking about 
> it...  If it's not easily doable anyway, that cuts short the internal 
> debate.)
While portage can be safe, for various reason (including the resultant
pkg) I do prefer to do the move in post_src_install() #1
All my tests have been done against a manually converted filesystem,
i.e. manually moving stuff around, creating the symlinks, putting the
code in bashrc and only after that (re)building everything inside the
system.
So I've no idea if this approach can work in a stage1 or equivalent.
It has been used for quite a long time from a "build server" =>
"consumer machine" environment.


#1 excerpt from bashrc, this code is rough but work in the gentoo
ebuilds tree domain

move_root_to_usr() {

  pushd "${D}"

  echo "PHASE: ${EBUILD_PHASE} move something around";

  for d in lib* *bin; do

    if [[ -d ${d} ]] ; then
      # move directories
      for f in $(find ${d}/ -type d) ; do
        if [[ -e usr/${f} ]] ; then
          if [[ -e ${f} ]] ; then
            echo "usr/${f} : exist, cannot move"
          else
            : # parent has already been moved
          fi
        else
          echo "${f} : ok to move"
          mv ${f} usr/${f}
        fi
      done

      # move files
      for f in $(find ${d}/ -type f -or -type l) ; do
        if [[ ( -e usr/${f} ) || (-L usr/${f}) ]] ; then
          if [[ ( -L ${f} ) && ( -f usr/${f} ) ]] ; then
            echo "${f} : is a symlink, remove"
            rm -f ${f}
          else
            if [[ ( -f ${f} ) && ( -L usr/${f} ) ]] ; then
              echo "${f} : file in usr is a symlink remove e move"
              rm -f usr/${f}
              mv ${f} usr/${f}
            else
              ls -ld ${f} usr/${f}
              echo "${f} : UNHANDLED CASE prepare to breakage"
            fi
          fi
        else
          echo "${f} : ok to move"
          mv ${f} usr/${f}
        fi
      done

      rmdir -p ${d} && [[ -e usr/${d} ]] || ln -s usr/${d} ${d}

    fi # if [[ -d ${d} ]] ; then

  done # for d in lib64 lib32 bin sbin; do

  rm -f lib/lib

  popd
}

post_src_install() {
    move_root_to_usr
}



  parent reply	other threads:[~2013-06-02 11:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-01  5:36 [gentoo-portage-dev] Is portage (/usr)/bin-merge safe? Duncan
2013-06-01  5:49 ` Zac Medico
2017-12-07  8:37   ` [gentoo-portage-dev] " Duncan
2017-12-07  9:07     ` Zac Medico
2017-12-07 12:14       ` Duncan
2013-06-01  6:17 ` [gentoo-portage-dev] " Mike Frysinger
2013-06-02 11:14 ` vivo75 [this message]
2013-06-02 11:54   ` [gentoo-portage-dev] " Duncan
2013-06-02 12:47     ` vivo75
2013-06-02 13:19       ` Duncan

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=51AB2921.2060906@gmail.com \
    --to=vivo75@gmail.com \
    --cc=gentoo-portage-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