Sync from SUSE:SLFO:Main ceph revision 81a5ffa382d5380db4a9883681d4285a

This commit is contained in:
Adrian Schröter 2024-05-03 11:33:05 +02:00
commit 6108fe7e93
15 changed files with 7460 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

25
README-ceph-test.txt Normal file
View File

@ -0,0 +1,25 @@
ceph-test.spec apologia
=======================
The ceph-test.spec file is generated automatically by running pre_checkin.sh
Originally, the ceph-test RPM was built by ceph.spec as a subpackage.
When ceph was first included in Ring1, the build time was too long and ceph
was blocking Factory builds. The ceph-test RPM - a non-user-facing subpackage
that is only used by CI tests - accounted for a significant portion of that
excessive build time. By spinning the ceph-test RPM off to a standalone spec
file spec file, the build time of ceph.spec was reduced and it was no longer
a problem to have ceph in Ring1.
A script, pre_checkin.sh, which is run before every commit, automatically
generates ceph-test.spec from ceph.spec. Thus, ceph-test.spec should be seen
as a "build artifact" whose purpose is to build the ceph-test RPM as it would
have been built had the original ceph.spec not been split.
Although this workflow results in a "not-pretty" ceph-test.spec, it has an
advantage in that ceph-test.spec is maintenance-free. Maintaining *two* spec
files for Ceph would be tricky, error-prone, and labor-intensive.
Nathan Cutler
April 17, 2017

19
README-checkin.txt Normal file
View File

@ -0,0 +1,19 @@
Use the "checkin.sh" script to generate ceph.spec and tarball from a git repo
and branch. For example:
$ bash checkin.sh --repo https://github.com/foo/ceph --branch wip-foo
For more options, try "./checkin.sh --help"
FAQ
===
Q. What is the pre_checkin.sh script?
A. The "pre_checkin.sh" script generates ceph-test.spec from ceph.spec.
Q. Should I run it before running checkin.sh?
A. It doesn't hurt to run it, but no, you don't need to run it because
checkin.sh does that for you.

31
README-constraints.txt Normal file
View File

@ -0,0 +1,31 @@
2023-06-13 - Tim Serong <tserong@suse.com>
Ceph needs plenty of disk space and RAM in order to build. To set
minimum requirements for these, we're using #!BuildConstraint directives
in ceph.spec and ceph-test.spec. We were previously using a _constraints
file, but this was shown to not always work correctly with _multibuild.
For more information about #!BuildConstraint directives see
https://github.com/openSUSE/obs-docu/pull/285, and in particular Darix's
comment that you shouldn't mix _constraints and #!BuildConstraint.
The #!BuildConstraint directives are added to the spec files automatically
by the pre_checkin.sh script. If the disk and memory constraints need to
be changed in future, adjust the variables in the pre_checkin.env file and
re-run pre_checkin.sh.
The current constraints are based on builds of ceph 16.2.7 on build.suse.de,
which showed the following resource usage (in MB):
ceph aarch64 max disk: 41568 max mem: 13698 (on ibs-centriq-6:3 disk: 65536 mem: 18432)
ceph x86_64 max disk: 41621 max mem: 9852 (on sheep74:2 disk: 51200 mem: 12500)
ceph ppc64le max disk: 42005 max mem: 8754 (on ibs-power9-10:1 disk: 61440 mem: 20480)
ceph s390x max disk: 40698 max mem: 8875 (on s390zl36:1 disk: 51200 mem: 10240)
ceph-test x86_64 max disk: 51760 max mem: 16835 (on sheep94:2 disk: 112640 mem: 16384)
Based on the above, and to hopefully provide a little wiggle room for
the future while at the same time not being too demanding of workers,
the minimum disk size is 50GB for ceph and 60GB for ceph-test. Memory
requirements remain at 8GB and 10GB respectively as they were before I
did the above tests - despite the memory usage shown above, AFAIK we
haven't run out of memory during builds, and this keeps the pool of
possible workers noticeably larger than it would be if we required 16GB.

52
README-packaging.txt Normal file
View File

@ -0,0 +1,52 @@
!!! DO NOT SUBMIT CEPH.SPEC MODIFICATIONS TO OBS !!!
!!! CEPH.SPEC IS MAINTAINED UPSTREAM !!!
So you have an idea for how to improve ceph.spec and are preparing to submit it
to the Factory devel project. You might also intend to test your patch in the
OBS, first. Please read this before proceeding!
Instructions for submitting
---------------------------
The ceph.spec file is maintained upstream at https://github.com/ceph/ceph
The Ceph package in OBS is built from SUSE's downstream fork at
https://github.com/SUSE/ceph (specifically, the ses7p branch).
To patch ceph.spec, ideally you should use the following procedure:
1. find out the current Factory ceph maintainer(s) (e.g. by examining the
most recent entries in the ceph.changes file)
2. open PR targeting the main branch at https://github.com/ceph/ceph
Make sure to sign your commit ("git commit --signoff") using your real name
and real email address. If this is a problem, contact the current Factory
maintainers: they can act as a proxy.
3. ping the Factory ceph maintainers about your PR
The Factory ceph maintainers will take care of getting your upstream PR
reviewed, tested, merged and, if necessary, backported. They will also take care
of submitting the patch to Factory.
Alternately, for patches that make no sense to submit to upstream main,
you can open a PR against the ses7p branch of https://github.com/SUSE/ceph
then ping the Factory ceph maintainers to get that reviewed and submitted to
Factory.
Caveat for testing
------------------
If you want to test your patch (e.g. in your home project), please read the
following CAVEAT:
The ceph.spec file is maintained upstream. As a consequence of that, we cannot
simply run the downstream spec file cleaner on it. (If you are now asking
"why?", here is one reason: the spec file cleaner changes the copyright notice!
Another reason is: the spec file cleaner has been known to munge ceph.spec so
badly that it breaks the build!)
Now, if special action is not taken, the spec file cleaner will run on the
server each time you commit. That must be avoided at all costs. Fortunately, it
is easy to avoid it by passing the "--noservice" option to "osc commit", e.g.:
osc commit --noservice

4
_multibuild Normal file
View File

@ -0,0 +1,4 @@
<multibuild>
<package>ceph-test</package>
</multibuild>

BIN
ceph-16.2.14-66-g7aa6ce9419f.tar.bz2 (Stored with Git LFS) Normal file

Binary file not shown.

38
ceph-cmake-3.28.patch Normal file
View File

@ -0,0 +1,38 @@
commit 8615731637a116f7b9299c6122a0e058d43a4f6d
Author: Dominique Leuenberger <dimstar@opensuse.org>
Date: Tue Dec 19 13:28:29 2023 +0100
cmake: Ensure git exists before executing it
CMake 3.28 has turned stricter when executing string(REPLACE …) and
expects four or more commands. In case of distro package builds from
tarball, it happens that git is not present. CTags.cmake tries to
catch that by veriying the exit status of the command, but as there
is in fact git | awk, awk returns 0 even when git does not exist.
Ensure that the variable submodules has been defined before trying
to replace substrings in this variable.
Signed-off-by: Dominique Leuenberger <dimstar@opensuse.org>
diff --git a/cmake/modules/CTags.cmake b/cmake/modules/CTags.cmake
index c3e1b3799b0..772f647f947 100644
--- a/cmake/modules/CTags.cmake
+++ b/cmake/modules/CTags.cmake
@@ -3,13 +3,14 @@ find_program(CTAGS_EXECUTABLE ctags)
function(add_tags name)
cmake_parse_arguments(TAGS "" "SRC_DIR;TAG_FILE" "EXCLUDE_OPTS;EXCLUDES" ${ARGN})
set(excludes ${TAGS_EXCLUDES})
+ find_package(Git)
if(TAGS_EXCLUDE_OPTS)
# always respect EXCLUDES_OPTS
list(APPEND excludes ${TAGS_EXCLUDE_OPTS})
- else()
+ elseif(Git_FOUND)
# exclude the submodules under SRC_DIR by default
execute_process(
- COMMAND git config --file .gitmodules --get-regexp path
+ COMMAND ${GIT_EXECUTABLE} config --file .gitmodules --get-regexp path
COMMAND awk "/${TAGS_SRC_DIR}/ { print $2 }"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
RESULT_VARIABLE result_code

109
ceph-rpmlintrc Normal file
View File

@ -0,0 +1,109 @@
# Upstream has fixed share library dependencies, all within the
# ceph src package. Eliminating them is a long-term effort.
addFilter("shlib-fixed-dependency")
# ceph-base RPM ships some internal static libraries
addFilter("ceph-base.*devel-file-in-non-devel-package.*compressor")
addFilter("ceph-base.*devel-file-in-non-devel-package.*rados-classes")
addFilter("ceph-base.*devel-file-in-non-devel-package.*libceph_crypto")
addFilter("ceph-base.*devel-file-in-non-devel-package.*libos_tp")
addFilter("ceph-base.*devel-file-in-non-devel-package.*libosd_tp")
# env shebang hack is required because the same script has to run in FreeBSD as
# well as Linux (Fedora, CentOS, SUSE, Debian, Ubuntu, etc.)
addFilter("ceph-common.*env-script-interpreter.*rbd-replay-many")
addFilter("ceph-common.*env-script-interpreter.*rbdmap")
# cephadm intentionally ships an empty file (.ssh/authorized_keys)
# and a hidden directory (/var/lib/cephadm/.ssh)
addFilter("cephadm.*zero-length")
addFilter("cephadm.*hidden-file-or-dir")
# ceph-mgr-dashboard ships a bunch of empty files and hidden files: need to audit if they are needed (WIP)
addFilter("ceph-mgr-dashboard.*zero-length")
addFilter("ceph-mgr-dashboard.*hidden-file-or-dir")
# ceph-immutable-object-cache has a weird description (WIP)
addFilter("ceph-immutable-object-cache.*description-shorter-than-summary")
# ceph-osd depends on libstoragemgmt explicitly (WIP)
addFilter("ceph-osd.*explicit-lib-dependency.*libstoragemgmt")
# we have a problem with RPM names that are too long for Joliet filesystem (WIP)
addFilter("filename-too-long-for-joliet")
# ceph-base intentionally calls its logrotate file "etc/logrotate.d/ceph"
addFilter("ceph-base.*incoherent-logrotate-file")
# many ceph executables might not be relinquishing groups (WIP)
addFilter("missing-call-to-setgroups-before-setuid")
# package summary might intentionally contain the word "Ceph"
addFilter("name-repeated-in-summary")
# the ceph RPM should be of the noarch architecture because it contains no binaries (WIP)
addFilter("ceph.*no-binary")
# cephfs-shell might be missing a Requires (WIP)
addFilter("cephfs-shell.*no-dependency-on.*python-base")
# ceph-osd ships /etc/sudoers.d/ceph-osd-smartctl without %config (WIP)
addFilter("ceph-osd.*non-conffile-in-etc.*sudoers")
# cephadm ships /etc/sudoers.d/cephadm without %config (WIP)
addFilter("cephadm.*non-conffile-in-etc.*sudoers")
# ceph-osd ships /usr/lib/sysctl.d/90-ceph-osd.conf with %config (WIP)
addFilter("ceph-osd.*non-etc-or-var-file-marked-as-conffile.*sysctl.d")
# ceph-dashboard ships several scripts that don't have executable bit set (WIP)
addFilter("ceph-mgr-dashboard.*non-executable-script")
# ceph-mgr-rook ships a script that doesn't have executable bit set (WIP)
addFilter("ceph-mgr-rook.*non-executable-script.*generate_rook_ceph_client.sh")
# some devel packages obsolete the deprecated "ceph-devel" package without providing it (WIP)
addFilter("obsolete-not-provided.*ceph-devel")
# libcephfs2 obsoletes libcephfs1 without providing it (WIP)
addFilter("libcephfs2.*obsolete-not-provided.*libcephfs1")
# librgw2 calls exit() or _exit(), probably in a non-fork() context (WIP)
addFilter("librgw2.*shared-lib-calls-exit")
# ceph-base ships with shared libraries - these are internal and upstream does
# not want to split them into separate RPMS
addFilter("ceph-base.*shlib-policy-missing-suffix")
# the ceph RPM is a "meta" RPM without any files. These are discouraged by SUSE,
# but upstream relies on this construct and we just have to live with it.
addFilter("ceph\..*suse-filelist-empty")
# ceph-common ships bash-completion files in the wrong directory (WIP)
addFilter("ceph-common.*suse-filelist-forbidden-bashcomp-userdirs")
# ceph-base ships a logrotate file in /etc/logrotate.d/ceph but does not not
# package the log directory /var/log/ceph (WIP)
addFilter("ceph-base.*suse-logrotate-log-dir-not-packaged")
# our packages are missing "rcFOO" symlinks - I doubt if this is worth fixing
addFilter("suse-missing-rclink")
# %post scriptlets do not call service_add_post (WIP)
addFilter("systemd-service-without-service_add_post")
# %pre scriptlets do not call service_add_pre (WIP)
addFilter("systemd-service-without-service_add_pre")
# %postun scriptlets do not call service_del_postun (WIP)
addFilter("systemd-service-without-service_del_postun")
# %preun scriptlets do not call service_del_preun (WIP)
addFilter("systemd-service-without-service_del_preun")
# /run/ceph needs to be added to %files section as %ghost (WIP)
addFilter("ceph-common.*tmpfile-not-in-filelist")
# ceph-radosgw ships a SO that belongs in librgw-devel (WIP)
addFilter("ceph-radosgw.*devel-file-in-non-devel-package")

1283
ceph-test.spec Normal file

File diff suppressed because it is too large Load Diff

2916
ceph.changes Normal file

File diff suppressed because it is too large Load Diff

2502
ceph.spec Normal file

File diff suppressed because it is too large Load Diff

140
checkin.sh Normal file
View File

@ -0,0 +1,140 @@
#!/bin/bash
#
# checkin.sh
#
# This script automates generation of a new tarball and spec file from a
# git clone or repo+branch combination for the "ceph" package in OBS.
#
set -x
BASEDIR=$(pwd)
function usage {
set +x
echo "Usage:"
echo " ${0} [-h,--help] [-e,--existing CLONE]"
echo " [-r,--repo REPO] [-b,--branch BRANCH]"
echo ""
echo "Options:"
echo " --existing Use existing ceph clone CLONE"
echo " --repo Make a fresh clone of ceph repo REPO"
echo " --branch Use branch BRANCH with fresh clone"
echo ""
echo "Notes:"
echo " If existing clone is given, repo and branch are ignored."
echo " Repo defaults to https://github.com/SUSE/ceph.git"
echo " Branch defaults to ses7p"
exit 1
}
function _error_exit {
echo >&2 $1
exit $2
}
function _check_ceph_clone {
local OPT="$1"
if [ -z "$OPT" ] ; then
_error_exit "Empty string sent to internal function _check_ceph_clone"
fi
if [ -e "$OPT/make-dist" ] ; then
echo "$OPT looks like a ceph clone; using it"
else
_error_exit "$OPT does not appear to be a ceph clone" 1
fi
}
function _verify_git_describe {
git describe --match 'v*'
echo "Does this version number looks sane? y/[N]"
read a
if [ "x$a" != "xy" ] ; then
_error_exit "Aborting!" 1
fi
}
GETOPT=$(getopt -o b:e:hr: --long "branch:,existing:,help,repo:" \
-n 'checkin.sh' -- "$@")
test "$?" -eq 0 || _error_exit "Terminating..." 1
eval set -- "$GETOPT"
EXISTING=""
REPO="https://github.com/SUSE/ceph.git"
BRANCH="ses7p"
while true ; do
case "$1" in
-b|--branch) BRANCH="$2" ; shift 2 ;;
-e|--existing) EXISTING="$2" ; shift 2 ;;
-h|--help) usage ;; # does not return
-r|--repo) REPO="$2" ; shift 2 ;;
--) shift ; break ;;
*) echo "Internal error" ; exit 1 ;;
esac
done
if [ -n "$EXISTING" ] ; then
if [ ! -d "$EXISTING" ] ; then
_error_exit "Alleged directory ->$EXISTING<- is not a directory" 1
fi
if [ ! -r "$EXISTING" ] ; then
_error_exit "I cannot read directory ->$EXISTING<-" 1
fi
if [ ! -w "$EXISTING" ] ; then
_error_exit "I cannot write to directory ->$EXISTING<-" 1
fi
if [ ! -x "$EXISTING" ] ; then
_error_exit "I cannot cd to directory ->$EXISTING<-" 1
fi
CLONE="$EXISTING"
else
echo "Will make fresh clone of repo ->$REPO<- branch ->$BRANCH<-"
# TMPDIR=$(mktemp -d --tmpdir=$BASEDIR) # does not work due to http://tracker.ceph.com/issues/39556
TMPDIR=$(mktemp -d)
echo "Created temporary temporary $TMPDIR"
git clone --progress --branch $BRANCH $REPO $TMPDIR
CLONE="$TMPDIR"
fi
_check_ceph_clone "$CLONE"
pushd $CLONE
#_verify_git_describe
if [ -z "$TMPDIR" ] ; then
echo "Deleting stale tarballs from previous runs"
rm -rf *.bz2
fi
echo "Running make-dist inside clone"
export DASHBOARD_FRONTEND_LANGS="ALL"
./make-dist
popd
echo "Running \"osc rm *bz2\" to nuke previous tarball"
if type osc > /dev/null 2>&1 ; then
osc rm *bz2
else
_error_exit "osc not installed - cannot continue" 1
fi
if stat --printf='' *.bz2 2>/dev/null ; then
_error_exit "There are still files ending in bz2 in the current directory - clean up yourself!" 1
fi
echo "Copying new spec file and tarball from $CLONE"
cp $CLONE/ceph.spec $CLONE/ceph*bz2 .
if [ -n "$TMPDIR" ] ; then
echo "Nuking the clone"
rm -rf $TMPDIR
fi
echo "Running \"osc add *bz2\" to register the new tarball"
osc add *bz2
echo "Running pre_checkin.sh"
if [ -f "pre_checkin.sh" ] ; then
bash pre_checkin.sh
else
echo "WARNING: no pre_checkin.sh script found!"
fi
echo "Done! Run \"osc ci --noservice\" to commit."

5
pre_checkin.env Normal file
View File

@ -0,0 +1,5 @@
# build constraints in GB (see README-constraints.txt)
CEPH_BUILD_DISK_SIZE_GB="50"
CEPH_BUILD_MEMORY_SIZE_GB="8"
CEPH_TEST_BUILD_DISK_SIZE_GB="60"
CEPH_TEST_BUILD_MEMORY_SIZE_GB="10"

310
pre_checkin.sh Normal file
View File

@ -0,0 +1,310 @@
#!/bin/bash
set -f
function packages_files {
local spec_file=$1
local exclude_pkg=$2
local in_files=false
local result=""
while IFS='' read -r line || [[ -n "$line" ]]; do
case $line in
"%files "*)
pkg=`echo "$line" | sed 's/%files.* \(\w\+\)/\1/g'`
if [[ $pkg == $exclude_pkg ]]; then
in_files=false
continue
fi
in_files=true
continue
;;
"%post"* | "%pre"* | "%preun"* | "%postun"* | "%changelog")
in_files=false
continue
;;
esac
result=""
changed=true
while [[ $in_files == true ]] && [[ $changed == true ]]; do
changed=false
case $line in
"%if"* | "" | "%defattr"* | "%endif"* | "%else"* | "#"* | "%docdir"*)
break
;;
"%dir"*)
break # for now we'll ignore %dir entries
;;
*)
result=`echo "$line" | sed -e 's/%config \(.*\)/\1/g' \
-e 's/%config(.*) \(.*\)/\1/g' \
-e 's/%attr(.*) \(.*\)/\1/g' \
-e 's/%exclude \(.*\)/\1/g'`
if [[ ! $line == $result ]]; then
changed=true
line=$result
continue
fi
;;
esac
echo "$result"
done
done < $spec_file
}
function get_package_summary {
local spec_file=$1
local pkg_name=$2
local in_package=false
while IFS='' read -r line || [[ -n "$line" ]]; do
case $line in
"%package "*)
pkg=`echo "$line" | sed 's/%package.* \(\w\+\)/\1/g'`
if [[ ! $pkg == $pkg_name ]]; then
in_package=false
else
in_package=true
fi
;;
"%prep"* | "%build"* | "%install"*)
in_package=false
;;
"Summary:"*)
if [[ $in_package == true ]]; then
echo $line
break
fi
;;
esac
done < $spec_file
}
function get_package_requires {
local spec_file=$1
local pkg_name=$2
local in_package=false
while IFS='' read -r line || [[ -n "$line" ]]; do
case $line in
"%package "*)
pkg=`echo "$line" | sed 's/%package.* \(\w\+\)/\1/g'`
if [[ ! $pkg == $pkg_name ]]; then
in_package=false
else
in_package=true
fi
;;
"%prep"* | "%build"* | "%install"*)
in_package=false
;;
"Requires:"*)
if [[ $in_package == true ]]; then
echo $line
fi
;;
esac
done < $spec_file
}
function get_package_description {
local spec_file=$1
local pkg_name=$2
local in_desc=false
while IFS='' read -r line || [[ -n "$line" ]]; do
case $line in
"%description "*)
pkg=`echo "$line" | sed 's/%description.* \(\w\+\)/\1/g'`
if [[ ! $pkg == $pkg_name ]]; then
in_desc=false
else
in_desc=true
fi
continue
;;
"%prep"* | "%build"* | "%install"* | "%package"* | "%if"* | "%endif"*)
in_desc=false
continue
;;
esac
if [[ $in_desc == true ]]; then
echo "$line"
fi
done < $spec_file
}
function transform_spec_file {
local spec_file=$1
local include_pkg=$2
local rm_files=$3
local summary=$4
local description=$5
local requires=$6
local in_package=false
local in_files=false
local in_desc=false
while IFS='' read -r line || [[ -n "$line" ]]; do
case $line in
"%bcond_with ceph_test_package"*)
line="%bcond_without ceph_test_package"
;;
"Name:"*)
line="Name: $include_pkg"
;;
"Summary:"*)
if [[ $in_package == false ]]; then
line="$summary"
fi
;;
"Source0:"*)
line=`echo $line | sed 's/%{name}/ceph/g'`
;;
"ExclusiveArch:"*)
line="ExclusiveArch: x86_64"
;;
"%autosetup -p1")
line="%autosetup -p1 -n ceph-%version"
;;
"Requires:"*)
if [[ $in_package == false ]]; then
line=""
fi
;;
"Requires(post):"*)
if [[ $in_package == false ]]; then
IFS=''
for r in "$requires"; do
echo "$r"
done
fi
;;
"%description"*)
if [[ $in_package == false ]]; then
in_desc=true
echo "$line"
echo "$description"
echo ""
continue
fi
;;
"%package "*)
in_package=true
continue
;;
"%prep"* | "%build"* | "%install"*)
in_package=false
in_desc=false
;;
"%files "*)
pkg=`echo "$line" | sed 's/%files.* \(\w\+\)/\1/g'`
if [[ $pkg == $include_pkg ]]; then
in_files=false
else
in_files=true
continue
fi
;;
"%changelog"*)
in_files=false
;;
"%clean"*)
in_package=false
IFS=''
for rf in "$rm_files"; do
echo "$rf"
done
echo ""
echo "dirs=\`find %{buildroot} -type d -empty\`"
echo "while [[ -n \$dirs ]]; do"
echo " for d in \$dirs; do"
echo " rm -rf \$d"
echo " done"
echo "dirs=\`find %{buildroot} -type d -empty\`"
echo "done"
echo ""
;;
"#"* | "%"*)
in_desc=false
;;
esac
if [[ $in_package == false ]] && [[ $in_files == false ]] && [[ $in_desc == false ]]; then
echo $line
else
if [[ $line == "%if"* ]] || [[ $line == "%endif"* ]]; then
echo $line
fi
fi
done < $spec_file
}
function generate_rm_exclude_files {
local exclude_list=$1
local buildroot=$2
for f in $exclude_list; do
echo "rm -rf $buildroot$f"
done
}
function insert_line_before {
local FILE=$1
local line_to_insert=$2
local match_regex=$3
sed -i "/${match_regex}/i $line_to_insert" $FILE
}
function set_build_constraints {
local FILE=$1
shift
sed -i -e '/#!BuildConstraint/d' $FILE
for constraint in "$@"; do
sed -i -e "1s/^/#!BuildConstraint: $constraint\n/" $FILE
done
}
PACKAGE="ceph-test"
SPEC_FILE="ceph.spec"
source ./pre_checkin.env
if [ -z "$CEPH_BUILD_DISK_SIZE_GB" -o \
-z "$CEPH_BUILD_MEMORY_SIZE_GB" -o \
-z "$CEPH_TEST_BUILD_DISK_SIZE_GB" -o \
-z "$CEPH_TEST_BUILD_MEMORY_SIZE_GB" ]; then
echo "ERROR: build constraints not set (see README-constraints.txt)";
exit 1
fi
files=`packages_files $SPEC_FILE $PACKAGE`
if [[ "$?" == "1" ]]; then
echo "ERROR: "
echo $files
exit 0
fi
rm_files=`generate_rm_exclude_files "$files" "%{buildroot}"`
summ=`get_package_summary $SPEC_FILE $PACKAGE`
desc=`get_package_description $SPEC_FILE $PACKAGE`
reqs=`get_package_requires $SPEC_FILE $PACKAGE`
sed -i -e 's/%bcond_without ceph_test_package/%bcond_with ceph_test_package/' $SPEC_FILE
transform_spec_file $SPEC_FILE $PACKAGE "$rm_files" "$summ" "$desc" "$reqs" > $PACKAGE.spec
insert_line_before "$PACKAGE.spec" "Source99: README-packaging.txt" "_insert_obs_source_lines_here"
insert_line_before "$PACKAGE.spec" "Source98: README-checkin.txt" "^Source99:"
insert_line_before "$PACKAGE.spec" "Source97: README-ceph-test.txt" "^Source98:"
insert_line_before "$PACKAGE.spec" "Source96: README-constraints.txt" "^Source97:"
insert_line_before "$PACKAGE.spec" "Source95: pre_checkin.env" "^Source96:"
insert_line_before "$PACKAGE.spec" "Source94: pre_checkin.sh" "^Source95:"
insert_line_before "$PACKAGE.spec" "Source93: checkin.sh" "^Source94:"
insert_line_before "$PACKAGE.spec" "Source92: ceph-rpmlintrc" "^Source93:"
set_build_constraints $SPEC_FILE "hardware:disk:size unit=G ${CEPH_BUILD_DISK_SIZE_GB}" "hardware:memory:size unit=G ${CEPH_BUILD_MEMORY_SIZE_GB}"
set_build_constraints "$PACKAGE.spec" "hardware:disk:size unit=G ${CEPH_TEST_BUILD_DISK_SIZE_GB}" "hardware:memory:size unit=G ${CEPH_TEST_BUILD_MEMORY_SIZE_GB}"