imapfilter convenience wrapper

rpmstuff 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/bash
  2. # MKit - simple install helper
  3. # See LICENSE file for copyright and license details.
  4. mkit_import build
  5. mkit_import target
  6. rpmstuff__main() {
  7. #
  8. # Build specfile
  9. #
  10. local specname=$MKIT_PROJ_PKGNAME.spec # .spec filename
  11. local specsrc # source of specfile
  12. target__run dist || die
  13. specsrc="$(ini 1value "dist:rpmstuff")"
  14. test -n "$specsrc" || die "dist:rpmstuff not specified"
  15. test -f "$specsrc" || die "specfile template not found: $specsrc"
  16. __rpmstuff__maybe_prefix_v0 "$specsrc"
  17. build__file "$specsrc" "$specname" rpmstuff
  18. }
  19. __rpmstuff__maybe_prefix_v0() {
  20. #
  21. # Avoid "normalizes to zero" error
  22. #
  23. # Scripting on Fedora 38 contains new check, where the version
  24. # is not allowed to be 0.0.0.
  25. #
  26. # We will disable this check for projects where our reported
  27. # version is indeed 0.0.0, but only if it's also a devel version,
  28. # in which case it has build data.
  29. #
  30. local file=$1
  31. local tmp="$1.__rpmstuff__maybe_prefix_v0.tmp"
  32. local version
  33. version=$(build__cached semver)
  34. case $version in
  35. 0.0.0+*)
  36. warn "disabling zero-version rpmbuild check" \
  37. " .. hint: We're doing this only because we trust" \
  38. " .. hint: that this is an early devel version." \
  39. " .. hint: Make sure to bump at least to 0.0.1" \
  40. " .. hint: before release."
  41. ;;
  42. *)
  43. return 0
  44. ;;
  45. esac
  46. cp -ar "$file" "$tmp"
  47. {
  48. echo "%define _python_dist_allow_version_zero 1"
  49. echo "# ^^ auto-added by mkit rpmstuff for early devel version"
  50. echo ""
  51. cat "$file"
  52. } > "$tmp"
  53. mv "$tmp" "$file"
  54. }