Some packages require Ruby as a build or runtime dependency but only use the core interpreter plus maybe a few gems, e.g. WebKit (third party or from overlay) - needed at build time only SASS (in Portage) - needs 3 additional gems at runtime kde-plasma/kde-gtk-config - needed at build time only However, the standard Portage installation of dev-lang/ruby also pulls in 17 gems packages and dependencies, even with the USE flags trimmed to a minimum. These then all need to be built and kept up to date even though they are never used. It would reduce this system overhead if there could be a "minimal" USE flag added to dev-lang/ruby to build and install only the language interpreter, without any extras or gems. Any gems required for a particular application could then be added separately. Obviously the default for the flag would be "off" to not affect existing installations. Reproducible: Always Steps to Reproduce: 1. Merge dev-lang/ruby with only the "ssl" USE flag set. 2. Observe the number of dependencies also merged. emerge --info if relevant: Portage 3.0.46 (python 3.11.4-final-0, default/linux/amd64/17.1/no-multilib/systemd/merged-usr, gcc-12, glibc-2.37-r3, 6.1.19-gentoo-x86_64 x86_64) ================================================================= System uname: Linux-6.1.19-gentoo-x86_64-x86_64-Intel-R-_Xeon-R-_CPU_5110_@_1.60GHz-with-glibc2.37 KiB Mem: 5067188 total, 632892 free KiB Swap: 33554428 total, 33343740 free Timestamp of repository gentoo: Sat, 08 Jul 2023 11:30:01 +0000 Head commit of repository gentoo: 1ccc77299e9c95a52afc32d0017d1561d285dcb7 sh bash 5.1_p16-r6 ld GNU ld (Gentoo 2.40 p5) 2.40.0 app-misc/pax-utils: 1.3.5::gentoo app-shells/bash: 5.1_p16-r6::gentoo dev-lang/perl: 5.36.1-r2::gentoo dev-lang/python: 2.7.18_p16-r1::gentoo, 3.11.4::gentoo dev-util/cmake: 3.26.4-r1::gentoo dev-util/meson: 1.1.1::gentoo sys-apps/baselayout: 2.13-r1::gentoo sys-apps/sandbox: 2.32::gentoo sys-apps/systemd: 253.3-r1::gentoo sys-devel/autoconf: 2.71-r6::gentoo sys-devel/automake: 1.16.5::gentoo sys-devel/binutils: 2.40-r5::gentoo sys-devel/binutils-config: 5.5::gentoo sys-devel/gcc: 12.3.1_p20230526::gentoo sys-devel/gcc-config: 2.11::gentoo sys-devel/libtool: 2.4.7-r1::gentoo sys-devel/make: 4.4.1-r1::gentoo sys-kernel/linux-headers: 6.1::gentoo (virtual/os-headers) sys-libs/glibc: 2.37-r3::gentoo Repositories: gentoo location: /usr/portage sync-type: rsync sync-uri: rsync://rsync.gentoo.org/gentoo-portage priority: -1000 volatile: True sync-rsync-verify-jobs: 1 sync-rsync-verify-max-age: 24 sync-rsync-extra-opts: sync-rsync-verify-metamanifest: yes ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="@FREE fairuse freedist NVIDIA-r2 Kermit bh-luxi google-chrome AdobeFlash-11.x linux-fw-redistributable no-source-code linux-firmware all-rights-reserved unRAR Activision ChexQuest3 DOOM-COLLECTORS-EDITION ms-teams-pre PUEL PUEL-11 PUEL-10 MPEG-4 Subversion NPSL Vivaldi Avago MSttfEULA" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -pipe -march=native -mtune=native -fomit-frame-pointer" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php7.4/ext-active/ /etc/php/cgi-php7.4/ext-active/ /etc/php/cli-php7.4/ext-active/ /etc/php/fpm-php7.4/ext-active/ /etc/php/phpdbg-php7.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d" CXXFLAGS="-O2 -pipe -march=native -mtune=native -fomit-frame-pointer" DISTDIR="/var/cache/distfiles" ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://www.mirrorservice.org/sites/distfiles.gentoo.org/ http://mirror.bytemark.co.uk/gentoo/" LANG="en_GB.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" LEX="flex" MAKEOPTS="-j4" PKGDIR="/var/cache/binpkgs" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git" PORTAGE_TMPDIR="/var/tmp" SHELL="/bin/bash" USE="X aac acl amd64 apache2 bash-completion branding bzip2 cdr cgi cli crypt css cups dbus dri exif ffmpeg flac foomaticdb fortran ftp gdbm gif iconv jpeg jpeg2k libtirpc man mp3 ncurses nls nptl offensive ogg pam pcre pdf png posix readline samba seccomp smp ssl svg systemd test-rust tiff truetype udev unicode upower usb vim-syntax vnc vorbis wmf xattr xface xml xpm zlib" ABI_X86="64" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby31" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Created attachment 865459 [details, diff] Suggested patch for ebuild Merged dev-ruby/ruby-3.1.4 with this patched ebuild. Verified that only the language interpreter is installed with USE="minimal ssl". Merged dev-ruby/sass together with the above. Verified that only 3 essential gems are installed and that SASS functions correctly.
I don't think the gains here of slightly lower package maintenance ways up against the drawbacks. The reason we PDEPEND on these packages is that we unbundle the code from dev-lang/ruby itself, and without installing them the ruby interpreter is not complete. It may work without these packages for some specific cases, but we need to cater to a wider set of use cases, some of which will need the functionality these packages directly or indirectly. My expectaton of introducing a "minimal" USE flag like this is that it will lead to bug reports and confused users. An additional thing to note is that a number of these bundled gems are on their way to be removed from dev-lang/ruby in future releases, so hopefully this list will shrink again in the future as more gems are split out from the main ruby package.
Ultimately, what I'd like to do is something like we do for Perl. Perl installs its bundled modules, but it uses the system copies if they're available (because it has multiple load paths). I don't know if Ruby supports that. If it does, it'd be great, because we could drop the unbundling (keep the virtual/rubygems stuff ofc) and things which really need Just The Interpreter would work as needed without pulling in a lot. If we can't do that, I agree with graaff - I don't want to do USE=minimal, because it's likely to lead to a lot of confusing bug reports.