зеркало из https://github.com/microsoft/docker.git
add scripts to clean experimental rpms and debs
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
This commit is contained in:
Родитель
3dd01713d8
Коммит
9ca8386c57
|
@ -0,0 +1,43 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# This script cleans the experimental pool for the apt repo.
|
||||
# This is useful when there are a lot of old experimental debs and you only want to keep the most recent.
|
||||
#
|
||||
|
||||
: ${DOCKER_RELEASE_DIR:=$DEST}
|
||||
APTDIR=$DOCKER_RELEASE_DIR/apt/repo/pool/experimental
|
||||
: ${DOCKER_ARCHIVE_DIR:=$DEST/archive}
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
latest_versions=$(dpkg-scanpackages "$APTDIR" /dev/null 2>/dev/null | awk -F ': ' '$1 == "Filename" { print $2 }')
|
||||
|
||||
# get the latest version
|
||||
latest_docker_engine_file=$(echo "$latest_versions" | grep docker-engine)
|
||||
latest_docker_engine_version=$(basename ${latest_docker_engine_file%~*})
|
||||
|
||||
echo "latest docker-engine version: $latest_docker_engine_version"
|
||||
|
||||
# remove all the files that are not that version in experimental
|
||||
pool_dir=$(dirname "$latest_docker_engine_file")
|
||||
old_pkgs=( $(ls "$pool_dir" | grep -v "^${latest_docker_engine_version}" | grep "${latest_docker_engine_version%%~git*}") )
|
||||
|
||||
echo "${old_pkgs[@]}"
|
||||
|
||||
mkdir -p "$DOCKER_ARCHIVE_DIR"
|
||||
for old_pkg in "${old_pkgs[@]}"; do
|
||||
echo "moving ${pool_dir}/${old_pkg} to $DOCKER_ARCHIVE_DIR"
|
||||
mv "${pool_dir}/${old_pkg}" "$DOCKER_ARCHIVE_DIR"
|
||||
done
|
||||
|
||||
echo
|
||||
echo "$pool_dir now has contents:"
|
||||
ls "$pool_dir"
|
||||
|
||||
# now regenerate release files for experimental
|
||||
export COMPONENT=experimental
|
||||
source "${DIR}/update-apt-repo"
|
||||
|
||||
echo "You will now want to: "
|
||||
echo " - re-sign the repo with hack/make/sign-repo"
|
||||
echo " - re-generate index files with hack/make/generate-index-listing"
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# This script cleans the experimental pool for the yum repo.
|
||||
# This is useful when there are a lot of old experimental rpms and you only want to keep the most recent.
|
||||
#
|
||||
|
||||
: ${DOCKER_RELEASE_DIR:=$DEST}
|
||||
YUMDIR=$DOCKER_RELEASE_DIR/yum/repo/experimental
|
||||
|
||||
suites=( $(find "$YUMDIR" -mindepth 1 -maxdepth 1 -type d) )
|
||||
|
||||
for suite in "${suites[@]}"; do
|
||||
echo "cleanup in: $suite"
|
||||
( set -x; repomanage -k2 --old "$suite" | xargs rm -f )
|
||||
done
|
||||
|
||||
echo "You will now want to: "
|
||||
echo " - re-sign the repo with hack/make/sign-repo"
|
||||
echo " - re-generate index files with hack/make/generate-index-listing"
|
|
@ -0,0 +1,70 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# This script updates the apt repo in $DOCKER_RELEASE_DIR/apt/repo.
|
||||
# This script is a "fix all" for any sort of problems that might have occured with
|
||||
# the Release or Package files in the repo.
|
||||
# It should only be used in the rare case of extreme emergencies to regenerate
|
||||
# Release and Package files for the apt repo.
|
||||
#
|
||||
# NOTE: Always be sure to re-sign the repo with hack/make/sign-repos after running
|
||||
# this script.
|
||||
|
||||
: ${DOCKER_RELEASE_DIR:=$DEST}
|
||||
APTDIR=$DOCKER_RELEASE_DIR/apt/repo
|
||||
|
||||
# supported arches/sections
|
||||
arches=( amd64 i386 )
|
||||
|
||||
# Preserve existing components but don't add any non-existing ones
|
||||
for component in main testing experimental ; do
|
||||
if ls "$APTDIR/dists/*/$component" >/dev/null 2>&1 ; then
|
||||
components+=( $component )
|
||||
fi
|
||||
done
|
||||
|
||||
dists=( $(find "${APTDIR}/dists" -maxdepth 1 -mindepth 1 -type d) )
|
||||
|
||||
# override component if it is set
|
||||
if [ "$COMPONENT" ]; then
|
||||
components=( $COMPONENT )
|
||||
fi
|
||||
|
||||
# release the debs
|
||||
for version in "${dists[@]}"; do
|
||||
for component in "${components[@]}"; do
|
||||
codename="${version//debootstrap-}"
|
||||
|
||||
# update the filelist for this codename/component
|
||||
find "$APTDIR/pool/$component" \
|
||||
-name *~${codename#*-}*.deb > "$APTDIR/dists/$codename/$component/filelist"
|
||||
done
|
||||
done
|
||||
|
||||
# run the apt-ftparchive commands so we can have pinning
|
||||
apt-ftparchive generate "$APTDIR/conf/apt-ftparchive.conf"
|
||||
|
||||
for dist in "${dists[@]}"; do
|
||||
version=$(basename "$dist")
|
||||
for component in "${components[@]}"; do
|
||||
codename="${version//debootstrap-}"
|
||||
|
||||
apt-ftparchive \
|
||||
-o "APT::FTPArchive::Release::Codename=$codename" \
|
||||
-o "APT::FTPArchive::Release::Suite=$codename" \
|
||||
-c "$APTDIR/conf/docker-engine-release.conf" \
|
||||
release \
|
||||
"$APTDIR/dists/$codename" > "$APTDIR/dists/$codename/Release"
|
||||
|
||||
for arch in "${arches[@]}"; do
|
||||
apt-ftparchive \
|
||||
-o "APT::FTPArchive::Release::Codename=$codename" \
|
||||
-o "APT::FTPArchive::Release::Suite=$codename" \
|
||||
-o "APT::FTPArchive::Release::Component=$component" \
|
||||
-o "APT::FTPArchive::Release::Architecture=$arch" \
|
||||
-c "$APTDIR/conf/docker-engine-release.conf" \
|
||||
release \
|
||||
"$APTDIR/dists/$codename/$component/binary-$arch" > "$APTDIR/dists/$codename/$component/binary-$arch/Release"
|
||||
done
|
||||
done
|
||||
done
|
Загрузка…
Ссылка в новой задаче