| |
@@ -27,21 +27,24 @@
|
| |
== Spec Templates for R packages
|
| |
|
| |
There are two types of R packages: arch-specific and noarch.
|
| |
-
|
| |
- === Arch specific R packaging spec template
|
| |
+ The following template shows how to package an arch-specific R package;
|
| |
+ there are very minor differences for noarch packages, which are noted below the template.
|
| |
|
| |
....
|
| |
%global packname foo
|
| |
- %global packrel 1
|
| |
+ %global rlibdir %{_libdir}/R/library
|
| |
|
| |
Name: R-%{packname}
|
| |
Version: 1.6.6
|
| |
Release: 1%{?dist}
|
| |
- Source0: ftp://cran.r-project.org/pub/R/contrib/main/%{packname}_%{version}-%{packrel}.tar.gz
|
| |
- License: GPLv2+
|
| |
- URL: https://cran.r-project.org/src/contrib
|
| |
Summary: Adds foo functionality for R
|
| |
- BuildRequires: R-devel, tex(latex)
|
| |
+
|
| |
+ License: GPLv2+
|
| |
+ URL: https://CRAN.R-project.org/package=%{packname}
|
| |
+ Source0: https://cran.r-project.org/src/contrib/%{packname}_%{version}.tar.gz
|
| |
+
|
| |
+ BuildRequires: R-devel
|
| |
+ BuildRequires: tex(latex)
|
| |
|
| |
%description
|
| |
R Interface to foo, enables bar!
|
| |
@@ -52,94 +55,84 @@
|
| |
%build
|
| |
|
| |
%install
|
| |
- mkdir -p %{buildroot}%{_libdir}/R/library
|
| |
- %{_bindir}/R CMD INSTALL -l %{buildroot}%{_libdir}/R/library %{packname}
|
| |
+ mkdir -p %{buildroot}%{rlibdir}
|
| |
+ %{_bindir}/R CMD INSTALL -l %{buildroot}%{rlibdir} %{packname}
|
| |
test -d %{packname}/src && (cd %{packname}/src; rm -f *.o *.so)
|
| |
- rm -rf %{buildroot}%{_libdir}/R/library/R.css
|
| |
+ rm -f %{buildroot}%{rlibdir}/R.css
|
| |
|
| |
%check
|
| |
%{_bindir}/R CMD check %{packname}
|
| |
|
| |
%files
|
| |
- %dir %{_libdir}/R/library/%{packname}
|
| |
- %doc %{_libdir}/R/library/%{packname}/doc
|
| |
- %doc %{_libdir}/R/library/%{packname}/html
|
| |
- %doc %{_libdir}/R/library/%{packname}/NEWS
|
| |
- %{_libdir}/R/library/%{packname}/DESCRIPTION
|
| |
- %{_libdir}/R/library/%{packname}/INDEX
|
| |
- %{_libdir}/R/library/%{packname}/NAMESPACE
|
| |
- %{_libdir}/R/library/%{packname}/Meta
|
| |
- %{_libdir}/R/library/%{packname}/R
|
| |
- %{_libdir}/R/library/%{packname}/R-ex
|
| |
- %{_libdir}/R/library/%{packname}/help
|
| |
+ %dir %{rlibdir}/%{packname}
|
| |
+ %doc %{rlibdir}/%{packname}/doc
|
| |
+ %doc %{rlibdir}/%{packname}/html
|
| |
+ %{rlibdir}/%{packname}/DESCRIPTION
|
| |
+ %doc %{rlibdir}/%{packname}/NEWS
|
| |
+ %{rlibdir}/%{packname}/INDEX
|
| |
+ %{rlibdir}/%{packname}/NAMESPACE
|
| |
+ %{rlibdir}/%{packname}/Meta
|
| |
+ %{rlibdir}/%{packname}/R
|
| |
+ %{rlibdir}/%{packname}/R-ex
|
| |
+ %{rlibdir}/%{packname}/help
|
| |
|
| |
%changelog
|
| |
* Fri Jul 6 2007 Tom "spot" Callaway <tcallawa@redhat.com> - 1.6.6-1
|
| |
- Initial package creation
|
| |
....
|
| |
|
| |
- === Noarch R packaging spec template
|
| |
+ === Differences between arch-specific and noarch R packages
|
| |
|
| |
- ....
|
| |
- %global packname foo
|
| |
- %global packrel 1
|
| |
+ * Noarch packages set `+BuildArch: noarch+`.
|
| |
+ * Noarch packages install into `+%{_datadir}/R/library/%{packname}+`;
|
| |
+ arch-specific packages install into `+%{_libdir}/R/library/%{packname}+`. +
|
| |
+ Change the `+%global rlibdir+` at the top of the file to use `+%{_datadir}+` instead of `+%{_libdir}+`.
|
| |
|
| |
- Name: R-%{packname}
|
| |
- Version: 1.6.6
|
| |
- Release: 1%{?dist}
|
| |
- Source0: ftp://cran.r-project.org/pub/R/contrib/main/%{packname}_%{version}-%{packrel}.tar.gz
|
| |
- License: GPLv2+
|
| |
- URL: https://cran.r-project.org/src/contrib
|
| |
- Summary: Adds foo functionality for R
|
| |
- BuildRequires: R-devel, tex(latex)
|
| |
- BuildArch: noarch
|
| |
- Requires: R-core
|
| |
+ === R2spec
|
| |
|
| |
- %description
|
| |
- R Interface to foo, enables bar!
|
| |
+ 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).
|
| |
+ More information here : https://pagure.io/r2spec/
|
| |
|
| |
- %prep
|
| |
- %setup -q -c -n %{packname}
|
| |
+ == Automatically generated dependencies
|
| |
|
| |
- %build
|
| |
+ WARNING: Automatically generated dependencies are only enabled for Fedora 31 and later.
|
| |
+ On older versions, you must provide the dependencies manually.
|
| |
|
| |
- %install
|
| |
- mkdir -p %{buildroot}%{_datadir}/R/library
|
| |
- %{_bindir}/R CMD INSTALL -l %{buildroot}%{_datadir}/R/library %{packname}
|
| |
- test -d %{packname}/src && (cd %{packname}/src; rm -f *.o *.so)
|
| |
- rm -rf %{buildroot}%{_datadir}/R/library/R.css
|
| |
+ All R packages that depend on `+R-devel+` will automatically produce Provides, Requires, Suggests, and Enhances via a generator in `+R-rpm-macros+`.
|
| |
+ This generator uses upstream metadata in `+DESCRIPTION+` files to determine what the package should depend on.
|
| |
|
| |
- %check
|
| |
- %{_bindir}/R CMD check %{packname}
|
| |
+ === Provides with a standardized name
|
| |
|
| |
- %files
|
| |
- %dir %{_datadir}/R/library/%{packname}
|
| |
- %doc %{_datadir}/R/library/%{packname}/doc
|
| |
- %doc %{_datadir}/R/library/%{packname}/html
|
| |
- %doc %{_datadir}/R/library/%{packname}/NEWS
|
| |
- %{_datadir}/R/library/%{packname}/DESCRIPTION
|
| |
- %{_datadir}/R/library/%{packname}/INDEX
|
| |
- %{_datadir}/R/library/%{packname}/NAMESPACE
|
| |
- %{_datadir}/R/library/%{packname}/Meta
|
| |
- %{_datadir}/R/library/%{packname}/R
|
| |
- %{_datadir}/R/library/%{packname}/R-ex
|
| |
- %{_datadir}/R/library/%{packname}/help
|
| |
+ The generator adds run time Provides in the form of `+R(foo) = packageVersion+`.
|
| |
|
| |
- %changelog
|
| |
- * Fri Jul 6 2007 Tom "spot" Callaway <tcallawa@redhat.com> - 1.6.6-1
|
| |
- - Initial package creation
|
| |
- ....
|
| |
+ No mangling will be performed on the version from the metadata
|
| |
+ (as specified in <<_r_version>> for package versioning).
|
| |
|
| |
- === Summary of differences between arch-specific and noarch R packages
|
| |
+ === Dependencies on standardized names
|
| |
|
| |
- * Noarch packages set `+BuildArch: noarch+`.
|
| |
- * Noarch packages install into `+%{_datadir}/R/library/%{packname}+`; arch-specific packages install into `+%{_libdir}/R/library/%{packname}+`.
|
| |
- * Noarch packages have `+Requires: R-core+`. For arch-specific packages, RPM will automatically add an appropriate dependency on the needed shared libraries but noarch packages need this added manually.
|
| |
+ The generator adds run time requires in the form of `+R(foo)+`
|
| |
+ (with versions as specified in the metadata if supplied.)
|
| |
|
| |
- === R2spec
|
| |
+ The packager MUST inspect the generated Requires for correctness.
|
| |
+ All dependencies MUST be resolvable within the targeted Fedora version.
|
| |
|
| |
- 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).
|
| |
- More information here : https://pagure.io/r2spec/
|
| |
+ Unwanted dependencies may be removed by editing the installed `+DESCRIPTION+` file
|
| |
+ or using xref:AutoProvidesAndRequiresFiltering.adoc[rpm's `+%__requires_exclude+`]
|
| |
+ (substitute `+suggests+` or `+enhances+` if necessary).
|
| |
+ For example, to filter out `+Suggests+` on `+foo+`, use:
|
| |
+
|
| |
+ ....
|
| |
+ %global __suggests_exclude ^R\\(foo\\)
|
| |
+ ....
|
| |
+
|
| |
+ To filter out multiple packages, use:
|
| |
+
|
| |
+ ....
|
| |
+ %global __suggests_exclude ^R\\((foo\\.bar|baz)\\)
|
| |
+ ....
|
| |
+
|
| |
+ Note that you need to escape regular expression special characters with backslash
|
| |
+ _and_ you need to escape said backslash for RPM.
|
| |
|
| |
== R packaging tips
|
| |
|
| |
@@ -147,7 +140,7 @@
|
| |
|
| |
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.
|
| |
|
| |
- '''Examples: '''
|
| |
+ ==== Examples
|
| |
|
| |
....
|
| |
R-mAr (R module named mAr)
|
| |
@@ -161,7 +154,7 @@
|
| |
|
| |
To be consistent with the versioning system used in Fedora, you should simply replace dashes with dots.
|
| |
|
| |
- Example:
|
| |
+ ==== Example
|
| |
|
| |
....
|
| |
Upstream tarball: Rfoo-0.5-8.tar.gz
|
| |
@@ -178,7 +171,10 @@
|
| |
|
| |
=== Deleting the R.css file
|
| |
|
| |
- Most R addon modules generate a new `+R.css file+`, but it would conflict with the master `+R.css+` file, included in the main R package. You must delete this file, and do not include it in your package.
|
| |
+ Most R addon modules generate a new `+R.css+` file,
|
| |
+ but it would conflict with the master `+R.css+` file,
|
| |
+ included in the main R package.
|
| |
+ You must delete this file, and do not include it in your package.
|
| |
|
| |
=== Cleaning the R directory of binaries
|
| |
|
| |
This does two things:
Since #914 has not made a decision to allow unsatisfiable Suggests, I have included language to indicate that packagers should review automated dependencies. This text was copied from the Python guidelines.