Issue: Testing the build quality of net-misc/youtube-dl is restricted due to violating the network-sandbox and the possibility of criminal consequences for the end user, depending on their jurisdiction. - Solution: Only use the offline tests as suggested here https://bugs.gentoo.org/676532 Source: https://github.com/ytdl-org/youtube-dl/blob/2019.11.28/Makefile#L43 ``` offlinetest: codetest $(PYTHON) -m nose --verbose test \ --exclude test_age_restriction.py \ --exclude test_download.py \ --exclude test_iqiyi_sdk_interpreter.py \ --exclude test_socks.py \ --exclude test_subtitles.py \ --exclude test_write_annotations.py \ --exclude test_youtube_lists.py \ --exclude test_youtube_signature.py ``` This allows the Makefile to test for its core functionality without pinging out to all the...other sites about availability. So there are no more network-sandbox violations to hundreds of entrepreneurial self hosted websites. The core code test is actually quite fast. I would post my log but the filenames copied over aren't something I'd like to show in a log haha. I have monitored traffic during the 'emake offlinetest' phase and didn't see any network activity from Portage. Still, it would probably make sense to just 'patch out' all the ones that do connect to the internet in case someone stumbles across this again...like me. I've attached a revised ebuild here. Would it make sense to give an exit code to a user trying 'emake test/make check' on the connection checking tests or is that too much of a hassle? Reproducible: Always Steps to Reproduce: 1. Compile youtube-dl with ebuild instead of emerge 2. Remove RESTRICT=test from the environment file in ${TEMP} to run `ebuild poorchoice.ebuild test` without reading why it was restricted in the first place Actual Results: Internet activity via the Portage build environment. I immediately ended the build. Expected Results: Testing of the compiled code in a sandbox, not of connectivity. It would be helpful to have bug issues attached to RESTRICTS or unusual changes to ebuilds. The software could not do anything to stop me, because it is inanimate. The software did what if was intended to do, but the solution proposed here looks much better. https://bugs.gentoo.org/676532#c0
Created attachment 599924 [details] youtube-dl-2019.11.28-r1.ebuild Requires dev-python/nose and dev-python/flake8 for USE test. It might be a better idea to put it in BDEPEND since RDEPEND is inheriting DEPEND.
Comment on attachment 599924 [details] youtube-dl-2019.11.28-r1.ebuild --- youtube-dl-2019.11.28.ebuild +++ youtube-dl-2019.11.28-r1.ebuild @@ -2,7 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 EAPI="7" -PYTHON_COMPAT=(python{2_7,3_5,3_6,3_7}) +PYTHON_COMPAT=(python{2_7,3_5,3_6,3_7,3_8}) inherit bash-completion-r1 distutils-r1 readme.gentoo-r1 DESCRIPTION="Download videos from YouTube.com (and more sites...)" @@ -11,11 +11,16 @@ LICENSE="public-domain" KEYWORDS="amd64 arm ~arm64 hppa ppc ppc64 x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x86-solaris" -RESTRICT="test" +IUSE="test" SLOT="0" DEPEND=" dev-python/setuptools[${PYTHON_USEDEP}] + test? ( + dev-python/nose[${PYTHON_USEDEP}] + dev-python/flake8[${PYTHON_USEDEP}] + ) " + RDEPEND=" ${DEPEND} || ( @@ -23,10 +28,16 @@ dev-python/pycrypto[${PYTHON_USEDEP}] ) " + S="${WORKDIR}/${PN}" src_compile() { distutils-r1_src_compile + + if use test ; then + cd ${S} && einfo "Running offline tests for all Python libraries built for ${PN}" + emake offlinetest || die "Tests fail with ${EPYTHON}" + fi } python_install_all() { @@ -47,6 +58,7 @@ rm -r "${ED}"/usr/share/doc/youtube_dl || die } + pkg_postinst() { elog "${PN}(1) / https://bugs.gentoo.org/355661 /" elog "https://github.com/rg3/${PN}/blob/master/README.md#faq :" @@ -66,4 +78,10 @@ elog elog "If you want ${PN} to embed thumbnails from the metadata into the" elog "resulting MP4 files, consider installing media-video/atomicparsley" + elog + elog "Increased transfer speed can be achieved by utilizing an external" + elog "downloader. net-misc/aria2 is a good starter due to native support" + elog "in ${PN} and its ability to create concurrent download streams" }
Comment on attachment 599924 [details] youtube-dl-2019.11.28-r1.ebuild >src_compile() { > distutils-r1_src_compile > > if use test ; then > cd ${S} && einfo "Running offline tests for all Python libraries built for ${PN}" If you would run the tests in the test phase as is common, you would not need to change the work directory here. You could then also arrange for the test suite to be run for all python versions. > emake offlinetest || die "Tests fail with ${EPYTHON}" emake dies on its own. > elog "Increased transfer speed can be achieved by utilizing an external" > elog "downloader. net-misc/aria2 is a good starter due to native support" > elog "in ${PN} and its ability to create concurrent download streams" Not sure why you're adding this.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=34a7529338bb3463fff8bf846c74e29cdff3e68a commit 34a7529338bb3463fff8bf846c74e29cdff3e68a Author: Jeroen Roovers <jer@gentoo.org> AuthorDate: 2019-12-25 11:37:17 +0000 Commit: Jeroen Roovers <jer@gentoo.org> CommitDate: 2019-12-25 11:47:16 +0000 net-misc/youtube-dl: Version 2019.12.25 Package-Manager: Portage-2.3.83, Repoman-2.3.20 Closes: https://bugs.gentoo.org/703168 Signed-off-by: Jeroen Roovers <jer@gentoo.org> net-misc/youtube-dl/Manifest | 1 + net-misc/youtube-dl/youtube-dl-2019.12.25.ebuild | 77 ++++++++++++++++++++++++ 2 files changed, 78 insertions(+) Additionally, it has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=354e050c9c802d45ad23a0e810327fb68d3b428c commit 354e050c9c802d45ad23a0e810327fb68d3b428c Author: Jeroen Roovers <jer@gentoo.org> AuthorDate: 2019-12-25 11:46:10 +0000 Commit: Jeroen Roovers <jer@gentoo.org> CommitDate: 2019-12-25 11:47:17 +0000 net-misc/youtube-dl: Update live ebuild Package-Manager: Portage-2.3.83, Repoman-2.3.20 Bug: https://bugs.gentoo.org/703168 Signed-off-by: Jeroen Roovers <jer@gentoo.org> net-misc/youtube-dl/youtube-dl-99999999.ebuild | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)