#22 Backport `macros.rubygems` to F27
Merged 5 years ago by pvalena. Opened 5 years ago by pvalena.
rpms/ pvalena/ruby rebase-f27  into  f27

file modified
+69 -4
@@ -42,8 +42,8 @@ 

  }

  

  

- # The 'read' command in gemspec_add _depand gemspec_remove_dep macros is not

- # essential, but it is usefull to make the sript appear in build log.

+ # The 'read' command in %%gemspec_* macros is not essential, but it is usefull

+ # to make the sript appear in build log.

  

  

  # %gemspec_add_dep - Add dependency into .gemspec.
@@ -60,7 +60,7 @@ 

  #

  %gemspec_add_dep(g:s:d) \

  read -d '' gemspec_add_dep_script << 'EOR' || : \

-   gemspec_file = '%{-s*}%{!?-s:./%{gem_name}.gemspec}' \

+   gemspec_file = '%{-s*}%{!?-s:%{_builddir}/%{gem_name}-%{version}.gemspec}' \

    \

    name = '%{-g*}' \

    requirements = %{*}%{!?1:nil} \
@@ -97,7 +97,7 @@ 

  #

  %gemspec_remove_dep(g:s:d) \

  read -d '' gemspec_remove_dep_script << 'EOR' || : \

-   gemspec_file = '%{-s*}%{!?-s:./%{gem_name}.gemspec}' \

+   gemspec_file = '%{-s*}%{!?-s:%{_builddir}/%{gem_name}-%{version}.gemspec}' \

    \

    name = '%{-g*}' \

    requirements = %{*}%{!?1:nil} \
@@ -128,3 +128,68 @@ 

  echo "$gemspec_remove_dep_script" | ruby \

  unset -v gemspec_remove_dep_script \

  %{nil}

+ 

+ 

+ # %%gemspec_add_file - Add files to various files lists in .gemspec.

+ #

+ # Usage: %%gemspec_add_file [options] <file>

+ #

+ # Add files to .gemspec file. <file> is expected to be valid Ruby code.

+ # Path to file is expected. Does not check real files in any way.

+ # By default, `files` list is edited.

+ #

+ # -s <gemspec_file>   Overrides the default .gemspec location.

+ # -t                  Edit test_files only.

+ # -r                  Edit extra_rdoc_files only.

+ #

+ %gemspec_add_file(s:tr) \

+ read -d '' gemspec_add_file_script << 'EOR' || : \

+   gemspec_file = '%{-s*}%{!?-s:%{_builddir}/%{gem_name}-%{version}.gemspec}' \

+   \

+   abort("gemspec_add_file: Use only one '-t' or '-r' at a time.") if "%{?-t}%{?-r}" == "-t-r" \

+   \

+   filenames = %{*}%{!?1:nil} \

+   filenames = Array(filenames) \

+   \

+   spec = Gem::Specification.load(gemspec_file) \

+   abort("#{gemspec_file} is not accessible.") unless spec \

+   \

+   spec.%{?-t:test_}%{?-r:extra_rdoc_}files += filenames \

+   File.write gemspec_file, spec.to_ruby \

+ EOR\

+ echo "$gemspec_add_file_script" | ruby \

+ unset -v gemspec_add_file_script \

+ %{nil}

+ 

+ 

+ # %%gemspec_remove_file - Remove files from various files lists in .gemspec.

+ #

+ # Usage: %%gemspec_remove_file [options] <file>

+ #

+ # Remove files from .gemspec file. <file> is expected to be valid Ruby code.

+ # Path to file is expected. Does not check/remove real files in any way.

+ # By default, `files` list is edited. File has to be removed from `test_files`

+ # first in order to be removable from `files`.

+ #

+ # -s <gemspec_file>   Overrides the default .gemspec location.

+ # -t                  Edit test_files only.

+ # -r                  Edit extra_rdoc_files only.

+ #

+ %gemspec_remove_file(s:tr) \

+ read -d '' gemspec_remove_file_script << 'EOR' || : \

+   gemspec_file = '%{-s*}%{!?-s:%{_builddir}/%{gem_name}-%{version}.gemspec}' \

+   \

+   abort("gemspec_remove_file: Use only one '-t' or '-r' at a time.") if "%{?-t}%{?-r}" == "-t-r" \

+   \

+   filenames = %{*}%{!?1:nil} \

+   filenames = Array(filenames) \

+   \

+   spec = Gem::Specification.load(gemspec_file) \

+   abort("#{gemspec_file} is not accessible.") unless spec \

+   \

+   spec.%{?-t:test_}%{?-r:extra_rdoc_}files -= filenames \

+   File.write gemspec_file, spec.to_ruby \

+ EOR\

+ echo "$gemspec_remove_file_script" | ruby \

+ unset -v gemspec_remove_file_script \

+ %{nil}

file modified
+8 -1
@@ -21,7 +21,7 @@ 

  %endif

  

  

- %global release 88

+ %global release 89

  %{!?release_string:%global release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{?dist}}

  

  # The RubyGems library has to stay out of Ruby directory three, since the
@@ -1029,6 +1029,13 @@ 

  %{gem_dir}/specifications/xmlrpc-%{xmlrpc_version}.gemspec

  

  %changelog

+ * Thu May 10 2018 Pavel Valena <pvalena@redhat.com> - 2.4.4-89

+ - Add macros to edit files lists in .gemspec

+   (gemspec_add_file and gemspec_remove_file).

+ 

+ * Wed May 02 2018 Vít Ondruch <vondruch@redhat.com> - 2.4.4-89

+ - Make %%gemspec_{add,remove}_dep modify .gemspec provided by %%setup macro.

+ 

  * Mon Apr 16 2018 Pavel Valena <pvalena@redhat.com> - 2.4.4-88

  - Update to Ruby 2.4.4.