Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

R.txt 8.4 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
  1. = R Packaging Guidelines
  2. == What is R?
  3. The definition from https://www.r-project.org/[The R-Project website] says that R is:
  4. _" R is a language and environment for statistical computing and graphics."_
  5. R is a GNU project, very similar to the S language developed by Bell Laboratories.
  6. This language is heavily used in research as it provides a lot of statistical and graphical tools.
  7. It is also a well developed language for data manipulation.
  8. If you are looking for more information on R, you can go to:
  9. * https://www.r-project.org/[The R-Project website]
  10. * https://cran.r-project.org/doc/manuals/R-intro.html[An introduction to R]
  11. If you are interested in packaging R modules, or if you are looking for R libraries, you should check here for upstream sources:
  12. * https://www.bioconductor.org/[The bioconductor website]
  13. * https://cran.r-project.org/[The CRAN website]
  14. * https://r-forge.r-project.org/[The R-forge from the R-Project website]
  15. * https://www.rforge.net/[The RForge website]
  16. == Spec Templates for R packages
  17. There are two types of R packages: arch-specific and noarch.
  18. The following template shows how to package an arch-specific R package;
  19. there are very minor differences for noarch packages, which are noted below the template.
  20. ....
  21. %global packname foo
  22. %global rlibdir %{_libdir}/R/library
  23. Name: R-%{packname}
  24. Version: 1.6.6
  25. Release: 1%{?dist}
  26. Summary: Adds foo functionality for R
  27. License: GPL-2.0-or-later
  28. URL: https://CRAN.R-project.org/package=%{packname}
  29. Source: %{url}&version=%{version}#/%{packname}_%{version}.tar.gz
  30. BuildRequires: R-devel
  31. BuildRequires: tex(latex)
  32. %description
  33. R Interface to foo, enables bar!
  34. %prep
  35. %setup -q -c -n %{packname}
  36. %build
  37. %install
  38. mkdir -p %{buildroot}%{rlibdir}
  39. %{_bindir}/R CMD INSTALL -l %{buildroot}%{rlibdir} %{packname}
  40. test -d %{packname}/src && (cd %{packname}/src; rm -f *.o *.so)
  41. rm -f %{buildroot}%{rlibdir}/R.css
  42. %check
  43. %{_bindir}/R CMD check %{packname}
  44. %files
  45. %dir %{rlibdir}/%{packname}
  46. %doc %{rlibdir}/%{packname}/doc
  47. %doc %{rlibdir}/%{packname}/html
  48. %{rlibdir}/%{packname}/DESCRIPTION
  49. %doc %{rlibdir}/%{packname}/NEWS
  50. %{rlibdir}/%{packname}/INDEX
  51. %{rlibdir}/%{packname}/NAMESPACE
  52. %{rlibdir}/%{packname}/Meta
  53. %{rlibdir}/%{packname}/R
  54. %{rlibdir}/%{packname}/R-ex
  55. %{rlibdir}/%{packname}/help
  56. %changelog
  57. * Fri Jul 6 2007 Tom "spot" Callaway <tcallawa@redhat.com> - 1.6.6-1
  58. - Initial package creation
  59. ....
  60. === Differences between arch-specific and noarch R packages
  61. * Noarch packages set `+BuildArch: noarch+`.
  62. * Noarch packages install into `+%{_datadir}/R/library/%{packname}+`;
  63. arch-specific packages install into `+%{_libdir}/R/library/%{packname}+`. +
  64. Change the `+%global rlibdir+` at the top of the file to use `+%{_datadir}+` instead of `+%{_libdir}+`.
  65. === R2spec
  66. R2spec is an excellent little tool to assist in creating Fedora-compliant packages for R libraries. Using it as a starting point is recommended (but certainly not mandated).
  67. More information here : https://pagure.io/r2spec/
  68. == Automatically generated dependencies
  69. All R packages that depend on `+R-devel+` will automatically produce Provides, Requires, Suggests, and Enhances via a generator in `+R-rpm-macros+`.
  70. This generator uses upstream metadata in `+DESCRIPTION+` files to determine what the package should depend on.
  71. === Provides with a standardized name
  72. The generator adds run time Provides in the form of `+R(foo) = packageVersion+`.
  73. The version from the metadata will be normalized
  74. (as specified in <<_r_version>> for package versioning).
  75. === Dependencies on standardized names
  76. The generator adds run time requires in the form of `+R(foo)+`
  77. (with versions as specified in the metadata if supplied.)
  78. The packager MUST inspect the generated Requires for correctness.
  79. All dependencies MUST be resolvable within the targeted Fedora version.
  80. Unwanted dependencies may be removed by editing the installed `+DESCRIPTION+` file
  81. or using xref:AutoProvidesAndRequiresFiltering.adoc[rpm's `+%__requires_exclude+`]
  82. (substitute `+suggests+` or `+enhances+` if necessary).
  83. For example, to filter out `+Suggests+` on `+foo+`, use:
  84. ....
  85. %global __suggests_exclude ^R\\(foo\\)
  86. ....
  87. To filter out multiple packages, use:
  88. ....
  89. %global __suggests_exclude ^R\\((foo\\.bar|baz)\\)
  90. ....
  91. Note that you need to escape regular expression special characters with backslash
  92. _and_ you need to escape said backslash for RPM.
  93. == R packaging tips
  94. === Naming of R packages
  95. Packages of R modules (thus they rely on R as a parent) have their own naming scheme. They should take into account the upstream name of the R module. This makes a package name format of `+R-$NAME+`. When in doubt, use the name of the module that you type to import it in R.
  96. ==== Examples
  97. ....
  98. R-mAr (R module named mAr)
  99. R-RScaLAPACK (R module named RScaLAPACK)
  100. R-waveslim (R module named waveslim)
  101. ....
  102. === R version
  103. Many R packages contain '-' in their version. Usually, the versioning used is a sequence of at least two (and usually three) non-negative integers separated by single '.' or '-' characters.
  104. To be consistent with the versioning system used in Fedora, you should simply replace dashes with dots.
  105. ==== Example
  106. ....
  107. Upstream tarball: Rfoo-0.5-8.tar.gz
  108. Fedora Version: 0.5.8
  109. ....
  110. === Empty %build section
  111. Unlike normal Fedora packages, there is normally no separate `+%build+` actions (e.g. `+%configure+`)that need to be taken for an R package. However, it is important that all R module packages include an empty `+%build+` section, as shown in the spec templates.
  112. === Installing the R addon bits
  113. Instead of calling make install, to install the R addon components, you need to run `+R CMD INSTALL -l %{buildroot}%{_datadir}/R/library %{packname}+` (noarch) or `+R CMD INSTALL -l %{buildroot}%{_libdir}/R/library %{packname}+` (arch-specific). Proper `+%install+` sections for Fedora R packages are demonstrated in the spec templates.
  114. === Deleting the R.css file
  115. Most R addon modules generate a new `+R.css+` file,
  116. but it would conflict with the master `+R.css+` file,
  117. included in the main R package.
  118. You must delete this file, and do not include it in your package.
  119. === Cleaning the R directory of binaries
  120. It is important to clean the R directory of binary files (`+*.o *.so+`) before running `+R CMD CHECK+`. Otherwise, the CHECK command will throw a warning about finding binaries in the source dir. This is accomplished by running (in `+%install+`):
  121. ....
  122. test -d %{packname}/src && (cd %{packname}/src; rm -f *.o *.so)
  123. ....
  124. This is demonstrated in the spec templates.
  125. === Running %check
  126. Most (if not all) R addon modules come with a built-in check. This can be triggered by running `+R CMD check+`. In Fedora, the check should be run in the `+%check+` section. Here is an example `+%check+` section for a Fedora R package:
  127. ....
  128. %check
  129. %{_bindir}/R CMD check %{packname}
  130. ....
  131. Note that frequently, R packages have circular dependency loops when running `+R CMD check+`. If you hit such a case, you can comment out the check to break the dependency loop, and leave a comment explaining the circular dependency problem.
  132. === Documentation files
  133. The `+R CMD INSTALL+` operation will install all of the files, including documentation files. The doc, html and NEWS files/directories need to be marked as `+%doc+`.
  134. Note that other files, such as DESCRIPTION, INDEX, NAMESPACE, and help/ are not `+%doc+`, since proper R functionality depends on their presence. Be careful not to duplicate `+%doc+` files in the package, the spec templates provide good examples on how to package the R addon files without duplications.
  135. ==== R documentation
  136. R documentation is written in TeX. rpmlint sometimes complains that these TeX files are not utf-8 files, but the encoding is normally specified in the file when needed, so this error is safe to ignore (and you should not try to re-encode the files).
  137. === Optimization flags
  138. R packages inherit their optimization flags from the main R package, which stores them in `+%{_libdir}/R/etc/Makeconf+`. The design of R is such that all R addon library modules use the same optimization flags that the main R package was built with. Accordingly, this is why R addon packages do not pass `+%{optflags}+`. Also, there is no simple way to pass special optimization flags to `+R CMD INSTALL+`.
  139. === R headers
  140. R packages usually expect to find their header files in `+%{_libdir}/R/library/*/+`. rpmlint will complain that these files are misplaced, but this is safe to ignore.
  141. You should still separate these header files into a -devel subpackage.
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...