Re: [cmake-developers] Make CPACK_RPM_PACKAGE_RELEASE match Fedora/RHOS/CentOS recommended behaviour

2016-05-14 Thread Domen Vrankar
> That is infinitely simpler. Looks like a good addition to me.
>
>
Applied to next:
https://cmake.org/gitweb?p=cmake.git;a=commit;h=d758f12

Thanks,
Domen
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Re: [cmake-developers] Make CPACK_RPM_PACKAGE_RELEASE match Fedora/RHOS/CentOS recommended behaviour

2016-05-11 Thread Harry Mallon
Hi Domen,

That is infinitely simpler. Looks like a good addition to me.

Thanks,
Harry


Harry Mallon

CODEX | Software Engineer

60 Poland Street | London | England | W1F 7NT

E ha...@codexdigital.com | T +44 203 7000 
989

Website | Facebook 
| Twitter

[http://www.codexdigital.com/?action=asset=E55D8A6F-AF62-4978-8FF1-435A85AFADBF]

On 11 May 2016, at 10:33, Domen Vrankar 
> wrote:



0001-CPack-RPM-release-dist-tag-support.patch
Description: 0001-CPack-RPM-release-dist-tag-support.patch
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Re: [cmake-developers] Make CPACK_RPM_PACKAGE_RELEASE match Fedora/RHOS/CentOS recommended behaviour

2016-05-11 Thread Domen Vrankar
Sorry for the late reply.

Here is another go. I have added a 3rd variable but I think it means that
> current behaviour is continued and your input (thanks Dolf and Romen) has
> been addressed.
>
> https://github.com/hm1992/CMake/commit/2f54442388ab767f60fcb8cde1db2236ae535080
>

I'm somewhat reluctant to add yet another CPACK_RPM_* variable to an
already long list as it doesn't add much value - RPMBUILD-DEFAULT
functionality could just as easily be added to CPACK_RPM_DIST variable
without breaking the back compatibility.

I took a better look at the documentation that you were referring to (
https://fedoraproject.org/wiki/Packaging:DistTag) and noticed this section:

   - You must not override the variables for %{dist} (or any of the related
   variables).
   - You must not hardcode a value for %{dist} (or any of the related
   variables) in your spec.
   - You must not hardcode a dist tag in the spec: *BAD:* Release: 1.fc20
   *GOOD:* Release: 1%{?dist}
   - You cannot put any sort of "tagging" in %{dist} (or any of the related
   variables). %{dist} (and its related variables) exist ONLY to define the
   distribution that a package was built against.

It would seem that overriding dist tag is unsupported and prohibited.

I've changed the patch with that in mind. Would the attached patch be OK
for you?
Thanks,
Domen
From 1091950f7ecabcaf283afbf3e36e357d1cd5b00b Mon Sep 17 00:00:00 2001
From: Harry Mallon 
Date: Wed, 11 May 2016 11:21:11 +0200
Subject: [PATCH 1/1] CPack/RPM release dist tag support

Some Linux distros require Release tag
to be set to .
---
 Modules/CPackRPM.cmake | 27 ---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index 768d64f..330fc1e 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -80,10 +80,27 @@
 #
 #  This is the numbering of the RPM package itself, i.e. the version of the
 #  packaging and not the version of the content (see
-#  CPACK_RPM_PACKAGE_VERSION). One may change the default value if the
-#  previous packaging was buggy and/or you want to put here a fancy Linux
+#  :variable:`CPACK_RPM_PACKAGE_VERSION`). One may change the default value if
+#  the previous packaging was buggy and/or you want to put here a fancy Linux
 #  distro specific numbering.
 #
+# .. note::
+#
+#  This is the string that goes into the RPM ``Release:`` field. Some distros
+#  (e.g. Fedora, CentOS) require ``1%{?dist}`` format and not just a number.
+#  ``%{?dist}`` part can be added by setting :variable:`CPACK_RPM_PACKAGE_RELEASE_DIST`.
+#
+# .. variable:: CPACK_RPM_PACKAGE_RELEASE_DIST
+#
+#  The dist tag that is added  RPM ``Release:`` field.
+#
+#  * Mandatory : NO
+#  * Default   : OFF
+#
+#  This is the reported ``%{dist}`` tag from the current distribution or empty
+#  ``%{dist}`` if RPM macro is not set. If this variable is set then RPM
+#  ``Release:`` field value is set to ``${CPACK_RPM_PACKAGE_RELEASE}%{?dist}``.
+#
 # .. variable:: CPACK_RPM_PACKAGE_LICENSE
 #
 #  The RPM package license policy.
@@ -1317,7 +1334,11 @@ function(cpack_rpm_generate_package)
   # This is the case when the packaging is buggy (not) the software :=)
   # If not set, 1 is a good candidate
   if(NOT CPACK_RPM_PACKAGE_RELEASE)
-set(CPACK_RPM_PACKAGE_RELEASE 1)
+set(CPACK_RPM_PACKAGE_RELEASE "1")
+  endif()
+
+  if(CPACK_RPM_PACKAGE_RELEASE_DIST)
+set(CPACK_RPM_PACKAGE_RELEASE "${CPACK_RPM_PACKAGE_RELEASE}%{?dist}")
   endif()
 
   # CPACK_RPM_PACKAGE_LICENSE
-- 
2.7.4

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Re: [cmake-developers] Make CPACK_RPM_PACKAGE_RELEASE match Fedora/RHOS/CentOS recommended behaviour

2016-05-08 Thread Harry Mallon
Hi,

Here is another go. I have added a 3rd variable but I think it means that 
current behaviour is continued and your input (thanks Dolf and Romen) has been 
addressed.
https://github.com/hm1992/CMake/commit/2f54442388ab767f60fcb8cde1db2236ae535080

# CPACK_RPM_DIST
if(NOT CPACK_RPM_DIST)
  execute_process(COMMAND ${RPMBUILD_EXECUTABLE} -E %{?dist}
  OUTPUT_VARIABLE CPACK_RPM_DIST
  ERROR_QUIET
  OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()

# CPACK_RPM_PACKAGE_RELEASE_NUMBER
# The RPM release is the numbering of the RPM package ITSELF
# this is the version of the PACKAGING and NOT the version
# of the CONTENT of the package.
# You may well need to generate a new RPM package release
# without changing the version of the packaged software.
# This is the case when the packaging is buggy (not) the software :=)
# If not set, 1 is a good candidate.
if(NOT CPACK_RPM_PACKAGE_RELEASE_NUMBER)
  set(CPACK_RPM_PACKAGE_RELEASE_NUMBER "1")
endif()

# CPACK_RPM_PACKAGE_RELEASE
if(NOT CPACK_RPM_PACKAGE_RELEASE)
  # CMake default e.g. "1"
  set(CPACK_RPM_PACKAGE_RELEASE "${CPACK_RPM_PACKAGE_RELEASE_NUMBER}")
elseif(${CPACK_RPM_PACKAGE_RELEASE} STREQUAL "RPMBUILD-DEFAULT")
  # Fedora/CentOS default e.g. "1.el7.centos"
  set(CPACK_RPM_PACKAGE_RELEASE
  "${CPACK_RPM_PACKAGE_RELEASE_NUMBER}${CPACK_RPM_DIST}")
endif()

H



Harry Mallon

CODEX | Software Engineer

60 Poland Street | London | England | W1F 7NT

E ha...@codexdigital.com | T +44 203 7000 
989

Website | Facebook 
| Twitter

[http://www.codexdigital.com/?action=asset=E55D8A6F-AF62-4978-8FF1-435A85AFADBF]

On 7 May 2016, at 4:35 pm, Domen Vrankar 
> wrote:

2016-05-06 19:09 GMT+02:00 Harry Mallon 
>:
According to Fedora documentation the "Release:" variable in RPM files should 
be set to 1%{?dist}.
https://fedoraproject.org/wiki/How_to_create_an_RPM_package
https://fedoraproject.org/wiki/Packaging:DistTag

This means it should be set to a string which looks like "1.el7.centos" on my 
CentOS7 machine. CPack sets this to "1" by default, but can be changed with the 
CPACK_RPM_PACKAGE_RELEASE variable. I propose a change as follows:
https://github.com/hm1992/CMake/commit/94c611d5710a51072e15855ed96a225def975c38

* Adds CPACK_RPM_DIST which defaults to the output of "rpmbuild -E %{dist} 
2>/dev/null".
* Makes CPACK_RPM_PACKAGE_RELEASE default to "1${CPACK_RPM_DIST}"

I think I am right in saying this would not change behaviour on distributions 
that did not use the %{dist} option as "rpmbuild -E %{dist}" should return 
nothing.

Hi,

dist tag looks like a good addition however there are some issues with the 
proposed patch:

- As Rolf already mentioned "2>/dev/null" should be replaced with ERROR_QUIET 
and also OUTPUT_STRIP_TRAILING_WHITESPACE

- there is no need to check for the existance of rpmbuild as that is already 
checked at the top of cpack_rpm_generate_package function

- rpmbuild -E %{dist} should use %{?dist} to check if tag is set otherwise 
%{dist} will be printed out instead of an empty string on platforms that don't 
set this tag

- CPACK_RPM_DIST is only applied in situations when CPACK_RPM_PACKAGE_RELEASE 
is not set by the user

To solve the last bullet I would propose that you extend the patch so that with 
CPACK_RPM_DIST:

- if not set current functionality would remain (${CPACK_RPM_PACKAGE_RELEASE} 
only - I would not make an exception for "1${CPACK_RPM_DIST}" default value)

- if set to value "RPMBUILD-DEFAULT" rpmbuild -E %{?dist} would be used to get 
CPACK_RPM_DIST value and then appended to CPACK_RPM_PACKAGE_RELEASE

- if set to any other value that value would be used (also a check would have 
to be made that if first character is not a dot it has to be added 
automatically)

Thanks,
Domen

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Re: [cmake-developers] Make CPACK_RPM_PACKAGE_RELEASE match Fedora/RHOS/CentOS recommended behaviour

2016-05-07 Thread Domen Vrankar
2016-05-06 19:09 GMT+02:00 Harry Mallon :

> According to Fedora documentation the "Release:" variable in RPM files
> should be set to 1%{?dist}.
> https://fedoraproject.org/wiki/How_to_create_an_RPM_package
> https://fedoraproject.org/wiki/Packaging:DistTag
>
> This means it should be set to a string which looks like "1.el7.centos" on
> my CentOS7 machine. CPack sets this to "1" by default, but can be changed
> with the CPACK_RPM_PACKAGE_RELEASE variable. I propose a change as follows:
>
> https://github.com/hm1992/CMake/commit/94c611d5710a51072e15855ed96a225def975c38
>
> * Adds CPACK_RPM_DIST which defaults to the output of "rpmbuild -E %{dist}
> 2>/dev/null".
> * Makes CPACK_RPM_PACKAGE_RELEASE default to "1${CPACK_RPM_DIST}"
>
> I think I am right in saying this would not change behaviour on
> distributions that did not use the %{dist} option as "rpmbuild -E
> %{dist}" should return nothing.
>

Hi,

dist tag looks like a good addition however there are some issues with the
proposed patch:

- As Rolf already mentioned "2>/dev/null" should be replaced with
ERROR_QUIET and also OUTPUT_STRIP_TRAILING_WHITESPACE

- there is no need to check for the existance of rpmbuild as that is
already checked at the top of cpack_rpm_generate_package function

- rpmbuild -E %{dist} should use %{?dist} to check if tag is set otherwise
%{dist} will be printed out instead of an empty string on platforms that
don't set this tag

- CPACK_RPM_DIST is only applied in situations when
CPACK_RPM_PACKAGE_RELEASE is not set by the user

To solve the last bullet I would propose that you extend the patch so that
with CPACK_RPM_DIST:

- if not set current functionality would remain (${CPACK_RPM_PACKAGE_RELEASE}
only - I would not make an exception for "1${CPACK_RPM_DIST}" default value)

- if set to value "RPMBUILD-DEFAULT" rpmbuild -E %{?dist} would be used to
get CPACK_RPM_DIST value and then appended to CPACK_RPM_PACKAGE_RELEASE

- if set to any other value that value would be used (also a check would
have to be made that if first character is not a dot it has to be added
automatically)

Thanks,
Domen
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Re: [cmake-developers] Make CPACK_RPM_PACKAGE_RELEASE match Fedora/RHOS/CentOS recommended behaviour

2016-05-06 Thread Rolf Eike Beer
Am Freitag, 6. Mai 2016, 17:09:14 schrieb Harry Mallon:
> According to Fedora documentation the "Release:" variable in RPM files
> should be set to 1%{?dist}.
> https://fedoraproject.org/wiki/How_to_create_an_RPM_package
> https://fedoraproject.org/wiki/Packaging:DistTag
> 
> This means it should be set to a string which looks like "1.el7.centos" on
> my CentOS7 machine. CPack sets this to "1" by default, but can be changed
> with the CPACK_RPM_PACKAGE_RELEASE variable. I propose a change as follows:
> https://github.com/hm1992/CMake/commit/94c611d5710a51072e15855ed96a225def97
> 5c38
> 
> * Adds CPACK_RPM_DIST which defaults to the output of "rpmbuild -E %{dist}
> 2>/dev/null". * Makes CPACK_RPM_PACKAGE_RELEASE default to
> "1${CPACK_RPM_DIST}"

Instead of "2>/dev/null" you should use the ERROR_QUIET option.

Eike

signature.asc
Description: This is a digitally signed message part.
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

[cmake-developers] Make CPACK_RPM_PACKAGE_RELEASE match Fedora/RHOS/CentOS recommended behaviour

2016-05-06 Thread Harry Mallon
According to Fedora documentation the "Release:" variable in RPM files should 
be set to 1%{?dist}.
https://fedoraproject.org/wiki/How_to_create_an_RPM_package
https://fedoraproject.org/wiki/Packaging:DistTag

This means it should be set to a string which looks like "1.el7.centos" on my 
CentOS7 machine. CPack sets this to "1" by default, but can be changed with the 
CPACK_RPM_PACKAGE_RELEASE variable. I propose a change as follows:
https://github.com/hm1992/CMake/commit/94c611d5710a51072e15855ed96a225def975c38

* Adds CPACK_RPM_DIST which defaults to the output of "rpmbuild -E %{dist} 
2>/dev/null".
* Makes CPACK_RPM_PACKAGE_RELEASE default to "1${CPACK_RPM_DIST}"

I think I am right in saying this would not change behaviour on distributions 
that did not use the %{dist} option as "rpmbuild -E %{dist}" should return 
nothing.

Harry

Harry Mallon

CODEX | Software Engineer

60 Poland Street | London | England | W1F 7NT

E ha...@codexdigital.com | T +44 203 7000 
989

Website | Facebook 
| Twitter

[http://www.codexdigital.com/?action=asset=E55D8A6F-AF62-4978-8FF1-435A85AFADBF]
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers