9001-makepkg-Treat-pkgrel-more-similarly-to-pkgver.patch 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. From e72212e314f98a0cf9a082dfa1293baa019fbc90 Mon Sep 17 00:00:00 2001
  2. From: Luke Shumaker <lukeshu@parabola.nu>
  3. Date: Thu, 14 Apr 2016 17:06:07 -0400
  4. Subject: [PATCH 4/4] makepkg: Treat pkgrel more similarly to pkgver
  5. This is perfectly fine with libalpm; it was only makepkg that was more
  6. strict with pkgrel than pkgver.
  7. Further, the former error message about invalid pkgrel formats claimed that
  8. pkgrel was a "decimal", which would mean that `1.1 == 1.10`. This is not
  9. the case; alpm parses pkgrel as a version, not as a decimal. In that
  10. light, enforcing /[0-9]+(\.([0-9]+)?/ on a version spec seems silly.
  11. ---
  12. doc/PKGBUILD.5.asciidoc | 5 ++--
  13. scripts/libmakepkg/lint_pkgbuild/pkgrel.sh.in | 4 ++--
  14. test/util/vercmptest.sh | 23 ++++++++++++++++++-
  15. 3 files changed, 26 insertions(+), 6 deletions(-)
  16. diff --git a/doc/PKGBUILD.5.asciidoc b/doc/PKGBUILD.5.asciidoc
  17. index f12effde..1ad8de37 100644
  18. --- a/doc/PKGBUILD.5.asciidoc
  19. +++ b/doc/PKGBUILD.5.asciidoc
  20. @@ -60,9 +60,8 @@ systems (see below).
  21. allows package maintainers to make updates to the package's configure
  22. flags, for example. This is typically set to '1' for each new upstream
  23. software release and incremented for intermediate PKGBUILD updates. The
  24. - variable is a positive integer, with an optional subrelease level
  25. - specified by adding another positive integer separated by a period
  26. - (i.e. in the form x.y).
  27. + variable is not allowed to contain colons, forward slashes, hyphens or
  28. + whitespace.
  29. *epoch*::
  30. Used to force the package to be seen as newer than any previous versions
  31. diff --git a/scripts/libmakepkg/lint_pkgbuild/pkgrel.sh.in b/scripts/libmakepkg/lint_pkgbuild/pkgrel.sh.in
  32. index 30fa6d71..0888e0b1 100644
  33. --- a/scripts/libmakepkg/lint_pkgbuild/pkgrel.sh.in
  34. +++ b/scripts/libmakepkg/lint_pkgbuild/pkgrel.sh.in
  35. @@ -36,8 +36,8 @@ check_pkgrel() {
  36. return 1
  37. fi
  38. - if [[ $rel != +([0-9])?(.+([0-9])) ]]; then
  39. - error "$(gettext "%s must be of the form 'integer[.integer]', not %s.")" "pkgrel${type:+ in $type}" "$rel"
  40. + if [[ $rel = *[[:space:]/:-]* ]]; then
  41. + error "$(gettext "%s is not allowed to contain colons, forward slashes, hyphens or whitespace; got %s.")" "pkgrel${type:+ in $type}" "$rel"
  42. return 1
  43. fi
  44. }
  45. diff --git a/test/util/vercmptest.sh b/test/util/vercmptest.sh
  46. index 1541e7ae..f41a0d1e 100755
  47. --- a/test/util/vercmptest.sh
  48. +++ b/test/util/vercmptest.sh
  49. @@ -39,7 +39,7 @@ tap_runtest() {
  50. tap_is_str "$($bin "$ver2" "$ver1")" "$exp" "$ver2 $ver1"
  51. }
  52. -tap_plan 92
  53. +tap_plan 124
  54. # all similar length, no pkgrel
  55. tap_runtest 1.5.0 1.5.0 0
  56. @@ -113,4 +113,25 @@ tap_runtest 1:1.0 1.0 1
  57. tap_runtest 1:1.0 1.1 1
  58. tap_runtest 1:1.1 1.1 1
  59. +# complex pkgrel values
  60. +tap_runtest 1-1.5.0 1-1.5.0 0
  61. +tap_runtest 1-1.5.1 1-1.5.0 1
  62. +tap_runtest 1-1.5.1 1-1.5 1
  63. +tap_runtest 1-1.5b 1-1.5 -1
  64. +tap_runtest 1-1.5b 1-1.5.1 -1
  65. +# based on "from the manpage"
  66. +tap_runtest 1-1.0a 1-1.0alpha -1
  67. +tap_runtest 1-1.0alpha 1-1.0b -1
  68. +tap_runtest 1-1.0b 1-1.0beta -1
  69. +tap_runtest 1-1.0beta 1-1.0rc -1
  70. +tap_runtest 1-1.0rc 1-1.0 -1
  71. +# based on "going crazy? alpha-dotted versions"
  72. +tap_runtest 1-1.5.a 1-1.5 1
  73. +tap_runtest 1-1.5.b 1-1.5.a 1
  74. +tap_runtest 1-1.5.1 1-1.5.b 1
  75. +# based on Parabola usage
  76. +tap_runtest 1-1 1-2.par1 -1
  77. +tap_runtest 1-2 1-2.par1 -1
  78. +tap_runtest 1-3 1-2.par1 1
  79. +
  80. tap_finish
  81. --
  82. 2.18.0