>>>>> "IU" == Iñaki Ucar <iucar@xxxxxxxxxxxxxxxxx> writes: IU> https://cran.r-project.org/package=simmer&version=3.0.0 IU> returns a redirection (303) to the complete URL, with file IU> extension. 303 is actually "See Other". Which is odd as that's usually sent in response to a PUT or POST, not a GET. Maybe you can get the files via POST as well; I'm not sure. In any case, none of that has any effect on the filename that spectool (really curl) will use. It can't use data supplied by the remote host for that, for obvious reasons. IU> CRAN maintainers are pretty strict with this kind of stuff: if it IU> works now, it's guaranteed to continue to work. Well, that's good, but this is a hack so it's not a terrible idea to inform them that we have to use this kind of thing so that they can either bless this method or provide a cleaner one. IU> There are no other formats: every package is tar.gz. But, as I IU> pointed out above, the immutable URL is a redirection to the IU> complete URL, so you can still extract the extension. No, you can't. Not in the context and under the limitations where we're running. Certainly we can't know anything about that in an RPM macro as we have to provide an extension in a complete vacuum. But given what you say, certainly defaulting to tar.gz will work for everything now. Try dropping the below into /usr/lib/rpm/macros.d/macros.test (temporarily, make sure to deleted it when you're done experimenting). See if it gives the results you expect when you use %cran_url and %cran_source. Do fedpkg prep or some local builds. Try spectool -g and rpmspec -P. Note that I've snuck a bit of magic in there which I'm not sure should be kept: If you don't have %packname defined and you call either %cran_url or %cran_source, then it will be automatically defined for you by stripping the leading "R-" from the name. With this, you can just have: Name: R-webp Version: 0.4 Release: 3%{?dist} Summary: A New Format for Lossless and Lossy Image Compression License: MIT URL: %cran_url Source0: %cran_source And use %packname in %prep as usual without explicitly defining it. But I'm not sure that much magic is a good idea. (And while we're doing R macros, that package suggests that we should also have a macro defined to %_libdir/R/library....) - J< # Macros to replace overly complicated references to CRAN URLs and source files. # %cran_source - # Expands to the CRAN URL for a package # Accepts zero to three arguments: # 1: The CRAN project name, defaulting to %packname if it is defined. # If not, R- will be stripped from %name and %packname defined to that. # 2: The CRAN version, defaulting to %version. # 3: The file extension, defaulting to %__cran_default_extension (tar.gz). # Requires %__cran_package_url_template and %__cran_default_extension to be defined. # %__cran_package_url_template will undergo substitution (case-sensitive): # * "PACKNAME" will be replaced with the above CRAN project name. # * "PACKVERSION" will be replaced with the above CRAN version. # * "EXTENSION" will be replaced with the above extension. # # %cran_url - # Expands to the CRAN URL for a package # Accepts zero or one arguments: # 1: The CRAN project name, defaulting to %packname if it is defined. # If not, R- will be stripped from %name and %packname defined to that. # Requires %__cran_project_url_template to be defined. # %__cran_project_url_template will undergo substitution (case-sensitive): # * "PACKNAME" will be replaced with the above CRAN project name. %__cran_project_url_template https://cran.r-project.org/package=PACKNAME %__cran_package_url_template %{__cran_project_url_template}&version=PACKVERSION#/PACKNAME_PACKVERSION.EXTENSION %__cran_default_extension tar.gz %cran_source() %{lua: local src = rpm.expand('%1') local ver = rpm.expand('%2') local ext = rpm.expand('%3') local url = rpm.expand('%__cran_package_url_template') \ -- If no first argument, try %packname, then %name with 'R-' stripped. -- Note that rpm leaves macros unchanged if they are not defined. if src == '%1' then src = rpm.expand('%packname') end if src == '%packname' then src = string.gsub(rpm.expand('%name'), "^R%-", "") -- Since packname wasn't defined, define it for convenience. rpm.define("packname " .. src) end \ -- If no second argument, use %version if ver == '%2' then ver = rpm.expand('%version') end \ -- If no third argument, use the preset default extension if ext == '%3' then ext = rpm.expand('%__cran_default_extension') end \ -- Now substitute in all the values url = string.gsub(url, "PACKNAME", src) url = string.gsub(url, "PACKVERSION", ver) url = string.gsub(url, "EXTENSION", ext) \ print(url) } %cran_url() %{lua: local src = rpm.expand('%1') local url = rpm.expand('%__cran_project_url_template') \ -- If no first argument, try %packname, then %name with 'R-' stripped. -- Note that rpm leaves macros unchanged if they are not defined. if src == '%1' then src = rpm.expand('%packname') end if src == '%packname' then src = string.gsub(rpm.expand('%name'), "^R%-", "") -- Since packname wasn't defined, define it for convenience. rpm.define("packname " .. src) end \ -- Substitute in the URL value url = string.gsub(url, "PACKNAME", src) \ print(url) } _______________________________________________ devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx