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
dev-python/brotlipy: Introducing the package #8261
Conversation
Pull Request assignment Areas affected: ebuilds dev-python/brotlipy: @gentoo/proxy-maint (new package) Bugs linked: 654854 In order to force reassignment and/or bug reference scan, please append Gentoo Mirror & CI services are provided by Michał Górny. The hardware was kindly provided by Todd Goodman. This unofficial service is not associated with Gentoo Infrastructure or Gentoo Foundation. This service is provided by the service provider "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the service provider be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this service, even if advised of the possibility of such damage. |
LICENSE="MIT" | ||
SLOT="0" | ||
KEYWORDS="~amd64 ~x86" | ||
IUSE="" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop it, if empty.
IUSE="" | ||
|
||
DEPEND="${PYTHON_DEPS} | ||
dev-python/setuptools[${PYTHON_USEDEP}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only one tab please.
dev-python/setuptools[${PYTHON_USEDEP}] | ||
" | ||
RDEPEND="${DEPEND} | ||
virtual/python-cffi[${PYTHON_USEDEP}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only one tab please.
I've pushed an update that takes care of your feedback. |
SLOT="0" | ||
KEYWORDS="~amd64 ~x86" | ||
|
||
DEPEND="${PYTHON_DEPS} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
distutils-r1 adds PYTHON_DEPS for you.
inherit distutils-r1 | ||
|
||
DESCRIPTION="Python binding to the Brotli library" | ||
HOMEPAGE="https://pypi.python.org/pypi/brotlipy" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include GitHub as well.
dev-python/setuptools[${PYTHON_USEDEP}] | ||
" | ||
RDEPEND="${DEPEND} | ||
virtual/python-cffi[${PYTHON_USEDEP}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be a setup-dependency as well.
" | ||
RDEPEND="${DEPEND} | ||
virtual/python-cffi[${PYTHON_USEDEP}] | ||
" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Run tests.
USE_SHARED_BROTLI=1
, don't use bundled libs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mgorny After investing a few hours and learning quite a bunch of new things about gentoo and python, I actually do not have much of positive news.
In the tests it uses datasets from brotli (https://github.com/python-hyper/brotlipy/blob/v0.7.0/test/conftest.py#L7 see the TEST_DATA_DIR var). Should I see how I can mock this around and supply somehow the test dataset or should I just give up on the tests? The tests did pass successfully after I manually altered the brotlipy-0.7.0.tar.gz tarball and included necessary files in there. The dataset is a little more than 1Mb of various files that are being compressed/decompressed.
As for USE_SHARED_BROTLI=1 -- unfortunately it was introduced after 0.7.0 tag, i.e. right now it's only in the dev snapshot.
The rest (corrected DEPEND and github homepage) are taken care of by me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you trying to say that the tests are not included in release? Can you use the generated tarball from GitHub instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello! Sorry to have disappeared for some time.
I have invested extra time into this ebuild. As far as the tests - the problem is that brotlipy tests are using data (files to compress/de-compress) from brotli lib. The path it uses (relative to brotlipy workdir is "'libbrotli/tests/testdata". I certainly could patch the source code of brotlipy and change the dirname to point somewhere else. Is there anyway I could "access" contents of "tests/" of a foreign ebuild while testing "my" ebuild? I ran equery files app-arch/brotli
but it did not show the tests filles anywhere.
I also tried once again to use the shared brotli lib. I patched the latest release of brotlipy with necessary patch to have the option of using external lib instead of the bundled one. The patch worked and I was able to compile brotlipy ebuild. But then a failure expected me :) Brotlipy comes with "0.6.0" brotli bundled whereas "app-arch/brotli" within Gentoo offers only brotli-1.0.* versions. They are incompatible and mitmproxy (a tool that depends on brotlipy) refused to start with errors related to brotli when I tried to launch it.
Should I try to include brotli-0.6.* ebuild into Gentoo repo? Or should we give up and use the bundled one? Also, do you have any suggestion/opinion about the tests? Maybe we should upload the test data files somewhere and download them from SRC_URI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, that looks bad. So we really don't want to use old libs here.
- What are the perspectives for updating it to work with brotli-1.*?
- As for test data, feel free to just fetch some version of brotli (preferably the newest) in
SRC_URI="test? ( ... )
thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I understand you.
To use brotli-1.*
the bottleneck appears to be upstream: brotlipy currently does not support it. Here is an issue on their github where a guy asks if they are planning on doing something about brotli-1.* python-hyper/brotlicffi#129
Does it mean I am out of luck to have dev-python/brotlipy in Gentoo tree? I also double checked the latest mitmproxy release now (remember that I am introducing all these packages for mitmproxy?) and the current master of mitmproxy depends on brotlipy>=0.7.0,<0.8
. And brotlipy in those versions only works with brotli-0.*
I also got you about the tests. I'll code that part in the coming days :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just bundle it then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Michal :) I hope now this ebuild is in proper shape. I just git push --force
an update into this branch.
A few points about the ebuild:
- I download brotli library in the exact same commit (state) as it's referenced within brotlipy as a git submodule.
- For some reason pypi release of brotlipy did not include
configtest.py
file and it was required for pytest to successfully run the tests, so I placed it intofiles
subfolder and copy it into appropriate place duringsrc_prepare()
. - I also tried to use github release of brotlipy (which does contain
configtest.py
file) and inject brotli lib into it, but the tests were failing for some reason.
I successfully emerged this ebuild with tests both enabled and disabled.
95cc2fe
to
a7321fc
Compare
a7321fc
to
de21b9d
Compare
HOMEPAGE="https://github.com/python-hyper/brotlipy/ https://pypi.python.org/pypi/brotlipy" | ||
SRC_URI=" | ||
mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz | ||
test? ( https://github.com/google/brotli/archive/${BROTLI_BUNDLED_COMMIT}.zip -> ${P}-tests.zip ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.tar.gz, please. Also, name it after the top directory inside, i.e. brotli-${BROTLI_BUNDLED_COMMIT}.tar.gz
. This will make it possible to reuse this distfile if we ever need to package this specific commit of brotli.
|
||
DEPEND=" | ||
dev-python/setuptools[${PYTHON_USEDEP}] | ||
virtual/python-cffi[${PYTHON_USEDEP}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure CFFI is a RDEPEND as well.
if use test; then | ||
# Inject test data into the bundled brotli lib from the upstream | ||
# brotli. | ||
rm -rf "${WORKDIR}/${P}/libbrotli/tests" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why -f
? Missing ||die
.
# Inject test data into the bundled brotli lib from the upstream | ||
# brotli. | ||
rm -rf "${WORKDIR}/${P}/libbrotli/tests" | ||
ln -s "${WORKDIR}/brotli-${BROTLI_BUNDLED_COMMIT}/tests" "${WORKDIR}/${P}/libbrotli/tests" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
||die
ln -s "${WORKDIR}/brotli-${BROTLI_BUNDLED_COMMIT}/tests" "${WORKDIR}/${P}/libbrotli/tests" | ||
|
||
# Inject configtest.py neccesary for pytest. | ||
cp "${FILESDIR}/conftest.py" "${WORKDIR}/${P}/test/conftest.py" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Putting this in FILESDIR really, really sucks, especially given it's full file with copyright potential. Could you try to figure out what's wrong with GitHub generated archive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done all of your feedback. now it's using github release and I inject the brotli lib into it. I have next to nothing in my knowledge about python and C, so I took the "stupid" approach to figure out what github release was missing - I simply put myself to compare build dir of portage when it was building from pypi and when it was building from github release. One of the differences that called up my attention was the fact that "libbrotli/python" folder was missing in the case of pypi. I assume the python code somehow interfered with brotlipy. So after removing this folder during src_prepare()
the tests ran successfully.
I confirm mitmproxy works successfully on this latest brotlipy-0.7.0.ebuild
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say what you did was probably the best way to find the problem. I suspect that pytest was picking up some tests from the bundled brotli Python stuff.
de21b9d
to
930269a
Compare
Introduce the dev/python/brotlipy package into Gentoo. Closes: https://bugs.gentoo.org/654854 Package-Manager: Portage-2.3.40, Repoman-2.3.9
Pull request CI report Report generated at: 2018-06-24 13:18 UTC No issues found |
Well, can't say it's perfect since it builds libbrotli multiple times but I guess that's good enough for now. Thanks! |
Thank you! I do appreciate you walking me through this QA process - I do learn a lot from your feedback! |
Introduce the dev/python/brotlipy package into Gentoo.
Closes: https://bugs.gentoo.org/654854
Package-Manager: Portage-2.3.33, Repoman-2.3.9