#28 Split infrequently used gconv modules into a separate package
Closed 2 years ago by codonell. Opened 3 years ago by siddhesh.
rpms/ siddhesh/glibc gconv-split  into  rawhide

file modified
+76
@@ -284,6 +284,14 @@ 

  Requires: glibc-langpack = %{version}-%{release}

  Suggests: glibc-minimal-langpack = %{version}-%{release}

  

+ # Similar to language packs, we have glibc require a virtual dependency on

+ # glibc-gconv, which gives us either glibc-gconv-all or glibc-gconv-minimal.

+ # We suggest glibc-gconv-all to ensure that default installations are

+ # unchanged.  This could be substituted with glibc-gconv-minimal to remove the

+ # less frequently used converter modules.

+ Requires: glibc-gconv = %{version}-%{release}

+ Suggests: glibc-gconv-all = %{version}-%{release}

+ 

  %description

  The glibc package contains standard libraries which are used by

  multiple programs on the system. In order to save disk space and
@@ -811,6 +819,30 @@ 

  nothing else. It is designed for assembling a minimal system.

  %files minimal-langpack

  

+ # No %files, this is an empty package.  gconv-minimal provides a way to remove

+ # infrequently used iconv converter modules packaged in gconv-all.

+ %package gconv-minimal

+ Summary: Minimal iconv converter modules for %{name}.

+ Provides: glibc-gconv = %{version}-%{release}

+ Requires: %{name} = %{version}-%{release}

+ Requires: %{name}-common = %{version}-%{release}

+ Conflicts: %{name}-gconv-all

+ %description gconv-minimal

+ This is a Meta package that is used to install minimal iconv converter modules.

+ This package ensures you can use common converters, i.e. UTF-8, UNICODE and

+ ISO-8859-1, ISO-8859-15 but nothing else. It is designed for assembling a

+ minimal system.

+ %files gconv-minimal

+ 

+ # Infrequently used icong converter modules.

+ %package gconv-all

+ Summary: All iconv converter modules for %{name}.

+ Provides: glibc-gconv = %{version}-%{release}

+ Requires: %{name} = %{version}-%{release}

+ Requires: %{name}-common = %{version}-%{release}

+ %description gconv-all

+ This package contains all iconv converter modules built in %{name}.

+ 

  ##############################################################################

  # glibc "nscd" sub-package

  #
@@ -1548,6 +1580,7 @@ 

  touch glibc.filelist

  touch common.filelist

  touch utils.filelist

+ touch gconv.filelist

  touch nscd.filelist

  touch devel.filelist

  touch doc.filelist
@@ -1625,6 +1658,7 @@ 

  # - All the libnss files (we add back the ones we want later).

  # - All bench test binaries.

  # - The aux-cache, since it's handled specially in the files section.

+ # - All gconv modules.  We add the required modules later.

  cat master.filelist \

  	| grep -v \

  	-e '%{_infodir}' \
@@ -1633,6 +1667,7 @@ 

  	-e '%{_libdir}/lib.*\.a' \

          -e '%{_libdir}/.*\.o' \

  	-e '%{_libdir}/lib.*\.so' \

+ 	-e '%{_libdir}/gconv/.*\.so$' \

  	-e 'nscd' \

  	-e '%{_prefix}/bin' \

  	-e '%{_prefix}/lib/locale' \
@@ -1654,6 +1689,23 @@ 

  	-e "/libnss_$module(\.so\.[0-9.]+|-[0-9.]+\.so)$" \

  	>> glibc.filelist

  done

+ 

+ GconvBaseModules="ANSI_X3.110 ISO8859-15 ISO8859-1 CP1252"

+ GconvBaseModules="$GconvBaseModules UNICODE UTF-16 UTF-32 UTF-7"

+ GconvAllModules=$(cat master.filelist |

+ 		  sed -n 's|%{_libdir}/gconv/\(.*\)\.so|\1|p')

+ 

+ # Put the base modules into glibc and the rest into glibc-gconv-all.

+ for conv in $GconvAllModules; do

+     if echo $GconvBaseModules | grep -q $conv; then

+ 	grep -E -e "%{_libdir}/gconv/$conv.so$" \

+ 	    master.filelist >> glibc.filelist

+     else

+ 	grep -E -e "%{_libdir}/gconv/$conv.so$" \

+ 	    master.filelist >> gconv.filelist

+     fi

+ done

+ 

  grep -e "libmemusage.so" -e "libpcprofile.so" master.filelist >> glibc.filelist

  

  ###############################################################################
@@ -1837,6 +1889,7 @@ 

  	-o debuginfocommon.filelist \

  	-l nss_db.filelist -l nss_hesiod.filelist \

  	-l libnsl.filelist -l glibc.filelist \

+ 	-l gconv.filelist \

  %if %{with benchtests}

  	-l benchtests.filelist

  %endif
@@ -2190,6 +2243,27 @@ 

  %post -n nscd

  %systemd_post nscd.service

  

+ # Update the gconv-modules cache whenever modules are updated.

+ %post gconv-all

+ IconvDir="%{_libdir}/gconv"

+ IconvCache="$IconvDir/gconv-modules.cache"

+ 

+ if [ -e $IconvCache ]; then

+     %{_prefix}/sbin/iconvconfig -o $IconvCache --nostdlib $IconvDir

+ else

+     echo "Error: Missing $IconvCache file."

+ fi

+ 

+ %post gconv-minimal

+ IconvDir="%{_libdir}/gconv"

+ IconvCache="$IconvDir/gconv-modules.cache"

+ 

+ if [ -e $IconvCache ]; then

+     %{_prefix}/sbin/iconvconfig -o $IconvCache --nostdlib $IconvDir

+ else

+     echo "Error: Missing $IconvCache file."

+ fi

+ 

  %preun -n nscd

  %systemd_preun nscd.service

  
@@ -2276,6 +2350,8 @@ 

  %files -f libnsl.filelist -n libnsl

  /%{_lib}/libnsl.so.1

  

+ %files -f gconv.filelist gconv-all

+ 

  %if 0%{?_enable_debug_packages}

  %files debuginfo -f debuginfo.filelist

  %ifarch %{debuginfocommonarches}

A draft patch to split gconv out into a separate package. A dnf update will result in glibc-gconv-all being pulled in by default. One could then minimize the image by running dnf install glibc-gconv-minimal --allowerasing, thus saving over a Meg.

With glibc-gconv-minimal, iconv_open fails for encodings that are not present, which is expected behaviour.

There's one limitation in this approach - gconv-modules is not regenerated and as a result, iconv -l will list all modules even with glibc-gconv-minimal.

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci

Pull-Request has been closed by codonell

2 years ago
Metadata