diff options
author | Yuta SATOH <nigoro@gentoo.gr.jp> | 2014-10-26 21:32:22 +0900 |
---|---|---|
committer | Yuta SATOH <nigoro@gentoo.gr.jp> | 2014-10-26 21:32:22 +0900 |
commit | 826d505c1e9476baa293bd59e4cdb0c585091561 (patch) | |
tree | b9e8a6242524a82aef562b047ecd28183eb99477 /scripts | |
parent | scripts/extract-9.0.sh: s/ftp:/http:/g (diff) | |
download | gentoo-bsd-826d505c1e9476baa293bd59e4cdb0c585091561.tar.gz gentoo-bsd-826d505c1e9476baa293bd59e4cdb0c585091561.tar.bz2 gentoo-bsd-826d505c1e9476baa293bd59e4cdb0c585091561.zip |
update catalyst-2.0.15-fbsd-extra.patch and stages_builder.sh
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/mkstages/stages_builder.sh | 161 |
1 files changed, 49 insertions, 112 deletions
diff --git a/scripts/mkstages/stages_builder.sh b/scripts/mkstages/stages_builder.sh index 82c7d32..f3021ca 100755 --- a/scripts/mkstages/stages_builder.sh +++ b/scripts/mkstages/stages_builder.sh @@ -2,16 +2,15 @@ export TARGETVER="${TARGETVER:-9.1}" export MKSRC="${MKSRC:-NONE}" export WORKDATE="${WORKDATE:-local}" -export WORKARCH="`uname -m`" +export WORKARCH="${WORKARCH:-$(uname -m)}" export FORCESTAGE3="${FORCESTAGE3:-}" +export EXTRAOVERLAY="${EXTRAOVERLAY:-}" OLDVER="${OLDVER:-9.0}" OVERLAY_SNAPSHOT="http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-bsd.git;a=snapshot;h=HEAD;sf=tgz" prepare(){ + local MAJORVER=`echo ${TARGETVER} | awk -F \. '{ print $1 }'` if [ -n "${STABLE}" ] ; then - local MAJORVER=`echo ${TARGETVER} | awk -F \. '{ print $1 }'` - fi - if [ -n "${MAJORVER}" ] ; then export CHOSTVER="${MAJORVER}.0" else export CHOSTVER="${TARGETVER}" @@ -51,24 +50,23 @@ prepare(){ fi cd ${WORKDIR} - if [ -d "${HOME}/portage.bsd-overlay" ] ; then - echo "Copy from ${HOME}/portage.bsd-overlay to ${WORKDIR}/" - cp -a "${HOME}/portage.bsd-overlay" ${WORKDIR}/ + if [ -d "${HOME}/gentoo-bsd" ] ; then + echo "Copy from ${HOME}/gentoo-bsd to ${WORKDIR}/" + cp -a "${HOME}/gentoo-bsd" ${WORKDIR}/ else - echo "Downloading gentoo-bsd overlay snapshot..." - wget -q -O bsd-overlay.tar.gz "${OVERLAY_SNAPSHOT}" + echo "Clone gentoo-bsd overlay snapshot..." + type -P git + [[ $? -ne 0 ]] && emerge git + git clone git://git.overlays.gentoo.org/proj/gentoo-bsd.git [[ $? -ne 0 ]] && exit 1 - - 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 + fi + if [ -n "${EXTRAOVERLAY}" ] ; then + echo "Copy from ${EXTRAOVERLAY} to ${WORKDIR}/gentoo-bsd" + cp -a ${EXTRAOVERLAY}/* ${WORKDIR}/gentoo-bsd/ fi echo "emerging catalyst..." - PORTDIR_OVERLAY=${WORKDIR}/portage.bsd-overlay ACCEPT_KEYWORDS=~x86-fbsd emerge -uq app-cdr/cdrtools app-text/build-docbook-catalog dev-util/catalyst::gentoo-bsd || exit 1 + PORTDIR_OVERLAY=${WORKDIR}/gentoo-bsd ACCEPT_KEYWORDS=~x86-fbsd emerge -uq app-cdr/cdrtools app-text/build-docbook-catalog dev-util/catalyst::gentoo-bsd || 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 @@ -76,10 +74,10 @@ prepare(){ if [ ! -e /usr/portage/profiles/releases/freebsd-${TARGETVER} ] ; then echo "prepare new ${TARGETVER} profiles" - cp -a ${WORKDIR}/portage.bsd-overlay/profiles/arch/amd64-fbsd/clang /usr/portage/profiles/arch/amd64-fbsd/ - 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/ + cp -a ${WORKDIR}/gentoo-bsd/profiles/arch/amd64-fbsd/clang /usr/portage/profiles/arch/amd64-fbsd/ + cp -a ${WORKDIR}/gentoo-bsd/profiles/default/bsd/fbsd/amd64/${TARGETVER} /usr/portage/profiles/default/bsd/fbsd/amd64/ + cp -a ${WORKDIR}/gentoo-bsd/profiles/default/bsd/fbsd/x86/${TARGETVER} /usr/portage/profiles/default/bsd/fbsd/x86/ + cp -a ${WORKDIR}/gentoo-bsd/profiles/releases/freebsd-${TARGETVER} /usr/portage/profiles/releases/ echo "amd64-fbsd default/bsd/fbsd/amd64/${TARGETVER} dev" >> /usr/portage/profiles/profiles.desc echo "x86-fbsd default/bsd/fbsd/x86/${TARGETVER} dev" >> /usr/portage/profiles/profiles.desc fi @@ -90,13 +88,19 @@ prepare(){ else MY_MKSRC="_${MKSRC}" fi - if [ ! -e /usr/portage/distfiles/freebsd-lib-${TARGETVER}${MY_MKSRC}.tar.bz2 ] ; then + local DISTDIR="`emerge --info | grep DISTDIR | awk -F= '{print $2}' | sed 's:\"::g'`" + if [[ ${MAJORVER} -ge 10 ]]; then + local TAREXT=xz + else + local TAREXT=bz2 + fi + if [ ! -e "${DISTDIR}/freebsd-lib-${TARGETVER}${MY_MKSRC}.tar.${TAREXT}" ] ; 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} - mkdir -p /usr/portage/distfiles - mv *${TARGETVER}${MY_MKSRC}*bz2 /usr/portage/distfiles/ + ${WORKDIR}/gentoo-bsd/scripts/extract-9.0.sh ${TARGETVER}${MY_MKSRC} + mkdir -p "${DISTDIR}" + mv *${TARGETVER}${MY_MKSRC}*${TAREXT} "${DISTDIR}/" fi ls -1 /usr/portage/sys-freebsd/freebsd-lib/freebsd-lib-${TARGETVER}*.ebuild > /dev/null 2>&1 @@ -104,7 +108,7 @@ prepare(){ create_manifest /usr/portage/sys-freebsd export WORKDATE="local" fi - create_manifest ${WORKDIR}/portage.bsd-overlay/sys-freebsd + create_manifest ${WORKDIR}/gentoo-bsd/sys-freebsd fi if [ "${WORKDATE}" = "remote" ] ; then @@ -130,18 +134,14 @@ prepare(){ if [ -n "${STABLE}" ] ; then echo "create stages, mixed stable ${TARGETARCH} and minimal ${TARGETARCH}-fbsd flag on" - mkdir -p ${WORKDIR}/portage.bsd-overlay/scripts/mkstages/etc/portage/profile - mkdir -p ${WORKDIR}/portage.bsd-overlay/scripts/mkstages/etc/portage/package.keywords - cp -a ${WORKDIR}/portage.bsd-overlay/scripts/mkstages/minimal-fbsd-list ${WORKDIR}/portage.bsd-overlay/scripts/mkstages/etc/portage/package.keywords/ - echo "ACCEPT_KEYWORDS=\"-${TARGETARCH}-fbsd -~${TARGETARCH}-fbsd ${TARGETARCH}\"" >> ${WORKDIR}/portage.bsd-overlay/scripts/mkstages/etc/portage/profile/make.defaults - echo "CHOST=\"${CATALYST_CHOST}\"" >> ${WORKDIR}/portage.bsd-overlay/scripts/mkstages/etc/portage/profile/make.defaults - echo 'CHOST_amd64_fbsd="${CHOST}"' >> ${WORKDIR}/portage.bsd-overlay/scripts/mkstages/etc/portage/profile/make.defaults - echo "CHOST_x86_fbsd=\"i686-gentoo-freebsd${CHOSTVER}\"" >> ${WORKDIR}/portage.bsd-overlay/scripts/mkstages/etc/portage/profile/make.defaults - echo "FEATURES=\"preserve-libs\"" >> ${WORKDIR}/portage.bsd-overlay/scripts/mkstages/etc/portage/profile/make.defaults - - #fixes bug 447810 - mkdir -p ${WORKDIR}/portage.bsd-overlay/scripts/mkstages/etc/portage/patches/app-shells/bash - wget -q -O ${WORKDIR}/portage.bsd-overlay/scripts/mkstages/etc/portage/patches/app-shells/bash/bash-4.2-fbsd-EINTR.patch "http://git.savannah.gnu.org/cgit/bash.git/patch/redir.c?id=208fdb509e072977ae7a621e916dfcd32c76047d" + mkdir -p ${WORKDIR}/gentoo-bsd/scripts/mkstages/etc/portage/profile + mkdir -p ${WORKDIR}/gentoo-bsd/scripts/mkstages/etc/portage/package.keywords + cp -a ${WORKDIR}/gentoo-bsd/scripts/mkstages/minimal-fbsd-list ${WORKDIR}/gentoo-bsd/scripts/mkstages/etc/portage/package.keywords/ + echo "ACCEPT_KEYWORDS=\"-${TARGETARCH}-fbsd -~${TARGETARCH}-fbsd ${TARGETARCH}\"" >> ${WORKDIR}/gentoo-bsd/scripts/mkstages/etc/portage/profile/make.defaults + echo "CHOST=\"${CATALYST_CHOST}\"" >> ${WORKDIR}/gentoo-bsd/scripts/mkstages/etc/portage/profile/make.defaults + echo 'CHOST_amd64_fbsd="${CHOST}"' >> ${WORKDIR}/gentoo-bsd/scripts/mkstages/etc/portage/profile/make.defaults + echo "CHOST_x86_fbsd=\"i686-gentoo-freebsd${CHOSTVER}\"" >> ${WORKDIR}/gentoo-bsd/scripts/mkstages/etc/portage/profile/make.defaults + echo "FEATURES=\"preserve-libs\"" >> ${WORKDIR}/gentoo-bsd/scripts/mkstages/etc/portage/profile/make.defaults fi } @@ -156,14 +156,9 @@ create_manifest(){ cd ${dir} ls -1 *${TARGETVER}*.ebuild > /dev/null 2>&1 if [ $? -eq 0 ] ; then - gsed -i "/${TARGETVER}/d" Manifest - ls -1 *${TARGETVER}${MY_MKSRC}*.ebuild > /dev/null 2>&1 - if [[ "${MKSRC}" = "release" || $? -ne 0 ]] ; then - EBUILDFILE=`ls -1 *${TARGETVER}*.ebuild | tail -n 1` - echo "copy ${EBUILDFILE} to ${TARGETVER}${MY_MKSRC}.ebuild" - gsed -i '/cve-2012-4576.patch/d' ${EBUILDFILE} - cp ${EBUILDFILE} ${dir}-${TARGETVER}${MY_MKSRC}.ebuild - fi + EBUILDFILE=`ls -1 *${TARGETVER}*.ebuild | tail -n 1` + echo "copy ${EBUILDFILE} to ${TARGETVER}${MY_MKSRC}.ebuild" + cp ${EBUILDFILE} ${dir}-${TARGETVER}${MY_MKSRC}.ebuild ls -1 *.ebuild > /dev/null 2>&1 @@ -178,48 +173,6 @@ create_manifest(){ 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/ - if [ -e ${WORKDIR}/portage.bsd-overlay/scripts/mkstages/etc/portage ] ; then - cp -a ${WORKDIR}/portage.bsd-overlay/scripts/mkstages/etc/portage/* ${WORKDIR}/stage3tmp/etc/portage/ - fi - if [ -e /etc/catalyst/catalystrc ] ; then - cp -a /etc/catalyst/catalystrc ${WORKDIR}/stage3tmp/tmp - fi - 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 - 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 -} - check_ecompressdir() { # dirty solution # /dev is still mounted; performing auto-bind-umount... @@ -241,28 +194,28 @@ run_catalyst() { local C_APPEND_OPT="" if [ ! -e /var/tmp/catalyst/builds/default/${C_TARGET}-${TARGETSUBARCH}-fbsd-${TARGETVER}-${WORKDATE}${C_APPEND_VERSION}.tar.bz2 ] ; then - if [ "${C_TARGET}" = "stage1" ] ; then + if [ "${C_TARGET}" = "stage1" ] && [ "${C_SOURCE}" != "stage3-${TARGETSUBARCH}-fbsd-${TARGETVER}-${WORKDATE}${C_TMP_APPEND_VERSION}" ]; then C_APPEND_OPT="${C_APPEND_OPT} update_seed=yes" fi if [ "${C_TARGET}" != "stage3" ] ; then C_APPEND_OPT="${C_APPEND_OPT} chost=${CATALYST_CHOST}" fi if [ -n "${STABLE}" ] ; then - C_APPEND_OPT="${C_APPEND_OPT} portage_confdir=${WORKDIR}/portage.bsd-overlay/scripts/mkstages/etc/portage" + C_APPEND_OPT="${C_APPEND_OPT} portage_confdir=${WORKDIR}/gentoo-bsd/scripts/mkstages/etc/portage" else - if [ -e ${WORKDIR}/portage.bsd-overlay/etc/portage ] ; then - C_APPEND_OPT="${C_APPEND_OPT} portage_confdir=${WORKDIR}/portage.bsd-overlay/etc/portage" + if [ -e ${WORKDIR}/gentoo-bsd/etc/portage ] ; then + C_APPEND_OPT="${C_APPEND_OPT} portage_confdir=${WORKDIR}/gentoo-bsd/etc/portage" fi fi if [ -n "${CLANG}" ] ; then C_APPEND_PROFILE="/clang" fi - catalyst -C target=${C_TARGET} version_stamp=fbsd-${TARGETVER}-${WORKDATE}${C_APPEND_VERSION} profile=default/bsd/fbsd/${TARGETARCH}/${TARGETVER}${C_APPEND_PROFILE} snapshot=${WORKDATE} source_subpath=default/${C_SOURCE} subarch=${TARGETSUBARCH} rel_type=default portage_overlay=${WORKDIR}/portage.bsd-overlay ${C_APPEND_OPT} + catalyst -C target=${C_TARGET} version_stamp=fbsd-${TARGETVER}-${WORKDATE}${C_APPEND_VERSION} profile=default/bsd/fbsd/${TARGETARCH}/${TARGETVER}${C_APPEND_PROFILE} snapshot=${WORKDATE} source_subpath=default/${C_SOURCE} subarch=${TARGETSUBARCH} rel_type=default portage_overlay=${WORKDIR}/gentoo-bsd ${C_APPEND_OPT} if [ $? -ne 0 ] ; then check_ecompressdir "${C_TARGET}-${TARGETSUBARCH}-fbsd-${TARGETVER}-${WORKDATE}${C_APPEND_VERSION}/usr/local/portage" if [ $? -ne 0 ] ; then - catalyst -C target=${C_TARGET} version_stamp=fbsd-${TARGETVER}-${WORKDATE}${C_APPEND_VERSION} profile=default/bsd/fbsd/${TARGETARCH}/${TARGETVER}${C_APPEND_PROFILE} snapshot=${WORKDATE} source_subpath=default/${C_SOURCE} subarch=${TARGETSUBARCH} rel_type=default portage_overlay=${WORKDIR}/portage.bsd-overlay ${C_APPEND_OPT} || exit 1 + catalyst -C target=${C_TARGET} version_stamp=fbsd-${TARGETVER}-${WORKDATE}${C_APPEND_VERSION} profile=default/bsd/fbsd/${TARGETARCH}/${TARGETVER}${C_APPEND_PROFILE} snapshot=${WORKDATE} source_subpath=default/${C_SOURCE} subarch=${TARGETSUBARCH} rel_type=default portage_overlay=${WORKDIR}/gentoo-bsd ${C_APPEND_OPT} || exit 1 fi fi @@ -278,28 +231,16 @@ run_catalyst() { mk_stages() { [[ -n "${CLANG}" ]] && local C_CLANG_APPEND_VERSION="-cl" local C_TMP_APPEND_VERSION="${C_CLANG_APPEND_VERSION}t" - if [ "${OLDVER}" != "${TARGETVER}" ] ; then - local SOURCE_STAGE3="stage3tmp-${TARGETSUBARCH}-freebsd-${TARGETVER}" - else - local SOURCE_STAGE3="stage3-${TARGETSUBARCH}-freebsd-${OLDVER}" - fi + local SOURCE_STAGE3="stage3-${TARGETSUBARCH}-freebsd-${OLDVER}" [[ -n ${FORCESTAGE3} ]] && SOURCE_STAGE3="${FORCESTAGE3}" run_catalyst stage1 ${SOURCE_STAGE3} ${C_TMP_APPEND_VERSION} - - ### Added when the library was upgraded - ln -s libmpfr.so.5 /var/tmp/catalyst/tmp/default/stage1-${TARGETSUBARCH}-fbsd-${TARGETVER}-${WORKDATE}${C_TMP_APPEND_VERSION}/tmp/stage1root/usr/lib/libmpfr.so.4 - ln -s libmpc.so /var/tmp/catalyst/tmp/default/stage1-${TARGETSUBARCH}-fbsd-${TARGETVER}-${WORKDATE}${C_TMP_APPEND_VERSION}/tmp/stage1root/usr/lib/libmpc.so.2 - ln -s libmpc.so /var/tmp/catalyst/tmp/default/stage1-${TARGETSUBARCH}-fbsd-${TARGETVER}-${WORKDATE}${C_TMP_APPEND_VERSION}/tmp/stage1root/usr/lib/libmpc.so.2.0.0 - run_catalyst stage2 stage1-${TARGETSUBARCH}-fbsd-${TARGETVER}-${WORKDATE}${C_TMP_APPEND_VERSION} ${C_TMP_APPEND_VERSION} run_catalyst stage3 stage2-${TARGETSUBARCH}-fbsd-${TARGETVER}-${WORKDATE}${C_TMP_APPEND_VERSION} ${C_TMP_APPEND_VERSION} - run_catalyst stage1 stage3-${TARGETSUBARCH}-fbsd-${TARGETVER}-${WORKDATE}${C_TMP_APPEND_VERSION} ${C_CLANG_APPEND_VERSION} run_catalyst stage2 stage1-${TARGETSUBARCH}-fbsd-${TARGETVER}-${WORKDATE}${C_CLANG_APPEND_VERSION} ${C_CLANG_APPEND_VERSION} run_catalyst stage3 stage2-${TARGETSUBARCH}-fbsd-${TARGETVER}-${WORKDATE}${C_CLANG_APPEND_VERSION} ${C_CLANG_APPEND_VERSION} - } if [ -e /etc/catalyst/catalystrc ] ; then @@ -312,10 +253,6 @@ 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}" ] && [ -z "${FORCESTAGE3}" ]; then - upgrade_src_stage3 - echo "upgrade done" -fi - mk_stages + |