Introduction

Rather than giving the kind of detailed explanation in std_env/MakeNewStdEnv/DebianEtchExample and std_env/MakeNewStdEnv/DebianLennyExample, this page just describes a little about automating the creation of the Debian squeeze build environments.

Adding --work-dir-pattern to pkg2vesta

To facilitate automating this process I added a new feature to pkg2vesta (see std_env/MakeNewOsComponent) in pkg2vesta/15. (You'll see the added --wd-pattern flag used below.)

Downloading and Importing OS Components

Next I downloaded, imported, and took immutable snapshots of the needed packages with the following script:

# Base URL to retrieve .deb files from.  Set to your favorite mirror,
# or your local cache.

base_url='http://debian.lcs.mit.edu/debian'

for arch in amd64 i386 powerpc sparc; do
    echo "======================================================"
    echo "-------------------- $arch (wget) --------------------"
    echo "======================================================"
    mkdir -p $arch
    cd $arch
    wget --progress=dot:mega \
        $base_url/pool/main/e/eglibc/libc6_2.11.2-10_$arch.deb \
        $base_url/pool/main/g/gcc-4.4/libstdc++6_4.4.5-8_$arch.deb \
        $base_url/pool/main/g/gcc-4.4/libgcc1_4.4.5-8_$arch.deb \
        $base_url/pool/main/b/binutils/binutils_2.20.1-16_$arch.deb \
        $base_url/pool/main/z/zlib/zlib1g_1.2.3.4.dfsg-3_$arch.deb \
        $base_url/pool/main/g/gcc-4.4/cpp-4.4_4.4.5-8_$arch.deb \
        $base_url/pool/main/g/gcc-4.4/gcc-4.4_4.4.5-8_$arch.deb \
        $base_url/pool/main/e/eglibc/libc6-dev_2.11.2-10_$arch.deb \
        $base_url/pool/main/l/linux-2.6/linux-libc-dev_2.6.32-31_$arch.deb \
        $base_url/pool/main/g/gmp/libgmp3c2_4.3.2+dfsg-1_$arch.deb \
        $base_url/pool/main/m/mpfr4/libmpfr4_3.0.0-2_$arch.deb \
        $base_url/pool/main/g/gcc-4.4/g++-4.4_4.4.5-8_$arch.deb \
        $base_url/pool/main/g/gcc-4.4/libstdc++6-4.4-dev_4.4.5-8_$arch.deb \
        $base_url/pool/main/f/flex/flex_2.5.35-10_$arch.deb \
        $base_url/pool/main/m/m4/m4_1.4.14-3_$arch.deb \
        $base_url/pool/main/b/bison/bison_2.4.1.dfsg-3_$arch.deb \
        $base_url/pool/main/s/swig1.3/swig_1.3.40-3_$arch.deb \
        $base_url/pool/main/p/perl/perl_5.10.1-17_$arch.deb \
        $base_url/pool/main/p/python2.6/python2.6_2.6.6-8+b1_$arch.deb \
        $base_url/pool/main/p/python2.6/python2.6-dev_2.6.6-8+b1_$arch.deb \
        $base_url/pool/main/t/tcl8.4/tcl8.4_8.4.19-4_$arch.deb \
        $base_url/pool/main/t/tcl8.4/tcl8.4-dev_8.4.19-4_$arch.deb
    cd ..
done

# The distribution name, mutable root mount point, and username (used
# in checkout working directory names)
dist_name='squeeze'
mut_root=$(vgetconfig UserInterface MutableRootName)
user_name=$(whoami)

# Run pkg2vesta on all the .deb files

for arch in amd64 i386 powerpc sparc; do
    if [ -d $arch ]; then
        echo "==========================================================="
        echo "-------------------- $arch (pkg2vesta) --------------------"
        echo "==========================================================="
        cd $arch
        for deb_f in *.deb; do
            pkg2vesta.pl --wd-pattern "$dist_name.%a/%p" --root /vesta/vestasys.org $deb_f
        done
        cd ..
        # Flush buffered writes through to the repository
        sync
    fi
done

# vadvance all the working directories

for arch in amd64 i386 powerpc sparc; do
    wd_par="$mut_root/$user_name/$dist_name.$arch"
    if [ -d $wd_par ]; then
        echo "=========================================================="
        echo "-------------------- $arch (vadvance) --------------------"
        echo "=========================================================="
        cd $wd_par
        for wd in *; do
            vadvance -Z -F -1 ./$wd
        done
    fi
done

creating the New std_envs

Then I used another script to create and check out the new std_env packages for Debian squeeze:

odist=lenny
ndist=squeeze
mut_root=$(vgetconfig UserInterface MutableRootName)
user_name=$(whoami)

for arch in amd64 i386 powerpc sparc; do
    # Find the package to base this on
    opkg="/vesta/vestasys.org/platforms/linux/debian/$arch/std_env.$odist"
    if [ ! -d $opkg ]; then
        opkg="/vesta/beta.vestasys.org/platforms/linux/debian/$arch/std_env.$odist"
    fi

    # We'll always put the new package in beta.vestasys.org
    npkg="/vesta/beta.vestasys.org/platforms/linux/debian/$arch/std_env.$ndist"

    if [ -d $opkg ]; then
        over=$(vlatest -n $opkg)
        if [ ! -d $npkg ]; then
            vcreate -m "Update for Debian $ndist" -o $over $npkg
            mkdir -p "$mut_root/$user_name/$ndist.$arch"
            vcheckout -M -w "$mut_root/$user_name/$ndist.$arch/std_env" $npkg
        fi
    fi
done

After editing the first std_env and getting it to build, I then used patch to propagate my changes to the ones for other CPU architectures. While this didn't apply cleanly in all cases, it reduced the amount of manual effort. Here are some of the commands I used to do this:

(cd /vesta/beta.vestasys.org/platforms/linux/debian/powerpc/std_env.squeeze/checkout/1 ; diff -ruN 0 latest | sed -e 's/powerpc/sparc/g' ) | patch -p1
(cd /vesta/beta.vestasys.org/platforms/linux/debian/powerpc/std_env.squeeze/checkout/1 ; diff -ruN 0 latest | sed -e 's/powerpc/i386/g' ) | patch -p1
(cd /vesta/beta.vestasys.org/platforms/linux/debian/i386/std_env.squeeze/checkout/1 ; diff -ruN 0 latest | sed -e 's/i386/amd64/g; s/i486/x86_64/g;' ) | patch -p1

When I was satisfied that everything was working, I proceeded to use this command line to check in all the OS components:

for d in /vesta-work/ken/squeeze.*/*; if echo $d | grep -q 'std_env$'; then echo "(skipping $d)"; else vcheckin -M $d; fi

Notable Changes

A couple things to note about the Debian squeeze std_envs:

Results

The edits made in the different std_env packages can be found here: