diff --git a/config/common.cfg b/config/common.cfg index 44e031d..e2496dc 100644 --- a/config/common.cfg +++ b/config/common.cfg @@ -6,16 +6,21 @@ LOG_ROOT="/var/log/mirror-sync" # Attempt to autodetect current Fuel version if hash fuel 2>/dev/null; then - # working on Fuel master node + # working on Fuel node FUEL_VERSION=`fuel --fuel-version 2>&1 | awk -v sq="'" '/^release:/ { gsub(sq,""); print $2 }'` if ! wget -nv https://raw.githubusercontent.com/stackforge/fuel-main/${FUEL_VERSION}/config.mk -O /dev/null; then FUEL_BRANCH=master else FUEL_BRANCH=$FUEL_VERSION fi + # On Fuel node we will be using dockerized Ubuntu for dependencies resolving. + # Assuming that Docker is up and running. + DOCKER_MODE=true else # working outside Fuel master node - echo "Cannot detect current Fuel version, using defaults. Please configure settings in config/common.cfg" + echo "Cannot detect current Fuel version, using defaults. Please configure FUEL_* settings in config/common.cfg" + sleep 3 FUEL_VERSION=6.1 FUEL_BRANCH=master + DOCKER_MODE=false fi \ No newline at end of file diff --git a/config/mos-ubuntu-updatesonly.cfg b/config/mos-ubuntu-updatesonly.cfg index 76f11bd..dfbed74 100644 --- a/config/mos-ubuntu-updatesonly.cfg +++ b/config/mos-ubuntu-updatesonly.cfg @@ -2,8 +2,8 @@ source "$(dirname $(readlink -f "${BASH_SOURCE[0]}"))/common.cfg" # Sync source -UPSTREAM="osci-mirror-kha.kha.mirantis.net" -UPSTREAM_DIR="mirror-sync/mos/ubuntu" +UPSTREAM="mirror.fuel-infra.org" +UPSTREAM_DIR="mirror/mos/ubuntu" UPSTREAM_DIR_HTTP="mos/ubuntu" # NOTE! Partial repository sync feature requires apt support on your OS! @@ -35,7 +35,7 @@ FETCH_DIFF="no" # Fetch diffs of 'Packages' (speed's up client update) FETCH_INDICES="no" # Fetch indices # Misc -DEBUG="no" +DEBUG="yes" QUIET="no" DISABLE_CLEANUP="no" LOG_FILE="${LOG_ROOT:-"/var/log/mirror-sync"}/ubuntu-update.log" diff --git a/config/mos-ubuntu.cfg b/config/mos-ubuntu.cfg index 584d2fe..ea94e14 100644 --- a/config/mos-ubuntu.cfg +++ b/config/mos-ubuntu.cfg @@ -2,8 +2,8 @@ source "$(dirname $(readlink -f "${BASH_SOURCE[0]}"))/common.cfg" # Sync source -UPSTREAM="osci-mirror-kha.kha.mirantis.net" -UPSTREAM_DIR="mirror-sync/mos/ubuntu" +UPSTREAM="mirror.fuel-infra.org" +UPSTREAM_DIR="mirror/mos/ubuntu" UPSTREAM_DIR_HTTP="mos/ubuntu" # NOTE! Partial repository sync feature requires apt support on your OS! diff --git a/config/ubuntu.cfg b/config/ubuntu.cfg index dd3f912..c0c17c2 100644 --- a/config/ubuntu.cfg +++ b/config/ubuntu.cfg @@ -38,7 +38,7 @@ FETCH_DIFF="no" # Fetch diffs of 'Packages' (speed's up client update) FETCH_INDICES="yes" # Fetch indices # Misc -DEBUG="no" +DEBUG="yes" QUIET="no" DISABLE_CLEANUP="no" LOG_FILE="${LOG_ROOT:-"/var/log/mirror-sync"}/ubuntu-update.log" diff --git a/deb-mirror b/deb-mirror index 6c8ecc4..71d8f2b 100755 --- a/deb-mirror +++ b/deb-mirror @@ -451,8 +451,6 @@ if [[ "$PARTIAL_UPSTREAM" = "1" ]]; then info "Resolving dependencies for partial mirror" -[ -f /usr/bin/apt-get ] || fatal "APT not found on this system, creation of partial repository will fail" - # Detect kernel version of debian-installer fuel_config_temp=`mktemp --suffix="-fuel-config-temp"` if ! wget -nv https://raw.githubusercontent.com/stackforge/fuel-main/${FUEL_BRANCH}/config.mk -O $fuel_config_temp; then @@ -473,7 +471,14 @@ rm -f "$fuel_config_temp" export apt_altstate=`mktemp -d --suffix="-apt-altstate"` export FUEL_BRANCH -$BINROOT/util/partial_ubuntu.sh || fatal "Cannot calculate list of dependencies" +if [[ "$DOCKER_MODE" = "true" ]]; then + # docker pull ubuntu:latest + docker -D run --net=bridge --rm -a stdout -a stderr -i -t --privileged -e FUEL_BRANCH=$FUEL_BRANCH -e BINROOT=$BINROOT -e apt_altstate=$apt_altstate -v $BINROOT:$BINROOT:rw -v $apt_altstate:$apt_altstate:rw ubuntu:latest $BINROOT/util/partial_ubuntu.sh || fatal "Cannot calculate list of dependencies" + # cleanup ubuntu container + docker images | awk '/ubuntu/ { print $3; }' | xargs --no-run-if-empty docker rmi -f +else + $BINROOT/util/partial_ubuntu.sh || fatal "Cannot calculate list of dependencies" +fi # Create download lists for deb and udeb awk 'FNR==NR {arr[$0];next} $3 in arr' $apt_altstate/deb "$deb_md5" > $apt_altstate/deb_md5 @@ -605,8 +610,10 @@ EOF # Build partial mirror info "Generating metadata for partial mirror" +info "Apply fix for upstream dpkg-scanpackages" +patch -N /usr/bin/dpkg-scanpackages < $BINROOT/util/dpkg.patch export BINROOT -$BINROOT/util/regenerate_ubuntu_repo ${PARTIAL_UPSTREAM_PATH} ${UBUNTU_RELEASE} || failure "Failed to generate partial mirror" +$BINROOT/util/regenerate_ubuntu_repo ${PARTIAL_UPSTREAM_PATH} ${UBUNTU_RELEASE} || fatal "Failed to generate partial mirror" rm -rf $LOCAL_DIR fi # "$PARTIAL_UPSTREAM" = "1" info "Done" diff --git a/util/dpkg-scanpackages b/util/dpkg-scanpackages deleted file mode 100755 index 37c0203..0000000 --- a/util/dpkg-scanpackages +++ /dev/null @@ -1,289 +0,0 @@ -#!/usr/bin/perl -# -# dpkg-scanpackages -# -# Copyright © 2006-2012 Guillem Jover -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -use warnings; -use strict; - -use IO::Handle; -use IO::File; -use Getopt::Long qw(:config posix_default bundling no_ignorecase); - -use Dpkg (); -use Dpkg::Gettext; -use Dpkg::ErrorHandling; -#use Dpkg::Util qw(:list); -use Dpkg::Control; -use Dpkg::Version; -use Dpkg::Checksums; -use Dpkg::Compression::FileHandle; -use Dpkg::IPC; - -textdomain('dpkg-dev'); - -# Do not pollute STDOUT with info messages -report_options(info_fh => \*STDERR); - -my (@samemaint, @changedmaint); -my @spuriousover; -my %packages; -my %overridden; - -my %options = (help => sub { usage(); exit 0; }, - version => \&version, - type => undef, - arch => undef, - multiversion => 0, - 'extra-override'=> undef, - medium => undef, - ); - -my @options_spec = ( - 'help|?', - 'version', - 'type|t=s', - 'arch|a=s', - 'multiversion|m!', - 'extra-override|e=s', - 'medium|M=s', -); - -sub version { - printf _g("Debian %s version.\n"), $Dpkg::PROGNAME; - exit; -} - -sub usage { - printf _g( -"Usage: %s [