-
-
Notifications
You must be signed in to change notification settings - Fork 902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
please ship specs in the gem #1855
Comments
Hi, Thanks for bringing this up, and I apologize if this change caught you off-guard. We did make reasonable efforts to discuss this publicly and get input into the decision. There was a public discussion on the mailing list and in a couple of different github issues about removing specs from the gem, and was met with general approval from users and downstream library maintainers. I released an RC with this change before shipping the final version. Apologies again if this was surprising, but then I'd encourage you to participate in the mailing list and/or github issues if you're repackaging Nokogiri. Some history: this change was originally proposed on the mailing list in January 2018. That discussion resulted in #1711 and a PR at #1719. I invite you to read all those threads for context. Nokogiri has been downloaded over 202 million times, so there is a real cost to shipping files in the gem that nobody uses (those costs are borne by the users of the gem as well as rubygems.org). I think at this point I would need to hear very compelling reasons for putting files in the gem that aren't necessary for installation, runtime, or licensing/legal reasons. I don't know much about what's done by Debian and other distros to repackage Nokogiri, but I imagine that it wouldn't be too troublesome to either download the source tarball from the Github Releases page or to use git to access the tagged release in the repo, and run those tests. Can you help me understand why it's not reasonable for re-packagers of Nokogiri to grab tests from the source repository? This is actually exactly what Nokogiri co-maintainer @larskanis does when he tests the pre-compiled binary releases of Windows, and what I'm in the middle of implementing for testing installed gems in our automated pipelines, so I'm not asking you to do anything that we're not already doing ourselves. |
One more note: I'd be happy to pair with you on updating your build scripts to merge the gem files of a certain version with the spec files from the same tagged version of the git repo. I'd like to learn more about how repackaging is being done by distro maintainers, so this might be a good way for us to build empathy with each other! |
I'd also be open to PRs that would make the above workflow easier to manage! For example, @larskanis proposed at one point that we decouple the |
@flavorjones , @boutil wrote this in his request "In Debian, we thought about using the github repository as the new source, but since it has no gemspec file (on purpose, as you explained already), byt has jar files, which we need to filter out, it makes things a bit tricky for packagers." So if you can provide gemspec file in release tarballs, that will suffice our use case. |
We use gem2deb https://salsa.debian.org/ruby-team/gem2deb for building the deb file and till 1.8 version we did not have to do anything special for nokogiri. |
@flavorjones thanks for your comments. We understand indeed the additional burden it was to provide the spec, and understand that going back is not a good idea from this point of view. As @pravi mentioned, we would be happy to use the github repository as the source. Filtering out the jar files can be done automatically. We would have the files under spec/ to run the test suite. The only missing bit for us would be a way to generate a simple gemspec (as we understand you don't want to include one #1471). Do you confirm we could use the gem:spec target of the Rakefile to produce a viable gemspec? It is needed to ensure integration between rubygems and the Debian package system. |
@boutil I tried rake gem:spec and at least 'concourse' is not packaged, may be we can patch Rakefile to use only the libraries that are really required to generate the gemspec file. Alternatively if the gemspec from .gem is combined with the tar file from repo either by upstream or by modifying debian's fake upstream service, that could work as well. |
We can comment out the part about concourse, and we would need then to package ruby-hoe-gemspec. This approach would be simpler than trying to combine two sources... |
@boutil You can create the gemspec file by yourself.
|
In case of Fedora (RPM base Linux distribution), we are planning to use
This is a common approach on Fedora project, because many gem packages including Rails does not include the test files in the gem file. And that makes sense.
I think you might be able to refer your deb package config files for Rails or some gem packages. |
It might be tricky. But it can sometimes happen for some gem packages' RPM packaging process. Here is the case for https://src.fedoraproject.org/rpms/rubygem-execjs/blob/master/f/rubygem-execjs.spec#_44
We are also providing a common function (RPM macro |
Hi all, I really appreciate the conversation here. I'd like to maybe state my opinion on a few of the options brought up:
I spent some time this morning looking at the As I see it, there are three options: 1. bring in the tests into the I've written this script that almost does what you need, except for reopening the gem spec to add the test files (which should only take 10 more minutes or so to write that code): #! /usr/bin/env bash
VERSION="1.9.1"
PATH_TO_SOURCE="${HOME}/code/oss/nokogiri"
if [[ ! -e nokogiri-${VERSION}.gem ]] ; then
gem fetch nokogiri -v ${VERSION}
fi
if [[ ! -e nokogiri-${VERSION}.tar.gz ]] ; then
gem2tgz nokogiri-${VERSION}.gem
fi
if [[ ! -d ruby-nokogiri-${VERSION} ]] ; then
dh-make-ruby nokogiri-${VERSION}.tar.gz
fi
exit 0
pushd ruby-nokogiri-${VERSION}
if [[ ! -d test ]] ; then
cp -var ${PATH_TO_SOURCE}/test ruby-nokogiri-${VERSION}
# TODO munge the gemspec here
dpkg-source --commit
fi
dpkg-buildpackage -d -us -uc
popd 2. build from the source tree, but copy in the gemspec from the published gem This still doesn't address the problem where that gemspec doesn't contain the test files, so litterally the exact same amount of work would need to be done here as in 3. we could publish a variation on the Nokogiri gem that includes tests, for use by people who want to be able to run the tests on an installed gem or .deb package. This might be the easiest thing to do. I'm investigating now. |
The idea behind 3 above is that you'd run `gem fetch nokogiri --platform=with-tests and get a gem file containing the tests. I built a local gem with test files in it, and ran |
@boutil I'll note that it appears as though |
Posting a test gem here. (It's a tarball because github won't allow me to post a nokogiri-1.10.0-with_tests.gem.tar.gz @boutil or @pravi can you let me know if it's satisfactory for your needs? If that works then I will try to publish something similar to rubygems.org and we can test it end-to-end. |
I've put the code that generate this gemfile into PR #1858 for visibility and review. |
@flavorjones @junaruga thanks for your messages. @junaruga I could generate the gemspec using your recipe and I think it would be sufficient for our need
So either solution 2 or 3 proposed by @flavorjones are equally good. I have a prototype using solution 2 for 1.10.0 (rebuilding the reverse dependencies), but I am willing to try the gem with test, if it does not cost too much work to you to generate. I'll report on this approach in a later message. As a side note, we have some patches in Debian applied on top of the source code to remove usage ofr mini_portile2 and ensure that the code is built against system libraries, like this: |
OK - @boutil I'll close this in a few days if I haven't heard back, since it sounds like you may be able to make this work without me shipping a special gem? For what it's worth, you can also generate the .gem with test files with this command, using the branch from #1858: BUILD_GEM_WITH_TESTS=t bundle exec rake gem |
@flavorjones I think you can indeed close. The approach proposed by @junaruga seems to fit our needs for the time being, and unfortunately, I won't have time in the coming days to play with your proposition, but I keep it bookmarked and certainly try it later. Thanks again for your help on this matter. |
@boutil alright, good news :) |
OK. Thanks all. I'll close this issue, but leave the branch up for a while. Before deleting the branch I'll comment here to give people time to object. |
Noting, as I promised I would above, that I'm intending to delete the branch created for #1858 in a week or so, unless someone has objections. |
Hi
Until 1.8, nokogiri gem contained the spec files. It was useful for Debian (and certainly for other GNU/Linux distributions) to be able to run the test suite when building packages for their archive.
Since 1.9, the spec/ subdir is not included anymore. In Debian, we thought about using the github repository as the new source, but since it has no gemspec file (on purpose, as you explained already), byt has jar files, which we need to filter out, it makes things a bit tricky for packagers.
Therefore, we would like to kindly ask you if you could continue to ship the specs in the gem file.
Thank you in advance.
The text was updated successfully, but these errors were encountered: