[gentoo-commits] proj/releng:master commit in: releases/weekly/scripts/, releases/weekly/specs/amd64/

2016-01-04 Thread Robin H. Johnson
commit: e0a2e5d8861040c1709340c0e057e194b31cf94d
Author: Robin H. Johnson  gentoo  org>
AuthorDate: Mon Jan  4 22:39:07 2016 +
Commit: Robin H. Johnson  gentoo  org>
CommitDate: Mon Jan  4 22:39:36 2016 +
URL:https://gitweb.gentoo.org/proj/releng.git/commit/?id=e0a2e5d8

Move cloud stage cleanup from fsscript to spec where possible.

Signed-off-by: Robin H. Johnson  gentoo.org>

 releases/weekly/scripts/cloud-prep.sh | 11 +-
 releases/weekly/specs/amd64/stage4-cloud.spec | 30 +++
 2 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/releases/weekly/scripts/cloud-prep.sh 
b/releases/weekly/scripts/cloud-prep.sh
index 1905f11..116e64d 100644
--- a/releases/weekly/scripts/cloud-prep.sh
+++ b/releases/weekly/scripts/cloud-prep.sh
@@ -68,13 +68,4 @@ sed -i '/^USE=\"\${USE}\ \ build\"$/d' /etc/portage/make.conf
 # clean up system
 passwd -d root
 passwd -l root
-rm -R -f /usr/portage/distfiles/*
-rm -f /etc/ssh/ssh_host_*
-rm -f /root/.bash_history
-rm -f /root/.nano_history
-rm -f /root/.lesshst
-rm -f /root/.ssh/known_hosts
-rm -rf /usr/src/linux
-rm -rf /usr/src/linux*
-for i in $(find /var/log -type f); do echo > $i; done
-for i in $(find /tmp -type f); do rm -f $i; done
+for i in $(find /var/log -type f); do truncate -s 0 $i; done

diff --git a/releases/weekly/specs/amd64/stage4-cloud.spec 
b/releases/weekly/specs/amd64/stage4-cloud.spec
index 240d14e..2a95e05 100644
--- a/releases/weekly/specs/amd64/stage4-cloud.spec
+++ b/releases/weekly/specs/amd64/stage4-cloud.spec
@@ -57,3 +57,33 @@ boot/kernel/gentoo/sources: gentoo-sources
 boot/kernel/gentoo/config: 
/release/releng/releases/weekly/kconfig/amd64/cloud-amd64-gentoo.config
 boot/kernel/gentoo/extraversion: openstack
 boot/kernel/gentoo/gk_kernargs: --all-ramdisk-modules
+
+# all of the cleanup...
+stage4/unmerge:
+   sys-kernel/genkernel
+   sys-kernel/gentoo-sources
+
+stage4/empty:
+   /root/.ccache
+   /tmp
+   /usr/portage/distfiles
+   /usr/src
+   /var/cache/edb/dep
+   /var/cache/genkernel
+   /var/empty
+   /var/run
+   /var/state
+   /var/tmp
+
+stage4/rm:
+   /etc/*-
+   /etc/*.old
+   /etc/ssh/ssh_host_*
+   /root/.*history
+   /root/.lesshst
+   /root/.ssh/known_hosts
+   /root/.viminfo
+   # Remove any generated stuff by genkernel
+   /usr/share/genkernel
+   # This is 3MB of crap for each copy
+   
/usr/lib64/python*/site-packages/gentoolkit/test/eclean/testdistfiles.tar.gz



[gentoo-commits] proj/releng:master commit in: releases/weekly/scripts/, releases/weekly/specs/amd64/hardened/, ...

2015-12-17 Thread Jorge Manuel B. S. Vicetto
commit: 6e2cef0da192dbb18f950c190051cbabc2fc1a98
Author: Jorge Manuel B. S. Vicetto (jmbsvicetto)  gentoo 
 org>
AuthorDate: Fri Dec 18 01:45:28 2015 +
Commit: Jorge Manuel B. S. Vicetto  gentoo  org>
CommitDate: Fri Dec 18 01:45:28 2015 +
URL:https://gitweb.gentoo.org/proj/releng.git/commit/?id=6e2cef0d

Add prep.sh to the repo and fix the stage3 name for the stage4 specs.

Signed-off-by: Jorge Manuel B. S. Vicetto (jmbsvicetto)  
gentoo.org>

 releases/weekly/scripts/prep.sh| 79 ++
 .../specs/amd64/hardened/stage4-nomultilib.spec|  2 +-
 releases/weekly/specs/amd64/hardened/stage4.spec   |  2 +-
 releases/weekly/specs/amd64/stage4-nomultilib.spec |  2 +-
 releases/weekly/specs/amd64/stage4.spec|  2 +-
 5 files changed, 83 insertions(+), 4 deletions(-)

diff --git a/releases/weekly/scripts/prep.sh b/releases/weekly/scripts/prep.sh
new file mode 100644
index 000..22478a9
--- /dev/null
+++ b/releases/weekly/scripts/prep.sh
@@ -0,0 +1,79 @@
+#!/usr/bin/env bash
+#
+# Okay, so here's some real meat.  We take a drive (as 02 said, I use a VM),
+# and we spray that stage4 all over it.  Then we rub some grub (0.97) all over
+# it to make it feel better, and then we box it up and ship it out.
+
+set -e -u -x -o pipefail
+
+# Vars
+export TEMP_DIR=${TEMP_DIR:-'/root/tmp/catalyst/gentoo'}
+export MOUNT_DIR=${MOUNT_DIR:-'/mnt'}
+export DATE=${DATE:-"$(date +%Y%m%d)"}
+export PORTAGE_DIR=${PORTAGE_DIR:-"/var/tmp/catalyst/snapshots"}
+# profiles supported are as follows
+# default/linux/amd64/13.0
+# default/linux/amd64/13.0/no-multilib
+# hardened/linux/amd64
+# hardened/linux/amd64/no-multilib
+# hardened/linux/amd64/selinux (eventually)
+# hardened/linux/amd64/no-multilib/selinux (eventually)
+export PROFILE=${PROFILE:-"default/linux/amd64/13.0"}
+if [[ "${PROFILE}" == "default/linux/amd64/13.0" ]]; then
+  PROFILE_SHORTNAME="amd64-default"
+elif [[ "${PROFILE}" == "default/linux/amd64/13.0/no-multilib" ]]; then
+  PROFILE_SHORTNAME="amd64-default-nomultilib"
+elif [[ "${PROFILE}" == "hardened/linux/amd64" ]]; then
+  PROFILE_SHORTNAME="amd64-hardened"
+elif [[ "${PROFILE}" == "hardened/linux/amd64/no-multilib" ]]; then
+  PROFILE_SHORTNAME="amd64-hardened-nomultilib"
+else
+  echo 'invalid profile, exiting'
+  exit 1
+fi
+export 
TARBALL=${TARBALL:-"/root/tmp/catalyst/gentoo/stage4-${PROFILE_SHORTNAME}-${DATE}.tar.bz2"}
+export TEMP_IMAGE=${TEMP_IMAGE:-"gentoo-${PROFILE_SHORTNAME}.img"}
+export 
TARGET_IMAGE=${TARGET_IMAGE:-"/root/openstack-${PROFILE_SHORTNAME}-${DATE}.qcow2"}
+
+# create a raw partition and do stuff with it
+fallocate -l 5G "${TEMP_DIR}/${TEMP_IMAGE}"
+BLOCK_DEV=$(losetup -f --show "${TEMP_DIR}/${TEMP_IMAGE}")
+
+# Okay, we have the disk, let's prep it
+echo 'Building disk'
+parted -s "${BLOCK_DEV}" mklabel gpt
+parted -s --align=none "${BLOCK_DEV}" mkpart bios_boot 0 2M
+parted -s --align=none "${BLOCK_DEV}" mkpart primary 2M 100%
+parted -s "${BLOCK_DEV}" set 1 boot on
+parted -s "${BLOCK_DEV}" set 1 bios_grub on
+mkfs.ext4 -F "${BLOCK_DEV}p2"
+
+# Mount it
+echo 'Mounting disk'
+mkdir -p "${MOUNT_DIR}/${PROFILE_SHORTNAME}"
+mount "${BLOCK_DEV}p2" "${MOUNT_DIR}/${PROFILE_SHORTNAME}"
+
+# Expand the stage
+echo 'Expanding tarball'
+tar --xattrs -xjpf "${TARBALL}" -C "${MOUNT_DIR}/${PROFILE_SHORTNAME}"
+
+echo 'Adding in /usr/portage'
+tar --xattrs -xjpf "${PORTAGE_DIR}/portage-latest.tar.bz2" -C 
"${MOUNT_DIR}/${PROFILE_SHORTNAME}/usr"
+
+# Install grub
+echo 'Installing grub'
+grub2-install "${BLOCK_DEV}" --boot-directory 
"${MOUNT_DIR}/${PROFILE_SHORTNAME}/boot"
+
+# Clean up
+echo 'Syncing; unmounting'
+sync
+umount "${MOUNT_DIR}/${PROFILE_SHORTNAME}"
+
+# get rid of block mapping
+losetup -d "${BLOCK_DEV}"
+
+echo 'Converting raw image to qcow2'
+qemu-img convert -c -f raw -O qcow2 "${TEMP_DIR}/${TEMP_IMAGE}" 
"${TARGET_IMAGE}"
+
+echo 'Cleaning up'
+rm "${TEMP_DIR}/${TEMP_IMAGE}"

diff --git a/releases/weekly/specs/amd64/hardened/stage4-nomultilib.spec 
b/releases/weekly/specs/amd64/hardened/stage4-nomultilib.spec
index ec6e4cb..1ba0948 100644
--- a/releases/weekly/specs/amd64/hardened/stage4-nomultilib.spec
+++ b/releases/weekly/specs/amd64/hardened/stage4-nomultilib.spec
@@ -4,7 +4,7 @@ version_stamp: hardened+cloud-nomultilib-2008.0
 rel_type: hardened
 profile: hardened/linux/amd64/no-multilib
 snapshot: 2008.0
-source_subpath: hardened/stage3-amd64-hardened+cloud-nomultilib-2008.0
+source_subpath: hardened/stage3-amd64-hardened+nomultilib-2008.0
 portage_confdir: /release/releng/releases/weekly/portage/stages
 
 stage4/use:

diff --git a/releases/weekly/specs/amd64/hardened/stage4.spec 
b/releases/weekly/specs/amd64/hardened/stage4.spec
index 7c7233c..707ec8a 100644
--- a/releases/weekly/specs/amd64/hardened/stage4.spec
+++ b/releases/weekly/specs/amd64/hardened/stage4.spec
@@ -4,7 +4,7 @@ version_stamp: hardened+cloud-2008.0
 rel_type: hardened
 profile: hardened/linux/amd64
 snapshot: 2008.0