Browse Source

Support usage of a reprepro wrapper script via REPREPRO_CMD

Development sponsored by Sipwise GmbH, recorded as
MT#17089 in customers' ticket system.
tags/0.18.4
Michael Prokop 5 years ago
parent
commit
ea83f076e5
3 changed files with 28 additions and 19 deletions
  1. +11
    -8
      scripts/build-and-provide-package
  2. +4
    -1
      scripts/remove-reprepro-codename
  3. +13
    -10
      scripts/repository_checker

+ 11
- 8
scripts/build-and-provide-package View File

@@ -101,6 +101,9 @@ checks_and_defaults() {
echo "*** REPREPRO_OPTS is unset, using default: $REPREPRO_OPTS ***"
fi

# support usage of a reprepro wrapper
REPREPRO_CMD="${REPREPRO_CMD:-reprepro}"

if [ -z "${DEFAULT_REPOSITORY:-}" ] ; then
DEFAULT_REPOSITORY='/srv/repository'
fi
@@ -773,7 +776,7 @@ remove_packages() {
fi

echo "*** Removing source package version from repository ***"
${SUDO_CMD:-} reprepro -A source -b "${REPOSITORY}" ${REPREPRO_OPTS} remove "${REPOS}" "${SOURCE_PACKAGE}"
${SUDO_CMD:-} ${REPREPRO_CMD} -A source -b "${REPOSITORY}" ${REPREPRO_OPTS} remove "${REPOS}" "${SOURCE_PACKAGE}"

echo "*** Removing previous binary package versions from repository ***"
for p in $(list_deb_files "${WORKSPACE}/binaries/"*"_${newest_version}_${arch}.changes") ; do
@@ -797,10 +800,10 @@ remove_packages() {
elif echo "$file" | egrep -q '_all.deb$'; then
# note: "removesrc" would remove foreign arch files (of different builds)
echo "*** Removing existing package ${binpackage} from repository ${REPOS} (arch all) ***"
${SUDO_CMD:-} reprepro -b "${REPOSITORY}" ${REPREPRO_OPTS} remove "${REPOS}" "${binpackage}"
${SUDO_CMD:-} ${REPREPRO_CMD} -b "${REPOSITORY}" ${REPREPRO_OPTS} remove "${REPOS}" "${binpackage}"
else
echo "*** Removing existing package ${binpackage} from repository ${REPOS} for arch ${arch} ***"
${SUDO_CMD:-} reprepro -A "${arch}" -b "${REPOSITORY}" ${REPREPRO_OPTS} remove "${REPOS}" "${binpackage}"
${SUDO_CMD:-} ${REPREPRO_CMD} -A "${arch}" -b "${REPOSITORY}" ${REPREPRO_OPTS} remove "${REPOS}" "${binpackage}"
fi

done
@@ -827,7 +830,7 @@ remove_missing_binary_packages() {
;;
esac

for p in $(${SUDO_CMD:-} reprepro -b "${REPOSITORY}" ${REPREPRO_OPTS} --list-format '${package}\n' listmatched "${REPOS}" '*' | sort -u); do
for p in $(${SUDO_CMD:-} ${REPREPRO_CMD} -b "${REPOSITORY}" ${REPREPRO_OPTS} --list-format '${package}\n' listmatched "${REPOS}" '*' | sort -u); do
echo " $binary_list " | grep -q " $p " || missing_packages="${missing_packages:-} $p"
done

@@ -850,7 +853,7 @@ remove_missing_binary_packages() {
echo "*** Package '$p' listed in SKIP_PACKAGE_FROM_REMOVAL - skipping removal therefore ***"
else
echo "*** Removing $p from $REPOS to avoid out-of-date data ***"
${SUDO_CMD:-} reprepro -b "${REPOSITORY}" ${REPREPRO_OPTS} remove "${REPOS}" "${p}"
${SUDO_CMD:-} ${REPREPRO_CMD} -b "${REPOSITORY}" ${REPREPRO_OPTS} remove "${REPOS}" "${p}"
fi
done

@@ -875,7 +878,7 @@ reprepro_wrapper() {
esac

echo "*** Including packages in repository $REPOS ***"
${SUDO_CMD:-} reprepro -b "${REPOSITORY}" ${REPREPRO_OPTS} \
${SUDO_CMD:-} ${REPREPRO_CMD} -b "${REPOSITORY}" ${REPREPRO_OPTS} \
--ignore=wrongdistribution --ignore=uploaders --ignore=surprisingbinary \
include "${REPOS}" "${WORKSPACE}/binaries/"*"_${newest_version}"_${architecture}.changes
[ $? -eq 0 ] || bailout 1 "Error: Failed to include binary package in $REPOS repository."
@@ -956,7 +959,7 @@ trunk_release() {

${SUDO_CMD:-} generate-reprepro-codename "$TRUNK_RELEASE"

${SUDO_CMD:-} reprepro -b "${REPOSITORY}" ${REPREPRO_OPTS} --ignore=wrongdistribution copymatched "$TRUNK_RELEASE" "$REPOS" '*'
${SUDO_CMD:-} ${REPREPRO_CMD} -b "${REPOSITORY}" ${REPREPRO_OPTS} --ignore=wrongdistribution copymatched "$TRUNK_RELEASE" "$REPOS" '*'
[ $? -eq 0 ] || bailout 1 "Error: Failed to copy packages from ${REPOS} to ${TRUNK_RELEASE}."
fi
}
@@ -1037,7 +1040,7 @@ EOF

local old_dir=$(pwd)
cd "${REPOSITORY}/incoming/${release}"
${SUDO_CMD:-} reprepro -b "${REPOSITORY}" ${REPREPRO_OPTS} --ignore=wrongdistribution \
${SUDO_CMD:-} ${REPREPRO_CMD} -b "${REPOSITORY}" ${REPREPRO_OPTS} --ignore=wrongdistribution \
processincoming "${release}" "$(basename ${WORKSPACE}/binaries/*.changes)"
local RC=$?
cd "$old_dir"


+ 4
- 1
scripts/remove-reprepro-codename View File

@@ -35,6 +35,9 @@ if [ -z "${REPOSITORY:-}" ] ; then
echo "*** Repository variable REPOSITORY is unset, using default [$REPOSITORY] ***"
fi

# support usage of a reprepro wrapper
REPREPRO_CMD="${REPREPRO_CMD:-reprepro}"

if [ -z "${REPREPRO_OPTS:-}" ] ; then
REPREPRO_OPTS='--waitforlock 1000 -v'
fi
@@ -60,6 +63,6 @@ echo "*** Removing codename $codename from reprepro configuration in $REPOSITORY
perl -i -00 -pe "if (!\$done && m|$codename|) { \$_=q(); \$done++}" "${REPOSITORY}/conf/distributions"

echo "*** Removing vanished data from reprepro ***"
reprepro $REPREPRO_OPTS -b "$REPOSITORY" --delete clearvanished
${REPREPRO_CMD} $REPREPRO_OPTS -b "$REPOSITORY" --delete clearvanished

# vim:foldmethod=marker ts=2 ft=sh ai expandtab sw=2

+ 13
- 10
scripts/repository_checker View File

@@ -33,6 +33,9 @@ if [ -z "${REPOSITORY:-}" ] ; then
echo "*** Repository variable REPOSITORY is unset, using default [$REPOSITORY] ***"
fi

# support usage of a reprepro wrapper
REPREPRO_CMD="${REPREPRO_CMD:-reprepro}"

if [ -z "${REPREPRO_OPTS:-}" ] ; then
REPREPRO_OPTS='--waitforlock 1000 -v'
fi
@@ -126,20 +129,20 @@ validate-source-bin-versions() {
rc=0

for repository in $(awk '/^Codename: / {print $2}' "${REPOSITORY}"/conf/distributions 2>"${LOGFILE}") ; do
for sourcepackage in $(reprepro $REPREPRO_OPTS -A source -b "${REPOSITORY}" --list-format='${package}\n' list $repository 2>"${LOGFILE}") ; do
for sourcepackage in $(${REPREPRO_CMD} $REPREPRO_OPTS -A source -b "${REPOSITORY}" --list-format='${package}\n' list $repository 2>"${LOGFILE}") ; do
if $_opt_validate_skip_package && _skip_package "${SKIP_PACKAGE}" "$sourcepackage" ; then
echo "skipping: $sourcepackage"
continue
fi
sourceversion=$(reprepro $REPREPRO_OPTS -A source -b "${REPOSITORY}" --list-format='${version}\n' list $repository $sourcepackage 2>"${LOGFILE}")
for binarypackage in $(reprepro $REPREPRO_OPTS -b "${REPOSITORY}" --list-format='${package}\n' -T deb listfilter "$repository" "\$Source (==$sourcepackage)" 2>"${LOGFILE}") ; do
sourceversion=$(${REPREPRO_CMD} $REPREPRO_OPTS -A source -b "${REPOSITORY}" --list-format='${version}\n' list $repository $sourcepackage 2>"${LOGFILE}")
for binarypackage in $(${REPREPRO_CMD} $REPREPRO_OPTS -b "${REPOSITORY}" --list-format='${package}\n' -T deb listfilter "$repository" "\$Source (==$sourcepackage)" 2>"${LOGFILE}") ; do

if $_opt_validate_skip_package && _skip_package "${SKIP_PACKAGE}" "$binarypackage" ; then
echo "skipping: $binarypackage"
continue
fi

archversion=$(reprepro $REPREPRO_OPTS -A amd64 -b "${REPOSITORY}" --list-format='${version}\n' list $repository $binarypackage 2>"${LOGFILE}")
archversion=$(${REPREPRO_CMD} $REPREPRO_OPTS -A amd64 -b "${REPOSITORY}" --list-format='${version}\n' list $repository $binarypackage 2>"${LOGFILE}")

if $_opt_version_remove_epoch ; then
sourceversion=$(_remove_epoch $sourceversion)
@@ -256,32 +259,32 @@ fi

# main execution
if $_opt_list_packages ; then
reprepro ${REPREPRO_OPTS} -b "${REPOSITORY}" ls "${PACKAGE}"
${REPREPRO_CMD} ${REPREPRO_OPTS} -b "${REPOSITORY}" ls "${PACKAGE}"
bailout 0
fi

if $_opt_list_source_package ; then
reprepro ${REPREPRO_OPTS} -b "${REPOSITORY}" -A source ls "${PACKAGE}"
${REPREPRO_CMD} ${REPREPRO_OPTS} -b "${REPOSITORY}" -A source ls "${PACKAGE}"
bailout 0
fi

if $_opt_list_binary_package ; then
reprepro ${REPREPRO_OPTS} -b "${REPOSITORY}" -T deb ls "${PACKAGE}"
${REPREPRO_CMD} ${REPREPRO_OPTS} -b "${REPOSITORY}" -T deb ls "${PACKAGE}"
bailout 0
fi

if $_opt_list_repos ; then
reprepro ${REPREPRO_OPTS} -b "${REPOSITORY}" list "${REPOS}"
${REPREPRO_CMD} ${REPREPRO_OPTS} -b "${REPOSITORY}" list "${REPOS}"
bailout 0
fi

if $_opt_list_source_repos ; then
reprepro ${REPREPRO_OPTS} -b "${REPOSITORY}" -A source list "${REPOS}"
${REPREPRO_CMD} ${REPREPRO_OPTS} -b "${REPOSITORY}" -A source list "${REPOS}"
bailout 0
fi

if $_opt_list_binary_repos ; then
reprepro ${REPREPRO_OPTS} -b "${REPOSITORY}" -T deb list "${REPOS}"
${REPREPRO_CMD} ${REPREPRO_OPTS} -b "${REPOSITORY}" -T deb list "${REPOS}"
bailout 0
fi



Loading…
Cancel
Save