public inbox for gentoo-embedded@lists.gentoo.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: gentoo-embedded@lists.gentoo.org
Subject: Re: [gentoo-embedded] crossdev improvements
Date: Fri, 8 Oct 2010 05:01:57 -0400	[thread overview]
Message-ID: <201010080501.58489.vapier@gentoo.org> (raw)
In-Reply-To: <OFEAAA581A.BC31360E-ONC12577A8.0056DED2-C12577A8.00580406@transmode.se>

[-- Attachment #1: Type: Text/Plain, Size: 3211 bytes --]

On Friday, September 24, 2010 12:01:21 Joakim Tjernlund wrote:
> - make crossdev respect PORTAGE_CONFIGROOT. We use our own portage
>   tree for our pkgs, including the compiler, as we want to be able
>   to recreate/rebuild the same sw versions in the future.

try this:
diff --git a/crossdev b/crossdev
index c35a2ed..a782d19 100755
--- a/crossdev
+++ b/crossdev
@@ -12,6 +12,8 @@ if [[ ${ROOT:-/} != "/" ]] ; then
 	exit 2
 fi
 
+CONFIGROOT="${PORTAGE_CONFIGROOT}/etc/portage"
+
 source /etc/init.d/functions.sh || exit 1
 esyslog() { :; }
 die() {
@@ -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" "${CONFIGROOT}"/categories
 	for f in package.{mask,keywords,use} ; do
-		f="/etc/portage/${f}"
+		f="${CONFIGROOT}/${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 "${CONFIGROOT}"/env/cross-${CTARGET}
+	rmdir "${CONFIGROOT}"/env 2>/dev/null
 
 	rmdir /var/db/pkg/cross-${CTARGET} 2>/dev/null
 	if [[ -d /var/db/pkg/cross-${CTARGET} ]] ; then
@@ -461,14 +463,15 @@ 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
+	d="${CONFIGROOT}/crossdev/${CTARGET}"
+	if [[ -e ${d}/${v} ]] ; then
 		# yes, quotes are needed in this instance (export $var="...")
-		export ${v}="$(</etc/portage/crossdev/${CTARGET}/${v})"
+		export ${v}="$(<"${d}"/${v})"
 		einfo "Restoring user setting '${v}' to '${!v}'"
 	fi
-	if [[ -e /etc/portage/crossdev/${CTARGET}/env ]] ; then
+	if [[ -e ${d}/env ]] ; then
 		einfo "Restoring generic user env settings"
-		source /etc/portage/crossdev/${CTARGET}/env
+		source "${d}"/env
 	fi
 done
 
@@ -509,6 +512,7 @@ einfo "Extra: insight:        DO IT"
 echo
 einfo "PORTDIR_OVERLAY:       ${PORTDIR_OVERLAY}"
 einfo "PORT_LOGDIR:           ${PORT_LOGDIR}"
+einfo "PORTAGE_CONFIGROOT:    ${PORTAGE_CONFIGROOT}"
 hr
 ) >& "${PORT_LOGDIR}"/cross-${CTARGET}-info.log || exit 1
 cat "${PORT_LOGDIR}"/cross-${CTARGET}-info.log
@@ -616,15 +620,15 @@ 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 "${PORTDIR_OVERLAY}"/cross-${CTARGET}
-cd /etc/portage
+mkdir -p "${CONFIGROOT}"
+check_trailing_newline "${CONFIGROOT}"/categories
+grep -qs "^cross-${CTARGET}$" "${CONFIGROOT}"/categories \
+	|| echo cross-${CTARGET} >> "${CONFIGROOT}"/categories
+mkdir -p "${PORTDIR_OVERLAY}"/cross-${CTARGET} || exit 1
+cd "${CONFIGROOT}"
 for f in package.{keywords,mask,use} ; do
 	[[ -f ${f} ]] && continue
-	mkdir -p ${f}
+	mkdir -p ${f} || exit 1
 	rm -f ${f}/cross-${CTARGET}
 done
 
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2010-10-08  9:14 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
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 [this message]
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=201010080501.58489.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=gentoo-embedded@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