From: "Yuta SATOH" <nigoro.gentoo@0x100.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoo-bsd:master commit in: scripts/mkstages/
Date: Fri, 3 Aug 2012 13:58:10 +0000 (UTC) [thread overview]
Message-ID: <1344002260.83011ae7ae1c1b41c2cfa183aecc5c9ceb5e388d.yuta_satoh@gentoo> (raw)
commit: 83011ae7ae1c1b41c2cfa183aecc5c9ceb5e388d
Author: Yuta SATOH <nigoro <AT> gentoo <DOT> gr <DOT> jp>
AuthorDate: Fri Aug 3 13:57:40 2012 +0000
Commit: Yuta SATOH <nigoro.gentoo <AT> 0x100 <DOT> com>
CommitDate: Fri Aug 3 13:57:40 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-bsd.git;a=commit;h=83011ae7
added sample script to create new stages
---
scripts/mkstages/chroot_prepare_upgrade.sh | 27 ++++
scripts/mkstages/stages_builder.sh | 187 ++++++++++++++++++++++++++++
2 files changed, 214 insertions(+), 0 deletions(-)
diff --git a/scripts/mkstages/chroot_prepare_upgrade.sh b/scripts/mkstages/chroot_prepare_upgrade.sh
new file mode 100755
index 0000000..3938cc3
--- /dev/null
+++ b/scripts/mkstages/chroot_prepare_upgrade.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+# fixes bug #412319
+emerge -q sys-devel/gcc-config
+gcc-config 1
+
+# fixes bug #413865
+emerge -q app-arch/libarchive
+
+# upgrade sys-freebsd packages
+rm /etc/make.profile
+ln -s ../usr/portage/profiles/default/bsd/fbsd/${TARGETARCH}/${TARGETVER} /etc/make.profile
+emerge -1q sys-freebsd/freebsd-mk-defs
+USE=build emerge -1q --nodeps sys-freebsd/freebsd-lib
+emerge -Cq sys-freebsd/boot0
+USE=symlink emerge -1q freebsd-bin freebsd-cddl freebsd-contrib freebsd-lib freebsd-libexec freebsd-mk-defs freebsd-pam-modules freebsd-sbin freebsd-share freebsd-ubin freebsd-usbin || exit
+
+# sys-libs/zlib will request ${CHOST}-gcc.
+# different ${CHOST}-gcc fails to install
+CHOST=${CATALYST_CHOST} emerge -q sys-devel/gcc || exit
+
+# libtool has the old CHOST. Need to be updated
+CHOST=${CATALYST_CHOST} emerge -q sys-devel/libtool || exit
+
+rm -rf /usr/local/portage.bsd-overlay
+gsed -i '/PORTDIR_OVERLAY=.*/d' /etc/make.conf
+touch /tmp/prepare_done
diff --git a/scripts/mkstages/stages_builder.sh b/scripts/mkstages/stages_builder.sh
new file mode 100755
index 0000000..4184601
--- /dev/null
+++ b/scripts/mkstages/stages_builder.sh
@@ -0,0 +1,187 @@
+#!/bin/bash
+export TARGETVER="${TARGETVER:-9.1}"
+export MKSRC="${MKSRC:-beta1}"
+export WORKDATE="`date +%Y%m%d`"
+export ARCH="`uname -m`"
+OLDVER="9.0"
+OVERLAY_SNAPSHOT="http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-bsd.git;a=snapshot;h=HEAD;sf=tgz"
+
+prepare(){
+ if [ "$1" = "x86" ] || [ "${ARCH}" = "i386" ] ; then
+ export CATALYST_CHOST="i686-gentoo-freebsd${TARGETVER}"
+ export TARGETARCH="x86"
+ export TARGETSUBARCH="i686"
+ else
+ export CATALYST_CHOST="x86_64-gentoo-freebsd${TARGETVER}"
+ export TARGETARCH="amd64"
+ export TARGETSUBARCH="amd64"
+ fi
+
+ export WORKDIR="/tmp/mk_stages_${TARGETARCH}_${TARGETVER}"
+
+ if [ -e ${WORKDIR} ] ; then
+ echo "WORKDIR ${WORKDIR} is already exists."
+ echo "Please remove manually it."
+ echo ""
+ echo "chflags -R noschg ${WORKDIR} && rm -rf ${WORKDIR}"
+ exit 1
+ else
+ mkdir -p ${WORKDIR}
+ fi
+
+ if [ ! -e "/var/tmp/catalyst/builds/default" ] ; then
+ mkdir -p /var/tmp/catalyst/builds/default
+ fi
+
+ if [ ! -e "/var/tmp/catalyst/builds/default/stage3-${TARGETSUBARCH}-freebsd-${OLDVER}.tar.bz2" ] ; then
+ echo "Downloading aballier's ${TARGETSUBARCH} stage3 file..."
+ wget -q -P /var/tmp/catalyst/builds/default http://dev.gentoo.org/~aballier/fbsd${OLDVER}/${TARGETARCH}/stage3-${TARGETSUBARCH}-freebsd-${OLDVER}.tar.bz2
+ if [ $? -ne 0 ] ; then
+ exit 1
+ fi
+ fi
+
+ cd ${WORKDIR}
+ echo "Downloading gentoo-bsd overlay snapshot..."
+ wget -q -O bsd-overlay.tar.gz "${OVERLAY_SNAPSHOT}"
+ if [ $? -ne 0 ] ; then
+ exit 1
+ fi
+
+ if [ -e "${WORKDIR}/portage.bsd-overlay" ] ; then
+ rm -rf ${WORKDIR}/portage.bsd-overlay
+ fi
+
+ tar xzf bsd-overlay.tar.gz
+ mv gentoo-bsd-* ${WORKDIR}/portage.bsd-overlay
+
+ echo "emerging catalyst..."
+ PORTDIR_OVERLAY=${WORKDIR}/portage.bsd-overlay ACCEPT_KEYWORDS=~x86-fbsd emerge -uq =app-cdr/cdrtools-3.00 '<app-text/build-docbook-catalog-1.19' =dev-util/catalyst-2.0.10.1 =app-arch/libarchive-3.0.3 || exit 1
+ grep "^export MAKEOPTS" /etc/catalyst/catalystrc > /dev/null 2>&1
+ if [ $? -ne 0 ] ; then
+ echo "export MAKEOPTS=\"-j`sysctl hw.ncpu | awk '{ print $2 + 1 }'`"\" >> /etc/catalyst/catalystrc
+ fi
+
+ if [ ! -e /usr/portage/profiles/releases/freebsd-${TARGETVER} ] ; then
+ echo "prepare new ${TARGETVER} profiles"
+ cp -a ${WORKDIR}/portage.bsd-overlay/profiles/default/bsd/fbsd/amd64/${TARGETVER} /usr/portage/profiles/default/bsd/fbsd/amd64/
+ cp -a ${WORKDIR}/portage.bsd-overlay/profiles/default/bsd/fbsd/x86/${TARGETVER} /usr/portage/profiles/default/bsd/fbsd/x86/
+ cp -a ${WORKDIR}/portage.bsd-overlay/profiles/releases/freebsd-${TARGETVER} /usr/portage/profiles/releases/
+ fi
+
+ if [ -n "${MKSRC}" ] ; then
+ if [ "${MKSRC}" = "release" ] ; then
+ MY_MKSRC=""
+ else
+ MY_MKSRC="_${MKSRC}"
+ fi
+ if [ ! -e /usr/portage/distfiles/freebsd-lib-${TARGETVER}${MY_MKSRC}.tar.bz2 ] ; then
+ echo "create src tarball"
+ mkdir ${WORKDIR}/${TARGETVER}${MY_MKSRC}_src
+ cd ${WORKDIR}/${TARGETVER}${MY_MKSRC}_src
+ ${WORKDIR}/portage.bsd-overlay/scripts/extract-9.0.sh ${TARGETVER}${MY_MKSRC}
+ mv *${TARGETVER}${MY_MKSRC}*bz2 /usr/portage/distfiles/
+ fi
+
+ cd ${WORKDIR}/portage.bsd-overlay/sys-freebsd
+ echo "re-create Manifest"
+ for dir in `ls -1 | grep freebsd-` boot0;
+ do
+ cd ${dir}
+ gsed -i "/${TARGETVER}/d" Manifest
+ rm *8.1*.ebuild
+ ls -1 *.ebuild > /dev/null 2>&1
+
+ if [ $? -eq 0 ] ; then
+ EBUILDFILE=`ls -1 *.ebuild | head -n 1`
+ echo ${EBUILDFILE}
+ ebuild ${EBUILDFILE} digest
+ fi
+
+ cd ..
+ done
+ fi
+}
+
+upgrade_src_stage3(){
+ if [ -e ${WORKDIR}/stage3tmp ] ; then
+ chflags -R noschg ${WORKDIR}/stage3tmp
+ rm -rf ${WORKDIR}/stage3tmp
+ fi
+ mkdir ${WORKDIR}/stage3tmp
+ tar xjpf /var/tmp/catalyst/builds/default/stage3-${TARGETSUBARCH}-freebsd-${OLDVER}.tar.bz2 -C ${WORKDIR}/stage3tmp
+ mount -t devfs devfs ${WORKDIR}/stage3tmp/dev
+ mkdir ${WORKDIR}/stage3tmp/usr/portage
+ kldload nullfs
+ mount -t nullfs /usr/portage ${WORKDIR}/stage3tmp/usr/portage
+ mount -t nullfs /usr/portage/distfiles ${WORKDIR}/stage3tmp/usr/portage/distfiles
+
+ cp -a ${WORKDIR}/portage.bsd-overlay/scripts/mkstages/chroot_prepare_upgrade.sh ${WORKDIR}/stage3tmp/tmp
+ cp -a ${WORKDIR}/portage.bsd-overlay ${WORKDIR}/stage3tmp/usr/local/
+ echo 'PORTDIR_OVERLAY="/usr/local/portage.bsd-overlay"' >> ${WORKDIR}/stage3tmp/etc/make.conf
+
+ if [ -e /etc/resolv.conf ]; then
+ cp /etc/resolv.conf ${WORKDIR}/stage3tmp/etc/
+ else
+ echo "nameserver 8.8.8.8" > ${WORKDIR}/stage3tmp/etc/resolv.conf
+ fi
+ chroot ${WORKDIR}/stage3tmp /tmp/chroot_prepare_upgrade.sh
+ umount ${WORKDIR}/stage3tmp/usr/portage/distfiles || exit 1
+ umount ${WORKDIR}/stage3tmp/usr/portage || exit 1
+ umount ${WORKDIR}/stage3tmp/dev || exit 1
+ if [ ! -e ${WORKDIR}/stage3tmp/tmp/prepare_done ] ; then
+ exit 1
+ fi
+ cd ${WORKDIR}/stage3tmp
+ tar cjpf /var/tmp/catalyst/builds/default/stage3tmp-${TARGETSUBARCH}-freebsd-${TARGETVER}.tar.bz2 .
+ cd ${WORKDIR}
+ chflags -R noschg ${WORKDIR}/stage3tmp
+ rm -rf ${WORKDIR}/stage3tmp
+}
+
+mk_stages_tmp() {
+ if [ "${OLDVER}" != "${TARGETVER}" ] ; then
+ local SOURCE_STAGE3="stage3tmp-${TARGETSUBARCH}-freebsd-${TARGETVER}"
+ else
+ local SOURCE_STAGE3="stage3-${TARGETSUBARCH}-freebsd-${OLDVER}"
+ fi
+
+ catalyst -C target=stage1 version_stamp=fbsd-${TARGETVER}-${WORKDATE}t profile=default/bsd/fbsd/${TARGETARCH}/${TARGETVER} snapshot=${WORKDATE} source_subpath=default/${SOURCE_STAGE3} subarch=${TARGETSUBARCH} rel_type=default portage_overlay=${WORKDIR}/portage.bsd-overlay chost=${CATALYST_CHOST}
+
+ local PID=`ps auxw | grep portage/bin/ebuild-helpers/ecompressdir | grep -v grep | awk '{ print $2 }' | xargs`
+ kill -9 ${PID}
+ rm -rf /var/tmp/catalyst/tmp/default/stage1-${TARGETSUBARCH}-fbsd-${TARGETVER}-${WORKDATE}t/usr/local/portage || exit 1
+
+ catalyst -C target=stage1 version_stamp=fbsd-${TARGETVER}-${WORKDATE}t profile=default/bsd/fbsd/${TARGETARCH}/${TARGETVER} snapshot=${WORKDATE} source_subpath=default/${SOURCE_STAGE3} subarch=${TARGETSUBARCH} rel_type=default portage_overlay=${WORKDIR}/portage.bsd-overlay chost=${CATALYST_CHOST} || exit 1
+
+ ### Added when the library was upgraded
+ ln -s libmpfr.so.5 /var/tmp/catalyst/tmp/default/stage1-${TARGETSUBARCH}-fbsd-${TARGETVER}-${WORKDATE}t/tmp/stage1root/usr/lib/libmpfr.so.4 || exit 1
+
+
+ catalyst -C target=stage2 version_stamp=fbsd-${TARGETVER}-${WORKDATE}t profile=default/bsd/fbsd/${TARGETARCH}/${TARGETVER} snapshot=${WORKDATE} source_subpath=default/stage1-${TARGETSUBARCH}-fbsd-${TARGETVER}-${WORKDATE}t subarch=${TARGETSUBARCH} rel_type=default portage_overlay=${WORKDIR}/portage.bsd-overlay chost=${CATALYST_CHOST} || exit 1
+ catalyst -C target=stage3 version_stamp=fbsd-${TARGETVER}-${WORKDATE}t profile=default/bsd/fbsd/${TARGETARCH}/${TARGETVER} snapshot=${WORKDATE} source_subpath=default/stage2-${TARGETSUBARCH}-fbsd-${TARGETVER}-${WORKDATE}t subarch=${TARGETSUBARCH} rel_type=default portage_overlay=${WORKDIR}/portage.bsd-overlay chost=${CATALYST_CHOST} || exit 1
+}
+
+mk_stages(){
+ catalyst -C target=stage1 version_stamp=fbsd-${TARGETVER}-${WORKDATE} profile=default/bsd/fbsd/${TARGETARCH}/${TARGETVER} snapshot=${WORKDATE} source_subpath=default/stage3-${TARGETSUBARCH}-fbsd-${TARGETVER}-${WORKDATE}t subarch=${TARGETSUBARCH} rel_type=default portage_overlay=${WORKDIR}/portage.bsd-overlay chost=${CATALYST_CHOST}
+
+ local PID=`ps auxw | grep portage/bin/ebuild-helpers/ecompressdir | grep -v grep | awk '{ print $2 }' | xargs`
+ kill -9 ${PID}
+ rm -rf /var/tmp/catalyst/tmp/default/stage1-${TARGETSUBARCH}-fbsd-${TARGETVER}-${WORKDATE}/usr/local/portage || exit 1
+
+ catalyst -C target=stage1 version_stamp=fbsd-${TARGETVER}-${WORKDATE} profile=default/bsd/fbsd/${TARGETARCH}/${TARGETVER} snapshot=${WORKDATE} source_subpath=default/stage3-${TARGETSUBARCH}-fbsd-${TARGETVER}-${WORKDATE}t subarch=${TARGETSUBARCH} rel_type=default portage_overlay=${WORKDIR}/portage.bsd-overlay chost=${CATALYST_CHOST} || exit 1
+
+ catalyst -C target=stage2 version_stamp=fbsd-${TARGETVER}-${WORKDATE} profile=default/bsd/fbsd/${TARGETARCH}/${TARGETVER} snapshot=${WORKDATE} source_subpath=default/stage1-${TARGETSUBARCH}-fbsd-${TARGETVER}-${WORKDATE} subarch=${TARGETSUBARCH} rel_type=default portage_overlay=${WORKDIR}/portage.bsd-overlay chost=${CATALYST_CHOST} || exit 1
+ catalyst -C target=stage3 version_stamp=fbsd-${TARGETVER}-${WORKDATE} profile=default/bsd/fbsd/${TARGETARCH}/${TARGETVER} snapshot=${WORKDATE} source_subpath=default/stage2-${TARGETSUBARCH}-fbsd-${TARGETVER}-${WORKDATE} subarch=${TARGETSUBARCH} rel_type=default portage_overlay=${WORKDIR}/portage.bsd-overlay chost=${CATALYST_CHOST} || exit 1
+}
+
+prepare
+if [ ! -e "/var/tmp/catalyst/snapshots/portage-${WORKDATE}.tar.bz2" ] ; then
+ catalyst -C target=snapshot version_stamp=${WORKDATE} || exit 1
+fi
+if [ ! -e /var/tmp/catalyst/builds/default/stage3tmp-${TARGETSUBARCH}-freebsd-${TARGETVER}.tar.bz2 ] && [ "${OLDVER}" != "${TARGETVER}" ] ; then
+ upgrade_src_stage3
+fi
+mk_stages_tmp
+mk_stages
+
next reply other threads:[~2012-08-03 13:58 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-03 13:58 Yuta SATOH [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-08-25 1:24 [gentoo-commits] proj/gentoo-bsd:master commit in: scripts/mkstages/ Yuta SATOH
2012-10-06 7:13 Yuta SATOH
2012-10-12 15:25 Yuta SATOH
2012-10-13 9:33 Yuta SATOH
2012-11-22 12:26 Yuta SATOH
2012-11-22 14:32 Yuta SATOH
2012-11-23 13:06 Yuta SATOH
2012-12-11 13:21 Yuta SATOH
2012-12-12 11:34 Yuta SATOH
2012-12-24 14:26 Yuta SATOH
2012-12-29 9:16 Yuta SATOH
2013-03-09 16:20 Yuta SATOH
2013-06-23 14:20 Yuta SATOH
2013-07-29 11:41 Yuta SATOH
2013-08-29 13:46 Yuta SATOH
2014-10-28 12:03 Yuta SATOH
2014-10-29 12:16 Yuta SATOH
2014-11-15 16:31 Yuta SATOH
2014-11-15 16:31 Yuta SATOH
2014-11-16 7:44 Yuta SATOH
2015-02-12 15:09 Yuta SATOH
2015-02-13 11:27 Yuta SATOH
2015-07-11 23:32 Yuta SATOH
2015-07-12 4:43 Yuta SATOH
2015-07-12 4:43 Yuta SATOH
2015-07-12 7:49 Yuta SATOH
2015-07-12 7:55 Yuta SATOH
2015-07-13 12:38 Yuta SATOH
2017-12-07 13:39 Yuta SATOH
2017-12-07 13:39 Yuta SATOH
2017-12-07 13:39 Yuta SATOH
2017-12-09 22:29 Yuta SATOH
2017-12-09 22:29 Yuta SATOH
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=1344002260.83011ae7ae1c1b41c2cfa183aecc5c9ceb5e388d.yuta_satoh@gentoo \
--to=nigoro.gentoo@0x100.com \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@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