From: Joakim Tjernlund <joakim.tjernlund@transmode.se>
To: gentoo-embedded@lists.gentoo.org
Subject: Re: [gentoo-embedded] crossdev improvements
Date: Sat, 25 Sep 2010 19:11:26 +0200 [thread overview]
Message-ID: <OF85935B08.21D9E6A7-ONC12577A9.005E326E-C12577A9.005E6E85@transmode.se> (raw)
In-Reply-To: <201009250137.49720.vapier@gentoo.org>
Mike Frysinger <vapier@gentoo.org> wrote on 2010/09/25 07:37:49:
>
> On Friday, September 24, 2010 13:42:04 Joakim Tjernlund wrote:
> > Mike Frysinger <vapier@gentoo.org> wrote on 2010/09/24 19:01:26:
> > > 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.
> > >
> > > i dont know what this means. crossdev doesnt touch PORTAGE_CONFIGROOT at
> > > all.
> >
> > Exactly, it uses hardcoded paths to /etc et. all instead of
> > PORTAGE_CONFIGROOT/etc
>
> so you're talking about the /etc/portage/ file setup. you should be explicit
> in your examples :P.
>
> i'd file a bug about this.
> -mike
Until then, here is an initial hack(untested), against 20100814:
From 50337e535b7dff4fb473db097483ba5ffe7b355e Mon Sep 17 00:00:00 2001
From: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Date: Sat, 25 Sep 2010 19:07:28 +0200
Subject: [PATCH] Initial support for PORTAGE_CONFIGROOT
---
crossdev-20100814/crossdev | 32 +++++++++++++++++---------------
1 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/crossdev-20100814/crossdev b/crossdev-20100814/crossdev
index 54a6ed7..fc9b89e 100755
--- a/crossdev-20100814/crossdev
+++ b/crossdev-20100814/crossdev
@@ -12,7 +12,8 @@ if [[ ${ROOT:-/} != "/" ]] ; then
exit 2
fi
-source /etc/init.d/functions.sh || exit 1
+setup_portage_vars
+source ${PORTAGE_CONFIGROOT}/etc/init.d/functions.sh || exit 1
esyslog() { :; }
die() {
echo
@@ -235,6 +236,7 @@ parse_target() {
}
setup_portage_vars() {
+ PORTAGE_CONFIGROOT=$(portageq envvar PORTAGE_CONFIGROOT)
PORTDIR_OVERLAYS=$(portageq envvar PORTDIR_OVERLAY)
PORTDIR_OVERLAY=${PORTDIR_OVERLAYS%% *}
PORTDIR=$(portageq envvar PORTDIR)
@@ -253,9 +255,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
@@ -263,8 +265,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
@@ -298,7 +300,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
@@ -445,14 +447,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})"
+ export ${v}="$(<${PORTAGE_CONFIGROOT}/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
@@ -600,12 +602,12 @@ set_portage() {
set_env ${pkg}
}
-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
next prev parent reply other threads:[~2010-09-25 18:05 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 [this message]
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
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=OF85935B08.21D9E6A7-ONC12577A9.005E326E-C12577A9.005E6E85@transmode.se \
--to=joakim.tjernlund@transmode.se \
--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