fuel-qa/fuelweb_test/helpers/regenerate_ubuntu_repo
Dennis Dmitriev fadb50130d Add auxiliary repositories to a just created cluster
- after uploading files to auxiliary repos, add the appropriate
repository to the last created cluster

- fix some issues in regenerate_repo_* scripts to allow working
with completely empty repositories.

Note that for patching feature the following variables should
point to the local auxiliary repositories:

export LOCAL_MIRROR_UBUNTU='/var/www/nailgun/ubuntu/auxiliary/'
export LOCAL_MIRROR_CENTOS='/var/www/nailgun/centos/auxiliary/'

The following variables added for new repos in a cluster:
AUX_DEB_REPO_PRIORITY=1150
AUX_RPM_REPO_PRIORITY=15

For auxiliary repository priority on Fuel admin node hardcoded
value 15, and for nailgun repo 20.

- add DockerActions for performing actions with group of containers

Impelements: blueprint package-fuel-components
Change-Id: If3a734550659f462a3911da93c6107026ad5702a
2015-04-21 13:04:22 +03:00

93 lines
2.7 KiB
Bash

#!/bin/bash
# Based on the method described here:
# http://troubleshootingrange.blogspot.com/2012/09/hosting-simple-apt-repository-on-centos.html
# Please install 'dpkg' and 'dpkg-devel' packages before use.
set -e
ARCH=amd64
REPO_PATH=$1
SUITE=$2
SECTION=main
BINDIR=${REPO_PATH}/dists/${SUITE}/${SECTION}
# Validate structure of the repo
mkdir -p "${BINDIR}/binary-${ARCH}/"
mkdir -p "${REPO_PATH}/pool/${SECTION}"
RELEASE="${REPO_PATH}/dists/${SUITE}/Release"
touch ${RELEASE}
release_header=`sed '/MD5Sum:/,$d' ${RELEASE}`
override_main="indices/override.${SUITE}.${SECTION}"
override_udeb="indices/override.${SUITE}.${SECTION}.debian-installer"
override_extra="indices/override.${SUITE}.extra.${SECTION}"
if [ -f "${REPO_PATH}/${override_main}" ]; then
binoverride="${override_main}"
else
binoverride=""
fi
if [ -f "${REPO_PATH}/${override_udeb}" ]; then
binoverride_udeb="${override_udeb}"
else
binoverride_udeb=""
fi
if [ -f "${REPO_PATH}/${override_extra}" ]; then
extraoverride="--extra-override ${override_extra}"
else
extraoverride=""
fi
package_deb=${BINDIR}/binary-${ARCH}/Packages
package_udeb=${BINDIR}/debian-installer/binary-${ARCH}/Packages
cd ${REPO_PATH}
# Scan *.deb packages
dpkg-scanpackages -m ${extraoverride} -a ${ARCH} pool/${SECTION} ${binoverride} > ${package_deb}.tmp 2>/dev/null
gzip -9c ${package_deb}.tmp > ${package_deb}.gz.tmp
bzip2 -ckz ${package_deb}.tmp > ${package_deb}.bz2.tmp
# Replace original files with new ones
mv --backup -f ${package_deb}.tmp ${package_deb}
mv --backup -f ${package_deb}.gz.tmp ${package_deb}.gz
mv --backup -f ${package_deb}.bz2.tmp ${package_deb}.bz2
# Scan *.udeb packages
if [ -d "${BINDIR}/debian-installer/binary-${ARCH}/" ]; then
dpkg-scanpackages --udeb -m -a ${ARCH} pool/debian-installer ${binoverride_udeb} > ${package_udeb}.tmp 2>/dev/null
gzip -9c ${package_udeb}.tmp > ${package_udeb}.gz.tmp
bzip2 -ckz ${package_udeb}.tmp > ${package_udeb}.bz2.tmp
# Replace original files with new ones
mv --backup -f ${package_udeb}.tmp ${package_udeb}
mv --backup -f ${package_udeb}.gz.tmp ${package_udeb}.gz
mv --backup -f ${package_udeb}.bz2.tmp ${package_udeb}.bz2
fi
# Generate release file
cd ${REPO_PATH}/dists/${SUITE}
echo "$release_header" > Release.tmp
# Generate hashes
c1=(MD5Sum: SHA1: SHA256: SHA512:)
c2=(md5 sha1 sha256 sha512)
i=0
while [ $i -lt ${#c1[*]} ]; do
echo ${c1[i]}
for hashme in `find ${SECTION} -type f \( -not -name "*~" -name "Package*" -o -name "Release*" \)`; do
ohash=`openssl dgst -${c2[$i]} ${hashme}`
chash="${ohash##* }"
size=`stat -c %s ${hashme}`
echo " ${chash} ${size} ${hashme}"
done
i=$(( $i + 1));
done >> Release.tmp
mv --backup -f Release.tmp Release