Create "port_conf" default.
Migrate all references to /etc/portage to the config's default.
Migrate all make.conf paths to the config'd default.
# TODO: zmedico and I discussed making this a directory and pushing
# in a parent file, as well as other user-specified configuration.
print "Configuring profile link..."
- cmd("rm -f "+self.settings["chroot_path"]+"/etc/portage/make.profile",\
- "Error zapping profile link",env=self.env)
- cmd("mkdir -p "+self.settings["chroot_path"]+"/etc/portage/")
- cmd("ln -sf ../.." + self.settings["portdir"] + "/profiles/" + \
- self.settings["target_profile"]+" "+\
- self.settings["chroot_path"]+"/etc/portage/make.profile",\
+ cmd("rm -f " + self.settings["chroot_path"] +
+ self.settings["port_conf"] + "/make.profile",
+ "Error zapping profile link",env=self.env)
+ cmd("mkdir -p " + self.settings["chroot_path"] +
+ self.settings["port_conf"])
+ cmd("ln -sf ../.." + self.settings["portdir"] + "/profiles/" +
+ self.settings["target_profile"] + " " +
+ self.settings["chroot_path"] +
+ self.settings["port_conf"] + "/make.profile",
"Error creating profile link",env=self.env)
touch(self.settings["autoresume_path"]+"config_profile_link")
print "Resume point detected, skipping setup_confdir operation..."
else:
if "portage_confdir" in self.settings:
- print "Configuring /etc/portage..."
- cmd("rsync -a "+self.settings["portage_confdir"]+"/ "+\
- self.settings["chroot_path"]+"/etc/portage/",\
- "Error copying /etc/portage",env=self.env)
+ print "Configuring %s..." % self.settings["port_conf"]
+ cmd("rsync -a " + self.settings["portage_confdir"] + "/ " +
+ self.settings["chroot_path"] + self.settings["port_conf"],
+ "Error copying %s" % self.settings["port_conf"],
+ env=self.env)
touch(self.settings["autoresume_path"]+"setup_confdir")
def portage_overlay(self):
def chroot_setup(self):
self.makeconf=read_makeconf(normpath(self.settings["chroot_path"]+
- self.settings["make.conf"]))
+ self.settings["make_conf"]))
self.override_cbuild()
self.override_chost()
self.override_cflags()
""" Modify and write out make.conf (for the chroot) """
makepath = normpath(self.settings["chroot_path"] +
- self.settings["make.conf"])
+ self.settings["make_conf"])
cmd("rm -f " + makepath,\
"Could not remove " + makepath, env=self.env)
myf=open(makepath, "w")
myf.close()
makepath = normpath(self.settings["chroot_path"] +
- self.settings["make.conf"])
+ self.settings["make_conf"])
cmd("cp " + makepath + " " + makepath + ".catalyst",\
- "Could not backup " + self.settings["make.conf"],env=self.env)
+ "Could not backup " + self.settings["make_conf"],env=self.env)
touch(self.settings["autoresume_path"]+"chroot_setup")
def fsscript(self):
cmd("rm -rf " + overlay,
"Could not remove " + self.settings["local_overlay"], env=self.env)
cmd("sed -i '/^PORTDIR_OVERLAY/d' "+self.settings["chroot_path"]+\
- self.settings["make.conf"],\
+ self.settings["make_conf"],\
"Could not remove PORTDIR_OVERLAY from make.conf",env=self.env)
""" Clean up old and obsoleted files in /etc """
"distdir": "/usr/portage/distfiles",
"hash_function": "crc32",
"local_overlay": "/usr/local/portage",
- "make.conf": "/etc/portage/make.conf",
+ "port_conf": "/etc/portage",
+ "make_conf": "%(port_conf)s/make.conf",
"options": set(),
"packagedir": "/usr/portage/packages",
"portdir": "/usr/portage",
def set_cleanables(self):
StageBase.set_cleanables(self)
self.settings["cleanables"].extend([\
- "/usr/share/zoneinfo", "/etc/portage/package*"])
+ "/usr/share/zoneinfo", self.settings["port_conf"] + "/package*"])
# XXX: How do these override_foo() functions differ from the ones in StageBase and why aren't they in stage3_target?
then
echo "Your profile seems to be broken."
echo "Could not build a list of build packages."
- echo "Double check your /etc/portage/make.profile link and the 'packages' files."
+ echo "Double check your ${clst_port_conf}/make.profile link and the 'packages' files."
exit 1
fi
## START BUILD
# First, we drop in a known-good baselayout
-[ -e /etc/portage/make.conf ] && \
- echo 'USE="${USE} -build"' >> /etc/portage/make.conf
+[ -e ${clst_make_conf} ] && \
+ echo 'USE="${USE} -build"' >> ${clst_make_conf}
run_merge "--oneshot --nodeps sys-apps/baselayout"
-sed -i '/USE="${USE} -build"/d' /etc/portage/make.conf
+sed -i '/USE="${USE} -build"/d' ${clst_make_conf}
# Now, we install our packages
-[ -e /etc/portage/make.conf ] && \
+[ -e ${clst_make_conf} ] && \
echo "USE=\"-* build ${BOOTSTRAP_USE} ${clst_HOSTUSE}\"" \
- >> /etc/portage/make.conf
+ >> ${clst_make_conf}
run_merge "--oneshot ${clst_buildpkgs}"
sed -i "/USE=\"-* build ${BOOTSTRAP_USE} ${clst_HOSTUSE}\"/d" \
- /etc/portage/make.conf
+ ${clst_make_conf}
# Setup "ROOT in chroot" dir
install -d ${clst_chroot_path}/${clst_root_path}/etc
- install -d ${clst_chroot_path}/${clst_root_path}/etc/portage
+ install -d ${clst_chroot_path}/${clst_root_path}${clst_port_conf}
# Setup make.conf and make.profile link in "ROOT in chroot":
- copy_to_chroot ${clst_chroot_path}/etc/portage/make.conf ${clst_root_path}/etc/portage
+ copy_to_chroot ${clst_chroot_path}${clst_make_conf} ${clst_root_path}${clst_port_conf}
# Enter chroot, execute our build script
exec_in_chroot \
then
export clst_myfeatures="${clst_myfeatures} distcc"
export DISTCC_HOSTS="${clst_distcc_hosts}"
- [ -e /etc/portage/make.conf ] && \
- echo 'USE="${USE} -avahi -gtk -gnome"' >> /etc/portage/make.conf
+ [ -e ${clst_make_conf} ] && \
+ echo 'USE="${USE} -avahi -gtk -gnome"' >> ${clst_make_conf}
# We install distcc to / on stage1, then use --noreplace, so we need to
# have some way to check if we need to reinstall distcc without being
# able to rely on USE, so we check for the distcc user and force a
else
clst_root_path=/ run_merge --oneshot --noreplace sys-devel/distcc || exit 1
fi
- sed -i '/USE="${USE} -avahi -gtk -gnome"/d' /etc/portage/make.conf
+ sed -i '/USE="${USE} -avahi -gtk -gnome"/d' ${clst_make_conf}
mkdir -p /etc/distcc
echo "${clst_distcc_hosts}" > /etc/distcc/hosts
setup_pkgmgr(){
# We need to merge our package manager with USE="build" set in case it is
- # portage to avoid frying our /etc/portage/make.conf file. Otherwise, we could
+ # portage to avoid frying our make.conf file. Otherwise, we could
# just let emerge system could merge it.
# Use --update or portage won't reinstall the same version later.
# Use --newuse to make sure it rebuilds with the "build" use flag.
- [ -e /etc/portage/make.conf ] && echo 'USE="${USE} build"' >> /etc/portage/make.conf
+ [ -e ${clst_make_conf} ] && echo 'USE="${USE} build"' >> ${clst_make_conf}
run_merge --oneshot --nodeps --update --newuse sys-apps/portage
- sed -i '/USE="${USE} build"/d' /etc/portage/make.conf
+ sed -i '/USE="${USE} build"/d' ${clst_make_conf}
}
cleanup_distcc() {
make_destpath() {
# ROOT is / by default, so remove any ROOT= settings from make.conf
- sed -i '/ROOT=/d' /etc/portage/make.conf
+ sed -i '/ROOT=/d' ${clst_make_conf}
export ROOT=/
if [ "${1}" != "/" -a -n "${1}" ]
then
- echo "ROOT=\"${1}\"" >> /etc/portage/make.conf
+ echo "ROOT=\"${1}\"" >> ${clst_make_conf}
export ROOT=${1}
fi
if [ ! -d ${ROOT} ]
emerge --info
# TODO: grab our entire env
# <zmedico> to get see the ebuild env you can do something like:
- # `set > /tmp/env_dump.${EBUILD_PHASE}` inside /etc/portage/bashrc
+ # `set > /tmp/env_dump.${EBUILD_PHASE}` inside ${clst_port_conf}/bashrc
# XXX: Also, portageq does *not* source profile.bashrc at any time.
echo
echo "BOOTSTRAP_USE: $(portageq envvar BOOTSTRAP_USE)"
fi
fi
-[ -e /etc/portage/make.conf ] && \
- echo "USE=\"\${USE} ${clst_kernel_use} \"" >> /etc/portage/make.conf
+[ -e ${clst_make_conf} ] && \
+ echo "USE=\"\${USE} ${clst_kernel_use} build\"" >> ${clst_make_conf}
if [ -n "${clst_KERNCACHE}" ]
then
mkdir -p /tmp/kerncache/${clst_kname}
clst_root_path=/tmp/kerncache/${clst_kname} PKGDIR=${PKGDIR} clst_myemergeopts="--quiet --update --newuse" run_merge "${clst_ksource}" || exit 1
KERNELVERSION=`portageq best_visible / "${clst_ksource}"`
- if [ ! -e /etc/portage/profile/package.provided ]
+ if [ ! -e ${clst_port_conf}/profile/package.provided ]
then
- mkdir -p /etc/portage/profile
- echo "${KERNELVERSION}" > /etc/portage/profile/package.provided
+ mkdir -p ${clst_port_conf}/profile
+ echo "${KERNELVERSION}" > ${clst_port_conf}/profile/package.provided
else
- if ( ! grep -q "^${KERNELVERSION}\$" /etc/portage/profile/package.provided )
+ if ( ! grep -q "^${KERNELVERSION}\$" ${clst_port_conf}/profile/package.provided )
then
- echo "${KERNELVERSION}" >> /etc/portage/profile/package.provided
+ echo "${KERNELVERSION}" >> ${clst_port_conf}/profile/package.provided
fi
fi
[ -L /usr/src/linux ] && rm -f /usr/src/linux
fi
build_kernel
-sed -i "/USE=\"\${USE} ${clst_kernel_use} \"/d" /etc/portage/make.conf
+sed -i "/USE=\"\${USE} ${clst_kernel_use} build\"/d" ${clst_make_conf}
# grep out the kernel version so that we can do our modules magic
VER=`grep ^VERSION\ \= /usr/src/linux/Makefile | awk '{ print $3 };'`
PAT=`grep ^PATCHLEVEL\ \= /usr/src/linux/Makefile | awk '{ print $3 };'`
if [ -n "${clst_KERNCACHE}" ]
then
- if [ -e /etc/portage/profile/package.provided ]
+ if [ -e ${clst_port_conf}/profile/package.provided ]
then
- sed -i "/^$(echo "${KERNELVERSION}" | sed -e 's|/|\\/|g')\$/d" /etc/portage/profile/package.provided
+ sed -i "/^$(echo "${KERNELVERSION}" | sed -e 's|/|\\/|g')\$/d" ${clst_port_conf}/profile/package.provided
fi
fi
# Tweak the livecd make.conf so that users know not to edit it
# http://bugs.gentoo.org/show_bug.cgi?id=144647
-mv /etc/portage/make.conf /etc/portage/make.conf.old
-echo "####################################################" >> /etc/portage/make.conf
-echo "## ATTENTION: THIS IS THE MAKE.CONF ON THE LIVECD ##" >> /etc/portage/make.conf
-echo "## PLEASE EDIT /mnt/gentoo/etc/portage/make.conf INSTEAD ##" >> /etc/portage/make.conf
-echo "####################################################" >> /etc/portage/make.conf
-cat /etc/portage/make.conf.old >> /etc/portage/make.conf
+mv ${clst_make_conf} ${clst_make_conf}.old
+echo "####################################################" >> ${clst_make_conf}
+echo "## ATTENTION: THIS IS THE MAKE.CONF ON THE LIVECD ##" >> ${clst_make_conf}
+echo "## PLEASE EDIT /mnt/gentoo${clst_make_conf} INSTEAD ##" >> ${clst_make_conf}
+echo "####################################################" >> ${clst_make_conf}
+cat ${clst_make_conf}.old >> ${clst_make_conf}
# devfs tweaks
[ -e /etc/devfsd.conf ] && sed -i '/dev-state/ s:^:#:' /etc/devfsd.conf