diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-05 08:38:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-05 08:38:39 +0000 |
commit | 80b126032c7e73d273bc883e973b5f1a94aac581 (patch) | |
tree | e7d13cf4f02585c239665a6c5465735ffde429c8 /scripts | |
parent | Releasing debian version 2.9.1-3. (diff) | |
download | nvme-cli-80b126032c7e73d273bc883e973b5f1a94aac581.tar.xz nvme-cli-80b126032c7e73d273bc883e973b5f1a94aac581.zip |
Merging upstream version 2.10.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build.sh | 67 | ||||
-rwxr-xr-x | scripts/release.sh | 82 |
2 files changed, 118 insertions, 31 deletions
diff --git a/scripts/build.sh b/scripts/build.sh index 470f39a..a88336f 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -21,6 +21,9 @@ usage() { echo " cross use cross toolchain to build" echo " coverage build coverage report" echo " appimage build AppImage target" + echo " distro build libnvme and nvme-cli separately" + echo " docs build documentation" + echo " static build a static binary" echo "" echo "configs with muon:" echo " [default] minimal static build" @@ -115,6 +118,25 @@ config_meson_appimage() { "${BUILDDIR}" } +config_meson_docs() { + CC="${CC}" "${MESON}" setup \ + -Ddocs=all \ + -Ddocs-build=true \ + --force-fallback-for=libnvme \ + -Dlibnvme:werror=false \ + "${BUILDDIR}" +} + +config_meson_static() { + CC="${CC}" "${MESON}" setup \ + --buildtype=release \ + --default-library=static \ + --wrap-mode=forcefallback \ + -Dc_link_args="-static" \ + -Dlibnvme:keyutils=disabled \ + "${BUILDDIR}" +} + build_meson() { "${MESON}" compile \ -C "${BUILDDIR}" @@ -205,6 +227,51 @@ test_muon() { ldd "${BUILDDIR}/nvme" 2>&1 | grep 'not a dynamic executable' || exit 1 } +_install_libnvme() { + local libnvme_ref=$(sed -n "s/revision = \([0-9a-z]\+\)/\1/p" subprojects/libnvme.wrap) + local LBUILDDIR="${BUILDDIR}/.build-libnvme" + + mkdir -p "${BUILDDIR}/libnvme" + + pushd "${BUILDDIR}/libnvme" + git init + git remote add origin https://github.com/linux-nvme/libnvme.git + git fetch origin ${libnvme_ref} + git reset --hard FETCH_HEAD + + CC="${CC}" "${MESON}" setup \ + --prefix="${BUILDDIR}/usr" \ + --buildtype="${BUILDTYPE}" \ + "${LBUILDDIR}" + + "${MESON}" compile \ + -C "${LBUILDDIR}" + + "${MESON}" install \ + -C "${LBUILDDIR}" + + popd || exit 1 +} + +config_meson_distro() { + _install_libnvme + + PKG_CONFIG_PATH="${BUILDDIR}/usr/lib64/pkgconfig" \ + CC="${CC}" ${MESON} setup \ + --prefix="${BUILDDIR}/usr" \ + --werror \ + --buildtype="${BUILDTYPE}" \ + "${BUILDDIR}" +} + +build_meson_distro() { + build_meson +} + +test_meson_distro() { + test_meson +} + if [[ "${BUILDTOOL}" == "muon" ]]; then SAMU="$(which samu 2> /dev/null)" || true if [[ -z "${SAMU}" ]]; then diff --git a/scripts/release.sh b/scripts/release.sh index d2cbb08..eb6eced 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -6,7 +6,8 @@ usage() { echo "The script does all necessary steps to create a new release." echo "" echo " -d: no documentation update" - echo " -n: dry run" + echo " -f: disable all sanity checks and just do the release" + echo " -l: do not update library dependency" echo "" echo "Note: The version number needs to be exactly" echo " '^v[\d]+.[\d]+(.[\d\]+(-rc[0-9]+)?$'" @@ -17,15 +18,19 @@ usage() { } build_doc=true -dry_run=false +update_lib_dep=true +force=false -while getopts "dn" o; do +while getopts "dfl" o; do case "${o}" in d) build_doc=false ;; - n) - dry_run=true + f) + force=true + ;; + l) + update_lib_dep=false ;; *) usage @@ -41,6 +46,26 @@ if [ -z "$VERSION" ] ; then exit 1 fi +cleanup() { + if [ -z "${OLD_HEAD}" ] ; then + exit + fi + git tag -d "Release $VERSION" "$VERSION" + git reset --hard "${OLD_HEAD}" +} + +register_cleanup() { + OLD_HEAD="$(git rev-parse HEAD)" +} + +unregister_cleanup() { + OLD_HEAD="" +} + +trap cleanup EXIT + +register_cleanup + # expected version regex re='^v([0-9]+\.[0-9]+(\.[0-9]+)?)(-rc[0-9]+)?$' @@ -57,7 +82,7 @@ fi cd "$(git rev-parse --show-toplevel)" || exit 1 -if [[ -f subprojects/libnvme.wrap ]]; then +if [ "$update_lib_dep" = true ] && [[ -f subprojects/libnvme.wrap ]]; then git -C subprojects/libnvme fetch --all # extract the version string from libnvme by using the ref @@ -75,16 +100,18 @@ if [[ -f subprojects/libnvme.wrap ]]; then fi fi -if [[ -n $(git status -s) ]]; then - echo "tree is dirty." - if [[ "${dry_run}" = false ]]; then - exit 1 +if [ "$force" = false ] ; then + if [[ -n $(git status -s) ]]; then + echo "tree is dirty." + if [[ "${dry_run}" = false ]]; then + exit 1 + fi fi -fi -if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ] ; then - echo "currently not on master branch. abort." - exit 1 + if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ] ; then + echo "currently not on master branch. abort." + exit 1 + fi fi # update all docs @@ -98,30 +125,22 @@ else 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 + git add $doc_dir + git commit -s -m "doc: Regenerate all docs for $VERSION" fi -if [[ "${dry_run}" = true ]]; then - exit 0 +# update meson.build +sed -i -e "0,/[ \t]version: /s/\([ \t]version: \).*/\1\'$ver\',/" meson.build +if [[ -n "$libnvme_VERSION" ]] && [[ -f subprojects/libnvme.wrap ]]; then + sed -i -e "s/\(dependency('libnvme', version: '>=\)\([\.1-9]\+\)/\1$libnvme_ver/" meson.build fi +git add meson.build +git commit -s -m "Release $VERSION" + git tag -s -m "Release $VERSION" "$VERSION" git push --dry-run origin "$VERSION"^{}:master tag "$VERSION" @@ -129,4 +148,5 @@ 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" + unregister_cleanup fi |