Import Upstream version 119

This commit is contained in:
su-fang 2022-09-26 10:05:32 +08:00
commit 90f009dc10
92 changed files with 6824 additions and 0 deletions

5
.gitreview Normal file
View File

@ -0,0 +1,5 @@
[gerrit]
host=review.openstack.org
port=29418
project=openstack/deb-openstack-pkg-tools.git
defaultbranch=debian/newton

View File

@ -0,0 +1,37 @@
#!/bin/sh
# Author: Michal Arbet <michal.arbet@ultimum.io>
set -e
CONF=${1}
MISSING_OPTIONS=${3}
if [ -n "${2}" ] ; then
SECTION=${2}
else
SECTION=DEFAULT
fi
if ! [ -r "${CONF}" ] ; then
echo "Could not find ${CONF}"
exit 1
fi
if [ -r "${3}" ] ; then
# Calculate start and end of file before and after
# the section starts
SECTION_START=$(grep -n "^\[${SECTION}\]\$" ${CONF} | cut -d: -f1)
FILE_LEN=$(cat ${CONF} | wc -l)
END_OF_FILE=$(( ${FILE_LEN} - ${SECTION_START}))
TEMP=$(mktemp $(basename $0).XXXXXX)
head -n ${SECTION_START} ${CONF} >>${TEMP}
cat ${MISSING_OPTIONS} >>${TEMP}
tail -n ${END_OF_FILE} ${CONF} >>${TEMP}
mv ${TEMP} ${CONF}
else
echo "Could not find ${MISSING_OPTIONS} or not readable."
exit 1
fi

117
build-tools/pkgos-bb Executable file
View File

@ -0,0 +1,117 @@
#!/bin/sh
set -e
set -x
if ! [ -r /etc/pkgos/pkgos.conf ] ; then
echo "Could not read /etc/pkgos/pkgos.conf"
exit 1
else
. /etc/pkgos/pkgos.conf
fi
# Manage parameters of this script
usage () {
echo "Usage: $0 [-u] [-d <DISTRO>]"
echo " -u: Upload to the defined Debian repository"
echo " -d <DISTRO>: Define from which distro to backport"
exit 1
}
UPLOAD=no
SRC_DISTRO=sid
for i in $@ ; do
case ${1} in
"-u")
UPLOAD=yes
shift
;;
"-d")
if [ -z "${2}" ] || [ -z "${3}" ] ; then usage ; fi
SRC_DISTRO=${2}
shift
shift
;;
*)
;;
esac
done
if [ -z "${1}" ] ; then usage ; fi
PKG_NAME=${1}
# Double-guessing some stuffs
if [ `whoami` = "jenkins" ] ; then
BUILD_ROOT=/var/lib/jenkins/backports/${BUILD_NUMBER}
else
BUILD_ROOT=~/src/os-bpo
fi
# Get info from packages.debian.org
PKG_INFO_FILE=`mktemp -t pkg_info_file.XXXXXX`
wget --no-check-certificate -O ${PKG_INFO_FILE} http://packages.debian.org/${SRC_DISTRO}/${PKG_NAME}
if [ `lsb_release -i -s` = "Ubuntu" ] ; then
RMADURL="--url=http://qa.debian.org/madison.php"
else
RMADURL=""
fi
DEB_VERSION=`rmadison $RMADURL --suite=${SRC_DISTRO} ${PKG_NAME} | grep -E ' amd64| all' | awk '{print $3}'`
NO_EPOCH_DEB_VERSION=$(echo ${DEB_VERSION} | sed 's/^[[:digit:]]*://')
UPSTREAM_VERSION=`echo ${DEB_VERSION} | sed 's/-[^-]*$//' | cut -d":" -f2`
DSC_URL=`cat ${PKG_INFO_FILE} | grep dsc | cut -d'"' -f2`
rm ${PKG_INFO_FILE}
# Prepare build folder and go in it
MY_CWD=`pwd`
rm -rf ${BUILD_ROOT}/$PKG_NAME
mkdir -p ${BUILD_ROOT}/$PKG_NAME
cd ${BUILD_ROOT}/$PKG_NAME
# Download the .dsc and extract it
dget -d -u ${DSC_URL}
PKG_SRC_NAME=`ls *.dsc | cut -d_ -f1`
PKG_NAME_FIRST_CHAR=`echo ${PKG_SRC_NAME} | awk '{print substr($0,1,1)}'`
# Guess source package name using an ls of the downloaded .dsc file
DSC_FILE=`ls *.dsc`
DSC_FILE=`basename $DSC_FILE`
SOURCE_NAME=`echo $DSC_FILE | cut -d_ -f1`
# Rename the build folder if the source package name is different from binary
if ! [ "${PKG_NAME}" = "${SOURCE_NAME}" ] ; then
cd ..
rm -rf $SOURCE_NAME
mv $PKG_NAME $SOURCE_NAME
cd $SOURCE_NAME
fi
# Extract the source and make it a backport
dpkg-source -x *.dsc
cd ${SOURCE_NAME}-${UPSTREAM_VERSION}
dch --newversion ${DEB_VERSION}~${BPO_POSTFIX} -b --allow-lower-version --distribution ${TARGET_DISTRO}-backports -m "Rebuilt for ${TARGET_DISTRO}."
# Chech changelog
pkgos-check-changelog || true
# Build the package
sbuild
# Copy in the FTP repo
cd ..
rm ${SOURCE_NAME}_${NO_EPOCH_DEB_VERSION}~${BPO_POSTFIX}_amd64.build
TARGET_FTP_FOLDER=${REPO_ROOT}/debian/pool/${REPO_NOCHANGE_BACKPORT_DEST}/main/${PKG_NAME_FIRST_CHAR}/$SOURCE_NAME
rm -rf ${TARGET_FTP_FOLDER}
mkdir -p ${TARGET_FTP_FOLDER}
cp *bpo* *.orig.tar.* ${TARGET_FTP_FOLDER}
# Update the archive and the sbuild chroot
pkgos-scan-repo ${REPO_NOCHANGE_BACKPORT_DEST}
# Uploading to FTP
if [ "${UPLOAD}" = "yes" ] ; then
REMOTE_FOLDER=/home/ftp/debian/pool/${SCP_DEST_SUITE}/main/${PKG_NAME_FIRST_CHAR}/$SOURCE_NAME
ssh ${SCP_DEST_HOST} "mkdir -p ${REMOTE_FOLDER}"
scp *bpo* *.orig.tar.* ${SCP_DEST_HOST}:${REMOTE_FOLDER}
fi

129
build-tools/pkgos-bop Executable file
View File

@ -0,0 +1,129 @@
#!/bin/sh
# Build an OpenStack team's package and write it in /home/ftp
set -e
if ! [ -r /etc/pkgos/pkgos.conf ] ; then
echo "Could not read /etc/pkgos/pkgos.conf"
exit 1
else
. /etc/pkgos/pkgos.conf
fi
command_exists () {
type "$1" >/dev/null 2>&1
}
# Alias git-buildpackage
if ! command_exists git-buildpackage ; then
alias git-buildpackage="gbp buildpackage"
fi
# Some quick calculation
BPO_DISTRO_NUM=~bpo${TARGET_DISTRO_NUM}+1
cleanup_old_build () {
echo "===> Cleaning-up old builds"
rm -rf ../*.orig.tar.xz ../*.orig.tar.gz ../build-area
}
# Finds the current version of the package
get_deb_version() {
PKG_NAME=`dpkg-parsechangelog -SSource`
DEB_VERS=`dpkg-parsechangelog -SVersion`
NO_EPOC=`echo ${DEB_VERS} | cut -d":" -f2`
UPSTREAM_VERS=`echo ${NO_EPOC} | cut -d"-" -f1`
if [ "${DEB_VERS}" = "${UPSTREAM_VERS}" ] ; then IS_NATIVE="yes" ; else IS_NATIVE="no" ; fi
ORIG=${PKG_NAME}_${UPSTREAM_VERS}.orig.tar.xz
CHANGE=${PKG_NAME}_${NO_EPOC}_${ARCH}.changes
PKG_NAME_FIRST_CHAR=`echo ${PKG_NAME} | awk '{print substr($0,1,1)}'`
}
create_orig_tar () {
if grep pristine-tar debian/gbp.conf | grep -q -i true ; then
echo "===> Calling gbp export-orig to generate the tarball"
gbp export-orig
echo "===> Copying tarball in ../build-area"
mkdir -p ../build-area
cp ../*.orig.tar.* ../build-area
else
if [ "${IS_NATIVE}" = "no" ] ; then
COMPRESSION_TYPE=xz
if [ -r debian/gbp.conf ] ; then
COMPRESSION_IN_FILE=`cat debian/gbp.conf | grep compression | cut -d'=' -f2 | awk '{print $1}'`
if [ "${COMPRESSION_IN_FILE}" = "gz" ] ; then
COMPRESSION_TYPE=gz
elif [ "${COMPRESSION_IN_FILE}" = "bzip2" ] ; then
COMPRESSION_TYPE=bzip2
fi
fi
if [ "${COMPRESSION_TYPE}" = "gz" ] ; then
./debian/rules gen-orig-gz
elif [ "${COMPRESSION_TYPE}" = "bzip2" ] ; then
./debian/rules gen-orig-bz2
else
./debian/rules gen-orig-xz
fi
fi
fi
}
bop_it () {
echo "===> Building using git-buildpackage"
LAST_GIT_COMMIT=`git log | head -n 1 | awk '{print $2}'`
dch --newversion ${DEB_VERS}${BPO_DISTRO_NUM} -b --allow-lower-version -m "Rebuilt by bop."
git commit debian/changelog -m "Rebuilt by bop."
pkgos-check-changelog || true
if [ "${PKGOS_RUN_UNIT_TESTS_AT_BUILD}" = "no" ] ; then
if ! DEB_BUILD_OPTIONS=nocheck git-buildpackage ; then
git reset --hard ${LAST_GIT_COMMIT}
echo "There was an error when bop called git-buildpackage: exiting."
exit 1
else
git reset --hard ${LAST_GIT_COMMIT}
fi
else
if ! git-buildpackage ; then
git reset --hard ${LAST_GIT_COMMIT}
echo "There was an error when bop called git-buildpackage: exiting."
exit 1
else
git reset --hard ${LAST_GIT_COMMIT}
fi
fi
}
test_the_package () {
echo "===> Lintian"
lintian -I -E --pedantic --profile debian/openstack ../build-area/*.changes
if [ x"$RUN_AUTOPKGTEST" = x"yes" ] ; then
echo "===> Autopkgtest"
set +e
adt-run ../build-area/*.changes --- schroot "$AUTOPKGTEST_SCHROOT"
RET=$?
if [ $RET != 0 ] && [ $RET != 8 ] ; then
echo "adt-run failed: $RET"
exit $RET
fi
set -e
fi
}
copy_to_ftparchive () {
echo "===> Copying to the FTP repo"
rm ../build-area/${PKG_NAME}_${NO_EPOC}${BPO_DISTRO_NUM}_*.build
TARGET_FOLDER=${REPO_ROOT}/debian/pool/${TARGET_DISTRO}-${TARGET_OPENSTACK_REL}-backports/main/${PKG_NAME_FIRST_CHAR}/${PKG_NAME}
rm -rf ${TARGET_FOLDER}
mkdir -p ${TARGET_FOLDER}
cp ../build-area/* ${TARGET_FOLDER}
}
cleanup_old_build
get_deb_version
create_orig_tar
bop_it
#test_the_package
copy_to_ftparchive
# Scan the repo to add the new package
pkgos-scan-repo

188
build-tools/pkgos-bop-jenkins Executable file
View File

@ -0,0 +1,188 @@
#!/bin/sh
set -e
set -x
. /etc/pkgos/pkgos.conf
PKG_NAME=${1}
SUBGROUP=${2}
ARCH=i386 ; if [ `uname -m` = "x86_64" ] ; then ARCH=amd64 ; fi
if ! [ `whoami` = "root" ] ; then SU=sudo ; fi
#################################
# Define some utility functions #
#################################
# Is the package from the pkgs-js group?
is_pkg_js () {
ISPKGJS="no"
for i in $PKG_JS ; do
if [ "${i}" = "${PKG_NAME}" ] ; then
ISPKGJS="yes"
fi
done
}
# Is the package maintained on a debian/<openstack-release-name> branch?
is_core () {
ISCORE="no"
for i in $OSTACK_PKGS ; do
if [ "${i}" = "${PKG_NAME}" ] ; then
ISCORE="yes"
return
fi
done
}
# Is the package maintained on a debian/experimental branch?
is_experi () {
ISEXPERI="no"
for i in ${EXPERIMENTAL_BRANCH} ; do
if [ "${i}" = "${PKG_NAME}" ] ; then
ISEXPERI="yes"
return
fi
done
}
is_server () {
ISSERVER="no"
for i in ${SERVERS} ; do
if [ "${i}" = "${PKG_NAME}" ] ; then
ISSERVER="yes"
return
fi
done
}
# Get some version information out of the debian/changelog last entry
get_deb_version() {
PKG_NAME=`dpkg-parsechangelog -SSource`
DEB_VERS=`dpkg-parsechangelog -SVersion`
NO_EPOC=`echo ${DEB_VERS} | cut -d":" -f2`
if echo ${DEB_VERS} | grep -q ':' ; then
EPOC=`echo ${DEB_VERS} | cut -d":" -f1`
fi
UPSTREAM_VERS=`echo ${NO_EPOC} | cut -d"-" -f1`
if [ "${DEB_VERS}" = "${UPSTREAM_VERS}" ] ; then IS_NATIVE="yes" ; else IS_NATIVE="no" ; fi
ORIG=${PKG_NAME}_${UPSTREAM_VERS}.orig.tar.xz
CHANGE=${PKG_NAME}_${NO_EPOC}_${ARCH}.changes
PKG_NAME_FIRST_CHAR=`echo ${PKG_NAME} | awk '{print substr($0,1,1)}'`
}
##############################
# Start of the actual script #
##############################
MY_CWD=`pwd`
# Go in the build dir and make sure it's cleaned
BUILD_ROOT=/var/lib/jenkins/jobs/${PKG_NAME}/builds/${BUILD_NUMBER}
rm -rf ${BUILD_ROOT}/$PKG_NAME
mkdir -p ${BUILD_ROOT}/$PKG_NAME
cd ${BUILD_ROOT}/$PKG_NAME
# "git clone" the package from the correct repo (either pkg-javascript or openstack)
is_pkg_js
if [ "${ISPKGJS}" = "yes" ] ; then
git clone ${CLONE_URL_PKGJS}/${PKG_NAME}.git
else
if [ -n "${SUBGROUP}" ] ; then
git clone ${CLONE_URL_BASE}/${SUBGROUP}/${PKG_NAME}.git
else
git clone ${CLONE_URL_BASE}/${PKG_NAME}.git
fi
fi
cd $PKG_NAME
# Checkout the correct branch(es) before building
PRIS=$(grep pristine-tar debian/gbp.conf | awk '{print $1}')
if [ "${PRIS}" = "pristine-tar" ] ; then
PRIS_VAL=$(grep pristine-tar debian/gbp.conf | cut -d'=' -f2 | awk '{print $1}')
if [ "${PRIS_VAL}" = "False" ] ; then
PRIS="none"
fi
fi
if [ "${PRIS}" = "pristine-tar" ] ; then
# Guess the upstream-branch and debian-branch reading gbp.conf
PRIS_UPSTREAM_BRANCH=$(grep upstream-branch debian/gbp.conf | cut -d'=' -f2 | awk '{print $1}')
PRIS_DEBIAN_BRANCH=$(grep debian-branch debian/gbp.conf | cut -d'=' -f2 | awk '{print $1}')
if [ -z "${PRIS_DEBIAN_BRANCH}" ] ; then
PRIS_DEBIAN_BRANCH=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
fi
# If it's a pristine-tar package, checkout the pristine-tar and upstream-unstable branches
git checkout -b pristine-tar origin/pristine-tar
git checkout -b ${PRIS_UPSTREAM_BRANCH} origin/${PRIS_UPSTREAM_BRANCH}
is_experi
if [ "${ISEXPERI}" = "yes" ] ; then
git checkout -b debian-experimental origin/debian-experimental
else
git checkout ${PRIS_DEBIAN_BRANCH}
fi
get_deb_version
else
is_core
if [ "${ISCORE}" = "yes" ] ; then
# If it's a core package, listed in OSTACK_PKGS in /etc/pkgos/pkgos.conf
# then we use debian/juno, debian/kilo, etc. as packaging branch.
git checkout -b debian/${TARGET_OPENSTACK_REL} origin/debian/${TARGET_OPENSTACK_REL} || true
if [ "${BUILD_FROM_TRUNK}" = "yes" ] ; then
is_server
if [ "${ISSERVER}" = "yes" ] ; then
# Get the master branch
./debian/rules get-master-branch
git checkout master
# Calculate a new tag
GIT_SHA256_FULL=`git log | head -n1 | cut -d' ' -f2`
GIT_SHA256=`echo ${GIT_SHA256_FULL} | awk '{print substr($0,0,10)}'`
DATETIME=`date +%F | sed s/-/./g`.`date +%T | sed s/:/./g`
UPSTREAM_NEW_TAG=`echo ${UPSTREAM_VERS} | sed s/~/_/`+git${DATETIME}.${GIT_SHA256}
UPSTREAM_NEW_VERSION=${UPSTREAM_VERS}+git${DATETIME}.${GIT_SHA256}
# Tag it
git tag ${UPSTREAM_NEW_TAG}
# Get back to our original Debian packaging branch, merge the tag
git checkout -b debian/${TARGET_OPENSTACK_REL}
git merge -X theirs ${UPSTREAM_NEW_TAG}
# and fix the debian/changelog with a new entry
if [ -n "${EPOC}" ] ; then
NEW_DEBVERSION="${EPOC}:"
fi
NEW_DEBVERSION=${NEW_DEBVERSION}${UPSTREAM_NEW_VERSION}-1
dch --newversion ${NEW_DEBVERSION} -b --allow-lower-version --distribution unstable -m "New upstream release based on commit ${GIT_SHA256_FULL}."
git commit debian/changelog -m "New upstream release based on commit ${GIT_SHA256_FULL}."
fi
fi
else
# If it's listed as EXPERIMENTAL_BRANCH in /etc/pkgos/pkgos.conf, then we
# use debian/experimental branch.
is_experi
if [ "${ISEXPERI}" = "yes" ] ; then
CURBRANCH=`git branch | grep '*' | cut -d' ' -f2`
if [ "${CURBRANCH}" = "debian/experimental" ] ; then
echo "Already on debian/experimental"
else
git checkout -b debian/experimental origin/debian/experimental
fi
else
git checkout debian/${TARGET_OPENSTACK_REL} || true
# git checkout -b ${DEBIAN_BRANCH} origin/${DEBIAN_BRANCH} || true
fi
fi
get_deb_version
# Generate the .orig.tar.xz using git archive...
if [ "${IS_NATIVE}" = "no" ] ; then
./debian/rules gen-orig-xz
fi
fi
# Build the package using sbuild (see that script, which can be used
# in your own laptop if you don't want to use jenkins...)
echo "calling pkgos-bop from "`pwd`
pkgos-bop

View File

@ -0,0 +1,69 @@
#!/bin/sh
set -e
set -x
PKGOS_USE_PY2=yes
PKGOS_USE_PY3=yes
PKGOS_IN_TMP=no
for i in $@ ; do
case "${1}" in
"--no-py3")
PKGOS_USE_PY3=no
shift
;;
"--no-py2")
PKGOS_USE_PY2=no
shift
;;
"--in-tmp")
PKGOS_IN_TMP=yes
shift
;;
*)
;;
esac
done
SRC_PKG_NAME=$(dpkg-parsechangelog -SSource)
PY_MODULE_NAME=$(echo ${SRC_PKG_NAME} | sed s/python-//)
if [ "${PKGOS_USE_PY2}" = "yes" ] ; then
PYTHONS=$(pyversions -vr 2>/dev/null)
fi
if [ "${PKGOS_USE_PY3}" = "yes" ] ; then
PYTHON3S=$(py3versions -vr 2>/dev/null)
fi
if [ "${PKGOS_USE_PY2}" = "yes" ] ; then
for pyvers in ${PYTHONS}; do
python${pyvers} setup.py install --install-layout=deb --root $(pwd)/debian/python-${PY_MODULE_NAME}
done
fi
if [ "${PKGOS_USE_PY3}" = "yes" ] ; then
if [ "${PKGOS_IN_TMP}" = "yes" ] ; then
TARGET_DIR=tmp
else
TARGET_DIR=python3-${PY_MODULE_NAME}
fi
for pyvers in ${PYTHON3S}; do
python${pyvers} setup.py install --install-layout=deb --root $(pwd)/debian/${TARGET_DIR}
done
fi
rm -rf $(pwd)/debian/python*/usr/lib/python*/dist-packages/*.pth
rm -rf $(pwd)/debian/tmp/usr/lib/python*/dist-packages/*.pth
# Move the files as python<PYVERSINO>-foo if we're packaging for both Py2 and Py3
# otherwise, leave the file as-is.
if [ -d $(pwd)/debian/python-${PY_MODULE_NAME}/usr/bin ] ; then
for i in $(pwd)/debian/python-${PY_MODULE_NAME}/usr/bin/* ; do
SCRIPT_NAME=$(basename ${i})
if [ "${PKGOS_USE_PY2}" = "yes" ] ; then
mv $(pwd)/debian/python-${PY_MODULE_NAME}/usr/bin/${SCRIPT_NAME} $(pwd)/debian/python-${PY_MODULE_NAME}/usr/bin/python2-${SCRIPT_NAME}
fi
if [ "${PKGOS_USE_PY3}" = "yes" ] ; then
mv $(pwd)/debian/python3-${PY_MODULE_NAME}/usr/bin/${SCRIPT_NAME} $(pwd)/debian/python3-${PY_MODULE_NAME}/usr/bin/python3-${SCRIPT_NAME}
fi
done
fi

107
build-tools/pkgos-dh_auto_test Executable file
View File

@ -0,0 +1,107 @@
#!/bin/sh
set -e
set -x
# Config vars
PKGOS_USE_PY2=yes
PKGOS_USE_PY3=yes
PKGOS_TEST_PARALLEL=yes
PKGOS_TEST_SERIAL=no
# Vars used in commands
PYTHONS=disabled
PYTHON3S=disabled
TEST_PARALLEL_OPT="--parallel"
TEST_SERIAL_OPT=""
for i in $@ ; do
case "${1}" in
"--no-py3")
PKGOS_USE_PY3=no
shift
;;
"--no-py2")
PKGOS_USE_PY2=no
shift
;;
"--no-parallel")
PKGOS_TEST_PARALLEL=no
shift
;;
"--serial")
PKGOS_TEST_SERIAL=yes
PKGOS_TEST_PARALLEL=no
shift
;;
*)
;;
esac
done
if [ "${PKGOS_USE_PY2}" = "yes" ] ; then
PYTHONS=2.7
fi
if [ "${PKGOS_USE_PY3}" = "yes" ] ; then
PYTHON3S=$(py3versions -vr 2>/dev/null)
fi
if [ "${PKGOS_TEST_PARALLEL}" = "no" ] ; then
TEST_PARALLEL_OPT=""
fi
if [ "${PKGOS_TEST_SERIAL}" = "yes" ] ; then
TEST_SERIAL_OPT="--serial"
fi
for pyvers in ${PYTHONS} ${PYTHON3S}; do
if [ "${pyvers}" = "disabled" ] ; then
continue
fi
PYMAJOR=$(echo ${pyvers} | cut -d'.' -f1)
echo "===> Testing with python${pyers} (python${PYMAJOR})"
if [ "${PYMAJOR}" = "3" ] ; then
if [ -d `pwd`/debian/tmp/usr/lib/python3/dist-packages ] && [ -z "${PYTHONPATH}" ] ; then
export PYTHONPATH=`pwd`/debian/tmp/usr/lib/python3/dist-packages
fi
elif [ "${PYMAJOR}" = "2" ] ; then
if [ -d `pwd`/debian/tmp/usr/lib/python2.7/dist-packages ] && [ -z "${PYTHONPATH}" ] ; then
export PYTHONPATH=`pwd`/debian/tmp/usr/lib/python2.7/dist-packages
fi
fi
if [ -e .stestr.conf ] ; then
if [ -x /usr/bin/python${PYMAJOR}-stestr ] ; then
STESTR=/usr/bin/python${PYMAJOR}-stestr
else
STESTR=stestr
fi
rm -rf .stestr
if ! PYTHON=python${pyvers} ${STESTR} run ${TEST_SERIAL_OPT} ${TEST_PARALLEL_OPT} --subunit $@ | subunit2pyunit ; then
echo "======> STESTR TEST SUITE FAILED FOR python${pyvers}: displaying pip3 freeze output..."
if [ -x /usr/bin/pip3 ] ; then
pip3 freeze
fi
exit 1
fi
${STESTR} slowest
rm -rf .stestr
elif [ -e .testr.conf ] ; then
if [ -x /usr/bin/testr-python${PYMAJOR} ] ; then
TESTR=/usr/bin/testr-python${PYMAJOR}
else
TESTR=testr
fi
rm -rf .testrepository
${TESTR} init
TEMP_REZ=$(mktemp -t)
if ! PYTHON=python${pyvers} ${TESTR} run ${TEST_SERIAL_OPT} ${TEST_PARALLEL_OPT} --subunit $@ | tee ${TEMP_REZ} | subunit2pyunit ; then
echo "======> TESTR TEST SUITE FAILED FOR python${pyvers}: displaying pip3 freeze output..."
if [ -x /usr/bin/pip3 ] ; then
pip3 freeze
fi
exit 1
fi
cat ${TEMP_REZ} | subunit-filter -s --no-passthrough | subunit-stats
rm -f ${TEMP_REZ}
${TESTR} slowest
rm -rf .testrepository
fi
done

View File

@ -0,0 +1,14 @@
#!/bin/bash
set -e
rm -f dist/*
python3 setup.py sdist
package=$(cd dist; ls -1 *.tar.gz)
version=$(echo $package | sed -e "s/\.tar\.gz//" -e "s/.*-//g")
deb_version=$(echo $version | sed -e "s/\.0a/~a/" -e "s/\.0b/~b/" -e "s/\.dev/~dev/")
pkg_name=$(echo $package | sed -e 's/\(.*\)-.*/\1/')
mkdir -p ~/tarballs
mv dist/$package ~/tarballs/${pkg_name}_${deb_version}.orig.tar.gz
echo "Snapshot placed under ~/tarballs/${pkg_name}_${deb_version}.orig.tar.gz"

161
build-tools/pkgos-infra-build-pkg Executable file
View File

@ -0,0 +1,161 @@
#!/bin/sh
set -e
set -x
detect_distro () {
DISTRO_VENDOR=$(lsb_release --id -s | awk '{print tolower($0)}')
DISTRO_NAME=$(lsb_release -c -s)
}
# Get some version information out of the debian/changelog last entry
get_deb_version() {
PKG_NAME=$(dpkg-parsechangelog -SSource)
DEB_VERS=$(dpkg-parsechangelog -SVersion)
NO_EPOC=$(echo ${DEB_VERS} | cut -d":" -f2)
if echo ${DEB_VERS} | grep -q ':' ; then
EPOC=$(echo ${DEB_VERS} | cut -d":" -f1)
fi
UPSTREAM_VERS=$(echo ${NO_EPOC} | cut -d"-" -f1)
if [ "${DEB_VERS}" = "${UPSTREAM_VERS}" ] ; then IS_NATIVE="yes" ; else IS_NATIVE="no" ; fi
ORIG=${PKG_NAME}_${UPSTREAM_VERS}.orig.tar.xz
CHANGE=${PKG_NAME}_${NO_EPOC}_${ARCH}.changes
PKG_NAME_FIRST_CHAR=$(echo ${PKG_NAME} | awk '{print substr($0,1,1)}')
}
calc_bpo_version () {
case ${DISTRO_NAME} in
jessie)
BPO_DISTRO_NUM="~bpo8+1"
;;
stretch)
BPO_DISTRO_NUM="~bpo9+1"
;;
buster)
BPO_DISTRO_NUM="~bpo10+1"
;;
sid)
BPO_DISTRO_NUM=""
;;
trusty)
BPO_DISTRO_NUM="~bpo14.04+1"
;;
xenial)
BPO_DISTRO_NUM="~bpo16.04+1"
;;
*)
echo "Distribution not supported!"
echo "Falling back to no changelog bpo version tag"
BPO_DISTRO_NUM=""
;;
esac
}
create_orig_tarball () {
if grep pristine-tar debian/gbp.conf | grep -q -i true ; then
echo "Nothing special to do with Pristine tar: not generating orig file!"
else
if [ "${IS_NATIVE}" = "no" ] ; then
GENORIG_DEBRULES_TARGET=gen-orig-xz
if [ -r debian/gbp.conf ] ; then
COMPRESSION_IN_FILE=$(cat debian/gbp.conf | grep compression | cut -d'=' -f2 | awk '{print $1}')
if [ "${COMPRESSION_IN_FILE}" = "gz" ] ; then
GENORIG_DEBRULES_TARGET=gen-orig-gz
elif [ "${COMPRESSION_IN_FILE}" = "bzip2" ] ; then
GENORIG_DEBRULES_TARGET=gen-orig-bz2
fi
fi
./debian/rules ${GENORIG_DEBRULES_TARGET}
fi
fi
}
detect_branch_name () {
PACKAGING_BRANCH_NAME=$(grep debian-branch debian/gbp.conf | cut -d= -f2 | awk '{print $1}')
}
build_backport_package () {
echo "===> Building using git-buildpackage"
# Edit debian/changelog to show we're building a backport
LAST_GIT_COMMIT=$(git log | head -n 1 | awk '{print $2}')
NUM_COMMITS_FROM_LAST_TAG=$(git rev-list --no-merges $(git describe --no-abbrev --candidates=1)..HEAD | wc -l)
DEBFULLNAME="Jenkins" DEBEMAIL=jenkins@openstack.org dch --newversion ${DEB_VERS}+${NUM_COMMITS_FROM_LAST_TAG}${BPO_DISTRO_NUM} -b --allow-lower-version -m "Backport rebuilt by Jenkins in OpenStack infra."
git commit debian/changelog -m "Backport rebuilt by Jenkins in OpenStack infra."
git checkout -B ${PACKAGING_BRANCH_NAME}
#
echo "Checking /etc/passwd and /etc/group just to please clarkb"
cat /etc/group | grep sbuild
cat /etc/passwd | grep sbuild
echo "Now attempting to build with sbuild"
# Create ssh key
if ! [ -e ~/.ssh/id_rsa ] ; then
ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
fi
# Copy it to authorized_keys
cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys2
# Build the package with gbp buildpackage
echo "===> Building with gbp buildpackage from ${WORKSPACE}"
if [ "${IS_NATIVE}" = "no" ] ; then
SAFLAG=" --force-orig-source"
else
SAFLAG=""
fi
echo "===> Building with gbp buildpackage from ${WORKSPACE}"
if ! ssh -o "StrictHostKeyChecking no" localhost "cd ${WORKSPACE} ; gbp buildpackage${SAFLAG}" ; then
git reset --hard ${LAST_GIT_COMMIT}
echo "Error building the package with gbp buildpackage: exiting."
exit 1
else
git reset --hard ${LAST_GIT_COMMIT}
fi
}
lintian_test_the_package () {
echo "===> Starting Lintian check"
lintian -I -E --pedantic --suppress-tags bad-distribution-in-changes-file --suppress-tags privacy-breach-uses-embedded-file ../build-area/*.changes
}
prepare_for_upload () {
# When we switch to zuul v3, we can use this:
#UPDIR=../uploads
# Until then, we must stay in the WORKSPACE
UPDIR=uploads
mkdir -p ${UPDIR}/${LAST_GIT_COMMIT}
cp ../build-area/* ${UPDIR}/${LAST_GIT_COMMIT}
rm ${UPDIR}/${LAST_GIT_COMMIT}/*.build
cp -auxf ../build-area .
lintian -I -E --pedantic --suppress-tags bad-distribution-in-changes-file ../build-area/*.changes
}
prepare_for_upload () {
# When we switch to zuul v3, we can use this:
#UPDIR=../uploads
# Until then, we must stay in the WORKSPACE
UPDIR=uploads
mkdir -p ${UPDIR}/${LAST_GIT_COMMIT}
cp ../build-area/* ${UPDIR}/${LAST_GIT_COMMIT}
rm ${UPDIR}/${LAST_GIT_COMMIT}/*.build
cp -auxf ../build-area .
}
# We need this because we don't re-login, and
# sbuild has just been installed:
newgrp - sbuild
# Then we can start...
detect_distro
calc_bpo_version
get_deb_version
create_orig_tarball
detect_branch_name
build_backport_package
lintian_test_the_package
prepare_for_upload

View File

@ -0,0 +1,614 @@
#!/bin/sh
# This script installs a building environment using sbuild as a
# builder for the "gbp buildpackage" command line. The sbuild
# chroot uses an union FS (ie: AUFS in Jessie and Trusty,
# OverlayFS on newer kernels) as this is the fastest backend,
# and that unionFS scratch disk is stored on tmpfs, as this
# is the fastest way to run sbuild.
# Author: Thomas Goirand <zigo@debian.org>
# License: Apache-2.0
set -e
set -x
OSTACK_RELEASE=newton
BUILDER_SYS_USERNAME="jenkins"
BUILDER_HOMEDIR=/home/jenkins
GITREPO_ROOT=${WORKSPACE}
DISTRO_VENDOR=$(lsb_release --id -s | awk '{print tolower($0)}')
HOST_DISTRO_NAME=$(lsb_release -c -s)
####################
# Parse parameters #
####################
# There's 3 OS name concept concepts here:
# HOST_DISTRO_NAME: the os of the host (example: jessie, xenial)
# SBUILD_CHROOT_DISTRO_NAME: the name of the distro to setup in the chroot (example: jessie, xenial)
# SBUILD_CHROOT_NAME: the name of the chroot we want to setup (example: jessie-newton or jessie-newton-backports)
DO_EXIT="no"
for i in $@ ; do
case "${1}" in
"--sbuild-chroot-name")
if [ -z "${2}" ] ; then echo "Parameter for option --sbuild-chroot-name is missing" > /dev/stderr ; DO_EXIT="yes" ; fi
SBUILD_CHROOT_NAME="${2}"
shift
shift
;;
"--sbuild-chroot-distro-name")
if [ -z "${2}" ] ; then echo "Parameter for option --sbuild-chroot-distro-name is missing" > /dev/stderr ; DO_EXIT="yes" ; fi
SBUILD_CHROOT_DISTRO_NAME="${2}"
shift
shift
;;
esac
done
if [ -z "${SBUILD_CHROOT_NAME}" ] ; then
SBUILD_CHROOT_NAME="${HOST_DISTRO_NAME}-${OSTACK_RELEASE}"
fi
if [ -z "${SBUILD_CHROOT_DISTRO_NAME}" ] ; then
SBUILD_CHROOT_DISTRO_NAME=${HOST_DISTRO_NAME}
fi
if [ ${DO_EXIT} = "yes" ] ; then
echo "Parameters not validated: will exit now!" > /dev/stderr
exit 1
fi
########################
# End parse parameters #
########################
# Some configuration stuff
CLOSEST_DEBIAN_MIRROR=http://deb.debian.org/debian
PATH=/usr/bin:/usr/sbin:/bin:/sbin
APT="DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends"
detect_distro () {
DISTRO_VENDOR=$(lsb_release --id -s | awk '{print tolower($0)}')
DISTRO_NAME=$(lsb_release -c -s)
}
disable_init_start () {
TMPFILE=$(mktemp)
echo "#!/bin/sh
exit 101
" >${TMPFILE}
sudo cp ${TMPFILE} /usr/sbin/policy-rc.d
sudo chmod +x /usr/sbin/policy-rc.d
rm ${TMPFILE}
}
enable_init_start () {
sudo rm -f /usr/sbin/policy-rc.d
}
# This gives the closest mirror in the current cloud where we're building
calculate_nodepool_mirror_host () {
if ! [ -r /etc/nodepool/provider ] ; then
echo "Could not read /etc/nodepool/provider"
exit 1
else
. /etc/nodepool/provider
NODEPOOL_MIRROR_HOST=${NODEPOOL_MIRROR_HOST:-mirror.$NODEPOOL_REGION.$NODEPOOL_CLOUD.openstack.org}
NODEPOOL_MIRROR_HOST=$(echo $NODEPOOL_MIRROR_HOST|tr '[:upper:]' '[:lower:]')
fi
}
# This is needed to install the backported version of dpkg
add_bpo_repo_to_host () {
calculate_nodepool_mirror_host
echo "deb http://${NODEPOOL_MIRROR_HOST}/debian-openstack jessie-newton-backports main
deb-src http://${NODEPOOL_MIRROR_HOST}/debian-openstack jessie-newton-backports main
" >/tmp/jessie-newton-backports.list
sudo cp /tmp/jessie-newton-backports.list /etc/apt/sources.list.d/jessie-newton-backports.list
# Add the repo key
echo "-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: GPGTools - https://gpgtools.org
mQENBFgbrv4BCADK/pHoOwW+CVPYSJLjhMIOJ3Ef981pDw2TEL/t0L2L7cNYuYfc
dx3G/kCZ0NBjHAXw6rkkFuGsXG6HDJ1TRKQTtdSqjFtI9/22xaGO6OE20BOQmhVF
m8xnJ4ie9TpebH+y4OZqgKq7E9MByYZkqFWZZwpkmxUO5C+KuSIrZnyDUD+715Kr
kmnpr1VAEP2IUA4dbvp4/DMDK6Ny7cptlxjwQbKTGIXRxMFNIzlQRDS3Ex6eiW2N
kX2nHCn4BBffNB2PhUBsuF3hEEOT2nIj91NUKY8DvGm5m3mgxz1BgUJ4nelTMedy
wXyL8HVUMMjdT8OUagjXyyymo0UK4RIDdLJ1ABEBAAG0OE9wZW5TdGFjayBJbmZy
YSAoT2NhdGEgQ3ljbGUpIDxpbmZyYS1yb290QG9wZW5zdGFjay5vcmc+iQEcBBAB
CAAGBQJYK6SJAAoJEA77lD6eDAE8Yt4IAMH2tT6wfcrEg/tZwwNl45+aTp1aAmXl
JMdGOQDILCP+5KtNTYLMR6AxSZ88UthA7BESg3uNkQXaMdoWlN8quat5FYQyIlAb
POJ0ywQiW4zE1bgaPi2F7dJ0xSER723Qf6XAYQP1oz0Aj+70dayqnTRcA86t6YaZ
4hYWLO/xE+J3hNoWamVEBUo4be5vYQ0FG3tXAQpa7VgDJkpI/Kc37Ny8UtPAODUY
vcYlOriD35mWsqR0u4A9ySd0u9G0qsQN1EwyN0yQh9H8oIE2VQicuqVGShV7t09K
UCfPsz2iaOiyNQaJrlVPi3Ohx7ZM7JjLGDsI2u9aXsHBZhh3JRmvWLmJARwEEwEI
AAYFAlgzTkgACgkQO20GoMQoQ3qr9Qf/RTbpqH7yvF32hEROc3mlkjydXO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47BJRS
uCi/nUkJETF6do6wvIqOWfk/jy7o0BPbuhge63yvNbNQZphO9kkIeyHSR+Traor7
sxfuRvOXK5oD+ayimeKlH2IX6Ls4bAm3LTg6v9iwylgcv6Zieydljtsw+RRzdIZJ
DTKvxjkrHHsi5WZGzzTHNt3za6g21agcOt9ZAe3hHAF65+zOm5Fas9nAV/IFqMNL
HcjH9ZmB4+fupaCcMrPbuFR1t0I6Udt3vab5/xf0nG2c9NUj8rzVYkS7gWVdxbhC
BNW6cr1y/W4b7epi5eZZFBLyiXy1ttizTZ3g0E5oLYfge69lxpolSSU0++eTbxqH
cgf/ahzLYoH1Y0eKmZ18k/9uwOKLW/2geey8K5a6XdC0lB8t6XCDz2XD+KVZMge1
xgcKDGptc3xj/hjf+1yHX78yqnK1+DNooBxyvtQZPOOQ3bIrzSsjs0jFJxt6XMF0
seegZtd2V1CM6TmQQs8gdFhiXGN7O9XbdhbxWEflY8HCG6MqwhFkf34YVe9KXy+h
oAC7Ej+rjB0pDzz723tgogtZJaL3dfACaXdO8fCy/3bmvPa/g2Ams8fsPxNNa0To
jtJzV/IDwL4gD13EWuCYnGy6YecLNvkugznb5oWBkwx6Vkhm+C9Y8oEP+3OTGh/j
xZwrZrFZAkLQ6kEKphyVA5imSQ==
=sQCo
-----END PGP PUBLIC KEY BLOCK-----" >/tmp/repo-key.gpg
sudo apt-key add /tmp/repo-key.gpg
rm /tmp/repo-key.gpg
sudo apt-get update
}
install_all_software () {
local PKGOS_INFRA_BUILD_PKG_PATH
PKGOS_INFRA_BUILD_PKG_PATH=${GITREPO_ROOT}/build-tools/pkgos-infra-build-pkg
echo "===> Installing required packages to run sbuild"
sudo sed -i s/httpredir.debian.org/deb.debian.org/ /etc/apt/sources.list
sudo apt-get update
sudo ${APT} git-buildpackage eatmydata build-essential \
fakeroot pristine-tar ssl-cert sudo debootstrap \
openstack-pkg-tools lsb-release gnupg haveged
# Since we're installing openstack-pkg-tools, this may overwrite
# pkgos-infra-build-pkg if we're building openstack-pkg-tools itself
if [ -e ${PKGOS_INFRA_BUILD_PKG_PATH} ] ; then
sudo cp ${PKGOS_INFRA_BUILD_PKG_PATH} /usr/bin
sudo chmod +x /usr/bin/pkgos-infra-build-pkg
fi
# Jessie needs lintian from jessie-backports, because we are using
# newer debhelper. New lintian prevents errors like
# postinst-must-call-ldconfig
if [ "${HOST_DISTRO_NAME}" = "jessie" ] ; then
add_bpo_repo_to_host
# Use lintian from backports
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y --no-install-recommends -t jessie-backports lintian
# This code thinks anything else than jessie is higher version of lintian
else
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y --no-install-recommends lintian
fi
# Jessie needs sbuild from jessie-backports, because it has the
# $clean_source = 0 option
if [ "${HOST_DISTRO_NAME}" = "jessie" ] ; then
add_bpo_repo_to_host
# Use sbuild from backports, as we need the $clean_source = 0 option
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y --no-install-recommends -t jessie-backports sbuild
# Patch libdpkg-perl so that it ignores .gitreview files
# This is a hack which should be replaced by a newer version of dpkg
THISDIR=$(pwd)
cd /usr/share/perl5/Dpkg/Source
if [ -e /usr/share/openstack-pkg-tools/libdpkg-perl-gitreview.patch ] ; then
patch -p1 </usr/share/openstack-pkg-tools/libdpkg-perl-gitreview.patch
else
patch -p1 <${THISDIR}/misc/libdpkg-perl-gitreview.patch
fi
cd ${THISDIR}
# Patch libsbuild-perl (jessie bpo) so that it doesn't use the --pinentry-mode
# option of gnupg which isn't available in Jessie
# THISDIR=$(pwd)
# cd /usr/share/perl5/Sbuild
# if [ -e /usr/share/openstack-pkg-tools/libsbuild-perl-ChrootSetup.pm-hotfix.patch ] ; then
# patch -p1 </usr/share/openstack-pkg-tools/libsbuild-perl-ChrootSetup.pm-hotfix.patch
# else
# patch -p1 <${THISDIR}/misc/libsbuild-perl-ChrootSetup.pm-hotfix.patch
# fi
# cd ${THISDIR}
# This code thinks anything else than jessie is higher version of sbuild
else
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y --no-install-recommends sbuild
fi
}
configure_dotgitconfig () {
git config user.name "OpenStack Package Builder"
git config user.email "openstack-infra@lists.openstack.org"
}
# This key will be used to sign the built package
gen_package_build_key () {
echo "===> Generating builder's GPG key to sign packages"
if ! [ -d ${BUILDER_HOMEDIR}/.gnupg ] ; then
mkdir -p ${BUILDER_HOMEDIR}/.gnupg
chmod 755 ${BUILDER_HOMEDIR}/.gnupg
fi
mkdir -p ${BUILDER_HOMEDIR}/.gnupg
chmod 700 ${BUILDER_HOMEDIR}/.gnupg
chmod 700 ${BUILDER_HOMEDIR}/.gnupg
if ! [ -r ${BUILDER_HOMEDIR}/.gnupg/gpg.conf ] ; then
echo "keyserver hkp://pool.sks-keyservers.net
personal-digest-preferences SHA256
default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed
cert-digest-algo SHA256
" >${BUILDER_HOMEDIR}/.gnupg/gpg.conf
fi
if ! [ -r ${BUILDER_HOMEDIR}/.gnupg/pkgos-gen-key-batchfile ] ; then
echo "
%echo Generating a basic OpenPGP key
Key-Type: RSA
Key-Length: 4096
Name-Real: Jenkins
Name-Email: ${BUILDER_SYS_USERNAME}@openstack.org
Expire-Date: 0
" >${BUILDER_HOMEDIR}/.gnupg/pkgos-gen-key-batchfile
fi
sudo chown -R ${BUILDER_SYS_USERNAME}:${BUILDER_SYS_USERNAME} ${BUILDER_HOMEDIR}/.gnupg
su ${BUILDER_SYS_USERNAME} -c "gpg --gen-key --batch ${BUILDER_HOMEDIR}/.gnupg/pkgos-gen-key-batchfile"
gpg --gen-key --batch ${BUILDER_HOMEDIR}/.gnupg/pkgos-gen-key-batchfile
}
configure_sbuild () {
echo "===> Setting-up sbuild's GPG key"
# Setup the gpg key for sbuild
sudo mkdir -p /root/.gnupg
sudo chmod 600 /root/.gnupg
sudo gpg --list-keys
sudo sbuild-update --keygen
# Add the builder as a sbuild user
sudo sbuild-adduser ${BUILDER_SYS_USERNAME}
echo "===> Creating sbuild's schroot chroot using a directory backend (ie: not tarball)"
# Create the actual schroot env
if ! [ -e /var/lib/sbuild/${SBUILD_CHROOT_NAME} ] ; then
sudo sbuild-createchroot ${SBUILD_CHROOT_DISTRO_NAME} /var/lib/sbuild/${SBUILD_CHROOT_DISTRO_NAME} ${CLOSEST_DEBIAN_MIRROR}
fi
if ! [ -e /var/lib/sbuild/${DISTRO_NAME} ] ; then
sudo sbuild-createchroot ${DISTRO_NAME} /var/lib/sbuild/${DISTRO_NAME} ${CLOSEST_DEBIAN_MIRROR}
fi
# Let's use a RAMDISK for sbuild chroot to build packages:
# that's much faster than the HDD backend
echo "===> Mounting /var/lib/schroot/union/{overlay,underlay} using tmpfs to speed-up build"
TMPFILE=$(mktemp)
cp /etc/fstab ${TMPFILE}
echo "tmpfs /var/lib/schroot/union/overlay tmpfs defaults 0 0
tmpfs /var/lib/schroot/union/underlay tmpfs defaults 0 0" >>${TMPFILE}
sudo cp ${TMPFILE} /etc/fstab
rm ${TMPFILE}
sudo mount /var/lib/schroot/union/overlay
sudo mount /var/lib/schroot/union/underlay
echo "===> Fixing-up newly created schroot's chroot config and /etc/git-buildpackage/gbp.conf"
# Make sure git-buildpackage is using sbuild
sudo sed -i 's/^[ #\t]*builder[ #\t]*=.*/builder = sbuild -v --no-apt-update/' /etc/git-buildpackage/gbp.conf
# Disable clean outside of the chroot (note: this actually doesn't work due to a bug,
# but let's keep it there still, when we found out how to fix git-buildpackage).
sudo sed -i 's/^[ #\t]*cleaner[ #\t]*=.*/cleaner = \/bin\/true/' /etc/git-buildpackage/gbp.conf
# Fix from jessie to jessie-newton
# or jessie to jessie-newton-backports
if ! [ "${SBUILD_CHROOT_NAME}" = "${SBUILD_CHROOT_DISTRO_NAME}" ] ; then
# Fetch the full chroot.d filename
SBUILD_SRC_NAME=$(ls /etc/schroot/chroot.d/${SBUILD_CHROOT_DISTRO_NAME}-amd64-sbuild-*)
SBUILD_CHROOTD_FN=$(echo ${SBUILD_SRC_NAME} | sed s/${SBUILD_CHROOT_DISTRO_NAME}/${SBUILD_CHROOT_NAME}/)
mv ${SBUILD_SRC_NAME} ${SBUILD_CHROOTD_FN}
sed -i s/${SBUILD_CHROOT_DISTRO_NAME}-amd64-sbuild/${SBUILD_CHROOT_NAME}-amd64-sbuild/ ${SBUILD_CHROOTD_FN}
mv /var/lib/sbuild/${SBUILD_CHROOT_DISTRO_NAME} /var/lib/sbuild/${SBUILD_CHROOT_NAME}
sed -i "s#/var/lib/sbuild/${SBUILD_CHROOT_DISTRO_NAME}#/var/lib/sbuild/${SBUILD_CHROOT_NAME}#" ${SBUILD_CHROOTD_FN}
fi
# Fetch the full chroot.d filename
SBUILD_CHROOTD_FN=$(ls /etc/schroot/chroot.d/${DISTRO_NAME}-amd64-sbuild-*)
# Switch from tarball to directory (ie: aufs) based build
# (again, that's much faster...)
sudo sed -i -e "s/^[ \t]*type[ \t]*=.*/type=directory/" ${SBUILD_CHROOTD_FN}
# Tell that we'd like to use AUFS as backend for union FS
# note that for Stretch and Xenial, we should switch to overlay instead
case ${HOST_DISTRO_NAME} in
jessie|trusty)
UNION_TYPE=aufs
;;
*)
UNION_TYPE=overlay
;;
esac
if ! grep -q union-type ${SBUILD_CHROOTD_FN} ; then
TMPFILE=$(mktemp)
cp ${SBUILD_CHROOTD_FN} ${TMPFILE}
echo "union-type=${UNION_TYPE}" >>${TMPFILE}
sudo cp ${TMPFILE} ${SBUILD_CHROOTD_FN}
rm ${TMPFILE}
fi
# Just to make sure in case union-type was there already (it's normally not there),
# we overwrite it.
sudo sed -i -e "s/^[ \t]*union-type[ \t]*=.*/union-type=${UNION_TYPE}/" ${SBUILD_CHROOTD_FN}
# Configure ~/.sbuildrc to use our new sbuild chroot
GPG_KEY_ID=$(su jenkins -c "gpg --list-keys ${BUILDER_SYS_USERNAME}" | grep ^pub | awk '{print $2}' | cut -d/ -f2)
GPG_KEY_ID=$(gpg --list-keys ${BUILDER_SYS_USERNAME} | grep ^pub | awk '{print $2}' | cut -d/ -f2)
DOT_SBUILDRC_PATH=${BUILDER_HOMEDIR}/.sbuildrc
if ! [ -r "${DOT_SBUILDRC_PATH}" ] ; then
echo "\$build_arch_all = 1;
\$build_source = 1;
\$distribution = '"${SBUILD_CHROOT_NAME}"';
# We may run lintian by hand later on
# not need to get git-buildpackage to do it
\$run_lintian = 0;
# We don't want to run clean of source tree before
# entering the chroot, because that would mean we need
# some of the build dependencies.
\$clean_source = 0;
# Needed for sbuild to show output in deb-auto-backports
\$verbose = 1;
# In case we decide to no sign packages, uncomment this:
#\$pgp_options = '-us -uc';
\$key_id = '${GPG_KEY_ID}';
# Needed for example for python-glance-store, which as in
# build-depends-indep: python3-all (>= 3.5) | python3-enum34
\$resolve_alternatives = 1;
# This is for perl, just leave it...
1;
" >${DOT_SBUILDRC_PATH}
fi
# Add our repos to the sbuild chroot
echo "deb http://${NODEPOOL_MIRROR_HOST}/debian-openstack jessie-newton-backports main
deb-src http://${NODEPOOL_MIRROR_HOST}/debian-openstack jessie-newton-backports main
" >/tmp/jessie-newton-backports.list
sudo cp /tmp/jessie-newton-backports.list /var/lib/sbuild/${SBUILD_CHROOT_NAME}/etc/apt/sources.list.d/jessie-newton-backports.list
echo "deb http://${NODEPOOL_MIRROR_HOST}/debian-openstack jessie-newton main
deb-src http://${NODEPOOL_MIRROR_HOST}/debian-openstack jessie-newton main
" >/tmp/jessie-newton.list
sudo cp /tmp/jessie-newton.list /var/lib/sbuild/${SBUILD_CHROOT_NAME}/etc/apt/sources.list.d/jessie-newton.list
# Add the repo key
echo "-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: GPGTools - https://gpgtools.org
mQENBFgbrv4BCADK/pHoOwW+CVPYSJLjhMIOJ3Ef981pDw2TEL/t0L2L7cNYuYfc
dx3G/kCZ0NBjHAXw6rkkFuGsXG6HDJ1TRKQTtdSqjFtI9/22xaGO6OE20BOQmhVF
m8xnJ4ie9TpebH+y4OZqgKq7E9MByYZkqFWZZwpkmxUO5C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LYoH1Y0eKmZ18k/9uwOKLW/2geey8K5a6XdC0lB8t6XCDz2XD+KVZMge1
xgcKDGptc3xj/hjf+1yHX78yqnK1+DNooBxyvtQZPOOQ3bIrzSsjs0jFJxt6XMF0
seegZtd2V1CM6TmQQs8gdFhiXGN7O9XbdhbxWEflY8HCG6MqwhFkf34YVe9KXy+h
oAC7Ej+rjB0pDzz723tgogtZJaL3dfACaXdO8fCy/3bmvPa/g2Ams8fsPxNNa0To
jtJzV/IDwL4gD13EWuCYnGy6YecLNvkugznb5oWBkwx6Vkhm+C9Y8oEP+3OTGh/j
xZwrZrFZAkLQ6kEKphyVA5imSQ==
=sQCo
-----END PGP PUBLIC KEY BLOCK-----" >/tmp/repo-key.gpg
sudo cp /tmp/repo-key.gpg /var/lib/sbuild/${SBUILD_CHROOT_NAME}/repo-key.gpg
sudo chroot /var/lib/sbuild/${SBUILD_CHROOT_NAME} apt-key add /repo-key.gpg
rm /tmp/repo-key.gpg /var/lib/sbuild/${SBUILD_CHROOT_NAME}/repo-key.gpg
sudo sbuild-update -udcar ${SBUILD_CHROOT_NAME}
}
detect_distro
disable_init_start
install_all_software
configure_dotgitconfig
gen_package_build_key
configure_sbuild
enable_init_start

120
build-tools/pkgos-keyring-package Executable file
View File

@ -0,0 +1,120 @@
#!/bin/sh
set -e
set -x
#################################
# AUTOMATICALLY DETECT ENV HERE #
#################################
if ! [ -r /etc/pkgos/pkgos.conf ] ; then
echo "Could not read /etc/pkgos/pkgos.conf"
exit 1
else
. /etc/pkgos/pkgos.conf
fi
detect_env () {
DEB_RELEASE=`lsb_release -a | grep Codename: | awk '{print $2}'`
DEB_RELEASE_NUM=`lsb_release -a | grep Release: | awk '{print $2}'`
DEB_DIST_TYPE=$(lsb_release -a | grep "Distributor ID:" | awk '{print $3}')
APT="apt-get install -y"
echo 'APT::Install-Recommends "0";' >/etc/apt/apt.conf.d/80norecommends
}
build_ostack_archive_keyring_package () {
# # Export the jenkins GPG key as pubkey.gpg in debian/dists/pubkey.gpg
# mkdir -p ${REPO_ROOT}/debian/dists
# chown -R ${THE_DEV_USER}:${THE_DEV_USER} ${REPO_ROOT}/debian/dists
# chown ${THE_DEV_USER}:${THE_DEV_USER} ${REPO_ROOT}/debian
# su ${THE_DEV_USER} -c "gpg --export -a ${THE_DEV_USER}" >${REPO_ROOT}/debian/dists/pubkey.gpg
# Create a Debian package out of it, called openstack-debian-archive-keyring
# and put it in the newly created Debian repository.
# Yes, a working, Debian-policy-compliant package is really only a few lines of shell... :)
TMPDIR=`mktemp -d`
MYCWD=`pwd`
cd ${TMPDIR}
VER=0.1
NAME=openstack-backports-archive-keyring
rm -rf ${NAME}-${VER}
mkdir -p ${NAME}-${VER}/debian/source
cd ${NAME}-${VER}
export DEBFULLNAME="Autogenerated key"
export DEBEMAIL="${THE_DEV_USER}@${HOST_FQDN}"
dch --create --package ${NAME} -D unstable --noquery --newversion 0.1 -m "Automatic archive package build."
sed -i 's/MAINTAINER <EMAIL>/Autogenerated key <'${THE_DEV_USER}'@'${HOST_FQDN}'>/' debian/changelog
echo "3.0 (native)" >debian/source/format
echo 9 >debian/compat
echo "#!/usr/bin/make -f
%:
dh \$@
" >debian/rules
echo "Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: ${NAME}
Source: See the openstack-pkg-tools package
Files: *
Copyright: (c) 2015, Thomas Goirand <zigo@debian.org>
License: Apache-2
Licensed under the Apache License, Version 2.0 (the \"License\");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
http://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an \"AS IS\" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian-based systems the full text of the Apache version 2.0 license
can be found in /usr/share/common-licenses/Apache-2.0.
" >debian/copyright
echo "Source: ${NAME}
Section: net
Priority: extra
Maintainer: PKG OpenStack <openstack-devel@lists.alioth.debian.org>
Uploaders: Thomas Goirand <zigo@debian.org>
Build-Depends: debhelper (>= 9)
Standards-Version: 3.9.6
Package: ${NAME}
Architecture: all
Depends: gnupg, \${misc:Depends}
Description: OpenStack ${TARGET_OPENSTACK_REL} ${TARGET_DISTRO} archive keyring
OpenStack ${TARGET_OPENSTACK_REL} ${TARGET_DISTRO} archive keyring
">debian/control
#su ${THE_DEV_USER} -c "gpg --export -a ${THE_DEV_USER}" >pubkey.gpg
gpg --export -a >pubkey.gpg
echo "pubkey.gpg /usr/share/${NAME}" >debian/${NAME}.install
echo "#!/bin/sh
set -e
if [ \"\$1\" = \"configure\" ] || [ \"\$1\" = \"reconfigure\" ] ; then
apt-key add /usr/share/${NAME}/pubkey.gpg
fi
#DEBHELPER#
exit 0
" >debian/${NAME}.postinst
#chown -R ${THE_DEV_USER}:${THE_DEV_USER} .
#su ${THE_DEV_USER} -c dpkg-buildpackage || true
dpkg-buildpackage
FIRST_LETTER=`echo ${NAME} | awk '{print substr($0,0,2)}'`
cd ..
MYDEST=${REPO_ROOT}/debian/pool/${REPO_DEST}/main/${FIRST_LETTER}/${NAME}
MYDEST2=${REPO_ROOT}/debian/pool/${REPO_NOCHANGE_BACKPORT_DEST}/main/${FIRST_LETTER}/${NAME}
for i in ${MYDEST} ${MYDEST2} ; do
mkdir -p ${i}
cp *.changes *.tar.xz *.deb *.dsc ${i}
done
cd ${MYCWD}
rm -r ${TMPDIR}
}
HOST_FQDN=`hostname --fqdn`
THE_DEV_USER=jenkins
build_ostack_archive_keyring_package

View File

@ -0,0 +1,57 @@
#!/bin/sh
set -e
PKG_NAME=${1}
shift
TEMPLATE_NAME=${1}
shift
# Fetch all the templates we need from argv
# because we will iterate more than once on them
TEMPLATES=""
for i in $@ ; do
if [ -n "${TEMPLATES}" ] ; then
TEMPLATES="${TEMPLATES} "
fi
TEMPLATES="${TEMPLATES}${1}"
shift
done
# Concat an eventual package specific template
if [ -e debian/${PKG_NAME}.templates.in ] ; then
cat debian/${PKG_NAME}.templates.in >>debian/${PKG_NAME}.templates
fi
# Concat all the stuff asked
for i in ${TEMPLATES} ; do
cat /usr/share/openstack-pkg-tools/debconf-templates/openstack-pkg-tools.configure-${i}.templates >>debian/${PKG_NAME}.templates
done
# Fix the name of the templates
sed -i 's|Template: ospt/|Template: '${TEMPLATE_NAME}'/|' debian/${PKG_NAME}.templates
# Concat all the translations
mkdir -p debian/po
for i in $(ls /usr/share/openstack-pkg-tools/debconf-templates/po/*.po) ; do
BASENAME=$(basename $i)
echo "Merging ${BASENAME}..."
if [ -e debian/po/${BASENAME} ] ; then
msgmerge -q $i debian/po/${BASENAME} 2>&1 >/dev/null
else
cp $i debian/po/
fi
done
# Check for POTFILES.in consistency
# (ie: ensure it has our templates listed)
touch debian/po/POTFILES.in
for i in ${TEMPLATES} ; do
if ! grep -q "\[type: gettext/rfc822deb\] ${PKG_NAME}.templates" debian/po/POTFILES.in ; then
echo "[type: gettext/rfc822deb] ${PKG_NAME}.templates" >>debian/po/POTFILES.in
fi
done
# Finally, run the debconf-updatepo to merge all translations
#debconf-updatepo

View File

@ -0,0 +1,62 @@
#!/bin/sh
set -e
CONF=${1}
if [ -n "${2}" ] ; then
SECTION=${2}
else
SECTION=keystone_authtoken
fi
if [ -n "${3}" ] ; then
DEFAULT_USERNAME=${3}
else
DEFAULT_USERNAME=admin
fi
if ! [ -r "${CONF}" ] ; then
echo "Could not find ${CONF}"
exit 1
fi
# Calculate start and end of file before and after
# the section starts
SECTION_START=$(grep -n "^\[${SECTION}\]\$" ${CONF} | cut -d: -f1)
FILE_LEN=$(cat ${CONF} | wc -l)
END_OF_FILE=$(( ${FILE_LEN} - ${SECTION_START}))
TEMP=$(mktemp $(basename $0).XXXXXX)
head -n ${SECTION_START} ${CONF} >>${TEMP}
echo "#
# Re-added by openstack-pkg-tools
#
# Complete Identity API endpoint.
auth_url = http://localhost:5000
# Project name for auth.
project_name = service
# Project's domain name for auth.
project_domain_name = Default
# Username for auth.
username = ${DEFAULT_USERNAME}
# User's domain name for auth
user_domain_name = Default
# Password for auth
#password =" >>${TEMP}
tail -n ${END_OF_FILE} ${CONF} >>${TEMP}
pkgos-fix-config-default ${TEMP} ${SECTION} www_authenticate_uri http://localhost:5000
pkgos-fix-config-default ${TEMP} ${SECTION} auth_type password
pkgos-fix-config-default ${TEMP} ${SECTION} region_name regionOne
mv ${TEMP} ${CONF}

66
build-tools/pkgos-scan-repo Executable file
View File

@ -0,0 +1,66 @@
#!/bin/sh
set -e
#set -x
### Make sure we're only executing this script once at a time ###
### with 120s timeout, using flock ###
LOCKDIR=/var/run/lock
LOCKFILE=${LOCKDIR}/$(basename ${0})
if [ "${1}" = "--nolock" ] ; then
shift
else
echo "Locking scan repository process in ${LOCKFILE}"
if ! flock -w 120 -x ${LOCKFILE}.lock $0 --nolock $@ ; then
exit 1
fi
exit 0
fi
if ! [ -r /etc/pkgos/pkgos.conf ] ; then
echo "Could not read /etc/pkgos/pkgos.conf"
exit 1
else
. /etc/pkgos/pkgos.conf
fi
# It's possible to give the repo name as parameter
if [ -n "${1}" ] ; then
REPO_DEST=${1}
fi
# Scan the repo
scan_repo() {
echo "===> Scanning ${REPO_ROOT} for packages in ${REPO_DEST} with arch ${SCAN_ARCHES}"
local MYCUR_DIR
MYCURDIR=`pwd`
cd ${REPO_ROOT}/debian
for i in ${SCAN_ARCHES} ; do
mkdir -p dists/${REPO_DEST}/main/binary-${i}
dpkg-scanpackages -a ${i} pool/${REPO_DEST}/main /dev/null > dists/${REPO_DEST}/main/binary-${i}/Packages
gzip -c dists/${REPO_DEST}/main/binary-${i}/Packages >dists/${REPO_DEST}/main/binary-${i}/Packages.gz
bzip2 -f -k dists/${REPO_DEST}/main/binary-${i}/Packages
done
mkdir -p dists/${REPO_DEST}/main/source
dpkg-scansources pool/${REPO_DEST}/main /dev/null >dists/${REPO_DEST}/main/source/Sources
gzip -c dists/${REPO_DEST}/main/source/Sources >dists/${REPO_DEST}/main/source/Sources.gz
bzip2 -f -k dists/${REPO_DEST}/main/source/Sources
cd dists/${REPO_DEST}
rm -f Release Release.gpg
TMPFILE=`mktemp -t pkgos_scan.XXXXXX`
apt-ftparchive release . -o APT::FTPArchive::Release::Origin="Mirantis" -o APT::FTPArchive::Release::Codename="${REPO_DEST}" > ${TMPFILE}
mv ${TMPFILE} ./Release
gpg -abs -o Release.gpg Release
gpg --clearsign Release
mv Release.asc InRelease
chmod +r Release Release.gpg
cd ${MYCURDIR}
}
scan_repo
for i in ${SCAN_ARCHES} ; do
echo "===> Updating schroot ${TARGET_DISTRO}-${i}"
sudo sbuild-update -udcar ${TARGET_DISTRO}-${i}
done

507
build-tools/pkgos-setup-sbuild Executable file
View File

@ -0,0 +1,507 @@
#!/bin/sh
set -e
set -x
#################################
# AUTOMATICALLY DETECT ENV HERE #
#################################
if ! [ -r /etc/pkgos/pkgos.conf ] ; then
echo "Could not read /etc/pkgos/pkgos.conf"
exit 1
else
. /etc/pkgos/pkgos.conf
fi
detect_env () {
DEB_RELEASE=`lsb_release -a | grep Codename: | awk '{print $2}'`
DEB_RELEASE_NUM=`lsb_release -a | grep Release: | awk '{print $2}'`
DEB_DIST_TYPE=$(lsb_release -a | grep "Distributor ID:" | awk '{print $3}')
APT="apt-get install -y"
echo 'APT::Install-Recommends "0";' >/etc/apt/apt.conf.d/80norecommends
}
configure_hostname () {
DEFROUTE_IF=`LC_ALL=C /sbin/route | grep default |awk -- '{ print $8 }' | cut -d" " -f1`
if [ -n "${DEFROUTE_IF}" ] ; then
DEFROUTE_IP=`LC_ALL=C ip addr show "${DEFROUTE_IF}" | grep inet | head -n 1 | awk '{print $2}' | cut -d/ -f1 | grep -E '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$'`
if [ -n "${DEFROUTE_IP}" ] ; then
echo "Detected IP: ${DEFROUTE_IP}"
echo "127.0.0.1 localhost.localdomain localhost
${DEFROUTE_IP} ${HOST_FQDN} ${TARGET_OPENSTACK_REL}-${TARGET_DISTRO}
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
" >/etc/hosts
fi
fi
echo $HOST_FQDN >/etc/hostname
hostname `cat /etc/hostname`
}
install_all_software () {
${APT} ${ADDED_DEB_PKG} sbuild apache2 screen joe apache2 pure-ftpd ftp most \
man-db git-buildpackage debhelper eatmydata build-essential python-setuptools \
fakeroot python3-all python-all python3-setuptools pristine-tar dh-autoreconf ssl-cert \
dh-python dh-systemd python-sphinx sudo debootstrap openstack-pkg-tools \
lintian lsb-release postfix gem2deb
}
configure_apache () {
a2enmod proxy
a2enmod proxy_http
a2enmod ssl
a2enmod headers
if [ "${DEB_RELEASE}" = "precise" ] ; then
APACHE_SSL_VHOST_CONF=default-ssl
FORWARD_TO_ADDR=ip6-localhost
DEFAULT_SITE=default
DEFAULT_SSL_SITE=default-ssl
elif [ "${DEB_RELEASE}" = "wheezy" ] ; then
APACHE_SSL_VHOST_CONF=default-ssl
FORWARD_TO_ADDR=localhost
DEFAULT_SITE=default
DEFAULT_SSL_SITE=default-ssl
else
APACHE_SSL_VHOST_CONF=default-ssl.conf
FORWARD_TO_ADDR=localhost
DEFAULT_SITE=000-default.conf
DEFAULT_SSL_SITE=default-ssl.conf
fi
a2ensite ${DEFAULT_SSL_SITE}
APACHE_SSL_VHOST_CONF_FULL_PATH=/etc/apache2/sites-available/${APACHE_SSL_VHOST_CONF}
echo "<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ErrorLog \${APACHE_LOG_DIR}/error.log
CustomLog \${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
<FilesMatch \"\.(cgi|shtml|phtml|php)\$\">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
# Jenkins proxy (and reverse)
ProxyPass / http://${FORWARD_TO_ADDR}:8080/ nocanon
ProxyPassReverse / http://${FORWARD_TO_ADDR}:8080/
ProxyRequests Off
AllowEncodedSlashes NoDecode
Header edit Location ^http://${HOST_FQDN}/ https://${HOST_FQDN}/
RequestHeader set X-Forwarded-Proto \"https\"
RequestHeader set X-Forwarded-Port \"443\"
ProxyPreserveHost on
SetOutputFilter INFLATE;proxy-html;DEFLATE
SetEnv proxy-nokeepalive 1
ServerAdmin webmaster@localhost
</VirtualHost>
</IfModule>
" >${APACHE_SSL_VHOST_CONF_FULL_PATH}
a2ensite ${APACHE_SSL_VHOST_CONF}
invoke-rc.d apache2 restart
if [ ! -e /var/www/html/debian ] && [ ! -h /var/www/html/debian ] ; then
ln -s /home/ftp/debian /var/www/html/debian
fi
}
configure_pure () {
if getent passwd ftp >/dev/null ; then
echo "FTP user already existing"
else
/usr/sbin/useradd -m ftp
fi
chown ${THE_DEV_USER}:${THE_DEV_USER} /home/ftp
rm -f /etc/pure-ftpd/conf/NoAnonymous
invoke-rc.d pure-ftpd stop
sleep 2
invoke-rc.d pure-ftpd start
}
install_jenkins_plugins () {
jenkins-cli -s https://${HOST_FQDN}/ -noCertificateCheck install-plugin instant-messaging
jenkins-cli -s https://${HOST_FQDN}/ -noCertificateCheck install-plugin ircbot
}
configure_jenkins_dotgitconfig () {
echo "[user]
email = zigo@debian.org
name = Thomas Goirand
[gitreview]
username = thomas-goirand
[alias]
wdiff = diff --color-words
wshow = show --color-words
[color]
ui = true" >/var/lib/jenkins/.gitconfig
}
configure_jenkins_sudoers () {
echo "jenkins ALL = NOPASSWD: /usr/bin/sbuild-update -udcar ${TARGET_DISTRO}-amd64" >/etc/sudoers.d/jenkins
chmod 440 /etc/sudoers.d/jenkins
}
# @param: $1 homedir of the GPG user
gen_the_dev_user_gpg_key () {
GPG_USER_HOMEDIR=${1}
mkdir -p ${GPG_USER_HOMEDIR}/.gnupg
chmod 700 ${GPG_USER_HOMEDIR}/.gnupg
chmod 700 ${GPG_USER_HOMEDIR}/.gnupg
if ! [ -r ${GPG_USER_HOMEDIR}/.gnupg/gpg.conf ] ; then
echo "keyserver hkp://pool.sks-keyservers.net
personal-digest-preferences SHA256
default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed
cert-digest-algo SHA256
" >${GPG_USER_HOMEDIR}/.gnupg/gpg.conf
fi
if ! [ -r ${GPG_USER_HOMEDIR}/.gnupg/pkgos-gen-key-batchfile ] ; then
echo "
%echo Generating a basic OpenPGP key
Key-Type: RSA
Key-Length: 4096
Name-Real: Autogenerated key
Name-Email: ${THE_DEV_USER}@"`hostname --fqdn`"
Expire-Date: 0
" >${GPG_USER_HOMEDIR}/.gnupg/pkgos-gen-key-batchfile
fi
chown -R ${THE_DEV_USER}:${THE_DEV_USER} ${GPG_USER_HOMEDIR}/.gnupg
su ${THE_DEV_USER} -c 'gpg --gen-key --batch '${GPG_USER_HOMEDIR}'/.gnupg/pkgos-gen-key-batchfile'
}
configure_jenkins_gpg_key () {
# Generate a self-signed gpg key so that we can sign packages
if ! [ -e /var/lib/jenkins/.gnupg/secring.gpg ] ; then
gen_the_dev_user_gpg_key /var/lib/jenkins
fi
}
check_user_gpg_key () {
if ! [ -d /home/${THE_DEV_USER}/.gnupg ] ; then
echo "There's no /home/${THE_DEV_USER}/.gnupg folder,"
echo "do you want this script to generate one? If you"
echo "don't, the script will exit."
echo -n "Generate a GPG key (Y/n)?"
read GEN_KEY
if [ -z "${GEN_KEY}" ] || [ "${GEN_KEY}" = "y" ] || [ "${GEN_KEY}" = "Y" ] ; then
echo "Genrating a gpg key for you..."
gen_the_dev_user_gpg_key /home/${THE_DEV_USER}
else
echo "No gpg key: exiting..."
exit 1
fi
fi
GPG_KEY_ID=$(su ${THE_DEV_USER} -c "gpg --list-keys ${THE_DEV_USER} | grep ^pub | awk '{print \$2}' | cut -d/ -f2 | head -n 1")
if [ -z "${GPG_KEY_ID}" ] ; then
echo "Cloud not find key ID, but there's a /home/${THE_DEV_USER}/.gnupg"
echo -n "Generate a GPG key (Y/n)?"
read GEN_KEY
if [ -z "${GEN_KEY}" ] || [ "${GEN_KEY}" = "y" ] || [ "${GEN_KEY}" = "Y" ] ; then
echo "Genrating a gpg key for you..."
gen_the_dev_user_gpg_key /home/${THE_DEV_USER}
else
echo "No gpg key: exiting..."
exit 1
fi
fi
GPG_KEY_ID=$(su ${THE_DEV_USER} -c "gpg --list-keys ${THE_DEV_USER} | grep ^pub | awk '{print \$2}' | cut -d/ -f2 | head -n 1")
echo "===> Key ID: ${GPG_KEY_ID}"
}
build_ostack_archive_keyring_package () {
# Export the jenkins GPG key as pubkey.gpg in debian/dists/pubkey.gpg
mkdir -p ${REPO_ROOT}/debian/dists
chown -R ${THE_DEV_USER}:${THE_DEV_USER} ${REPO_ROOT}/debian/dists
chown ${THE_DEV_USER}:${THE_DEV_USER} ${REPO_ROOT}/debian
su ${THE_DEV_USER} -c "gpg --export -a ${THE_DEV_USER}" >${REPO_ROOT}/debian/dists/pubkey.gpg
# Create a Debian package out of it, called openstack-debian-archive-keyring
# and put it in the newly created Debian repository.
# Yes, a working, Debian-policy-compliant package is really only a few lines of shell... :)
TMPDIR=`mktemp -d`
MYCWD=`pwd`
cd ${TMPDIR}
chown ${THE_DEV_USER}:${THE_DEV_USER} .
VER=0.1
NAME=${TARGET_DISTRO}-${TARGET_OPENSTACK_REL}-archive-keyring
rm -rf ${NAME}-${VER}
mkdir -p ${NAME}-${VER}/debian/source
cd ${NAME}-${VER}
export DEBFULLNAME="Debian OpenStack Jenkins"
export DEBEMAIL="${THE_DEV_USER}@${HOST_FQDN}"
dch --create --package ${NAME} -D unstable --noquery --newversion 0.1 -m "Automatic archive package build."
sed -i 's/MAINTAINER <EMAIL>/Debian OpenStack <'${THE_DEV_USER}'@'${HOST_FQDN}'>/' debian/changelog
echo "3.0 (native)" >debian/source/format
echo 9 >debian/compat
echo "#!/usr/bin/make -f
%:
dh \$@
" >debian/rules
echo "Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: ${NAME}
Source: See the openstack-pkg-tools package
Files: *
Copyright: (c) 2015, Thomas Goirand <zigo@debian.org>
License: Apache-2
Licensed under the Apache License, Version 2.0 (the \"License\");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
http://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an \"AS IS\" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian-based systems the full text of the Apache version 2.0 license
can be found in /usr/share/common-licenses/Apache-2.0.
" >debian/copyright
echo "Source: ${NAME}
Section: net
Priority: extra
Maintainer: PKG OpenStack <openstack-devel@lists.alioth.debian.org>
Uploaders: Thomas Goirand <zigo@debian.org>
Build-Depends: debhelper (>= 9)
Standards-Version: 3.9.6
Package: ${NAME}
Architecture: all
Depends: \${misc:Depends}
Description: OpenStack ${TARGET_OPENSTACK_REL} ${TARGET_DISTRO} archive keyring
OpenStack ${TARGET_OPENSTACK_REL} ${TARGET_DISTRO} archive keyring
">debian/control
cp ${REPO_ROOT}/debian/dists/pubkey.gpg .
echo "pubkey.gpg /usr/share/${NAME}" >debian/${NAME}.install
echo "#!/bin/sh
set -e
if [ \"\$1\" = \"configure\" ] || [ \"\$1\" = \"reconfigure\" ] ; then
apt-key add /usr/share/${NAME}/pubkey.gpg
fi
#DEBHELPER#
exit 0
" >debian/${NAME}.postinst
chown -R ${THE_DEV_USER}:${THE_DEV_USER} .
su ${THE_DEV_USER} -c dpkg-buildpackage || true
FIRST_LETTER=`echo ${TARGET_OPENSTACK_REL} | awk '{print substr($0,0,2)}'`
cd ..
MYDEST=${REPO_ROOT}/debian/pool/${REPO_DEST}/main/${FIRST_LETTER}/${NAME}
MYDEST2=${REPO_ROOT}/debian/pool/${REPO_NOCHANGE_BACKPORT_DEST}/main/${FIRST_LETTER}/${NAME}
for i in ${MYDEST} ${MYDEST2} ; do
su ${THE_DEV_USER} -c "mkdir -p ${i}"
cp *.changes *.tar.xz *.deb *.dsc ${i}
chown -R ${THE_DEV_USER}:${THE_DEV_USER} ${i}
done
cd ${MYCWD}
rm -r ${TMPDIR}
}
configure_sbuildrc () {
GPG_KEY_ID=$(su ${THE_DEV_USER} -c "gpg --list-keys ${THE_DEV_USER} | grep ^pub | awk '{print \$2}' | cut -d/ -f2")
DOT_SBUILDRC_PATH=${THE_USER_HOMEDIR}/.sbuildrc
if ! [ -r "${DOT_SBUILDRC_PATH}" ] ; then
echo "# don't remove this, Perl needs it:
\$build_arch_all = 1;
\$build_source = 1;
\$distribution = '"${TARGET_DISTRO}"';
\$run_lintian = 0;
# Don't sign packages:
#\$pgp_options = '-us -uc';
# FIX THIS !!!
\$key_id = '${GPG_KEY_ID}';
1;
" >${DOT_SBUILDRC_PATH}
fi
}
configure_sbuild () {
USE_OVERLAY=yes
# Setup the gpg key for sbuild
mkdir -p /root/.gnupg
chmod 600 /root/.gnupg
gpg --list-keys
sbuild-update --keygen
# Add jenkins as a sbuild user
sbuild-adduser ${THE_DEV_USER}
if [ "${USE_OVERLAY}" = "yes" ] ; then
# Create the actual schroot env
if ! [ -e /var/lib/sbuild/${TARGET_DISTRO} ] ; then
# Using AUFS or overlay
sbuild-createchroot ${TARGET_DISTRO} /var/lib/sbuild/${TARGET_DISTRO} ${CLOSEST_DEBIAN_MIRROR}
fi
else
# Create the actual schroot env
if ! [ -e /var/lib/sbuild/${TARGET_DISTRO}-amd64.tar.gz ] ; then
# Using tarballs
sbuild-createchroot --make-sbuild-tarball=/var/lib/sbuild/${TARGET_DISTRO}-amd64.tar.gz ${TARGET_DISTRO} `mktemp -d` ${CLOSEST_DEBIAN_MIRROR}
fi
fi
# Make sure git-buildpackage is using sbuild
sed -i 's/^[ #\t]*builder[ #\t]*=.*/builder = sbuild -v --no-apt-update/' /etc/git-buildpackage/gbp.conf
sed -i 's/^[ #\t]*cleaner[ #\t]*=.*/cleaner = \/bin\/true/' /etc/git-buildpackage/gbp.conf
# Make sure that /dev/shm is mounted in the chroot, otherwise anything which
# uses /dev/shm (like python-taskflow, etc.) will fail to build
sed -i 's|#/dev/shm|/dev/shm|' /etc/schroot/default/fstab
# Install the juno-jessie-archive-keyring package in the repository
FIRST_LETTER=`echo ${TARGET_OPENSTACK_REL} | awk '{print substr($0,0,2)}'`
NAME=${TARGET_OPENSTACK_REL}-${TARGET_DISTRO}-archive-keyring
VERS=0.1
MYPKG_FILE_NAME=${NAME}_0.1_all.deb
LOCATION=debian/pool/${TARGET_DISTRO}-${TARGET_OPENSTACK_REL}-backports/main/${FIRST_LETTER}/${NAME}/${MYPKG_FILE_NAME}
if [ "${USE_OVERLAY}" = "yes" ] ; then
cp /home/ftp/${LOCATION} /var/lib/sbuild/${TARGET_DISTRO}
chroot /var/lib/sbuild/${TARGET_DISTRO} dpkg -i ${MYPKG_FILE_NAME}
rm /var/lib/sbuild/${TARGET_DISTRO}/${MYPKG_FILE_NAME}
else
schroot -c source:${TARGET_DISTRO}-amd64-sbuild -u root -- apt-get install -y wget
schroot -c source:${TARGET_DISTRO}-amd64-sbuild -u root -- wget http://localhost/${LOCATION}
schroot -c source:${TARGET_DISTRO}-amd64-sbuild -u root -- dpkg -i ${MYPKG_FILE_NAME}
fi
# Since we have already a first package (the archive-keyring one),
# let's scan the tree in /home/ftp/debian/pool, and build a valid Debian repo
MYCWD=`pwd`
cd ${THE_USER_HOMEDIR}
su ${THE_DEV_USER} -c pkgos-scan-repo
su ${THE_DEV_USER} -c pkgos-scan-repo ${REPO_NOCHANGE_BACKPORT_DEST}
cd ${MYCWD}
if [ "${USE_OVERLAY}" = "yes" ] ; then
echo "deb http://localhost/debian ${TARGET_DISTRO}-${TARGET_OPENSTACK_REL}-backports main
deb http://localhost/debian ${REPO_NOCHANGE_BACKPORT_DEST} main" >/var/lib/sbuild/${TARGET_DISTRO}/etc/apt/sources.list.d/openstack.list
else
# Add a hook to have both our repositories used inside the sbuild chroot
echo "#!/bin/sh
set -e
. \"\$SETUP_DATA_DIR/common-data\"
. \"\$SETUP_DATA_DIR/common-functions\"
. \"\$SETUP_DATA_DIR/common-config\"
if [ \$STAGE = \"setup-start\" ] || [ \$STAGE = \"setup-recover\" ]; then
echo \"deb http://localhost/debian ${TARGET_DISTRO}-${TARGET_OPENSTACK_REL}-backports main\" >\${CHROOT_PATH}/etc/apt/sources.list.d/openstack.list
echo \"deb http://localhost/debian ${REPO_NOCHANGE_BACKPORT_DEST} main\" >\${CHROOT_PATH}/etc/apt/sources.list.d/openstack-backports.list
fi" >>/etc/schroot/setup.d/80sources
chmod +x /etc/schroot/setup.d/80sources
fi
}
configure_jenkins_job_builder () {
GENERATED_PASSWORD=$(dd if=/dev/random bs=64 count=1 2>|/dev/null | md5sum | awk '{print $1}')
echo "[job_builder]
ignore_cache=True
keep_descriptions=False
include_path=/usr/local/bin
recursive=False
allow_duplicates=False
[jenkins]
user=zigo
password=${JENKINS_JOBS_BUILDER_PASS}
url=http://localhost:8080/
" >/etc/jenkins_jobs/jenkins_jobs.ini
echo "" >job.yaml
for i in `cat /etc/pkgos/build-list` ; do
echo "- job:
name: $i
builders:
- shell: 'pkgos-bop-jenkins "${i}"'
auth-token: g5rjtpms5emw
logrotate:
numToKeep: 4
publishers:
- ircbot:
strategy: all
notify-start: true
message-type: summary
wrappers:
- ansicolor:
colormap: xterm
" >>job.yaml
done
jenkins-jobs update job.yaml
}
restart_jenkins () {
service jenkins restart
}
##############################
# ACTUAL START OF THE SCRIPT #
##############################
usage () {
echo "Wrong usage: $0 [dev|jenkins] <username>"
echo "the username 2nd param is only if you use the dev mode"
exit 1
}
if [ "${1}" = "dev" ] ; then
echo "Setting-up a developer machine."
DEV_OR_JENKINS=dev
shift
if [ -z "${1}" ] ; then
usage
fi
THE_DEV_USER=${1}
shift
if [ -n "${1}" ] ; then
usage
fi
THE_USER_HOMEDIR=/home/${THE_DEV_USER}
elif [ "${1}" = "jenkins" ] ; then
echo "Setting-up a Jenkins build server."
DEV_OR_JENKINS=jenkins
THE_DEV_USER=jenkins
shift
if [ -n "${1}" ] ; then
usage
fi
THE_USER_HOMEDIR=/var/lib/jenkins
else
usage
fi
detect_env
[ "${DEV_OR_JENKINS}" = "jenkins" ] && configure_hostname
install_all_software
configure_apache
configure_pure
# This often fails because the list of plugins isn't fetched by Jenkins
#install_jenkins_plugins
[ "${DEV_OR_JENKINS}" = "jenkins" ] && configure_jenkins_dotgitconfig
[ "${DEV_OR_JENKINS}" = "jenkins" ] && configure_jenkins_sudoers
[ "${DEV_OR_JENKINS}" = "jenkins" ] && configure_jenkins_gpg_key
[ "${DEV_OR_JENKINS}" = "dev" ] && check_user_gpg_key
configure_sbuildrc
build_ostack_archive_keyring_package
configure_sbuild
#[ "${DEV_OR_JENKINS}" = "jenkins" ] && configure_jenkins_job_builder
# This is needed so that jenkins can login into sbuild
[ "${DEV_OR_JENKINS}" = "jenkins" ] && restart_jenkins

221
etc/pkgos/build-list Normal file
View File

@ -0,0 +1,221 @@
ceilometer
cinder
cliff-tablib
cobbler
designate
factory-boy
ftp-cloudfs
fuel-astute
fuel-nailgun
gf-complete
git-review
glance
heat
heat-cfntools
horizon
ironic
jerasure
keystone
liberasurecode
libjs-autonumeric
libjs-backbone-deep-model
libjs-backbone.stickit
libjs-cocktail
libjs-i18next
libjs-require-css
libjs-requirejs
libjs-requirejs-text
migrate
msgpack-python
murano
murano-agent
murano-dashboard
nailgun-agent
nailgun-mcagents
neutron
neutron-l3-healthcheck
nova
novnc
ntpstat
openstack-debian-images
openstack-doc-tools
openstack-meta-packages
openstack-nose
openstack-pkg-tools
openstack-trove
openvswitch
oslo-config
oslo.messaging
oslo.rootwrap
oslo-sphinx
python-barbicanclient
python-bashate
python-ceilometerclient
python-cinderclient
python-cloudfiles
python-coffin
python-concurrent.futures
python-couleur
python-croniter
python-daemonize
python-dbutils
python-ddt
python-designateclient
python-dib-utils
python-diskimage-builder
python-django-appconf
python-django-bootstrap-form
python-django-compressor
python-django-discover-runner
python-django-openstack-auth
python-django-pyscss
python-dogpile.cache
python-dogpile.core
python-extras
python-eventlet
python-falcon
python-fixtures
python-fuelclient
python-glanceclient
python-glance-store
python-hacking
python-happybase
python-heatclient
python-hp3parclient
python-hplefthandclient
python-httpretty
python-hurry.filesize
python-ibm-db-sa
python-invocations
python-invoke
python-ironicclient
python-jingo
python-json-patch
python-jsonpath-rw
python-json-pointer
python-jsonschema
python-keystoneclient
python-keystonemiddleware
python-ldappool
python-lesscpy
python-logutils
python-misaka
python-mockito
python-mox3
python-muranoclient
python-network-checker
python-neutronclient
python-nose-exclude
python-nosehtmloutput
python-nose-parameterized
python-nose-testconfig
python-nose-timer
python-novaclient
python-openstackclient
python-os-apply-config
python-os-client-config
python-os-collect-config
python-oslo.db
python-oslo.i18n
python-oslo.policy
python-oslo.serialization
python-oslotest
python-oslo.utils
python-oslo.vmware
python-osprofiler
python-os-refresh-config
python-pbr
python-pecan
python-pint
python-posix-ipc
python-proboscis
python-pycadf
python-pyeclib
python-pyghmi
python-pymemcache
python-pymysql
python-pysaml2
python-pyvmomi
python-rednose
python-requests-mock
python-retrying
python-rfc3986
python-rtslib-fb
python-rudolf
python-saharaclient
python-savannaclient
python-seamicroclient
python-semver
python-shotgun
python-sockjs-tornado
python-sphinxcontrib.plantuml
python-steadymark
python-sure
python-swiftclient
python-sysv-ipc
python-tablib
python-taskflow
python-tasklib
python-tempest-lib
python-termcolor
python-termstyle
python-testscenarios
python-tooz
python-trollius
python-troveclient
python-tuskarclient
python-warlock
python-wrapt
python-wsgi-intercept
python-wsme
python-xmlbuilder
python-xstatic
python-xstatic-angular
python-xstatic-angular-cookies
python-xstatic-angular-mock
python-xstatic-bootstrap-datepicker
python-xstatic-bootstrap-scss
python-xstatic-d3
python-xstatic-font-awesome
python-xstatic-hogan
python-xstatic-jasmine
python-xstatic-jquery
python-xstatic-jquery.bootstrap.wizard
python-xstatic-jquery-migrate
python-xstatic-jquery.quicksearch
python-xstatic-jquery.tablesorter
python-xstatic-jquery-ui
python-xstatic-jsencrypt
python-xstatic-qunit
python-xstatic-rickshaw
python-xstatic-spin
python-xvfbwrapper
python-yaql
python-zake
q-text-as-data
ruby-cstruct
ruby-raemon
ruby-rethtool
ruby-symboltable
sahara
sftpcloudfs
sphinxcontrib-docbookrestapi
sphinxcontrib-httpdomain
sphinxcontrib-issuetracker
sphinxcontrib-pecanwsme
sphinxcontrib-programoutput
spice-html5
stevedore
subunit
swift
swift-account-stats
swift-bench
swift-plugin-s3
tasksel
tempest
testresources
tripleo-heat-templates
tripleo-image-elements
tuskar
tuskar-ui
websockify

View File

@ -0,0 +1,4 @@
python-django-babel
python-pykmip
voluptuous
websockify

View File

@ -0,0 +1,96 @@
aodh
barbican
ceilometer
cinder
congress
designate
glance
gnocchi
heat
horizon
ironic
keystone
manila
migrate
mistral
murano
murano-agent
murano-dashboard
networking-mlnx
neutron
neutron-fwaas
neutron-lbaas
neutron-vpnaas
nova
openstack-doc-tools
openstack-meta-packages
openstack-pkg-tools
openstack-trove
oslo-sphinx
python-barbicanclient
python-castellan
python-ceilometerclient
python-cinderclient
python-congressclient
python-debtcollector
python-designateclient
python-django-openstack-auth
python-futurist
python-gabbi
python-glanceclient
python-glance-store
python-gnocchiclient
python-heatclient
python-ironicclient
python-ironic-inspector-client
python-keystoneauth1
python-keystoneclient
python-keystonemiddleware
python-manilaclient
python-mistralclient
python-muranoclient
python-neutronclient
python-neutron-lib
python-novaclient
python-openstackclient
python-openstacksdk
python-os-brick
python-os-client-config
python-os-testr
python-oslo.cache
python-oslo.concurrency
python-oslo.config
python-oslo.context
python-oslo.db
python-oslo.i18n
python-oslo.log
python-oslo.messaging
python-oslo.middleware
python-oslo.policy
python-oslo.reports
python-oslo.rootwrap
python-oslo.serialization
python-oslo.service
python-oslotest
python-oslo.utils
python-oslo.versionedobjects
python-oslo.vmware
python-osprofiler
python-pbr
python-pecan
python-proliantutils
python-pycadf
python-saharaclient
python-swiftclient
python-taskflow
python-tempest-lib
python-tooz
python-troveclient
python-yaql
python-zaqarclient
quantum
sahara
stevedore
swift
tempest
zaqar

View File

@ -0,0 +1,17 @@
libjs-angularjs-smart-table
libjs-angular-gettext
libjs-autonumeric
libjs-backbone-deep-model
libjs-backbone.stickit
libjs-bootswatch
libjs-cocktail
libjs-i18next
libjs-jsencrypt
libjs-lrdragndrop
libjs-magic-search
libjs-require-css
libjs-requirejs
libjs-requirejs-text
libjs-term.js
libjs-twitter-bootstrap-datepicker
libjs-spin.js

View File

@ -0,0 +1,20 @@
aodh
barbican
ceilometer
cinder
congress
designate
glance
heat
horizon
ironic
keystone
magnum
manila
mistral
murano
neutron
nova
openstack-trove
sahara
zaqar

109
etc/pkgos/pkgos.conf Normal file
View File

@ -0,0 +1,109 @@
#################################################
# This file configure build tools for OpenStack #
# and is used by scripts under /usr/bin/pkgos-* #
#################################################
### Target OS and target OpenStack release ###
##############################################
# Target distribution for which we are backporting for
TARGET_DISTRO=buster
# OpenStack release name we're building
TARGET_OPENSTACK_REL=ussuri
### Target backport distribution ###
# Release number as it appears on the changelog (ie: as in ~bpo8+1)
TARGET_DISTRO_NUM=10
# Release backport postfix, to use with pkgos-bb
BPO_POSTFIX=bpo${TARGET_DISTRO_NUM}+1
### Definitions for your Debian repository ###
##############################################
# Root folder where the Debian FTP archive will be populated by a build
REPO_ROOT=/home/ftp
# what will be the http://<url>debian <REPO_DEST> main ?
REPO_DEST=${TARGET_DISTRO}-${TARGET_OPENSTACK_REL}-backports
# Space separated list of arch to scan using dpkg-scanpackages
SCAN_ARCHES=amd64
# Where to store the strait backports (eg: backports with no change
# at all from original source package, only a rebuild...)
REPO_NOCHANGE_BACKPORT_DEST=${TARGET_DISTRO}-${TARGET_OPENSTACK_REL}-backports-nochange
# This is where to upload a package to backport using pkgos-bb
SCP_DEST_HOST=archive.gplhost.com
# What folder inside SCP_DEST_HOST
SCP_DEST_SUITE=${REPO_DEST}
# Debian mirror near you for faster build (hint: you can use approx)
CLOSEST_DEBIAN_MIRROR=http://localhost:9999/debian
### Hostname of your computer ###
#################################
# Hostname postfix (for example, with the above, it's going to
# be juno-jessie.pkgs.mirantis.com)
HOSTNAME_POSTFIX="infomaniak.ch"
# Calculated using the above
HOST_FQDN="${TARGET_DISTRO}-${TARGET_OPENSTACK_REL}.${HOSTNAME_POSTFIX}"
# Password of the user for jenkins-jobs-builder to use
JENKINS_JOBS_BUILDER_PASS=
### Git clone URLs (using alioth.debian.org ...) ###
####################################################
# From what Git repository should we git clone packages?
CLONE_URL_BASE=https://salsa.debian.org/openstack-team
# Same as above, but for javascript packages listed in PKG_JS below
CLONE_URL_PKGJS=https://salsa.debian.org/javascript-team
# Run unit tests or skip them? With anything else than no,
# unit tests will run.
PKGOS_RUN_UNIT_TESTS_AT_BUILD=yes
BUILD_FROM_TRUNK=no
############################
# Definitions of branches. #
############################
# Packages using debian/${TARGET_OPENSTACK_REL}
OSTACK_PKGS=`cat /etc/pkgos/packages-list/openstack-release-branch | tr '\n' ' '`
# Packages using debian/experimental
EXPERIMENTAL_BRANCH=`cat /etc/pkgos/packages-list/experimental-branch | tr '\n' ' '`
# List of packages within the pkgs-js Alioth group,
# cloned from the ${CLONE_URL_PKGJS} repository (see above for the URL)
PKG_JS=`cat /etc/pkgos/packages-list/pkg-javascript-repo | tr '\n' ' '`
SERVERS=`cat /etc/pkgos/packages-list/servers`
# Run adt-run after every package build
RUN_AUTOPKGTEST=no
AUTOPKGTEST_SCHROOT=${TARGET_DISTRO}-amd64-sbuild
##########################################
# Start of pkgos-check-changelog options #
##########################################
# "LOOK_FOR_FORMAT_ERRORS_MODE" and "SORTING_VERSION_MODE" can takes values [disable|notification|peform]
# For applying changes provided by parametrs choose "perform" value for the target parametr.
# For disabling performing functions privided this parametrs chose disable value
# For only displaying notifications and do not perform any actions chose notification value
LOOK_FOR_FORMAT_ERRORS_MODE=disable
SORTING_VERSION_MODE=disable
# Display found anomalies [yes|no]
FIND_ANOMALIES=no
# Default path to the changelog file
INPUT_FILE="debian/changelog"
########################################
# End of pkgos-check-changelog options #
########################################

21
etc/pkgos/substitute Normal file
View File

@ -0,0 +1,21 @@
pyopenssl python-openssl
sqlalchemy-migrate migrate
mysql-python python-mysqldb
ibm_db_sa python-ibm-db-sa
msgpack-python python-msgpack
pytz python-tz
futures python-concurrent.futures
pyzmq python-zmq
qpid-python python-qpid
pyyaml python-yaml
pycrypto python-crypto
python-memcached python-memcache
pysqlite python-pysqlite2
pysendfile python-sendfile
kafka-python python-kafka
pysnmp python-pysnmp4
requests-aws python-awsauth
django_openstack_auth python-openstack-auth
django_compressor python-compressor
beautifulsoup4 python-bs4
gitpython python-git

View File

@ -0,0 +1,243 @@
#!/bin/sh
# The content after this line comes from openstack-pkg-tools
# and has been automatically added to a .init.in script, which
# contains only the descriptive part for the daemon. Everything
# else is standardized as a single unique script.
# Author: Thomas Goirand <zigo@debian.org>
# Author: Ondřej Nový <novy@ondrej.org>
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
if [ -n "${UWSGI_PORT}" ] && [ -n "${UWSGI_INI_PATH}" ] && [ -n "${UWSGI_INI_APP}" ] ; then
if ! [ -f "${UWSGI_INI_APP}" ] ; then
exit 0
fi
if [ -d /etc/${PROJECT_NAME}/ssl/private ] ; then
KEY_FILE=$(find /etc/${PROJECT_NAME}/ssl/private -type f -iname '*.pem' 2>/dev/null | head -n 1)
fi
if [ -e /usr/local/share/ca-certificates/puppet_openstack.crt ] ; then
# This is needed for puppet...
CERT_FILE=/usr/local/share/ca-certificates/puppet_openstack.crt
else
if [ -d /etc/${PROJECT_NAME}/ssl/public ] ; then
CERT_FILE=$(find /etc/${PROJECT_NAME}/ssl/public -type f -iname '*.crt' 2>/dev/null | head -n 1)
fi
fi
# Sid doesn't have /usr/bin/uwsgi_python3, so we need
# to search for a more specific daemon name. For stretch
# /usr/bin/uwsgi_python3 is fine.
for i in 3 35 36 37 38 39 ; do
if [ -x /usr/bin/uwsgi_python${i} ] ; then
DAEMON=/usr/bin/uwsgi_python${i}
fi
done
if [ -n "${UWSGI_BIND_CONFIG_FILE}" ] && [ -r "${UWSGI_BIND_CONFIG_FILE}" ] && [ -n "${UWSGI_BIND_CONFIG_SECTION}" ] && [ -n "${UWSGI_BIND_CONFIG_IP_DIRECTIVE}" ] && [ -n "${UWSGI_BIND_CONFIG_PORT_DIRECTIVE}" ] && [ -r /usr/share/openstack-pkg-tools/pkgos_func ] ; then
. /usr/share/openstack-pkg-tools/pkgos_func
pkgos_inifile get ${UWSGI_BIND_CONFIG_FILE} ${UWSGI_BIND_CONFIG_SECTION} ${UWSGI_BIND_CONFIG_IP_DIRECTIVE}
if [ -n "${RET}" ] && [ ! "${RET}" = "NOT_FOUND" ] ; then
UWSGI_BIND_IP=${RET}
fi
pkgos_inifile get ${UWSGI_BIND_CONFIG_FILE} ${UWSGI_BIND_CONFIG_SECTION} ${UWSGI_BIND_CONFIG_PORT_DIRECTIVE}
if [ -n "${RET}" ] && [ ! "${RET}" = "NOT_FOUND" ] ; then
UWSGI_PORT=${RET}
fi
if [ -n "${UWSGI_BIND_CONFIG_WORKERS_DIRECTIVE}" ] ; then
pkgos_inifile get ${UWSGI_BIND_CONFIG_FILE} ${UWSGI_BIND_CONFIG_SECTION} ${UWSGI_BIND_CONFIG_WORKERS_DIRECTIVE}
if [ -n "${RET}" ] && [ ! "${RET}" = "NOT_FOUND" ] ; then
UWSGI_PROCESSES=" --processes ${RET}"
else
# If we can't find the directive in the config file,
# we fallback to the number of thread / 2.
UWSGI_PROCESSES=" --processes "$(( $(nproc) / 2 ))
fi
fi
if [ "${UWSGI_BIND_CONFIG_FILE}" = "/etc/swift/object-server.conf" ] ; then
pkgos_inifile get ${UWSGI_BIND_CONFIG_FILE} ${UWSGI_BIND_CONFIG_SECTION} devices
if [ -n "${RET}" ] && [ ! "${RET}" = "NOT_FOUND" ] ; then
DEVICES_PATH=${RET}
NUM_DEVICES=$(ls ${DEVICES_PATH} | wc -l)
COUNT=0
while [ "${COUNT}" != "${NUM_DEVICES}" ] ; do
CUR_PORT=$(( ${UWSGI_PORT} + ${COUNT} ))
BIND_PARAMS="${BIND_PARAMS} --http-socket ${UWSGI_BIND_IP}:${CUR_PORT}"
COUNT=$(( ${COUNT} + 1 ))
done
fi
fi
else
UWSGI_BIND_IP=""
fi
if [ -n "${BIND_PARAMS}" ] ; then
DAEMON_ARGS="${BIND_PARAMS}${UWSGI_PROCESSES}"
else
if [ -n "${KEY_FILE}" ] && [ -n "${CERT_FILE}" ] ; then
DAEMON_ARGS="--https-socket ${UWSGI_BIND_IP}:${UWSGI_PORT},${CERT_FILE},${KEY_FILE}${UWSGI_PROCESSES}"
else
DAEMON_ARGS="--http-socket ${UWSGI_BIND_IP}:${UWSGI_PORT}${UWSGI_PROCESSES}"
fi
fi
DAEMON_ARGS="${DAEMON_ARGS} --ini ${UWSGI_INI_PATH}"
NO_OPENSTACK_CONFIG_FILE_DAEMON_ARG=yes
NO_OPENSTACK_LOGFILE_DAEMON_ARG=yes
fi
if [ -z "${DAEMON}" ] ; then
DAEMON=/usr/bin/${NAME}
fi
PIDFILE=/var/run/${PROJECT_NAME}/${NAME}.pid
if [ -z "${SCRIPTNAME}" ] ; then
SCRIPTNAME=/etc/init.d/${NAME}
fi
if [ -z "${SYSTEM_USER}" ] ; then
SYSTEM_USER=${PROJECT_NAME}
fi
if [ -z "${SYSTEM_GROUP}" ] ; then
SYSTEM_GROUP=${PROJECT_NAME}
fi
if [ "${SYSTEM_USER}" != "root" ] ; then
STARTDAEMON_CHUID="--chuid ${SYSTEM_USER}:${SYSTEM_GROUP}"
fi
if [ -z "${CONFIG_FILE}" ] ; then
CONFIG_FILE=/etc/${PROJECT_NAME}/${PROJECT_NAME}.conf
fi
LOGFILE=/var/log/${PROJECT_NAME}/${NAME}.log
if [ -z "${NO_OPENSTACK_CONFIG_FILE_DAEMON_ARG}" ] ; then
DAEMON_ARGS="--config-file=${CONFIG_FILE} ${DAEMON_ARGS}"
fi
# Exit if the package is not installed
[ -x $DAEMON ] || exit 0
# If ran as root, create /var/lock/X, /var/run/X and /var/cache/X as needed
if [ `whoami` = "root" ] ; then
for i in lock run cache ; do
mkdir -p /var/$i/${PROJECT_NAME}
chown ${SYSTEM_USER}:${SYSTEM_GROUP} /var/$i/${PROJECT_NAME}
done
fi
# This defines support functions which we use later on
. /lib/lsb/init-functions
RET=0
# Manage log options: logfile and/or syslog, depending on user's choosing
[ -r /etc/default/openstack ] && . /etc/default/openstack
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
[ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog"
if [ -z "${NO_OPENSTACK_LOGFILE_DAEMON_ARG}" ] ; then
[ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=$LOGFILE"
fi
do_start() {
start-stop-daemon \
--start \
--quiet \
--background ${STARTDAEMON_CHUID} \
--make-pidfile --pidfile ${PIDFILE} \
--chdir /var/lib/${PROJECT_NAME} \
--startas $DAEMON \
--test > /dev/null \
|| return 1
if [ -n "${PYARGV}" ] ; then
start-stop-daemon \
--start \
--quiet \
--background ${STARTDAEMON_CHUID} \
--make-pidfile --pidfile ${PIDFILE} \
--chdir /var/lib/${PROJECT_NAME} \
--startas $DAEMON \
-- $DAEMON_ARGS --pyargv "${PYARGV}" \
|| return 2
else
start-stop-daemon \
--start \
--quiet \
--background ${STARTDAEMON_CHUID} \
--make-pidfile --pidfile ${PIDFILE} \
--chdir /var/lib/${PROJECT_NAME} \
--startas $DAEMON \
-- $DAEMON_ARGS \
|| return 2
fi
}
do_stop() {
start-stop-daemon \
--stop \
--quiet \
--retry=TERM/30/KILL/5 \
--pidfile $PIDFILE
RETVAL=$?
rm -f $PIDFILE
return "$RETVAL"
}
do_systemd_start() {
if [ -n "${PYARGV}" ] ; then
exec $DAEMON $DAEMON_ARGS --pyargv "${PYARGV}"
else
exec $DAEMON $DAEMON_ARGS
fi
}
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
do_start
case $? in
0|1) log_end_msg 0 ; RET=$? ;;
2) log_end_msg 1 ; RET=$? ;;
esac
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case $? in
0|1) log_end_msg 0 ; RET=$? ;;
2) log_end_msg 1 ; RET=$? ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME"
RET=$?
;;
systemd-start)
do_systemd_start
;;
show-args)
if [ -n "${PYARGV}" ] ; then
echo $DAEMON $DAEMON_ARGS --pyargv \"${PYARGV}\"
else
echo $DAEMON $DAEMON_ARGS
fi
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case $? in
0|1)
do_start
case $? in
0) log_end_msg 0 ; RET=$? ;;
1) log_end_msg 1 ; RET=$? ;; # Old process is still running
*) log_end_msg 1 ; RET=$? ;; # Failed to start
esac
;;
*) log_end_msg 1 ; RET=$? ;; # Failed to stop
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload|systemd-start}" >&2
RET=3
;;
esac
exit $RET

View File

@ -0,0 +1,129 @@
#!/bin/sh
if [ $# -ne 1 ] ; then
echo "Usage: $0 <init_template>"
exit 1
fi
INIT_TEMPLATE=${1}
SERVICE_FILE=`echo ${INIT_TEMPLATE} | sed 's/.init.in/.service/'`
# Get the variables defined in the init template
. ${INIT_TEMPLATE}
if [ -z "${NAME}" ] ; then
echo "Variable NAME is not set!"
exit 1
fi
if [ -z "${PROJECT_NAME}" ] ; then
echo "Variable PROJECT_NAME is not set!"
exit 1
fi
if [ -z "${DESC}" ] ; then
echo "Variable DESC is not set!"
exit 1
fi
if [ -z "${SCRIPTNAME}" ] ; then
SCRIPTNAME=/etc/init.d/${NAME}
fi
if [ -z "${SYSTEM_USER}" ] ; then
SYSTEM_USER=${PROJECT_NAME}
fi
if [ -z "${SYSTEM_GROUP}" ] ; then
SYSTEM_GROUP=${PROJECT_NAME}
fi
if [ -z "${SYSTEMD_TYPE}" ] ; then
SYSTEMD_TYPE=simple
fi
# Find out what should go in After=
SHOULD_START=$(cat ${INIT_TEMPLATE} | grep "# Should-Start:" | sed 's/# Should-Start://')
X_START_BEFORE=$(cat ${INIT_TEMPLATE} | grep "# X-Start-Before:" | sed 's/# X-Start-Before://')
REQUIRED_START=$(cat ${INIT_TEMPLATE} | grep "# Required-Start:" | sed 's/# Required-Start://')
if [ -n "${SHOULD_START}" ] || [ -n "${REQUIRED_START}" ] ; then
AFTER="After="
WANTS="Wants="
fi
if [ -n "${SHOULD_START}" ] ; then
for i in ${SHOULD_START} ; do
AFTER="${AFTER}${i}.service "
done
fi
for i in $(cat ${INIT_TEMPLATE} | grep "# Required-Start:" | sed 's/# Required-Start://' ) ; do
# Translate Required-Start: that has a $ ...
if [ $( echo $i | head -c 1) = '$' ] ; then
if [ "${i}" = '$network' ] ; then
AFTER="${AFTER}network-online.target "
WANTS="${WANTS}network-online.target "
fi
if [ "${i}" = '$local_fs' ]; then
AFTER="${AFTER}local-fs.target "
fi
if [ "${i}" = '$remote_fs' ]; then
AFTER="${AFTER}remote-fs.target "
fi
# Write down all of the others
else
AFTER="${AFTER}${i}.service "
fi
done
if [ "${WANTS}" = "Wants=" ]; then
WANTS=""
fi
if [ -n "${X_START_BEFORE}" ] ; then
BEFORE="Before="
for i in ${X_START_BEFORE} ; do
BEFORE="${BEFORE}${i}.service "
done
fi
if [ "${SYSTEMD_TYPE}" = "oneshot" ] ; then
SYSTEMD_RESTART="Restart=no"
else
SYSTEMD_RESTART="Restart=on-failure"
fi
if [ -n "${SYSTEMD_DOC}" ] ; then
SYSTEMD_DOC="Documentation=$SYSTEMD_DOC"
else
SYSTEMD_DOC="Documentation=man:${NAME}(1)"
fi
if [ -n "${SYSTEMD_NOTIFY_ACCESS}" ] ; then
SYSTEMD_NOTIFY_ACCESS="NotifyAccess=${SYSTEMD_NOTIFY_ACCESS}"
fi
echo "[Unit]
Description=${DESC}
$AFTER
$WANTS
$BEFORE
$SYSTEMD_DOC
$CUSTOM_SYSTEMD_UNIT
[Service]
User=${SYSTEM_USER}
Group=${SYSTEM_GROUP}
Type=${SYSTEMD_TYPE}
WorkingDirectory=~
RuntimeDirectory=${PROJECT_NAME} lock/${PROJECT_NAME}
CacheDirectory=${PROJECT_NAME}
ExecStart=${SCRIPTNAME} systemd-start
$SYSTEMD_RESTART
LimitNOFILE=65535
TimeoutStopSec=15
${SYSTEMD_NOTIFY_ACCESS}
[Install]
WantedBy=multi-user.target
" >${SERVICE_FILE}.tmp
# 1. Make several blank lines between blocks to single line
# 2. Remove last empty line
awk 'BEGIN{bl=0}/^$/{bl++;if(bl==1)print;else next}/^..*$/{bl=0;print}' ${SERVICE_FILE}.tmp | awk 'NR > 1{print t} {t = $0}END{if (NF) print }' > ${SERVICE_FILE}
rm -f ${SERVICE_FILE}.tmp

View File

@ -0,0 +1,24 @@
.\" Contact akroshchenko@mirantis.com to correct errors or typos.
.TH man 8 "27 Apr 2016" "45.0" "pkgos-alioth-new-git"
.SH NAME
pkgos-alioth-new-git - create a new Git repository out of your current working tree on Alioth.
.SH SYNOPSIS
.B pkgos-alioth-new-git
[-u <alioth-username>] <destination-project-path-on-alioth>
.SH DESCRIPTION
This utility will use the current folder to create git repository on Alioth with the same name.
.SH OPTIONS
.IP -u
use login as <alioth-username>
.SH BUGS
No known bugs.
.SH AUTHOR
Script is written by Thomas Goirand <zigo@debian.org>
.PD 0
.TP
Man page is written by Andrii Kroshchenko <akroshchenko@mirantis.com>

View File

@ -0,0 +1,31 @@
.\" Contact akroshchenko@mirantis.com to correct errors or typos.
.TH man 8 "27 Apr 2016" "45.0" "pkgos-alternative-bin"
.SH NAME
pkgos-alternative-bin - add alternative(s) simlink (
.B see update-alternatives(8)
) of the python (version 2 and 3) target package in the debian/{post{inst,rm},prerm} files
and suggest additions to debian/rules.
.SH SYNOPSIS
.B pkgos-alternative-bin
PKG-NAME bin-name-1 [ bin-name-2 ...]
.SH DESCRIPTION
.B pkgos-alternative-bin
adds alternative(s) simlink (see update-alternatives(8)) of the target package in the debian/{post{inst,rm},prerm} files
.SH OPTIONS
The \fBpkgos-alternative-bin\fR does not take any options.
.SH BUGS
No known bugs.
.SH SEE ALSO
.B
update-alternatives(8)
.SH AUTHOR
Script is written by Thomas Goirand <zigo@debian.org>
.PD 0
.TP
Man page is written by Andrii Kroshchenko <akroshchenko@mirantis.com>

33
man/pkgos-bb.1 Normal file
View File

@ -0,0 +1,33 @@
.\" Contact akroshchenko@mirantis.com to correct errors or typos.
.TH man 8 "27 Apr 2016" "45.0" "pkgos-bb"
.SH NAME
pkgos-bb \- backport package from defined distribution.
.SH SYNOPSIS
.B pkgos-bb
[\-u] [\-d <DISTRO>]
PACKAGE_NAME
.SH DESCRIPTION
.B pkgos-bb
backports package from defined distribution.
.SH OPTIONS
\-u upload to the defined Debian repository.
\-d DISTRO define fron which distro to backport.
.SH FILES
/var/lib/jenkins/backports/ \- the root backport directory for building by jenkins user
~/src/os-bpo \- the root backport directory for building by other users
.SH BUGS
No known bugs.
.SH AUTHOR
Script is written by Thomas Goirand <zigo@debian.org>
.PD 0
.TP
Man page is written by Andrii Kroshchenko <akroshchenko@mirantis.com>

30
man/pkgos-bop-jenkins.1 Normal file
View File

@ -0,0 +1,30 @@
.\" Contact akroshchenko@mirantis.com to correct errors or typos.
.TH man 8 "27 Apr 2016" "45.0" "pkgos-bop-jenkins man page"
.SH NAME
pkgos-bop-jenkins \- Jenkins helper to build a package.
.SH SYNOPSIS
.B pkgos-bop-jenkins
.SH DESCRIPTION
.B pkgos-bop-jenkins
fetches the source package from the correct repository (either pkg-javascript
or openstack), switched to the defined branch in /etc/pkgos/pkgos.conf, and
builds it using pkgos-bop. This script is typically used by a Jenkins
installtion.
.SH OPTIONS
The \fBpkgos-bop-jenkins\fR does not take any options.
.SH BUGS
No known bugs.
. SH SEE ALSO
pkgos-bop
.SH AUTHOR
Script is written by Thomas Goirand <zigo@debian.org>
.PD 0
.TP
Man page is written by Andrii Kroshchenko <akroshchenko@mirantis.com>

19
man/pkgos-bop.1 Normal file
View File

@ -0,0 +1,19 @@
.\" Contact akroshchenko@mirantis.com to correct errors or typos.
.TH man 8 "27 Apr 2016" "45.0" "pkgos-bop man page"
.SH NAME
pkgos-bop \- build package.
.SH SYNOPSIS
.B pkgos-bop
.SH DESCRIPTION
.B pkgos-bop
builds package using gbp buildpackage and write it in /home/ftp.
.SH OPTIONS
The \fBpkgos-bop\fR does not take any options.
.SH BUGS
No known bugs.
.SH AUTHOR
Script is written by Thomas Goirand <zigo@debian.org>
.PD 0
.TP
Man page is written by Andrii Kroshchenko <akroshchenko@mirantis.com>

View File

@ -0,0 +1,57 @@
.\" Contact akroshchenko@mirantis.com to correct errors or typos.
.TH man 8 "30 May 2016" "45.0" "pkgos-check-changelog man page"
.SH NAME
pkgos-check-changelog \- look for errors of sorting by versions and formatting
errors in debian changelog and try to correct them.
.SH SYNOPSIS
.B pkgos-check-changelog
[\-a yes|no]
[\-e disable|notification|perform]
[\-f <path_to_the_changelog>]
[\-s disable|notification|perform]
[\-h]
.SH DESCRIPTION
.B pkgos-check-changelog
tries to find errors of sorting by versions and formatting errors in debian
changelog and according to options of the script can display or tries to
correct them. Also script has ability to detect situation when newer version
of package is older then previous packages.
.SH OPTIONS
.PP
.PD 0
.TP 15
.B \-a
If parameter set yes - tells to script display information about found
anomalies.
.PD 5
.TP 15
.B \-e
Setting up mode for finding format errors. Disable means do not perform search
of formatting errors, notification - only display errors and perform - try to
correct found errors.
.TP 3
.B \-f
<path> Setting up path to the changelog file.
.TP 15
.B \-s
Setting up mode for sorting by version. Disable - turm off, notification -
display the difference betwean exist sorting versions order and proposed,
perform - try to correct sorting order.
.TP 15
.B \-h
Show help message.
.SH BUGS
No known bugs.
.SH AUTHOR
Andrii Kroshchenko <akroshchenko@mirantis.com>

29
man/pkgos-debpypi.1 Normal file
View File

@ -0,0 +1,29 @@
.\" Contact akroshchenko@mirantis.com to correct errors or typos.
.TH man 8 "27 Apr 2016" "45.0" "pkgos-debpypi man page"
.SH NAME
pkgos-debpypi \- create a template Debian package out of a PyPi package name.
.SH SYNOPSIS
.B pkgos-debpypi
[\-u URL]
<package_name>
.SH DESCRIPTION
.B pkgos-debpypi
creates a template Debian package out of a PyPi package name. Once this script
has run, make sure it did what you expected, then use the newly created source
package as a template. Make sure you correct the debian/copyright file before
publishing any package.
.SH OPTIONS
\-u upload package from target URL
.SH BUGS
No known bugs.
.SH AUTHOR
Script is written by Thomas Goirand <zigo@debian.org>
.PD 0
.TP
Man page is written by Andrii Kroshchenko <akroshchenko@mirantis.com>

View File

@ -0,0 +1,23 @@
.\" Contact akroshchenko@mirantis.com to correct errors or typos.
.TH man 8 "27 Apr 2016" "45.0" " pkgos-fetch-fake-repo man page"
.SH NAME
pkgos-fetch-fake-repo \- prepear repository(folder) which contain Packages.gz and Sources.gz files of target distribution.
.SH SYNOPSIS
.B pkgos-fetch-fake-repo
.SH DESCRIPTION
.B pkgos-fetch-fake-repo
prepares a /etc/pkgos/fake-${TARGET_DISTRO}-mirror folder
with Packages.gz and Sources.gz files so that we can later on use
the madison-lite script when using pkgos-parse-requirements.
Indeed, using rmadison for this task is a way too slow, considering the
average amount of dependency in a typical OpenStack component.
.SH OPTIONS
The \fBpkgos-fetch-fake-repo\fR does not take any options.
.SH BUGS
No known bugs.
.SH AUTHOR
Script is written by Thomas Goirand <zigo@debian.org>
.PD 0
.TP
Man page is written by Andrii Kroshchenko <akroshchenko@mirantis.com>

View File

@ -0,0 +1,20 @@
.\" Contact akroshchenko@mirantis.com to correct errors or typos.
.TH man 8 "27 Apr 2016" "45.0" "pkgos-fix-config-default man page"
.SH NAME
pkgos-fix-config-default \- change value of parameter for target section in mentioned configure file.
.SH SYNOPSIS
.B pkgos-fix-config-default
<CONFIG_PATH> <SECTION> <NAME> <VALUE>
.SH DESCRIPTION
.B pkgos-fix-config-default
changes value of parameter by name NAME in config file by path CONFIG_PATH in section SECTION on value VALUE.
.SH OPTIONS
The \fBpkgos-fix-config-default\fR does not take any options.
.SH BUGS
No known bugs.
.SH AUTHOR
Script is written by Thomas Goirand <zigo@debian.org>
.PD 0
.TP
Man page is written by Andrii Kroshchenko <akroshchenko@mirantis.com>

View File

@ -0,0 +1,20 @@
.\" Contact akroshchenko@mirantis.com to correct errors or typos.
.TH man 8 "27 Apr 2016" "45.0" "pkgos-gen-systemd-unit man page"
.SH NAME
pkgos-gen-systemd-unit \- generate the systemd unit.
.SH SYNOPSIS
.B pkgos-gen-systemd-unit
<init_template>
.SH DESCRIPTION
.B pkgos-gen-systemd-unit
generates the systemd unit from the init template.
.SH OPTIONS
The \fBpkgos-gen-systemd-unit\fR does not take any options.
.SH BUGS
No known bugs.
.SH AUTHOR
Script is written by Thomas Goirand <zigo@debian.org>
.PD 0
.TP
Man page is written by Andrii Kroshchenko <akroshchenko@mirantis.com>

View File

@ -0,0 +1,24 @@
.\" Contact akroshchenko@mirantis.com to correct errors or typos.
.TH man 8 "27 Apr 2016" "45.0" "pkgos-infra-build-pkg"
.SH NAME
pkgos-infra-build-pkg - build backport package in the OpenStack infra
.SH SYNOPSIS
.B pkgos-infra-build-pkg
.SH DESCRIPTION
.B pkgos-infra-build-pkg
build backport package using gbp buildpackage. It is used within the OpenStack
infra CI/CD system, and it is not meant to be run by final users.
.SH OPTIONS
The \fBpkgos-infra-build-pkg\fR does not take any options.
.SH BUGS
No known bugs.
.SH AUTHOR
Script is written by Thomas Goirand <zigo@debian.org>
.PD 0
.TP
Man page is written by Andrii Kroshchenko <akroshchenko@mirantis.com>

View File

@ -0,0 +1,30 @@
.\" Contact akroshchenko@mirantis.com to correct errors or typos.
.TH man 8 "27 Apr 2016" "45.0" "pkgos-infra-install-sbuild"
.SH NAME
pkgos-infra-install-sbuild - install a building environment to be used in
OpenStack infra.
.SH SYNOPSIS
.B pkgos-infra-install-sbuild
.SH DESCRIPTION
.B pkgos-infra-install-sbuild
installs a building environment using sbuild as a builder for the "gbp
buildpackage". The sbuild chroot uses an union FS as this is the fastest
backend, and that unionFS scratch disk is stored on tmpfs, as this is the
fastest way to run sbuild.
This script is used within the upstream OpenStack infra using a nodepool
and zuul deployment. It is not meant to be used by final users.
.SH OPTIONS
The \fBpkgos-infra-install-sbuild\fR does not take any options.
.SH BUGS
No known bugs.
.SH AUTHOR
Script is written by Thomas Goirand <zigo@debian.org>
.PD 0
.TP
Man page is written by Andrii Kroshchenko <akroshchenko@mirantis.com>

View File

@ -0,0 +1,40 @@
.\" Contact akroshchenko@mirantis.com to correct errors or typos.
.TH man 8 "27 Apr 2016" "45.0" "pkgos-parse-requirements"
.SH NAME
pkgos-parse-requirements - output list of project requirements
.SH SYNOPSIS
.B pkgos-parse-requirements
[\-h] [file_for_parsing]
.SH DESCRIPTION
This utility attempts to parse an OpenStack requirements.txt file as input, and
produce a list of Debian dependencies as output.
It takes the first argument as the file to parse. If this utility is called
without a parameter, it will attempt to read the requirements.txt and
test-requirements.txt file.
Note that this is far from perfect, and that you *WILL* need to manually check
for the dependencies.
.B *CASES OF MANUAL EDDITING*:
.PD 0
.TP
Some packages should never be in the dependencies in Debian as they are
included in Python (version 2 or 3). If you find one that is missing, just add
it to the BLACK_LIST(for missing packages of Python 2) and/or the
BLACK_LIST_PY3 (for missing packages of Python 3).
.SH OPTIONS
.IP -h
output this page
.SH BUGS
No known bugs.
.SH AUTHOR
Script is written by Thomas Goirand <zigo@debian.org>
.PD 0
.TP
Man page is written by Andrii Kroshchenko <akroshchenko@mirantis.com>

22
man/pkgos-reqsdiff.1 Normal file
View File

@ -0,0 +1,22 @@
.\" Contact akroshchenko@mirantis.com to correct errors or typos.
.TH man 8 "27 Apr 2016" "45.0" "pkgos-reqsdiff"
.SH NAME
pkgos-reqsdiff - show the difference between control-dependencies and project requirenents.
.SH SYNOPSIS
.B pkgos-reqsdiff
.SH DESCRIPTION
.B pkgos-reqsdiff
shows differences between control-dependencies and project requirenents
using \fBpkgos-show-control-depends\fR and \fBpkgos-parse-requirements\fR accordingly to generate
input data.
.SH OPTIONS
The \fBpkgos-reqsdiff\fR does not take any options.
.SH BUGS
No known bugs.
.SH SEE ALSO
pkgos-show-control-depends(1), pkgos-parse-requirements(1)
.SH AUTHOR
Script is written by Thomas Goirand <zigo@debian.org>
.PD 0
.TP
Man page is written by Andrii Kroshchenko <akroshchenko@mirantis.com>

26
man/pkgos-scan-repo.1 Normal file
View File

@ -0,0 +1,26 @@
.\" Contact akroshchenko@mirantis.com to correct errors or typos.
.TH man 8 "27 Apr 2016" "45.0" "pkgos-scan-repo"
.SH NAME
pkgos-scan-repo \- scan the root repo(for default: /home/ftp/debian/pool) and
build a valid Debian repository.
.SH SYNOPSIS
.B pkgos-scan-repoi
[<target-repository-for-scanning>]
.SH DESCRIPTION
.B pkgos-scan-repo
Scanning ${REPO_ROOT} (see /etc/pkgos/pkgos.conf) for packages in target
repository.
.SH OPTIONS
The \fBpkgos-scan-repo\fR does not take any options.
.SH BUGS
No known bugs.
.SH AUTHOR
Script is written by Thomas Goirand <zigo@debian.org>
.PD 0
.TP
Man page is written by Andrii Kroshchenko <akroshchenko@mirantis.com>

29
man/pkgos-setup-sbuild.1 Normal file
View File

@ -0,0 +1,29 @@
.\" Contact akroshchenko@mirantis.com to correct errors or typos.
.TH man 8 "27 Apr 2016" "45.0" "pkgos-setup-sbuild"
.SH NAME
pkgos-setup-sbuild - setup an sbuild.
.SH SYNOPSIS
.B pkgos-setup-sbuild
dev <username>
.PD 0
.TP
\fBpkgos-setup-sbuild\fR jenkins
.SH DESCRIPTION
.B pkgos-setup-sbuild
setups environment for using sbuild, either for personal use, or to setup a
fully working Jenkins build system. This script has many parametrs for setting
in its body, so for getting more details see source code of "pkgos-setus-sbuild".
.SH OPTIONS
The \fBpkgos-setup-sbuild\fR does not take any options.
.SH BUGS
No known bugs.
.SH AUTHOR
Script is written by Thomas Goirand <zigo@debian.org>
.PD 0
.TP
Man page is written by Andrii Kroshchenko <akroshchenko@mirantis.com>

View File

@ -0,0 +1,20 @@
.\" Contact akroshchenko@mirantis.com to correct errors or typos.
.TH man 8 "27 Apr 2016" "45.0" "pkgos-show-control-depends"
.SH NAME
pkgos-show-control-depends - output list of control dependencies
.SH SYNOPSIS
.B pkgos-show-control-depends
.SH DESCRIPTION
.B pkgos-show-control-depends
parses 'control' file and output fields 'Build-Depends', 'Build-Depends-Indep ', 'Depends'.
.SH OPTIONS
The \fBpkgos-show-control-depends\fR does not take any options.
.SH BUGS
No known bugs.
.SH SEE ALSO
pkgos-show-control-depends(1)
.SH AUTHOR
Script is written by Thomas Goirand <zigo@debian.org>
.PD 0
.TP
Man page is written by Andrii Kroshchenko <akroshchenko@mirantis.com>

23
man/pkgos-testr.1 Normal file
View File

@ -0,0 +1,23 @@
.\" Contact akroshchenko@mirantis.com to correct errors or typos.
.TH man 8 "27 Apr 2016" "45.0" "pkgos-testr man page"
.SH NAME
pkgos-testr \- run testes for target python package.
.SH SYNOPSIS
.B pkgos-testr
python-version
[test-scope]
.SH DESCRIPTION
.B pkgos-testr
runs testes for target python package using the information from .test.conf and
output information by block. Output block information includes simple massage about
status of test and brief description if error.
.SH OPTIONS
The \fBpkgos-testr\fR does not take any options.
.SH BUGS
No known bugs.
.SH AUTHOR
Script is written by Thomas Goirand <zigo@debian.org>
.PD 0
.TP
Man page is written by Andrii Kroshchenko <akroshchenko@mirantis.com>

71
man/pkgos.make.1 Normal file
View File

@ -0,0 +1,71 @@
.\" Contact akroshchenko@mirantis.com to correct errors or typos.
.TH man 8 "02 Jun 2016" "45.0" "pkgos.make man page"
.SH NAME
pkgos.make \- helper with useful functions for maintainers
.SH SYNOPSIS
.B pkgos.make
.SH DESCRIPTION
.B pkgos.make
uses exist .init.in file to generate appropriate init script, systemd unit if
these files are absent. This make file also contains some common functions
which can be useful for maintainers:
.PP
.PD 5
.TP 10
.B \-gen-init-configurations
this function is responsible for generating init script and systemd unit.
.TP
.B \-gen-author-list
generates list of authors taken from git log.
.TP
.B \-gen-upstream-changelog
generate changelog file for debian distribution from git log.
.TP
.B \-get-orig-source
downloads the new upstream tarball by using uscan.
.TP
.B \-fetch-upstream-remote
downloads package from the upstream
(https://github.com/openstack/<package_name>). The package_name is determined
by the package of the current directory.
.TP
.B \-gen-orig-(xz|gz|bz2)
creates original tarball by using (xz|gz|bz2) data compressor.
.TP
.B \-get-master-branch
create master branch.
.TP
.B \-get-vcs-source
is the pipeline of the functions fetch-upstream-remote, gen-orig-xz,
get-master-branch.
.TP
.B \-versioninfo
write package version to the versioninfo file.
.TP
.B \-display-po-stats
displays number of translated messages for each .po file in debian/po.
.TP
.B \-call-for-po-trans
this functions calls podebconf-report-po with specific parameters.
.TP
.B \-regen-manifest-patch
generate list of all files of the package and write it to the MANIFEST.in.
.SH EXAMPLES
.PP 5
.TP
.B For calling functions above use next syntax:
\/./debian/rules <function_name>
.SH SEE ALSO
\fBpkgos-gen-systemd-unit\fR(\fB8\fR),
\fBpkgos-gen-upstart-job\fR(\fB8\fR),
\fBuscan\fR(\fB1\fR),
\fBpodebconf-report-po\fR(\fB1\fR),
\fBquilt\fR(\fB1\fR).
.SH BUGS
No known bugs.
.SH AUTHOR
.TP
Script is written by Thomas Goirand <zigo@debian.org>
.TP
Man page is written by Andrii Kroshchenko <akroshchenko@mirantis.com>

View File

@ -0,0 +1,19 @@
--- a/Package.pm 2016-04-25 23:41:39.000000000 +0200
+++ b/Package.pm 2016-08-18 11:34:34.281978936 +0200
@@ -70,7 +70,7 @@
(?:^|/)(?:DEADJOE|\.arch-inventory|\.(?:bzr|cvs|hg|git)ignore)$|
# File or directory names that should be ignored
(?:^|/)(?:CVS|RCS|\.deps|\{arch\}|\.arch-ids|\.svn|
-\.hg(?:tags|sigs)?|_darcs|\.git(?:attributes|modules)?|
+\.hg(?:tags|sigs)?|_darcs|\.git(?:attributes|modules|review)?|
\.shelf|_MTN|\.be|\.bzr(?:\.backup|tags)?)(?:$|/.*$)
';
# Take out comments and newlines
@@ -106,6 +106,7 @@
.gitattributes
.gitignore
.gitmodules
+.gitreview
.hg
.hgignore
.hgsigs

View File

@ -0,0 +1,11 @@
--- a/ChrootSetup.pm 2016-10-12 21:03:05.357702250 +0000
+++ b/ChrootSetup.pm 2016-10-12 21:03:26.929579131 +0000
@@ -274,7 +274,7 @@
return $?
}
- my @command = ('gpg', '--no-options', '--pinentry-mode', 'loopback', '--passphrase-file', '/dev/null', '--no-default-keyring', '--batch', '--gen-key',
+ my @command = ('gpg', '--no-options', '--passphrase-file', '/dev/null', '--no-default-keyring', '--batch', '--gen-key',
$tmpfilename);
$host->run_command(
{ COMMAND => \@command,

12
misc/openstack.profile Normal file
View File

@ -0,0 +1,12 @@
# This profile is auto-generated
Profile: debian/main
Extends: debian/ftp-master-auto-reject
Enable-Tags-From-Check: apache2, automake, binaries, changelog-file, changes-file,
conffiles, control-file, control-files, copyright-file, cruft, dbus, deb-format,
debconf, debhelper, debian-readme, debian-source-dir, description,
duplicate-files, fields, filename-length, files, group-checks, huge-usr-share,
infofiles, init.d, java, lintian, manpages, md5sums, menu-format, menus, nmu,
ocaml, patch-systems, phppear, po-debconf, rules, scripts, shared-libs,
source-copyright, standards-version, symlinks, systemd, testsuite,
version-substvars, watch-file
Disable-Tags: debian-watch-may-check-gpg-signature, unused-file-paragraph-in-dep5-copyright, no-upstream-changelog, binary-without-manpage, maintainer-script-should-not-use-update-alternatives-remove, latest-debian-changelog-entry-without-new-version

28
misc/pkgos-alioth-new-git Executable file
View File

@ -0,0 +1,28 @@
#!/bin/sh
set -e
usage () {
echo "$0 creates a new Git repository out of your current working tree on alioth."
echo "You must be at the root of that local git repository"
echo "$0 will use the current folder as the name for the Alioth git repository."
echo ""
echo "Usage: $0 <group> <repo>"
echo "example: $0 openstack will create a /git/openstack/><group>/<repo>.git repository"
echo "note that you will need to have write access on the destination project,"
echo "which means you must be a member of that said project on Alioth."
echo ""
echo "Please send patch/comments to: Debian OpenStack <openstack-devel@lists.alioth.debian.org>"
exit 1
}
if [ $# != 2 ] ; then
usage
fi
GROUP=$1
REPO=$2
ssh git.debian.org "/home/groups/openstack/stuff/create-repo.sh ${GROUP} ${REPO}"
git remote add origin ssh://git.debian.org/git/openstack/${GROUP}/${REPO}.git
git push -u --all origin

82
misc/pkgos-alternative-bin Executable file
View File

@ -0,0 +1,82 @@
#!/bin/sh
set -e
usage () {
echo "$0 PKG-NAME bin-name-1 [ bin-name-2 ...]"
exit 1
}
if [ $# -lt 2 ] ; then
usage
fi
PKG_NAME=${1}
PKG_PY2=python-${1}
PKG_PY3=python3-${1}
shift
# postinst
echo "#!/bin/sh
set -e
if [ \"\$1\" = \"configure\" ] ; then" >debian/$PKG_PY2.postinst
cp debian/$PKG_PY2.postinst debian/$PKG_PY3.postinst
# postrm
echo "#!/bin/sh
set -e
if [ \"\$1\" = \"remove\" ] || [ \"\$1\" = \"disappear\" ] ; then" >debian/$PKG_PY2.postrm
cp debian/$PKG_PY2.postrm debian/$PKG_PY3.postrm
# postrm
echo "#!/bin/sh
set -e
if [ \"\$1\" = \"remove\" ] ; then" >debian/$PKG_PY2.prerm
cp debian/$PKG_PY2.prerm debian/$PKG_PY3.prerm
RULES_ENTRY=""
while [ -n "${1}" ] ; do
BIN_UTIL_NAME=$1
shift
echo " update-alternatives --install /usr/bin/${BIN_UTIL_NAME} ${BIN_UTIL_NAME} /usr/bin/python2-${BIN_UTIL_NAME} 300" >>debian/$PKG_PY2.postinst
echo " update-alternatives --install /usr/bin/${BIN_UTIL_NAME} ${BIN_UTIL_NAME} /usr/bin/python3-${BIN_UTIL_NAME} 200" >>debian/$PKG_PY3.postinst
echo " update-alternatives --remove ${BIN_UTIL_NAME} /usr/bin/python2-${BIN_UTIL_NAME}" >>debian/$PKG_PY2.postrm
echo " update-alternatives --remove ${BIN_UTIL_NAME} /usr/bin/python3-${BIN_UTIL_NAME}" >>debian/$PKG_PY3.postrm
echo " update-alternatives --remove ${BIN_UTIL_NAME} /usr/bin/python2-${BIN_UTIL_NAME}" >>debian/$PKG_PY2.prerm
echo " update-alternatives --remove ${BIN_UTIL_NAME} /usr/bin/python3-${BIN_UTIL_NAME}" >>debian/$PKG_PY3.prerm
RULES_ENTRY="${RULES_ENTRY}\n\tmv \$(CURDIR)/debian/${PKG_PY2}/usr/bin/${BIN_UTIL_NAME} \$(CURDIR)/debian/${PKG_PY2}/usr/bin/python2-${BIN_UTIL_NAME}"
RULES_ENTRY="${RULES_ENTRY}\n\tmv \$(CURDIR)/debian/${PKG_PY3}/usr/bin/${BIN_UTIL_NAME} \$(CURDIR)/debian/${PKG_PY3}/usr/bin/python3-${BIN_UTIL_NAME}"
done
for i in postinst prerm postrm ; do
echo "fi
#DEBHELPER#
exit 0">>debian/$PKG_PY2.$i
echo "fi
#DEBHELPER#
exit 0">>debian/$PKG_PY3.$i
done
echo "I created the below maintainer scripts for you:
- debian/$PKG_PY2.postinst
- debian/$PKG_PY3.postinst
- debian/$PKG_PY2.postrm
- debian/$PKG_PY3.postrm
- debian/$PKG_PY2.prerm
- debian/$PKG_PY3.prerm
Please make sure to insert this in your debian/rules:
${RULES_ENTRY}
"
exit 0

217
misc/pkgos-check-changelog Executable file
View File

@ -0,0 +1,217 @@
#!/bin/bash
# set -o errexit
# set -x
if ! [ -r /etc/pkgos/pkgos.conf ] ; then
echo "Could not read /etc/pkgos/pkgos.conf"
exit 1
else
. /etc/pkgos/pkgos.conf
fi
GetoptsVariables() {
while getopts ":e:s:f:a:h" opt; do
case ${opt} in
e)
LOOK_FOR_FORMAT_ERRORS_MODE=${OPTARG}
;;
s)
SORTING_VERSION_MODE=${OPTARG}
;;
a)
FIND_ANOMALIES=${OPTARG}
;;
f)
INPUT_FILE=${OPTARG}
;;
h)
ShowUsage
exit 1
;;
*)
echo "Wrong option for the pkgos-check-changelog"
exit 1
esac
done
}
ShowUsage() {
cat << EOF
Using pkgos-check-changelog
OPTION POSSIBLE VALUES DESCRIPTION
______ _______________ __________________________
-a yes|no Find anomalies
-e disable| Find format errors
notification|
perform
-f <path> Path to the changelog file
-s disable| Sorting by version
notification|
perform
-h Help message
EOF
}
GetPackageName() {
WORK_FILE=$(mktemp -t WORK_FILE.XXXXX)
cp ${INPUT_FILE} ${WORK_FILE}
i=0
while [ -z "$(head -n 1 ${WORK_FILE})" ]; do
i=$((i + 1))
if [ $i -gt 100 ]; then
echo "Too many empty lines in the beginning"
exit 1
fi
sed -i "1d" "${WORK_FILE}"
done
GLOBAL_NAME_OF_PACKAGE="$(head -n 1 ${WORK_FILE} |cut -d" " -f1|cut -d"-" -f1)"
rm ${WORK_FILE}
}
LookforFormatErrors() {
FORMAT_ERROR_FLAG=0
echo "LOOKING FOR FORMAT ERRORS===================================="
FORMAT_ERROR_WORK_FILE=$(mktemp -t FORMAT_ERROR_WORK_FILE.XXXXX)
cp ${INPUT_FILE} ${FORMAT_ERROR_WORK_FILE}
echo >> "${FORMAT_ERROR_WORK_FILE}"
sed -i "s/ *$//" "${FORMAT_ERROR_WORK_FILE}"
sed -i "/${GLOBAL_NAME_OF_PACKAGE}.*urgency.*/ s/^ *//" "${FORMAT_ERROR_WORK_FILE}"
sed -i "/--.*>/ s/^ */ /" "${FORMAT_ERROR_WORK_FILE}"
if [ "${LOOK_FOR_FORMAT_ERRORS_MODE}" = "perform" ]; then
FORMAT_ERROR_FLAG=1
cp ${FORMAT_ERROR_WORK_FILE} ${INPUT_FILE}
elif [ "${LOOK_FOR_FORMAT_ERRORS_MODE}" = "notification" ]; then
echo "Check next lines:"
diff -u ${INPUT_FILE} ${FORMAT_ERROR_WORK_FILE} |grep -e "^-[^-]" |sed "s/^-//g"
else
echo "Wrong value of LOOK_FOR_FORMAT_ERRORS_MODE"
fi
rm ${FORMAT_ERROR_WORK_FILE}
}
PrintBody() {
local LINE_1 LINE NAME VERSION FLAG
local INPUT_ORDER=$1
while IFS= read LINE_1; do
if $(echo "${LINE_1}" |grep -q "^${GLOBAL_NAME_OF_PACKAGE}"); then
NAME="$( echo "${LINE_1}" |cut -d " " -f 1 )"
VERSION="$( echo "${LINE_1}" |cut -d " " -f 2 | sed -e "s/\((\|)\)//g")"
FLAG=0
fi
while IFS= read -r LINE; do
if [ "${FLAG}" -eq 1 ]; then
if echo "${LINE}" | grep "<.*@.*>" | grep -qe "^ -- "; then
echo "${LINE}"
echo ""
break
fi
echo "${LINE}"
fi
if echo "${LINE}" | grep -q "${NAME}" && echo "${LINE}" | grep -qw "(${VERSION})"; then
echo "${LINE}"
FLAG=1
fi
done<${INPUT_FILE}
done<${INPUT_ORDER}
}
SortbyVersion() {
local LINE
WORK_FILE=$(mktemp -t WORK_FILE.XXXXX)
cp ${INPUT_FILE} ${WORK_FILE}
MY_VER_SORT_TEMP_MOS_SUFFIX=$(mktemp -t MY_VER_SORT_TEMP_MOS_SUFFIX.XXXXX)
MY_VER_SORT_TEMP_WITHOUT_MOS_SUFFIX=$(mktemp -t MY_VER_SORT_TEMP_WITHOUT_MOS_SUFFIX.XXXXX)
echo "SORTING_BY_VERSION=========================================="
if [ ${FORMAT_ERROR_FLAG} -eq 0 ]; then
echo "For correct work before sorting by version need check file for format errors!"
fi
if grep "^${GLOBAL_NAME_OF_PACKAGE}" "${WORK_FILE}" |grep -q ":" ; then
sed -i "${GLOBAL_NAME_OF_PACKAGE}.*([0-9][^:]/s/(/(0:/g" "${WORK_FILE}"
fi
echo "$(grep "^${GLOBAL_NAME_OF_PACKAGE}" "${WORK_FILE}" | cut -d " " -f 1,2 |grep mos| sort -Vru | sed -e "s/\((\|)\)//g")" > "${MY_VER_SORT_TEMP_MOS_SUFFIX}"
echo "$(grep "^${GLOBAL_NAME_OF_PACKAGE}" "${WORK_FILE}" | cut -d " " -f 1,2 | grep -v mos| sort -Vru | sed -e "s/\((\|)\)//g")" > "${MY_VER_SORT_TEMP_WITHOUT_MOS_SUFFIX}"
if [ -n "$(cat ${MY_VER_SORT_TEMP_MOS_SUFFIX})" ];then
while read LINE; do
sed -i "/${LINE%~*}/ i\\${LINE}" ${MY_VER_SORT_TEMP_WITHOUT_MOS_SUFFIX}
done<${MY_VER_SORT_TEMP_MOS_SUFFIX}
fi
PrintBody "${MY_VER_SORT_TEMP_WITHOUT_MOS_SUFFIX}" > "${WORK_FILE}"
sed -i "/^${GLOBAL_NAME_OF_PACKAGE}.*(0:/s/(0:/(/g" "${WORK_FILE}"
if [ "${SORTING_VERSION_MODE}" = "perform" ]; then
cp ${WORK_FILE} ${INPUT_FILE}
elif [ "${SORTING_VERSION_MODE}" = "notification" ]; then
echo "Proposed variants marked '+', exist variants marked '-'"
diff -u <(grep "^${GLOBAL_NAME_OF_PACKAGE}" "${INPUT_FILE}" | cut -d" " -f 1,2 | sed -e "s/\((\|)\)//g") ${MY_VER_SORT_TEMP_WITHOUT_MOS_SUFFIX}
else
echo "Wrong value of SORTING_VERSION_MODE"
fi
rm "${WORK_FILE}" "${MY_VER_SORT_TEMP_WITHOUT_MOS_SUFFIX}" "${MY_VER_SORT_TEMP_MOS_SUFFIX}"
}
LookforAnomalies() {
local DATE_1 DATE_2 VERSION_1 VERSION_2 LINE LINE_1
echo "LOOKING FOR ANOMALIES======================================="
i=0
j=0
while read true ; do
i=$((i + 1))
if dpkg-parsechangelog -o $i -c 1 --show-field source --format rfc822 -l ${INPUT_FILE} &>/dev/null ; then
break
fi
VERSION_1="$(dpkg-parsechangelog -n $i --show-field version --format rfc822 -l ${INPUT_FILE})"
DATE_1="$(dpkg-parsechangelog -n $i --show-field date --format rfc822 -l ${INPUT_FILE})"
while read true; do
j=$((i + 1))
if dpkg-parsechangelog -o $j -c 1 --show-field source --format rfc822 -l ${INPUT_FILE} &>/dev/null ; then
break
fi
VERSION_2="$(dpkg-parsechangelog -n $j --show-field version --format rfc822 -l ${INPUT_FILE} )"
DATE_2="$(dpkg-parsechangelog -n $j --show-field date --format rfc822 -l ${INPUT_FILE})"
if dpkg --compare-versions "${VERSION_1}" gt "${VERSION_2}" ; then
if [ `date -d ${DATE_1} +%s` -gt `date -d ${DATE_2} +%s` ]; then
continue
else
echo "anomaly is in a date between :"
echo "${VERSION_1} ${DATE_1} and ${VERSION_2} ${DATE_2}"
exit 1
fi
elif dpkg --compare-versions "${VERSION_1%~*}" ge "${VERSION_2}" ; then
if [ `date -d ${DATE_1} +%s` -gt `date -d ${DATE_2} +%s` ]; then
continue
else
echo "anomaly is in a date between :"
echo "${VERSION_1} ${DATE_1} and ${VERSION_2} ${DATE_2}"
exit 1
fi
fi
done<${INPUT_FILE}
done<${INPUT_FILE}
}
GetoptsVariables ${@}
GetPackageName
echo "LOOK_FOR_FORMAT_ERRORS_MODE = ${LOOK_FOR_FORMAT_ERRORS_MODE}"
echo "SORTING_VERSION_MODE = ${SORTING_VERSION_MODE}"
echo "FIND_ANOMALIES = ${FIND_ANOMALIES}"
if [ "${LOOK_FOR_FORMAT_ERRORS_MODE}" != "disable" ]; then
LookforFormatErrors
fi
if [ "${SORTING_VERSION_MODE}" != "disable" ]; then
SortbyVersion
fi
if [ "${FIND_ANOMALIES}" != "no" ]; then
LookforAnomalies
fi

273
misc/pkgos-debpypi Executable file
View File

@ -0,0 +1,273 @@
#!/bin/sh
set -e
set -x
if [ "${1}" = "-u" ] && [ -n "${2}" ] ; then
ORIG_URL="${2}"
shift
shift
fi
if [ -z "${1}" ] ; then
echo "This tool creates a template Debian package out of a PyPi package name."
echo "Once this script has run, make sure it did what you expected, then use"
echo "the newly created source package as a template. Make sure you correct"
echo "the debian/copyright file before publishing any package."
echo "Usage: ${0} package-name"
exit 1
fi
PKG_NAME=${1}
# Calculate the package name based on the command line argument
LOWER_PKG_NAME=`echo ${PKG_NAME} | awk '{print tolower($0)}'`
LOWER_PKG_NAME=`echo ${LOWER_PKG_NAME} | sed 's/_/-/g'`
if echo ${LOWER_PKG_NAME} | grep -q '^python-' ; then
DEB_PKG_NAME=${LOWER_PKG_NAME}
else
DEB_PKG_NAME=python-${LOWER_PKG_NAME}
fi
echo "===> Package name will be ${DEB_PKG_NAME}"
if ! [ -e ${PKG_NAME}.json ] ; then
wget https://pypi.org/pypi/${PKG_NAME}/json -O ${PKG_NAME}.json
fi
PY3_PKG_NAME=python3-$(echo ${DEB_PKG_NAME} | sed 's/python-//g')
# Get the info from .json using jq
VERSION_STRING=$(cat ${PKG_NAME}.json | jq --raw-output '. | .info.version')
SHORT_DESC=$(cat ${PKG_NAME}.json | jq --raw-output '. | .info.summary')
UP_MAINT_NAME=$(cat ${PKG_NAME}.json | jq --raw-output '. | .info.author')
AUTHOR_EMAIL=$(cat ${PKG_NAME}.json | jq --raw-output '. | .info.author_email')
HOMEPAGE=$(cat ${PKG_NAME}.json | jq --raw-output '. | .info.home_page')
FIRST_LETTER=$(echo ${PKG_NAME} | awk '{print substr($0,1,1)}')
if [ -e ${DEB_PKG_NAME}_${VERSION_STRING}.orig.tar.xz ] ; then
ORIG=${DEB_PKG_NAME}_${VERSION_STRING}.orig.tar.xz
else
ORIG=${DEB_PKG_NAME}_${VERSION_STRING}.orig.tar.gz
fi
echo "===> Package info:
Upstream version: ${VERSION_STRING}
Author: ${UP_MAINT_NAME}
Homepage: ${HOMEPAGE}"
if [ ! -e ${ORIG} ] ; then
echo "===> Downloading ${ORIG} file"
if [ -z "${ORIG_URL}" ] ; then
if [ $(cat ${PKG_NAME}.json | jq --raw-output '. | .urls[0].packagetype') = "sdist" ] ; then
ORIG_URL=$(cat ${PKG_NAME}.json | jq --raw-output '. | .urls[0].url')
else
if [ $(cat ${PKG_NAME}.json | jq --raw-output '. | .urls[1].packagetype') = "sdist" ] ; then
ORIG_URL=$(cat ${PKG_NAME}.json | jq --raw-output '. | .urls[1].url')
else
echo "First and 2nd URL aren't sdist, please manually download..."
exit 1
fi
fi
fi
wget -nv "${ORIG_URL}" -O ${ORIG}
fi
echo "===> Extracting ${ORIG}"
tar -xf ${ORIG}
if ! [ ${PKG_NAME}-${VERSION_STRING} = ${DEB_PKG_NAME}-${VERSION_STRING} ] ; then
# The sed is in case there's a package called package_name with underscore, in which
# case we want to replace that by dash
mv $(echo ${PKG_NAME} | sed 's#_#*#g' | sed 's#-#*#g')-${VERSION_STRING} ${DEB_PKG_NAME}-${VERSION_STRING}
fi
echo "===> Creating debian folder for ${DEB_PKG_NAME}"
if [ ! -d ${DEB_PKG_NAME}-${VERSION_STRING}/debian/source ] ; then
mkdir -p ${DEB_PKG_NAME}-${VERSION_STRING}/debian/source
fi
cd ${DEB_PKG_NAME}-${VERSION_STRING}
echo "===> Searching for sphinx doc folder"
if [ -e doc ] ; then
DOC_FOLDER=doc
elif [ -e docs ] ; then
DOC_FOLDER=docs
fi
if [ -n "${DOC_FOLDER}" ] ; then
CONFPY_FILE=`find ${DOC_FOLDER} -name 'conf.py'`
if [ -r "${CONFPY_FILE}" ] ; then
DOC_FOLDER=`dirname ${CONFPY_FILE}`
SPHINX_BUILD_DEP=", python3-sphinx"
RULES_WITH=",sphinxdoc"
SUGGEST_DOC="
Suggests: ${DEB_PKG_NAME}-doc"
else
DOC_FOLDER=
SPHINX_BUILD_DEP=""
RULES_WITH=""
SUGGEST_DOC=""
fi
fi
echo "===> Checking for PBR and fixing accordingly"
# If the package uses PBR, then we need openstack-pkg-tools
if grep -q "setup_requires=\['pbr'\]" ${DEB_PKG_NAME}-${VERSION_STRING}/setup.py ; then
OSTACK_PKG_T_CTRL=", openstack-pkg-tools"
# We need a mandatory include...
# ... and the export OSLO_PACKAGE_VERSION=$(VERSION)
OSTACK_PKG_T_RULES="include /usr/share/openstack-pkg-tools/pkgos.make
export OSLO_PACKAGE_VERSION=\$(VERSION)"
else
# Otherwise, we just include it non-mandatorily, so that
# we can use ./debian/rules gen-orig-xz
OSTACK_PKG_T_CTRL=""
OSTACK_PKG_T_RULES="-include /usr/share/openstack-pkg-tools/pkgos.make"
fi
echo "Source: ${DEB_PKG_NAME}
Section: python
Priority: optional
Maintainer: Debian OpenStack <team+openstack@tracker.debian.org>
Uploaders: Thomas Goirand <zigo@debian.org>
Build-Depends:
debhelper (>= 10),
dh-python,
openstack-pkg-tools (>= 93~),
python3-setuptools,
python3-all${SPHINX_BUILD_DEP}${OSTACK_PKG_T_CTRL}
Standards-Version: 4.3.0
Vcs-Browser: https://salsa.debian.org/openstack-team/python/${DEB_PKG_NAME}
Vcs-Git: https://salsa.debian.org/openstack-team/python/${DEB_PKG_NAME}.git
Homepage: ${HOMEPAGE}
Package: ${PY3_PKG_NAME}
Architecture: all
Depends: \${python3:Depends}, \${misc:Depends}${SUGGEST_DOC}
Description: ${SHORT_DESC} - Python 3.x
- REPLACE ME -
.
This package contains the Python 3.x module.
" >debian/control
if [ -n "${DOC_FOLDER}" ] ; then
echo "Package: python-"$(echo ${LOWER_PKG_NAME} | sed s/python-//)"-doc
Section: doc
Architecture: all
Depends: \${misc:Depends}, \${sphinxdoc:Depends}
Description: ${SHORT_DESC} - doc
- REPLACE ME -
.
This package contains the documentation.
" >>debian/control
echo "Document: ${DEB_PKG_NAME}-doc
Title: ${PKG_NAME} Documentation
Author: N/A
Abstract: Sphinx documentation for ${PKG_NAME}
Section: Programming/Python
Format: HTML
Index: /usr/share/doc/python-${LOWER_PKG_NAME}-doc/html/index.html
Files: /usr/share/doc/python-${LOWER_PKG_NAME}-doc/html/*" >debian/python-${LOWER_PKG_NAME}-doc.doc-base
fi
EDITOR=touch dch --create --package ${DEB_PKG_NAME} --distribution unstable --urgency medium -v ${VERSION_STRING}-1
rm +1
echo "10" >debian/compat
if [ -n "${AUTHOR_EMAIL}" ] ; then
UP_MAINT_AND_EMAIL="${UP_MAINT_NAME} <${AUTHOR_EMAIL}>"
else
UP_MAINT_AND_EMAIL=${UP_MAINT_NAME}
fi
echo "Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: ${PKG_NAME}
Source: ${HOMEPAGE}
Files: *
Copyright: (c) 2019, ${UP_MAINT_AND_EMAIL}
License: Apache-2
Files: debian/*
Copyright: (c) 2019, Thomas Goirand <zigo@debian.org>
License: Apache-2
License: Apache-2
Licensed under the Apache License, Version 2.0 (the \"License\");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
http://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an \"AS IS\" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian-based systems the full text of the Apache version 2.0 license
can be found in /usr/share/common-licenses/Apache-2.0.
" >debian/copyright
if [ -n "${DOC_FOLDER}" ] ; then
SPHINX_BUILD_RULES="override_dh_sphinxdoc:
ifeq (,\$(findstring nodoc, \$(DEB_BUILD_OPTIONS)))
PYTHONPATH=. python3 -m sphinx -b html ${DOC_FOLDER} debian/python-"$(echo ${LOWER_PKG_NAME} | sed s/python-//)"-doc/usr/share/doc/python-"$(echo ${LOWER_PKG_NAME} | sed s/python-//)"-doc/html
dh_sphinxdoc
endif
"
else
SPHINX_BUILD_RULES=""
fi
if [ -e .testr.conf ] || [ -e .stestr.conf ] ; then
UNIT_TEST_RULES="override_dh_auto_test:
ifeq (,\$(findstring nocheck, \$(DEB_BUILD_OPTIONS)))
pkgos-dh_auto_test --no-py2
endif
"
else
UNIT_TEST_RULES="
ifeq (,\$(findstring nocheck, \$(DEB_BUILD_OPTIONS)))
set -e ; for pyvers in \$(PYTHON3S); do \\
python\$\$pyvers setup.py test ; \\
done
endif
"
fi
echo "#!/usr/bin/make -f
UPSTREAM_GIT := https://github.com/<please-user>/${PKG_NAME}.git
${OSTACK_PKG_T_RULES}
%:
dh \$@ --buildsystem=python_distutils --with python3${RULES_WITH}
override_dh_auto_clean:
rm -rf build .stestr
find . -iname '*.pyc' -delete
for i in \$\$(find . -type d -iname __pycache__) ; do rm -rf \$\$i ; done
override_dh_auto_build:
echo \"Do nothing...\"
override_dh_auto_install:
pkgos-dh_auto_install --no-py2 --in-tmp
${UNIT_TEST_RULES}
override_dh_auto_test:
echo \"Do nothing...\"
${SPHINX_BUILD_RULES}
" >debian/rules
chmod +x debian/rules
echo "/usr" >debian/python3-${LOWER_PKG_NAME}.install
echo "version=3
opts=uversionmangle=s/(rc|a|b|c)/~\$1/ \\
https://pypi.debian.net/${PKG_NAME}/${PKG_NAME}-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
" >debian/watch
echo "3.0 (quilt)" >debian/source/format
echo 'extend-diff-ignore = "^[^/]*[.]egg-info/"' >debian/source/options

30
misc/pkgos-fetch-fake-repo Executable file
View File

@ -0,0 +1,30 @@
#!/bin/sh
# This script prepares a /etc/pkgos/fake-${TARGET_DISTRO}-mirror folder
# with Packages.gz and Sources.gz files so that we can later on use
# the madison-lite script when using pkgos-parse-requirements.
# Indeed, using rmadison for this task is a way too slow, considering the
# average amount of dependency in a typical OpenStack component.
set -e
if ! [ -r /etc/pkgos/pkgos.conf ] ; then
echo "Could not read /etc/pkgos/pkgos.conf"
exit 1
else
. /etc/pkgos/pkgos.conf
fi
# Create the folder and remove the Packages.gz / Sources.gz
DEST_DIST_DIR=/etc/pkgos/fake-${TARGET_DISTRO}-mirror/dists/${TARGET_DISTRO}/main
for i in binary-all binary-amd64 source ; do
if ! [ -d ${DEST_DIST_DIR}/$i ] ; then
mkdir -p ${DEST_DIST_DIR}/$i
fi
if [ "$i" = "source" ] ; then
GZFILE=Sources.gz
else
GZFILE=Packages.gz
fi
rm -f ${DEST_DIST_DIR}/$i/$GZFILE
wget ${CLOSEST_DEBIAN_MIRROR}/dists/${TARGET_DISTRO}/main/$i/$GZFILE -O ${DEST_DIST_DIR}/$i/$GZFILE
done

View File

@ -0,0 +1,14 @@
#!/bin/sh
# -*- mode: shell-script -*-
set -e
. /usr/share/openstack-pkg-tools/pkgos_func
# $1 = config file path (example: /etc/nova/nova.conf)
# $2 = .ini file section (example: DEFAULT)
# $3 = directive name (example: sql_connection)
# $4 = only present in "set" mode: new value to replace in the .ini file
PKGOS_VERBOSE=yes
pkgos_inifile set $@

38
misc/pkgos-gen-completion Executable file
View File

@ -0,0 +1,38 @@
#!/bin/sh
# -*- mode: shell-script -*-
set -x
# Default use python3
PKGOS_PY_VER=python3
for i in $@ ; do
case "${1}" in
"--py3")
PKGOS_PY_VER=python3
shift
;;
"--py2")
PKGOS_PY_VER=python
shift
;;
*)
;;
esac
done
BINARY=$1
CLIENT="${BINARY}client"
PYTHON_SHELL_MODULE="${CLIENT}.shell"
COMPLETION_INSTALL_PATH="$(pwd)/debian/${PKGOS_PY_VER}-$CLIENT/usr/share/bash-completion/completions"
TEMP_FILE=$(mktemp)
${PKGOS_PY_VER} -m ${PYTHON_SHELL_MODULE} complete > ${TEMP_FILE}
if grep "_shell()" ${TEMP_FILE} > /dev/null ; then
mkdir -p ${COMPLETION_INSTALL_PATH}
cat ${TEMP_FILE} | sed -r "s/shell/${BINARY}/g" > ${COMPLETION_INSTALL_PATH}/${BINARY}
fi
# Delete temp file
rm -f ${TEMP_FILE}

308
misc/pkgos-parse-requirements Executable file
View File

@ -0,0 +1,308 @@
#!/bin/sh
set -e
if ! [ -r /etc/pkgos/pkgos.conf ] ; then
echo "Could not read /etc/pkgos/pkgos.conf"
exit 1
else
. /etc/pkgos/pkgos.conf
fi
if [ "${1}" = "-h" ] ; then
echo "This utility attemps to parse an OpenStack requirements.txt file"
echo "as input, and produce a list of Debian dependencies as output."
echo "Note that this is far from perfect, and that you *WILL* need to"
echo "manually check for the dependencies. This is only a helper in"
echo "order to gain some precious development time."
echo ""
echo "If this utility is called without a parameter, it will attempt"
echo "to read the requirements.txt and test-requirements.txt file."
echo "Otherwise, it takes the first argument as the file to parse."
exit 0
fi
# Some packages should never be in the dependencies in Debian,
# as they are included in Python 2.7. If you find one that is
# missing, just add it to the list it here.
BLACK_LIST="discover argparse ordereddict doc8 pylint flake8 pyflakes pep8"
is_blacklisted () {
ISBLACKLISTED="no"
for i in $BLACK_LIST ; do
if [ "${i}" = "${1}" ] ; then
ISBLACKLISTED="yes"
fi
done
}
BLACK_LIST_PY3="python3-testrepository python3-oslosphinx python3-coverage python3-concurrent.futures"
is_py3_blacklisted () {
IS_PY3BLACKLISTED="no"
for i in $BLACK_LIST_PY3 ; do
if [ "${i}" = "${1}" ] ; then
IS_PY3BLACKLISTED="yes"
fi
done
}
# Some packages should never make it into the Build-Depends-Indep:,
# because they are already in Build-Depends:. Here's the list for it.
BUILD_DEPENDS_LIST="sphinx pbr"
is_build_depends () {
ISBUILDDEPENDS="no"
for i in ${BUILD_DEPENDS_LIST} ; do
if [ "${i}" = ${1} ] ; then
ISBUILDDEPENDS="yes"
fi
done
}
EPOC_1_IN="python-cinderclient python-keystoneclient python-glanceclient python-swiftclient python-neutronclient python-oslo.config"
has_1_in_epoc () {
HAS_1_IN_EPOC="no"
for i in ${EPOC_1_IN} ; do
if [ "${i}" = ${1} ] ; then
HAS_1_IN_EPOC="yes"
fi
done
}
EPOC_2_IN="python-novaclient"
has_2_in_epoc () {
HAS_2_IN_EPOC="no"
for i in ${EPOC_2_IN} ; do
if [ "${i}" = ${1} ] ; then
HAS_2_IN_EPOC="yes"
fi
done
}
NO_PYTHON_PREFIX="alembic testrepository subunit websockify cliff-tablib"
is_python_prefixed () {
PY_PREFIX="yes"
for i in ${NO_PYTHON_PREFIX} ; do
if [ "${i}" = "${1}" ] ; then
PY_PREFIX="no"
fi
done
}
# Param: $1: input file
# $2: if set, then the Build-Depends: programs will be removed (for example: sphinx, pbr, etc.)
parse_and_print () {
INPUT_FILE=$1
REMOVE_BUILD_DEPENDS="no"
if [ "${2}" = "build-depends" ] ; then
REMOVE_BUILD_DEPENDS="yes"
fi
PYVERS=${3}
DEP_LIST=""
# echo `cat ${INPUT_FILE} | grep -v '^#' | grep -v '^[ \t]*$' | awk '{print $1}' | tr '[:upper:]' '[:lower:]' | sed $EXP`
for i in `cat ${INPUT_FILE} | grep -v '^#' | grep -v '^[ \t]*$' | awk '{print $1}' | tr '[:upper:]' '[:lower:]' | sed $EXP` ; do
# echo "Line ---> $i"
if echo $i | grep -q -e '^http://' ; then
i=`echo $i | cut -d'=' -f2`
VERS=""
else
TRIM_VERS=`echo $i | sed -e 's/^[-a-zA-Z0-9._]*//'`
VERS=`echo $TRIM_VERS | sed -e 's/^[-a-zA-Z0-9._]*//' | tr ',|;' '\n' | sort | tr '\n' ',' | sed -e 's/,$//'`
fi
if [ -n "$VERS" ] ; then
PKG=`echo $i | sed -e "s/${TRIM_VERS}//" | sed -e s/python-//`
else
PKG=`echo $i | sed -e s/python-//`
fi
PKG=`echo ${PKG} | sed -e s/_/-/g`
is_blacklisted ${PKG}
ISBUILDDEPENDS="no"
if [ REMOVE_BUILD_DEPENDS="yes" ] ; then
is_build_depends ${PKG}
fi
if [ $ISBLACKLISTED = "no" ] && [ ${ISBUILDDEPENDS} = "no" ]; then
is_python_prefixed ${PKG}
if [ ${PY_PREFIX} = "yes" ] ; then
PKG=python-${PKG}
fi
# Convert the package name into lowercase, as Debian
# doesn't have any upper case in package names
PKG=`echo ${PKG} | tr '[:upper:]' '[:lower:]'`
if [ -n "$VERS" ] && [ ${PKG} != "python-hacking" ] ; then
# If there's a a version-depends, convert the pip style
# of dependency to the Debian one (ie: >> instead of >)
FIRST_CONSTR=`echo $VERS | cut -d, -f1`
FIRST_NUMS=`echo $FIRST_CONSTR | sed -e 's/[<>=\!]*//'`
FIRST_SIGN=`echo $FIRST_CONSTR | sed -e "s/${FIRST_NUMS}//"`
if [ "${FIRST_SIGN}" = '<' ] ; then
FIRST_SIGN='<<'
fi
if [ "${FIRST_SIGN}" = '>' ] ; then
FIRST_SIGN='>>'
fi
has_1_in_epoc ${PKG}
if [ "${HAS_1_IN_EPOC}" = "yes" ] ; then
FIRST_NUMS="1:${FIRST_NUMS}"
fi
has_2_in_epoc ${PKG}
if [ "${HAS_2_IN_EPOC}" = "yes" ] ; then
FIRST_NUMS="2:${FIRST_NUMS}"
fi
# If there's a fake-jessie-mirror folder in /etc/pkgos
# use that one with madison-lite to check if the version
# of the package is already in Jessie.
if [ -d /etc/pkgos/fake-jessie-mirror ] ; then
STABLE_VERSION=`madison-lite -a all,amd64 --mirror /etc/pkgos/fake-${TARGET_DISTRO}-mirror ${PKG} | awk '{print $3}'`
# Make sure that the package is in the stable repo
if [ -z "${STABLE_VERSION}" ] ; then
VERSION_TO_DEPEND_ON=" (${FIRST_SIGN} ${FIRST_NUMS})"
else
#echo "Comparing for ${PKG}: dpkg --compare-versions ${STABLE_VERSION} gt ${FIRST_NUMS}"
if dpkg --compare-versions ${STABLE_VERSION} gt ${FIRST_NUMS} ; then
VERSION_TO_DEPEND_ON=""
else
VERSION_TO_DEPEND_ON=" (${FIRST_SIGN} ${FIRST_NUMS})"
fi
fi
else
VERSION_TO_DEPEND_ON=" (${FIRST_SIGN} ${FIRST_NUMS})"
fi
if [ "${PYVERS}" = 3 ] ; then
PKG=`echo ${PKG} | sed s/python-/python3-/`
is_py3_blacklisted ${PKG}
if [ ${IS_PY3BLACKLISTED} = "yes" ] ; then
continue
fi
fi
if [ -z "${DEP_LIST}" ] ; then
DEP_LIST="${PKG}${VERSION_TO_DEPEND_ON}"
#echo " ${PKG} (${FIRST_SIGN} ${FIRST_NUMS}),"
else
DEP_LIST="${DEP_LIST}\n${PKG}${VERSION_TO_DEPEND_ON}"
fi
else
if [ -z "${DEP_LIST}" ] ; then
DEP_LIST="${PKG}"
else
#echo " ${PKG},"
DEP_LIST="${DEP_LIST}\n${PKG}"
fi
fi
#echo "Package: ${PKG}\t\tFirst sign: ${FIRST_SIGN}\t\tFirst num: ${FIRST_NUMS}..."
fi
done
}
# Param: $DEPS: the dependency list, one package per line
# $1: the word for the package dep (ie: Depends: or Build-Depends-Indep:)
format_output () {
# set -x
SPACES_IN_FRONT=`echo "${1} " | sed -e 's/[a-zBDI:-]/ /g'`
CNT="0"
echo $DEPS | LC_COLLATE=C sort -u | while read i ; do
if [ "${CNT}" = "0" ] ; then
echo "${1} ${i},"
else
echo -n "${1}" | sed -e 's/[a-zBDI:-]/ /g'
echo " ${i},"
fi
CNT=$(($CNT + 1))
done
if [ $1 = "Depends:" ] ; then
echo " \${misc:Depends},"
echo " \${python:Depends},"
fi
}
calc_substitue_list () {
if [ -r /etc/pkgos/substitute ] ; then
while read i ; do
SOURCE=`echo $i | cut -d" " -f1`
DEST=`echo $i | cut -d" " -f2`
EXP="$EXP -e s/$SOURCE/$DEST/"
done </etc/pkgos/substitute
fi
# echo \'$EXP\'
}
calc_substitue_list
if [ "${1}" ] ; then
parse_and_print ${1}
format_output "Build-Depends:"
else
# Check if we declared Python3 support in debian/control
HAS_PY3_SUPPORT="no"
if [ -r debian/control ] ; then
HAS_PYTHON3_PKG_IN_CTRL=`cat debian/control | grep "Package: python3" || true`
if [ -n "${HAS_PYTHON3_PKG_IN_CTRL}" ] ; then
HAS_PY3_SUPPORT="yes"
fi
fi
# If there's a debian/*.init.in, then we want dh-systemd as build-depends
INIT=`find debian/ -iname '*init.in'`
if [ -n "${INIT}" ] ; then
DH_SYSTEMD="\n dh-systemd,"
OSTACK_PKG_TOOLS_VERS=" (>= 23~)"
else
DH_SYSTEMD=""
OSTACK_PKG_TOOLS_VERS=""
fi
TEMPLATES=`find debian/ -iname '*.templates'`
if [ -n "${TEMPLATES}" ] ; then
PO_DEBCONF="\n po-debconf,"
else
PO_DEBCONF=""
fi
echo "Build-Depends: debhelper (>= 9),
dh-python,${DH_SYSTEMD}
openstack-pkg-tools${OSTACK_PKG_TOOLS_VERS},${PO_DEBCONF}
python-all,
python-pbr,
python-setuptools,
python-sphinx,"
# Adds python3 support packages
if [ "${HAS_PY3_SUPPORT}" = "yes" ] ; then
echo " python3-all,
python3-pbr,
python3-setuptools,"
fi
# Gather the dependencies.
if [ -e test-requirements-py2.txt ] ; then
parse_and_print test-requirements-py2.txt build-depends 2
else
parse_and_print test-requirements.txt build-depends 2
fi
DEP_LIST_TESTS=${DEP_LIST}
if [ -r requirements-py2.txt ] ; then
parse_and_print requirements-py2.txt depends
else
parse_and_print requirements.txt depends
fi
DEP_LIST_RUNTIME=${DEP_LIST}
# If the package has python3 support, let's try to also print python3 build-depends
if [ "${HAS_PY3_SUPPORT}" = "yes" ] ; then
parse_and_print requirements.txt depends 3
DEP_LIST_TESTS="${DEP_LIST_TESTS}\n${DEP_LIST}"
if [ -e test-requirements-py3.txt ] ; then
parse_and_print test-requirements-py3.txt build-depends 3
else
parse_and_print test-requirements.txt build-depends 3
fi
DEP_LIST_TESTS="${DEP_LIST_TESTS}\n${DEP_LIST}"
fi
if [ -r .testr.conf ] ; then
DEP_LIST_TESTS="${DEP_LIST_TESTS}\ntestrepository\nsubunit"
if [ -r debian/control ] && [ -n "${HAS_PYTHON3}" ] ; then
DEP_LIST_TESTS="${DEP_LIST_TESTS}\npython3-subunit"
fi
fi
# Format the output
DEPS="${DEP_LIST_RUNTIME}\n${DEP_LIST_TESTS}"
format_output "Build-Depends-Indep:"
DEPS=${DEP_LIST_RUNTIME}
format_output "Depends:"
fi

10
misc/pkgos-reqsdiff Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
set -e
TEMP_FILE1=`mktemp -t pkgos-reqsdiff1.XXXXXX` || exit 1
TEMP_FILE2=`mktemp -t pkgos-reqsdiff1.XXXXXX` || exit 1
pkgos-show-control-depends >${TEMP_FILE1}
pkgos-parse-requirements >${TEMP_FILE2}
diff -u ${TEMP_FILE1} ${TEMP_FILE2}
rm -f ${TEMP_FILE1} ${TEMP_FILE2}

30
misc/pkgos-show-control-depends Executable file
View File

@ -0,0 +1,30 @@
#!/bin/sh
set -e
TOTAL_NUM_OF_LINES=`cat debian/control | wc -l`
BUILD_DEPENDS_LINE=`cat debian/control | grep -n "^Build-Depends:" | head -n 1 | cut -d":" -f1`
BUILD_DEPENDS_INDEP_LINE=`cat debian/control | grep -n "^Build-Depends-Indep:" | head -n 1 | cut -d":" -f1`
STANDARD_VERSION_LINE=`cat debian/control | grep -n "^Standards-Version:" | head -n 1 | cut -d":" -f1`
DEPENDS_LINE=`cat debian/control | grep -n "^Depends:" | head -n 1 | cut -d":" -f1`
DESCRIPTION_LINE=`cat debian/control | grep -n "^Description:" | head -n 1 | cut -d":" -f1`
# Params: $1 line start
# $2 line end
show_part_of_file () {
LINE_END=$((${2} - 1))
TMP_FILE=`mktemp -t pkgos-show-control-depends.XXXXXX` || exit 1
head -n ${LINE_END} debian/control >${TMP_FILE}
LINE_START=$(($LINE_END - ${1} + 1))
tail -n ${LINE_START} ${TMP_FILE}
rm ${TMP_FILE}
}
# Show Build-Depends:
show_part_of_file ${BUILD_DEPENDS_LINE} ${BUILD_DEPENDS_INDEP_LINE}
# Show Build-Depends-Indep:
show_part_of_file ${BUILD_DEPENDS_INDEP_LINE} ${STANDARD_VERSION_LINE}
# Show Depends:
show_part_of_file ${DEPENDS_LINE} ${DESCRIPTION_LINE}

29
misc/pkgos-testr Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
set -e
PYTHON=${1}
if [ -z "$PYTHON" ]; then
echo "ERROR: Missing python version argument"
echo "Usage: pkgos-testr <python-version> [<test-scope>]"
exit 1
fi
PY_MAJOR=$(echo $PYTHON | cut -d . -f 1)
SCOPE=${2}
TEMP_REZ=`mktemp -t`
function finish {
rm -rf .testrepository
rm -f $TEMP_REZ
}
trap finish EXIT
echo "===> Testing for python$PYTHON"
rm -rf .testrepository
testr init
PYTHON=python$PYTHON PYTHONPATH=`pwd` testr run --subunit $SCOPE | tee $TEMP_REZ | subunit2pyunit
cat $TEMP_REZ | subunit-filter -s --no-passthrough | subunit-stats
testr slowest
echo "===> Testing with python$PYTHON complete."

138
pkgos.make Normal file
View File

@ -0,0 +1,138 @@
# -*- Makefile -*-, you silly Emacs!
# vim: set ft=make:
PYTHONS:=$(shell pyversions -vr)
PYTHON3S:=$(shell py3versions -vr)
DEBVERS ?= $(shell dpkg-parsechangelog -SVersion)
VERSION ?= $(shell echo '$(DEBVERS)' | sed -e 's/^[[:digit:]]*://' -e 's/[-].*//')
DEBFLAVOR ?= $(shell dpkg-parsechangelog -SDistribution)
DEBPKGNAME ?= $(shell dpkg-parsechangelog -SSource)
UPSTREAM_GIT ?= https://github.com/openstack/$(DEBPKGNAME).git
GIT_TAG ?= $(shell echo '$(VERSION)' | sed -e 's/~/_/')
MANIFEST_EXCLUDE_STANDARD ?= $(DEBPKGNAME)
DEBIAN_BRANCH ?= $(shell cat debian/gbp.conf | grep debian-branch | cut -d'=' -f2 | awk '{print $1}')
export OSLO_PACKAGE_VERSION=$(shell dpkg-parsechangelog -SVersion | sed -e 's/^[[:digit:]]*://' -e 's/[-].*//' -e 's/~git.*//' -e 's/~/.0/' -e 's/+dfsg1//' -e 's/+ds1//' | head -n 1)
gen-init-configurations:
# Create the init scripts and systemd unit files from the template
set -e ; set -x ; for i in `ls -1 debian/*.init.in` ; do \
MYINIT=`echo $$i | sed s/.init.in//` ; \
cp $$i $$MYINIT.init ; \
cat /usr/share/openstack-pkg-tools/init-script-template >>$$MYINIT.init ; \
pkgos-gen-systemd-unit $$i ; \
done
# If there's a service.in file, use that one instead of the generated one
set -e ; set -x ; for i in `ls -1 debian/*.service.in`; do \
MYPKG=`echo $$i | sed s/.service.in//` ; \
cp $$MYPKG.service.in $$MYPKG.service ; \
done
# Generate the systemd unit if there's no already existing .service.in
set -e ; set -x ; for i in `ls debian/*.init.in` ; do \
MYINIT=`echo $$i | sed s/.init.in/.service.in/` ; \
if ! [ -e $$MYINIT ] ; then \
pkgos-gen-systemd-unit $$i ; \
fi \
done
override_dh_installsystemd: gen-init-configurations
dh_installsystemd
override_dh_installinit: gen-init-configurations
dh_installinit --error-handler=true
gen-author-list:
git log --format='%aN <%aE>' | awk '{arr[$$0]++} END{for (i in arr){print arr[i], i;}}' | sort -rn | cut -d' ' -f2-
gen-upstream-changelog:
git checkout master || git checkout upstream/master
git reset --hard $(GIT_TAG)
git log >$(CURDIR)/../CHANGELOG
git checkout debian/$(DEBFLAVOR)
mv $(CURDIR)/../CHANGELOG $(CURDIR)/debian/CHANGELOG
git add $(CURDIR)/debian/CHANGELOG
git commit -a -m "Updated upstream changelog"
override_dh_installchangelogs:
if [ -e $(CURDIR)/debian/CHANGELOG ] ; then \
dh_installchangelogs $(CURDIR)/debian/CHANGELOG ; \
else \
dh_installchangelogs ; \
fi
get-orig-source:
uscan --verbose --force-download --rename --destdir=../build-area
fetch-upstream-remote:
ifeq (,$(findstring https:,$(UPSTREAM_GIT)))
$(error Using insecure proto in UPSTREAM_GIT: $(UPSTREAM_GIT))
endif
git remote add upstream $(UPSTREAM_GIT) || true
git remote set-url upstream $(UPSTREAM_GIT)
git fetch upstream
gen-orig-xz:
git tag -v $(GIT_TAG) || true
if [ ! -f ../$(DEBPKGNAME)_$(VERSION).orig.tar.xz ] ; then \
git archive --prefix=$(DEBPKGNAME)-$(VERSION)/ $(GIT_TAG) | xz >../$(DEBPKGNAME)_$(VERSION).orig.tar.xz ; \
fi
[ ! -e ../build-area ] && mkdir ../build-area || true
[ ! -e ../build-area/$(DEBPKGNAME)_$(VERSION).orig.tar.xz ] && cp ../$(DEBPKGNAME)_$(VERSION).orig.tar.xz ../build-area
gen-orig-gz:
git tag -v $(GIT_TAG) || true
if [ ! -f ../$(DEBPKGNAME)_$(VERSION).orig.tar.gz ] ; then \
git archive --prefix=$(DEBPKGNAME)-$(VERSION)/ $(GIT_TAG) | gzip >../$(DEBPKGNAME)_$(VERSION).orig.tar.gz ; \
fi
[ ! -e ../build-area ] && mkdir ../build-area || true
[ ! -e ../build-area/$(DEBPKGNAME)_$(VERSION).orig.tar.gz ] && cp ../$(DEBPKGNAME)_$(VERSION).orig.tar.gz ../build-area
gen-orig-bz2:
git tag -v $(GIT_TAG) || true
if [ ! -f ../$(DEBPKGNAME)_$(VERSION).orig.tar.bz2 ] ; then \
git archive --prefix=$(DEBPKGNAME)-$(VERSION)/ $(GIT_TAG) | bzip2 >../$(DEBPKGNAME)_$(VERSION).orig.tar.bz2 ; \
fi
[ ! -e ../build-area ] && mkdir ../build-area || true
[ ! -e ../build-area/$(DEBPKGNAME)_$(VERSION).orig.tar.bz2 ] && cp ../$(DEBPKGNAME)_$(VERSION).orig.tar.bz2 ../build-area
get-master-branch:
if ! git checkout master ; then \
echo "No upstream branch: checking out" ; \
git checkout -b master upstream/master ; \
fi
git checkout $(DEBIAN_BRANCH)
get-vcs-source:
$(CURDIR)/debian/rules fetch-upstream-remote
$(CURDIR)/debian/rules gen-orig-xz
$(CURDIR)/debian/rules get-master-branch
versioninfo:
echo $(VERSION) > versioninfo
display-po-stats:
cd $(CURDIR)/debian/po ; for i in *.po ; do \
echo -n $$i": " ; \
msgfmt -o /dev/null --statistic $$i ; \
done
call-for-po-trans:
podebconf-report-po --call --withtranslators --languageteam
regen-manifest-patch:
quilt pop -a || true
quilt push install-missing-files.patch
git checkout MANIFEST.in
git ls-files --no-empty-directory --exclude-standard $(MANIFEST_EXCLUDE_STANDARD) | grep -v '.py$$' | grep -v LICENSE | sed -n 's/.*/include &/gp' >> MANIFEST.in
quilt refresh
quilt pop -a
override_dh_gencontrol:
if dpkg-vendor --derives-from ubuntu ; then \
dh_gencontrol -- -T$(CURDIR)/debian/ubuntu_control_vars ; \
else \
dh_gencontrol -- -T$(CURDIR)/debian/debian_control_vars ; \
fi
.PHONY: get-vcs-source get-orig-source override_dh_installinit regen-manifest-patch call-for-po-trans display-po-stats versioninfo

58
pkgos.stdpkg.make Normal file
View File

@ -0,0 +1,58 @@
include /usr/share/openstack-pkg-tools/pkgos.make
PKGOS_NO_PYTHON =$(shell echo $(DEBPKGNAME) | sed s/python-//)
PKGOS_PYTHON_PKG =$(shell grep -e '^Package: python-'$(PKGOS_NO_PYTHON)'$$' debian/control | awk '{print $$2}')
PKGOS_PYTHON3_PKG =$(shell grep -e '^Package: python3-'$(PKGOS_NO_PYTHON)'$$' debian/control | awk '{print $$2}')
PKGOS_PYTHONDOC_PKG=$(shell grep -e '^Package: python-'$(PKGOS_NO_PYTHON)'-doc$$' debian/control | awk '{print $$2}')
ifeq (python-$(PKGOS_NO_PYTHON), $(PKGOS_PYTHON_PKG))
PKGOS_DH2_LIST=python2,
else
PKGOS_NO_PY2="--no-py2"
endif
ifeq (python3-$(PKGOS_NO_PYTHON), $(PKGOS_PYTHON3_PKG))
PKGOS_DH3_LIST=python3,
else
PKGOS_NO_PY3="--no-py3"
endif
ifeq (python-$(PKGOS_NO_PYTHON)-doc, $(PKGOS_PYTHONDOC_PKG))
PKGOS_DHDOC_LIST=sphinxdoc,
endif
PKGOS_DH_LIST=$(PKGOS_DH2_LIST)$(PKGOS_DH3_LIST)$(PKGOS_DHDOC_LIST)
%:
dh $@ --buildsystem=python_distutils --with $(PKGOS_DH_LIST)
override_dh_auto_install:
pkgos-dh_auto_install $(PKGOS_NO_PY2) $(PKGOS_NO_PY3)
ifeq (python3-$(PKGOS_NO_PYTHON), $(PKGOS_PYTHON3_PKG))
override_dh_python3:
dh_python3 --shebang=/usr/bin/python3
endif
override_dh_auto_clean:
dh_auto_clean
rm -rf .testrepository build doc/man
override_dh_auto_test:
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
pkgos-dh_auto_test $(PKGOS_NO_PY2) $(PKGOS_NO_PY3) $(PKGOS_TEST_REGEX)
endif
override_dh_sphinxdoc:
ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
PYTHONPATH=. python3 -m sphinx -b html doc/source $(CURDIR)/debian/$(PKGOS_PYTHONDOC_PKG)/usr/share/doc/$(PKGOS_PYTHONDOC_PKG)/html
dh_sphinxdoc
endif
# Commands not to run
override_dh_installcatalogs:
override_dh_installemacsen override_dh_installifupdown:
override_dh_installinfo override_dh_installmenu override_dh_installmime:
override_dh_installmodules override_dh_installlogcheck:
override_dh_installpam override_dh_installppp override_dh_installudev:
override_dh_installwm:
override_dh_installxfonts override_dh_gconf override_dh_icons:
override_dh_perl override_dh_usrlocal:

1152
pkgos_func Normal file

File diff suppressed because it is too large Load Diff

14
pkgos_insert_include Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
set -e
# Example call: pkgos_insert_include pkgos_func keystone.config
INC=/usr/share/openstack-pkg-tools/${1}
DST=debian/${2}
SRC="debian/${2}.in"
awk '{if ($1 == "#PKGOS-INCLUDE#") {
print "### Start of included " G " library"
while ((getline line < F) > 0) print line
print "### End of included " G " library"
} else print}' F=${INC} G=$(basename $INC) ${SRC} > ${DST}

35
pkgos_postrm Normal file
View File

@ -0,0 +1,35 @@
#!/bin/sh
# -*- mode: shell-script -*-
# Perform cleanups when removing a package
# Prototype: pkgos_postrm <template-prefix-name> <package-name> $@
# Example: pkgos_postrm neutron neutron-common $@
pkgos_dbc_postrm () {
local PKPRM_TEMPLATE_PREFIX PKPRM_PACKAGE_NAME
PKPRM_TEMPLATE_PREFIX=${1}
PKPRM_PACKAGE_NAME=${2}
shift
shift
if [ -f /usr/share/debconf/confmodule ] ; then
. /usr/share/debconf/confmodule
# If the package has the template, then it means we're having a db,
# and therefore we can call the dbconfig-common clean function.
db_get ${PKPRM_TEMPLATE_PREFIX}/configure_db
if [ "$RET" = "true" ] ; then
if [ -f /usr/share/dbconfig-common/dpkg/postrm ] ; then
. /usr/share/dbconfig-common/dpkg/postrm
dbc_go ${PKPRM_PACKAGE_NAME} $@
else
rm -f /etc/dbconfig-common/${PKPRM_PACKAGE_NAME}.conf
if which ucf >/dev/null 2>&1; then
ucf --purge /etc/dbconfig-common/${PKPRM_PACKAGE_NAME}.conf
ucfr --purge ${PKPRM_PACKAGE_NAME} /etc/dbconfig-common/${PKPRM_PACKAGE_NAME}.conf
fi
fi
fi
fi
rm -rf /var/lib/${PKPRM_TEMPLATE_PREFIX} /var/log/${PKPRM_TEMPLATE_PREFIX} /var/lock/${PKPRM_TEMPLATE_PREFIX}
}

35
run_tests Executable file
View File

@ -0,0 +1,35 @@
#!/bin/sh
set -e
# This is a basic test runner for shell script tests
# it just searches for all test_ scripts under the tests
# folder, and run them.
echo "Running shell script unit tests..."
CURDIR=$(pwd)
SUCCESS=yes
CNT=0
for i in $(find tests -type f -iname 'test_*') ; do
DIRNAME=$(dirname $i)
BASENAME=$(basename $i)
cd ${DIRNAME}
echo -n $i" ... "
if ./${BASENAME} ; then
echo "OK"
else
SUCCESS=no
echo "FAILED"
fi
cd ${CURDIR}
CNT=$(( ${CNT} + 1 ))
done
if [ "${SUCCESS}" = "yes" ] ; then
echo "Successfully ran ${CNT} tests :)"
exit 0
else
echo "Failure while running unit tests :("
exit 1
fi

20
tests/osstt Normal file
View File

@ -0,0 +1,20 @@
#!/bin/sh
set -e
# This script stands for "OpenStack Shell Test Tools"
# and is a set of functions used to test the validity of
# shell scripts.
# Param: $1 file1
# $2 file2
osstt_assertFilesAreSame () {
FILE1=${1}
FILE2=${2}
F1_MD5=$(md5sum ${FILE1} | awk '{print $1}')
F2_MD5=$(md5sum ${FILE2} | awk '{print $1}')
if [ "${F1_MD5}" = "${F2_MD5}" ] ; then
RET=yes
else
RET=no
fi
}

View File

@ -0,0 +1,11 @@
[DEFAULT]
lock_dir = /super/bad/path
[keystone_authtoken]
# The username for auth
#username =
# Address of your keystone server
auth_uri =

View File

@ -0,0 +1,8 @@
[DEFAULT]
lock_dir = /super/bad/path
[keystone_authtoken]
# Address of your keystone server
auth_uri =

View File

@ -0,0 +1,17 @@
#!/bin/sh
set -e
. ../../../pkgos_func
. ../../../tests/osstt
cp example.ini example-result.ini
pkgos_add_directive example-result.ini keystone_authtoken "username =" "# The username for auth"
osstt_assertFilesAreSame example-result.ini example-after-add-directive.ini
rm example-result.ini
if [ "${RET}" = "yes" ] ; then
exit 0
else
echo "example-result.ini is not the same as example-after-add-directive.ini"
exit 1
fi

View File

@ -0,0 +1,17 @@
#!/bin/sh
set -e
. ../../../pkgos_func
. ../../../tests/osstt
cp example.ini example-result.ini
pkgos_add_directive example-result.ini keystone_authtoken "auth_uri =" "# Address of your keystone server"
osstt_assertFilesAreSame example-result.ini example.ini
rm example-result.ini
if [ "${RET}" = "yes" ] ; then
exit 0
else
echo "pkgos_add_directive modified the .ini when the directive already existed"
exit 1
fi

View File

@ -0,0 +1,18 @@
[DEFAULT]
lock_dir = /super/bad/path
[keystone_authtoken]
# Address of your keystone server
auth_uri =
[new_section]
# NEW DIRECTIVE
new_directive = one_value
[old_section]
# DEPRECATED
#old_directive = one_value
another_directive = False

View File

@ -0,0 +1,18 @@
[DEFAULT]
lock_dir = /super/bad/path
[keystone_authtoken]
# Address of your keystone server
auth_uri =
[new_section]
# NEW DIRECTIVE
new_directive = one_value
[old_section]
# DEPRECATED
#old_directive = one_value
another_directive = False

View File

@ -0,0 +1,18 @@
[DEFAULT]
lock_dir = /super/bad/path
[keystone_authtoken]
# Address of your keystone server
auth_uri =
[new_section]
# NEW DIRECTIVE
#new_directive =
[old_section]
# DEPRECATED
old_directive = one_value
another_directive = False

View File

@ -0,0 +1,17 @@
#!/bin/sh
set -e
. ../../../pkgos_func
. ../../../tests/osstt
cp example-after-old-existing.ini example-result.ini
pkgos_deprecate_directive example-result.ini old_section old_directive new_section new_directive
osstt_assertFilesAreSame example-result.ini example-after-old-existing.ini
#rm example-result.ini
if [ "${RET}" = "yes" ] ; then
exit 0
else
echo "pkgos_deprecate_directive did something on an already valid file"
exit 1
fi

View File

@ -0,0 +1,17 @@
#!/bin/sh
set -e
. ../../../pkgos_func
. ../../../tests/osstt
cp example.ini example-result.ini
pkgos_deprecate_directive example-result.ini old_section old_directive new_section new_directive
osstt_assertFilesAreSame example-result.ini example-after-old-existing.ini
rm example-result.ini
if [ "${RET}" = "yes" ] ; then
exit 0
else
echo "pkgos_deprecate_directive didn't deprecate correcly"
exit 1
fi

View File

@ -0,0 +1,20 @@
[DEFAULT]
lock_dir = /super/bad/path
[keystone_authtoken]
# Address of your keystone server
auth_uri =
[database]
# DEPRECATED
old_directive = one_value
another_directive = False
connection = mysql+pymysql://whatever
[new_section]
# NEW DIRECTIVE
#new_directive =

View File

@ -0,0 +1,3 @@
[api-database]
connection = mysql+pymysql://foo

View File

@ -0,0 +1,23 @@
[DEFAULT]
lock_dir = /super/bad/path
[keystone_authtoken]
# Address of your keystone server
auth_uri =
[database]
# DEPRECATED
old_directive = one_value
another_directive = False
connection = mysql+pymysql://whatever
[api-database]
connection = mysql+pymysql://foo
[new_section]
# NEW DIRECTIVE
#new_directive =

View File

@ -0,0 +1,29 @@
#!/bin/sh
set -e
. ../../../pkgos_func
. ../../../tests/osstt
cp example.ini example-fortest.ini
pkgos_extract_section example-fortest.ini example-fortest-db.ini api-database
osstt_assertFilesAreSame example-after-removed-section.ini example-fortest.ini
if [ "${RET}" != "yes" ] ; then
echo "pkgos_extract_section didn't extract a section correctly"
echo "Diff of source file:"
diff -u example-after-removed-section.ini example-fortest.ini
rm -f example-fortest.ini example-fortest-db.ini
exit 1
fi
osstt_assertFilesAreSame example-extracted-section.ini example-fortest-db.ini
if [ "${RET}" = "yes" ] ; then
rm -f example-fortest.ini example-fortest-db.ini
exit 0
else
echo "pkgos_extract_section didn't extract a section correctly"
echo "Diff of extracted section file:"
diff -u example-extracted-section.ini example-fortest-db.ini
rm example-fortest.ini example-fortest-db.ini
exit 1
fi

View File

@ -0,0 +1,38 @@
# Start conversion
pkgos_add_directive nova-test.ini keystone_authtoken "password =" "# Password for auth."
pkgos_deprecate_directive nova-test.ini keystone_authtoken admin_password keystone_authtoken password
pkgos_add_directive nova-test.ini keystone_authtoken "project_name =" "# Project name for auth."
pkgos_deprecate_directive nova-test.ini keystone_authtoken admin_tenant_name keystone_authtoken project_name
pkgos_add_directive nova-test.ini keystone_authtoken "username =" "# Project name for auth."
pkgos_deprecate_directive nova-test.ini keystone_authtoken admin_user keystone_authtoken username
pkgos_add_directive nova-test.ini keystone_authtoken "www_authenticate_uri =" "# Complete 'public' Identity API endpoint."
pkgos_deprecate_directive nova-test.ini keystone_authtoken auth_uri keystone_authtoken www_authenticate_uri
pkgos_add_directive nova-test.ini keystone_authtoken "auth_url =" "# Complete 'admin' Identity API endpoint."
pkgos_inifile get nova-test.ini keystone_authtoken auth_protocol
if [ "${RET}" = "http" ] ; then
PROTO=http
else
PROTO=https
fi
pkgos_inifile get nova-test.ini keystone_authtoken auth_host
ADDR=${RET}
if [ "${RET}" != "NOT_FOUND" ] && [ -n "${RET}" ] ; then
pkgos_inifile get nova-test.ini keystone_authtoken www_authenticate_uri
if [ -z "${RET}" ] ; then
pkgos_inifile set nova-test.ini keystone_authtoken www_authenticate_uri ${PROTO}://${ADDR}:5000
fi
pkgos_inifile get nova-test.ini keystone_authtoken auth_url
if [ -z "${RET}" ] ; then
pkgos_inifile set nova-test.ini keystone_authtoken auth_url ${PROTO}://${ADDR}:5000
fi
fi
pkgos_search_directive_line_num nova-test.ini keystone_authtoken auth_host
if [ "${RET}" != "NOT_FOUND" ] && [ -n "${RET}" ] ; then
sed -i ${RET}'s/^auth_host/#auth_host/' nova-test.ini
fi
pkgos_search_directive_line_num nova-test.ini keystone_authtoken auth_protocol
if [ "${RET}" != "NOT_FOUND" ] && [ -n "${RET}" ] ; then
sed -i ${RET}'s/^auth_protocol/#auth_protocol/' nova-test.ini
fi
# End conversion

View File

@ -0,0 +1,79 @@
[DEFAULT]
# The IP address which the host is using to connect to the management network.
# (string value)
my_ip = 192.168.10.12
[keystone_authtoken]
#
# From keystonemiddleware.auth_token
#
# Complete "public" Identity API endpoint.
#auth_uri = <None>
# API version of the admin Identity API endpoint. (string value)
#auth_version = <None>
# Do not handle authorization requests within the middleware, but delegate the authorization decision to downstream WSGI components.
# (boolean value)
#delay_auth_decision = false
# Request timeout value for communicating with Identity API server. (integer value)
#http_connect_timeout = <None>
# How many times are we trying to reconnect when communicating with Identity API Server. (integer value)
#http_request_max_retries = 3
# Request environment key where the Swift cache object is stored.
#cache = <None>
# Required if identity server requires client certificate (string value)
#certfile = <None>
# Required if identity server requires client certificate (string value)
#keyfile = <None>
# A PEM encoded Certificate Authority to use when verifying HTTPs connections. Defaults to system CAs. (string value)
#cafile = <None>
# Verify HTTPS connections. (boolean value)
#insecure = false
# The region in which the identity server can be found. (string value)
region_name = regionOne
# Host providing the admin Identity API endpoint. Deprecated, use identity_uri. (string value)
auth_host = 192.168.10.2
# Port of the admin Identity API endpoint. Deprecated, use identity_uri. (integer value)
#auth_port = 35357
# Protocol of the admin Identity API endpoint. Deprecated, use identity_uri. (string value)
# Allowed values: http, https
auth_protocol = https
# Complete admin Identity API endpoint. This should specify the unversioned root endpoint e.g. https://localhost:5000/ (string value)
#identity_uri = <None>
# Service username. (string value)
admin_user = admin
# Service user password. (string value)
admin_password = MySecretPassWord
# Service tenant name. (string value)
admin_tenant_name = admin
# Authentication type to load (string value)
# Deprecated group/name - [keystone_authtoken]/auth_plugin
#auth_type = <None>
# Config Section from which to load plugin specific options (string value)
#auth_section = <None>
[libvirt]
# The ID of the image to boot from to rescue data from a corrupted instance.
#
#rescue_image_id = <None>

View File

@ -0,0 +1,94 @@
[DEFAULT]
# The IP address which the host is using to connect to the management network.
# (string value)
my_ip = 192.168.10.12
[keystone_authtoken]
# Complete 'admin' Identity API endpoint.
auth_url = https://192.168.10.2:5000
# Complete 'public' Identity API endpoint.
www_authenticate_uri = https://192.168.10.2:5000
# Project name for auth.
username = admin
# Project name for auth.
project_name = admin
# Password for auth.
password = MySecretPassWord
#
# From keystonemiddleware.auth_token
#
# Complete "public" Identity API endpoint.
#auth_uri = <None>
# API version of the admin Identity API endpoint. (string value)
#auth_version = <None>
# Do not handle authorization requests within the middleware, but delegate the authorization decision to downstream WSGI components.
# (boolean value)
#delay_auth_decision = false
# Request timeout value for communicating with Identity API server. (integer value)
#http_connect_timeout = <None>
# How many times are we trying to reconnect when communicating with Identity API Server. (integer value)
#http_request_max_retries = 3
# Request environment key where the Swift cache object is stored.
#cache = <None>
# Required if identity server requires client certificate (string value)
#certfile = <None>
# Required if identity server requires client certificate (string value)
#keyfile = <None>
# A PEM encoded Certificate Authority to use when verifying HTTPs connections. Defaults to system CAs. (string value)
#cafile = <None>
# Verify HTTPS connections. (boolean value)
#insecure = false
# The region in which the identity server can be found. (string value)
region_name = regionOne
# Host providing the admin Identity API endpoint. Deprecated, use identity_uri. (string value)
#auth_host = 192.168.10.2
# Port of the admin Identity API endpoint. Deprecated, use identity_uri. (integer value)
#auth_port = 35357
# Protocol of the admin Identity API endpoint. Deprecated, use identity_uri. (string value)
# Allowed values: http, https
#auth_protocol = https
# Complete admin Identity API endpoint. This should specify the unversioned root endpoint e.g. https://localhost:5000/ (string value)
#identity_uri = <None>
# Service username. (string value)
#admin_user = admin
# Service user password. (string value)
#admin_password = MySecretPassWord
# Service tenant name. (string value)
#admin_tenant_name = admin
# Authentication type to load (string value)
# Deprecated group/name - [keystone_authtoken]/auth_plugin
#auth_type = <None>
# Config Section from which to load plugin specific options (string value)
#auth_section = <None>
[libvirt]
# The ID of the image to boot from to rescue data from a corrupted instance.
#
#rescue_image_id = <None>

View File

@ -0,0 +1,20 @@
#!/bin/sh
set -e
. ../../../pkgos_func
. ../../../tests/osstt
cp nova-pike.conf nova-test.ini
. ./convert_script
osstt_assertFilesAreSame nova-test.ini nova-queens.conf
if [ "${RET}" = "yes" ] ; then
rm nova-test.ini
exit 0
else
diff -u nova-queens.conf nova-test.ini
echo "pkgos_deprecate_directive didn't deprecate correcly"
exit 1
fi

View File

@ -0,0 +1,20 @@
#!/bin/sh
set -e
. ../../../pkgos_func
. ../../../tests/osstt
cp nova-queens.conf nova-test.ini
. ./convert_script
osstt_assertFilesAreSame nova-test.ini nova-queens.conf
if [ "${RET}" = "yes" ] ; then
rm nova-test.ini
exit 0
else
diff -u nova-queens.conf nova-test.ini
echo "pkgos_deprecate_directive didn't deprecate correcly"
exit 1
fi

View File

@ -0,0 +1,7 @@
[DEFAULT]
lock_dir = /var/lock
[keystone_authtoken]
# Address of your keystone server
auth_uri =

View File

@ -0,0 +1,13 @@
#!/bin/sh
set -e
. ../../../pkgos_func
pkgos_inifile get example.ini DEFAULT lock_dir
if [ "${RET}" = "/var/lock" ] ; then
exit 0
else
echo "Could not get value from example.ini"
exit 1
fi

View File

@ -0,0 +1,7 @@
[DEFAULT]
lock_dir = /var/lock
[keystone_authtoken]
# Address of your keystone server
auth_uri =

View File

@ -0,0 +1,7 @@
[DEFAULT]
lock_dir = /super/bad/path
[keystone_authtoken]
# Address of your keystone server
auth_uri =

View File

@ -0,0 +1,18 @@
#!/bin/sh
set -e
. ../../../pkgos_func
. ../../../tests/osstt
cp example.ini example-result.ini
pkgos_inifile set example-result.ini DEFAULT lock_dir /var/lock
osstt_assertFilesAreSame example-result.ini example-after-fix-lock_dir.ini
rm example-result.ini
if [ "${RET}" = "yes" ] ; then
exit 0
else
echo "example-result.ini is not the same as example-after-fix-lock_dir.ini"
exit 1
fi

View File

@ -0,0 +1,12 @@
[DEFAULT]
lock_dir = /super/bad/path
[keystone_authtoken]
# Address of your keystone server
auth_uri =
[new_section]
# NEW DIRECTIVE
#new_directive =

View File

@ -0,0 +1,18 @@
[DEFAULT]
lock_dir = /super/bad/path
[keystone_authtoken]
# Address of your keystone server
auth_uri =
[old_section]
# DEPRECATED
old_directive = one_value
another_directive = False
[new_section]
# NEW DIRECTIVE
#new_directive =

View File

@ -0,0 +1,17 @@
#!/bin/sh
set -e
. ../../../pkgos_func
. ../../../tests/osstt
cp example.ini example-result.ini
pkgos_remove_section example-result.ini old_section
osstt_assertFilesAreSame example-result.ini example-after-remove-section.ini
rm example-result.ini
if [ "${RET}" = "yes" ] ; then
exit 0
else
echo "pkgos_remove_section didn't remove a section correctly"
exit 1
fi

View File

@ -0,0 +1,7 @@
[DEFAULT]
lock_dir = /super/bad/path
[keystone_authtoken]
# Address of your keystone server
auth_uri =

View File

@ -0,0 +1,14 @@
#!/bin/sh
set -e
. ../../../pkgos_func
. ../../../tests/osstt
pkgos_search_directive_line_num example.ini DEFAULT lock_dir
if [ "${RET}" = 3 ] ; then
exit 0
else
echo "pkgos_search_directive_line_num didn't return the right line number"
exit 1
fi