public inbox for gentoo-embedded@lists.gentoo.org
 help / color / mirror / Atom feed
From: Joakim Tjernlund <joakim.tjernlund@transmode.se>
To: Mike Frysinger <vapier@gentoo.org>
Cc: gentoo-embedded@lists.gentoo.org
Subject: Re: [gentoo-embedded] crossdev improvements
Date: Fri, 8 Oct 2010 10:09:17 +0200	[thread overview]
Message-ID: <OF13BB5D55.23389D89-ONC12577B6.002CAB99-C12577B6.002CCBCC@transmode.se> (raw)
In-Reply-To: <201010072254.07952.vapier@gentoo.org>



Mike Frysinger <vapier@gentoo.org> wrote on 2010/10/08 04:54:07:
>
> On Saturday, September 25, 2010 13:11:26 Joakim Tjernlund wrote:
> >  setup_portage_vars() {
> > +   PORTAGE_CONFIGROOT=$(portageq envvar PORTAGE_CONFIGROOT)
>
> is this necessary ?  you cant really put PORTAGE_CONFIGROOT in /etc/make.conf
> as you hit a chicken & egg problem ...

Perhaps this is better:

From 79d5bbe239f90383fa07fb17cd6fde1461bc0917 Mon Sep 17 00:00:00 2001
From: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Date: Fri, 8 Oct 2010 10:01:30 +0200
Subject: [PATCH 2/2] Initial PORTAGE_CONFIGROOT support

This is untested

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
---
 crossdev |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/crossdev b/crossdev
index c35a2ed..854ae58 100755
--- a/crossdev
+++ b/crossdev
@@ -12,7 +12,9 @@ if [[ ${ROOT:-/} != "/" ]] ; then
 	exit 2
 fi

-source /etc/init.d/functions.sh || exit 1
+export PORTAGE_CONFIGROOT=${PORTAGE_CONFIGROOT:-/}
+
+source ${PORTAGE_CONFIGROOT}/etc/init.d/functions.sh || exit 1
 esyslog() { :; }
 die() {
 	echo
@@ -265,9 +267,9 @@ uninstall() {

 	[[ -d ${PORTDIR_OVERLAY}/cross-${CTARGET} ]] \
 		&& rm -r ${PORTDIR_OVERLAY}/cross-${CTARGET}
-	sed -i -e "/^cross-${CTARGET}$/d" /etc/portage/categories
+	sed -i -e "/^cross-${CTARGET}$/d" ${PORTAGE_CONFIGROOT}/etc/portage/categories
 	for f in package.{mask,keywords,use} ; do
-		f="/etc/portage/${f}"
+		f="${PORTAGE_CONFIGROOT}/etc/portage/${f}"
 		if [[ -d ${f} ]] ; then
 			rm -f "${f}"/cross-${CTARGET}
 			rmdir "${f}" 2>/dev/null
@@ -275,8 +277,8 @@ uninstall() {
 			sed -i -e "/cross-${CTARGET}\//d" "${f}"
 		fi
 	done
-	rm -rf /etc/portage/env/cross-${CTARGET}
-	rmdir /etc/portage/env 2>/dev/null
+	rm -rf ${PORTAGE_CONFIGROOT}/etc/portage/env/cross-${CTARGET}
+	rmdir ${PORTAGE_CONFIGROOT}/etc/portage/env 2>/dev/null

 	rmdir /var/db/pkg/cross-${CTARGET} 2>/dev/null
 	if [[ -d /var/db/pkg/cross-${CTARGET} ]] ; then
@@ -310,7 +312,7 @@ uninstall() {
 			[[ ${ans} == [Yy]* ]] && rm -rf "${d}"
 		fi
 	done
-	rm -f /etc/env.d/{binutils,gcc}/config-${CTARGET}
+	rm -f ${PORTAGE_CONFIGROOT}/etc/env.d/{binutils,gcc}/config-${CTARGET}
 	[[ -e /var/db/pkg/cross-${CTARGET} ]] && rmdir /var/db/pkg/cross-${CTARGET}

 	exit 0
@@ -461,14 +463,14 @@ fi

 # grab user settings
 for v in ABI UCLIBC_CPU USE BVER GVER KVER LVER STAGE CFLAGS LDFLAGS ASFLAGS ; do
-	if [[ -e /etc/portage/crossdev/${CTARGET}/${v} ]] ; then
+	if [[ -e ${PORTAGE_CONFIGROOT}/etc/portage/crossdev/${CTARGET}/${v} ]] ; then
 		# yes, quotes are needed in this instance (export $var="...")
 		export ${v}="$(</etc/portage/crossdev/${CTARGET}/${v})"
 		einfo "Restoring user setting '${v}' to '${!v}'"
 	fi
-	if [[ -e /etc/portage/crossdev/${CTARGET}/env ]] ; then
+	if [[ -e ${PORTAGE_CONFIGROOT}/etc/portage/crossdev/${CTARGET}/env ]] ; then
 		einfo "Restoring generic user env settings"
-		source /etc/portage/crossdev/${CTARGET}/env
+		source ${PORTAGE_CONFIGROOT}/etc/portage/crossdev/${CTARGET}/env
 	fi
 done

@@ -616,12 +618,12 @@ set_portage() {
 	set_env ${pkg} "${env}"
 }

-mkdir -p /etc/portage
-check_trailing_newline /etc/portage/categories
-grep -qs "^cross-${CTARGET}$" /etc/portage/categories \
-	|| echo cross-${CTARGET} >> /etc/portage/categories
+mkdir -p ${PORTAGE_CONFIGROOT}/etc/portage
+check_trailing_newline ${PORTAGE_CONFIGROOT}/etc/portage/categories
+grep -qs "^cross-${CTARGET}$" ${PORTAGE_CONFIGROOT}/etc/portage/categories \
+	|| echo cross-${CTARGET} >> ${PORTAGE_CONFIGROOT}/etc/portage/categories
 mkdir -p "${PORTDIR_OVERLAY}"/cross-${CTARGET}
-cd /etc/portage
+cd ${PORTAGE_CONFIGROOT}/etc/portage
 for f in package.{keywords,mask,use} ; do
 	[[ -f ${f} ]] && continue
 	mkdir -p ${f}
--
1.7.2.2




  parent reply	other threads:[~2010-10-08  9:09 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-24 16:01 [gentoo-embedded] crossdev improvements Joakim Tjernlund
2010-09-24 17:01 ` Mike Frysinger
2010-09-24 17:42   ` Joakim Tjernlund
2010-09-25  5:37     ` Mike Frysinger
2010-09-25 17:11       ` Joakim Tjernlund
2010-10-08  2:54         ` Mike Frysinger
2010-10-08  6:31           ` Joakim Tjernlund
2010-10-08  8:09           ` Joakim Tjernlund [this message]
2010-10-08  8:23             ` Mike Frysinger
2010-10-08  9:07               ` Joakim Tjernlund
2010-09-30 15:38   ` Joakim Tjernlund
2010-10-01  0:36     ` Mike Frysinger
2010-10-01  6:56       ` Joakim Tjernlund
2010-10-08  3:06         ` Mike Frysinger
2010-10-08  6:37           ` Joakim Tjernlund
2010-10-08  7:32             ` Joakim Tjernlund
2010-10-08  8:20               ` Mike Frysinger
2010-10-08  9:37                 ` Joakim Tjernlund
2010-10-08  9:01 ` Mike Frysinger
2010-10-08  9:45   ` Joakim Tjernlund
2010-10-08 10:14   ` Joakim Tjernlund
2010-10-09 22:15     ` Mike Frysinger
2010-10-10  7:30       ` Joakim Tjernlund
2010-10-28  4:05         ` Mike Frysinger
     [not found]   ` <OF335958F7.6D21F143-ONC12577B6.00357DAC-C12577B6.003593A7@LocalDomain>
2010-10-08 12:40     ` Joakim Tjernlund
2010-10-09 22:16       ` Mike Frysinger

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=OF13BB5D55.23389D89-ONC12577B6.002CAB99-C12577B6.002CCBCC@transmode.se \
    --to=joakim.tjernlund@transmode.se \
    --cc=gentoo-embedded@lists.gentoo.org \
    --cc=vapier@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