1
0
Fork 0

Adding upstream version 1.5.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-16 10:09:05 +01:00
parent 7536d04328
commit 6b42c9b733
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
874 changed files with 9553 additions and 1347 deletions

182
scripts/build.sh Executable file
View file

@ -0,0 +1,182 @@
#!/bin/bash
usage() {
echo "Usage: build.sh [-b [release|debug]] "
echo " [-c [gcc|clang]]"
echo " [-m [meson|muon]"
echo " [config]"
echo ""
echo "CI build script."
echo ""
echo " -b [release]|debug build type"
echo " -c [gcc]|clang compiler to use"
echo " -m [meson]|muon use meson or muon"
echo " -t [armhf]|ppc64le|s390x cross compile target"
echo ""
echo "configs with meson:"
echo " [default] default settings"
echo " libdbus build with libdbus"
echo " fallback download all dependencies"
echo " and build them as shared libaries"
echo " cross use cross toolchain to build"
echo ""
echo "configs with muon:"
echo " [default] minimal static build"
}
BUILDTOOL=meson
MESON=meson
BUILDTYPE=release
CROSS_TARGET=armhf
CC=${CC:-"gcc"}
while getopts "b:c:m:t:" o; do
case "${o}" in
b)
BUILDTYPE="${OPTARG}"
;;
c)
CC="${OPTARG}"
;;
m)
BUILDTOOL="${OPTARG}"
;;
t)
CROSS_TARGET="${OPTARG}"
;;
*)
usage
exit 1
;;
esac
done
shift $((OPTIND-1))
CONFIG=${1:-"default"}
cd "$(git rev-parse --show-toplevel)" || exit 1
BUILDDIR="$(pwd)/.build-ci"
config_meson_default() {
CC="${CC}" "${MESON}" setup \
--werror \
--buildtype="${BUILDTYPE}" \
"${BUILDDIR}"
}
config_meson_libdbus() {
CC="${CC}" "${MESON}" setup \
--werror \
--buildtype="${BUILDTYPE}" \
-Dlibdbus=enabled \
--prefix=/ \
"${BUILDDIR}"
}
config_meson_fallback() {
CC="${CC}" "${MESON}" setup \
--werror \
--buildtype="${BUILDTYPE}" \
--wrap-mode=forcefallback \
-Dlibdbus=enabled \
-Ddbus:werror=false \
-Dopenssl:werror=false \
"${BUILDDIR}"
}
config_meson_cross() {
CC="${CC}" "${MESON}" setup \
--werror \
--buildtype="${BUILDTYPE}" \
--cross-file=.github/cross/ubuntu-cross-"${CROSS_TARGET}".txt \
-Dpython=disabled \
-Dopenssl=disabled \
"${BUILDDIR}"
}
build_meson() {
"${MESON}" compile \
-C "${BUILDDIR}"
}
test_meson() {
"${MESON}" test \
-C "${BUILDDIR}"
}
tools_build_samurai() {
mkdir -p "${BUILDDIR}"/build-tools
git clone --depth 1 https://github.com/michaelforney/samurai.git \
"${BUILDDIR}/build-tools/samurai"
pushd "${BUILDDIR}/build-tools/samurai" || exit 1
CC="${CC}" make
SAMU="${BUILDDIR}/build-tools/samurai/samu"
popd || exit 1
}
tools_build_muon() {
mkdir -p "${BUILDDIR}"/build-tools
git clone --depth 1 https://git.sr.ht/~lattis/muon \
"${BUILDDIR}/build-tools/muon"
pushd "${BUILDDIR}/build-tools/muon" || exit 1
CC="${CC}" ninja="${SAMU}" ./bootstrap.sh stage1
CC="${CC}" ninja="${SAMU}" stage1/muon setup \
-Dprefix="${BUILDDIR}/build-tools" \
-Dlibcurl=enabled \
-Dlibarchive=enabled \
-Dlibpkgconf=enabled \
-Ddocs=disabled \
-Dsamurai=disabled \
"${BUILDDIR}/build-tools/.build-muon"
"${SAMU}" -C "${BUILDDIR}/build-tools/.build-muon"
MUON="${BUILDDIR}/build-tools/.build-muon/muon"
# "${MUON}" -C "${BUILDDIR}/build-tools/.build-muon" test
popd || exit 1
}
config_muon_default() {
CC="${CC}" CFLAGS="${CFLAGS} -static" \
ninja="${SAMU}" "${MUON}" setup \
-Ddefault_library=static \
-Djson-c=disabled \
-Dopenssl=disabled \
-Dkeyutils=disabled \
-Dpython=disabled \
-Dpython=disabled \
"${BUILDDIR}"
}
build_muon() {
"${SAMU}" -C "${BUILDDIR}"
}
test_muon() {
ninja="${SAMU}" "${MUON}" -C "${BUILDDIR}" test
}
rm -rf "${BUILDDIR}"
if [[ "${BUILDTOOL}" == "muon" ]]; then
if ! which samu ; then
tools_build_samurai
else
SAMU="$(which samu)"
fi
if ! which muon ; then
tools_build_muon
else
MUON="$(which muon)"
fi
fi
config_"${BUILDTOOL}"_"${CONFIG}"
build_"${BUILDTOOL}"
test_"${BUILDTOOL}"

2523
scripts/kernel-doc Executable file

File diff suppressed because it is too large Load diff

10
scripts/kernel-doc-check Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
# SPDX-License-Identifier: LGPL-2.1-or-later
kernel_doc=$(dirname $0)/kernel-doc
"$kernel_doc" -none "$@" 2>&1 |
grep '\(warning\|error\)'
# check that kernel-doc succeeded, but the grep failed
[ ${PIPESTATUS[0]} -eq 0 -a ${PIPESTATUS[1]} -eq 1 ]

16
scripts/list-man-pages.sh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/bash
# SPDX-License-Identifier: LGPL-2.1-or-later
file=$1
for func in $(sed -n 's/ \* \([a-z_][a-z_0-9]*\)() -.*/\1/p' $file); do
echo ${func}
done
for struct in $(sed -n 's/ \* struct \([a-z_][a-z_0-9]*\) -.*/\1/p' $file); do
echo ${struct}
done
for enum in $(sed -n 's/ \* enum \([a-z_][a-z_0-9]*\) -.*/\1/p' $file); do
echo ${enum}
done

5
scripts/list-pre-compiled.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
for i in man/*.2; do
echo $i
done

17
scripts/meson-vcs-tag.sh Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: LGPL-2.1-or-later
set -eu
set -o pipefail
dir="${1:?}"
fallback="${2:?}"
# Apparently git describe has a bug where it always considers the work-tree
# dirty when invoked with --git-dir (even though 'git status' is happy). Work
# around this issue by cd-ing to the source directory.
cd "$dir"
# Check that we have either .git/ (a normal clone) or a .git file (a work-tree)
# and that we don't get confused if a tarball is extracted in a higher-level
# git repository.
[ -e .git ] && git describe --abbrev=7 --dirty=+ 2>/dev/null | sed 's/^v//' || echo "$fallback"

132
scripts/release.sh Executable file
View file

@ -0,0 +1,132 @@
#!/bin/bash
usage() {
echo "Usage: release.sh [-d] VERSION"
echo ""
echo "The script does all necessary steps to create a new release."
echo ""
echo " -d: no documentation update"
echo " -n: dry run"
echo ""
echo "Note: The version number needs to be exactly"
echo " '^v[\d]+.[\d]+(.[\d\]+(-rc[0-9]+)?$'"
echo ""
echo "example:"
echo " release.sh v2.1-rc0 # v2.1 release candidate 0"
echo " release.sh v2.1 # v2.1 release"
}
build_doc=true
dry_run=false
while getopts "dn" o; do
case "${o}" in
d)
build_doc=false
;;
n)
dry_run=true
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
VERSION=${1:-}
if [ -z "$VERSION" ] ; then
usage
exit 1
fi
# expected version regex
re='^v([0-9]+\.[0-9]+(\.[0-9]+)?)(-rc[0-9]+)?$'
# use the version string provided from the command line
if [[ "$VERSION" =~ ${re} ]]; then
echo "valid version $VERSION string"
# remove the leading 'v'
ver="${VERSION#v}"
else
echo "invalid version string $VERSION"
exit 1
fi
cd "$(git rev-parse --show-toplevel)" || exit 1
if [[ -f subprojects/libnvme.wrap ]]; then
git -C subprojects/libnvme fetch --all
# extract the vesion string from libnvme by using the ref
# defined in libnvme.wrap.
libnvme_ref=$(sed -n "s/revision = \([0-9a-z]\+\)/\1/p" subprojects/libnvme.wrap)
libnvme_VERSION=$(git -C subprojects/libnvme describe "${libnvme_ref}")
if [[ "${libnvme_VERSION}" =~ ${re} ]]; then
echo "libnvme: valid version ${libnvme_VERSION} string"
# remove the leading 'v'
libnvme_ver="${libnvme_VERSION#v}"
else
echo "libnvme: invalid version string ${libnvme_VERSION}"
exit 1
fi
fi
if [[ -n $(git status -s) ]]; then
echo "tree is dirty."
if [[ "${dry_run}" = false ]]; then
exit 1
fi
fi
if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ] ; then
echo "currently not on master branch. abort."
exit 1
fi
# update all docs
doc_dir=""
if [ -d "Documentation" ]; then
doc_dir="Documentation"
elif [ -d "doc" ]; then
doc_dir="doc"
else
echo "documenation directory not found"
exit 1
fi
# update meson.build
sed -i -e "0,/[ \t]version: /s/\([ \t]version: \).*/\1\'$ver\',/" meson.build
if [[ -f subprojects/libnvme.wrap ]]; then
sed -i -e "s/\(dependency('libnvme', version: '>=\)\([\.1-9]\+\)/\1$libnvme_ver/" meson.build
fi
if [[ "${dry_run}" = false ]]; then
git add meson.build
git commit -s -m "build: Update version to $VERSION"
fi
if [ "$build_doc" = true ]; then
# update documentation
./scripts/update-docs.sh
if [[ "${dry_run}" = false ]]; then
git add $doc_dir
git commit -s -m "doc: Regenerate all docs for $VERSION"
fi
fi
if [[ "${dry_run}" = true ]]; then
exit 0
fi
git tag -s -m "Release $VERSION" "$VERSION"
git push --dry-run origin "$VERSION"^{}:master tag "$VERSION"
read -p "All good? Ready to push changes to remote? [Yy]" -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
git push origin "$VERSION"^{}:master tag "$VERSION"
fi

49
scripts/update-docs.sh Executable file
View file

@ -0,0 +1,49 @@
#!/bin/sh
# SPDX-License-Identifier: LGPL-2.1-or-later
cd "$(git rev-parse --show-toplevel)" || exit 1
# build man docs
BUILDDIR="$(mktemp -d)"
echo "${BUILDDIR}"
trap 'rm -rf -- ${BUILDDIR}' EXIT
meson setup \
-Ddocs=man \
-Ddocs-build=true \
"${BUILDDIR}"
meson compile \
-C "${BUILDDIR}"
rm -rf doc/man
mkdir doc/man
find "${BUILDDIR}/doc" -maxdepth 1 -name '*.2' -exec cp {} doc/man \;
# build ReST docs
rm -rf -- "${BUILDDIR}"
BUILDDIR="$(mktemp -d)"
echo "${BUILDDIR}"
trap 'rm -rf -- ${BUILDDIR}' EXIT
meson setup \
-Ddocs=rst \
-Ddocs-build=true \
"${BUILDDIR}"
meson compile \
-C "${BUILDDIR}"
rm -rf doc/rst/*.rst
mkdir -p doc/rst
find "${BUILDDIR}/doc/rst" -maxdepth 1 -name '*.rst' -exec cp {} doc/rst \;
cp "${BUILDDIR}/doc/conf.py" doc
cp "${BUILDDIR}/doc/index.rst" doc
cp "${BUILDDIR}/doc/config-schema.json" doc
# build html docs
# The HTML doc is not ready yet
# rm -rf $DESTDIR/doc/html
# cp -R $BUILDDIR/doc/html $DESTDIR/doc/