ensure guest upgrade occurs before attempting to get manifest

fixes #85
lxc
Devrandom 9 years ago
parent 7d1e7c5419
commit 81bf5d7025

1
.gitignore vendored

@ -9,3 +9,4 @@ inputs
base*
*.qcow2
sigs
target-bin/bootstrap-fixup

@ -1,3 +1,16 @@
2015-03-23
----------
Now ensuring that `apt-get dist-upgrade` occurs at least once before package manifest
is computed. This is because distributions usually don't store old versions of packages
in the repos, so we can't download the exact package version we have installed if it's
out of date.
gbuild now has a --upgrade flag that forces an upgrade after the first one.
Other Notes
===========
Important:
We are planning on switching from using lxc-start to using lxc-execute. lxc-execute requires lxc-init (or init.lxc) to be available on the guest at one of the expected places. You might have to manually install lxc on your base VM image or recreate the image.

@ -96,7 +96,11 @@ def build_one_configuration(suite, arch, build_desc, reference_datetime)
info "Installing additional packages (log in var/install.log)"
system! "on-target -u root -e DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends -y install #{build_desc["packages"].join(" ")} > var/install.log 2>&1"
info "Downloading system packages and creating manifest. This may take a while."
if @options[:upgrade] || system("on-target -u root '[ ! -e /var/cache/gitian/initial-upgrade ]'")
info "Upgrading system, may take a while"
system! "on-target -u root bash < target-bin/upgrade-system.sh > var/install.log 2>&1"
end
info "Creating package manifest"
system! "on-target -u root bash < target-bin/grab-packages.sh > var/base-#{suitearch}.manifest"
info "Creating build script (var/build-script)"
@ -141,6 +145,9 @@ OptionParser.new do |opts|
opts.on("-i", "--skip-image", "reuse current target image") do |v|
@options[:skip_image] = v
end
opts.on("--upgrade", "upgrade guest with latest packages") do |v|
@options[:upgrade] = v
end
opts.on("-q", "--quiet", "be quiet") do |v|
@options[:quiet] = v
end

@ -6,10 +6,7 @@ set -e
cd /var/cache/apt/archives
#apt-get clean
# remove obsolete grub, it causes package dependency issues
apt-get -y purge grub > /dev/null || true
dpkg-query -W -f '${Package}\n' | xargs -n 50 apt-get install --reinstall -y -d > /dev/null
# make sure all packages with installed versions are downloaded
dpkg-query -W -f '${Package}=${Version}\n' | xargs -n 50 apt-get install -q --reinstall -y -d > /tmp/download.log
grep "cannot be downloaded" /tmp/download.log && { echo Could not download some packages, please run gbuild --upgrade 1>&2 ; exit 1 ; }
sha256sum *.deb | sort --key 2

@ -0,0 +1,15 @@
#!/bin/sh
# Upgrade system
set -e
mkdir -p /var/cache/gitian
# remove obsolete grub, it causes package dependency issues
apt-get -q -y purge grub > /dev/null 2>&1 || true
# upgrade packages
DEBIAN_FRONTEND=noninteractive apt-get -y dist-upgrade > /dev/null > /var/cache/gitian/upgrade.log 2>&1
touch /var/cache/gitian/initial-upgrade
Loading…
Cancel
Save