Sep 25, 2010, 10:11 AM
Post #5 of 26
(8034 views)
Permalink
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