Re: Some analysis on the size of the minimal and Server installs of Fedora 23

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 17/11/15 17:03, Pádraig Brady wrote:
> On 17/11/15 01:39, Stephen Gallagher wrote:
>> (Please keep responses on the devel@ list; I've set it in the Reply-To.)
>>
>> To jump right to the premise: The default Fedora Server install is Way
>> Too Big(TM) and the minimal install (also available on the Fedora
>> Server install media) is also Too Big.

>> Some highlights of my initial research (with a lot of my raw data in
>> the tarball attached to this email):
>>
>>
>> == Minimal ==
>>
>> === Disk Usage ===
>> /boot: 79MB
>> /:     755MB
>>
>>
>> === Packages ===
>> Total count: 270
>>
>> ==== Largest 10 packages ====
>> 14288083: coreutils
> 
> We might create a coreutils-singlebin package that is built with
>   ./configure --enable-single-binary
> which would include only the single binary and stubs.
> I think chromium is using this setup.
> coreutils-singlebin could Recommends: coreutils-doc, while the
> standard coreutils package would require coreutils-doc.
> That would save about 13MB in the install.
> Caveat is that the single binary would dynamically link
> all shared libs, which associated startup and mem overhead.

Attached is a proposed split for coreutils.

Original coreutils (14.2MB) is now split to:

coreutils (5.5MB), coreutils-single (1.2MB)
and an optional coreutils-common (8.7MB)

coreutils and coreutils-single are mutually exclusive.
coreutils requires coreutils-common, though it
can be forcefully removed if desired, and only
docs and translations are degraded.

I.E. there are 4 possible setups now:

coreutils-single (1.2MB)
coreutils-single + coreutils-common (9.9MB)
coreutils (5.5MB)
coreutils + coreutils-common (14.2MB)

cheers,
Pádraig.
From 3b01b048617cc689fa7a92aba9a153838719dc68 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@xxxxxxxxxxxxxx>
Date: Tue, 17 Nov 2015 23:58:22 +0000
Subject: [PATCH 1/2] clean stale parts of the spec file

---
 coreutils.spec | 122 ++++-----------------------------------------------------
 1 file changed, 8 insertions(+), 114 deletions(-)

diff --git a/coreutils.spec b/coreutils.spec
index 20cdfe6..4ec62d5 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -152,7 +152,7 @@ the old GNU fileutils, sh-utils, and textutils packages.
 %patch950 -p1 -b .selinux
 %patch951 -p1 -b .selinuxman
 
-chmod a+x tests/misc/sort-mb-tests.sh tests/df/direct.sh tests/cp/no-ctx.sh || :
+chmod a+x tests/misc/sort-mb-tests.sh tests/df/direct.sh || :
 
 #fix typos/mistakes in localized documentation(#439410, #440056)
 find ./po/ -name "*.p*" | xargs \
@@ -167,29 +167,20 @@ touch aclocal.m4 configure config.hin Makefile.in */Makefile.in
 aclocal -I m4
 autoconf --force
 automake --copy --add-missing
-%configure --enable-largefile \
+%configure --enable-install-program=arch \
+           --enable-no-install-program=uptime \
            --with-openssl \
-           --enable-install-program=hostname,arch \
            --with-tty-group \
            DEFAULT_POSIX2_VERSION=200112 alternative=199209 || :
 
-# Regenerate manpages
-touch man/*.x
-
 make all %{?_smp_mflags}
 
-# XXX docs should say /var/run/[uw]tmp not /etc/[uw]tmp
-sed -i -e 's,/etc/utmp,/var/run/utmp,g;s,/etc/wtmp,/var/run/wtmp,g' doc/coreutils.texi
-
 %check
 make check %{?_smp_mflags}
 
 %install
 make DESTDIR=$RPM_BUILD_ROOT install
 
-# man pages are not installed with make install
-make mandir=$RPM_BUILD_ROOT%{_mandir} install-man
-
 # fix japanese catalog file
 if [ -d $RPM_BUILD_ROOT%{_datadir}/locale/ja_JP.EUC/LC_MESSAGES ]; then
    mkdir -p $RPM_BUILD_ROOT%{_datadir}/locale/ja/LC_MESSAGES
@@ -214,7 +205,10 @@ install -p -c -m644 %SOURCE105 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.s
 install -p -c -m644 %SOURCE106 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.csh
 
 # These come from util-linux and/or procps.
-for i in hostname uptime kill ; do
+# With coreutils > 8.24 one can just add to --enable-no-install-program
+# rather than manually removing here, since tests depending on
+# built utilities are correctly skipped if not present.
+for i in kill ; do
     rm $RPM_BUILD_ROOT{%{_bindir}/$i,%{_mandir}/man1/$i.1}
 done
 
@@ -269,107 +263,7 @@ fi
 %doc ABOUT-NLS NEWS README THANKS TODO
 %{!?_licensedir:%global license %%doc}
 %license COPYING
-%{_bindir}/arch
-%{_bindir}/basename
-%{_bindir}/cat
-%{_bindir}/chgrp
-%{_bindir}/chmod
-%{_bindir}/chown
-%{_bindir}/cp
-%{_bindir}/cut
-%{_bindir}/date
-%{_bindir}/dd
-%{_bindir}/df
-%{_bindir}/echo
-%{_bindir}/env
-%{_bindir}/false
-%{_bindir}/link
-%{_bindir}/ln
-%{_bindir}/ls
-%{_bindir}/mkdir
-%{_bindir}/mknod
-%{_bindir}/mv
-%{_bindir}/nice
-%{_bindir}/pwd
-%{_bindir}/readlink
-%{_bindir}/rm
-%{_bindir}/rmdir
-%{_bindir}/sleep
-%{_bindir}/sort
-%{_bindir}/stty
-%{_bindir}/sync
-%{_bindir}/mktemp
-%{_bindir}/touch
-%{_bindir}/true
-%{_bindir}/uname
-%{_bindir}/unlink
-%{_bindir}/[
-%{_bindir}/base64
-%{_bindir}/chcon
-%{_bindir}/cksum
-%{_bindir}/comm
-%{_bindir}/csplit
-%{_bindir}/dir
-%{_bindir}/dircolors
-%{_bindir}/dirname
-%{_bindir}/du
-%{_bindir}/expand
-%{_bindir}/expr
-%{_bindir}/factor
-%{_bindir}/fmt
-%{_bindir}/fold
-%{_bindir}/groups
-%{_bindir}/head
-%{_bindir}/hostid
-%{_bindir}/id
-%{_bindir}/install
-%{_bindir}/join
-%{_bindir}/logname
-%{_bindir}/md5sum
-%{_bindir}/mkfifo
-%{_bindir}/nl
-%{_bindir}/nohup
-%{_bindir}/nproc
-%{_bindir}/numfmt
-%{_bindir}/od
-%{_bindir}/paste
-%{_bindir}/pathchk
-%{_bindir}/pinky
-%{_bindir}/pr
-%{_bindir}/printenv
-%{_bindir}/printf
-%{_bindir}/ptx
-%{_bindir}/realpath
-%{_bindir}/runcon
-%{_bindir}/seq
-%{_bindir}/sha1sum
-%{_bindir}/sha224sum
-%{_bindir}/sha256sum
-%{_bindir}/sha384sum
-%{_bindir}/sha512sum
-%{_bindir}/shred
-%{_bindir}/shuf
-%{_bindir}/split
-%{_bindir}/stat
-%{_bindir}/stdbuf
-%{_bindir}/sum
-%{_bindir}/tac
-%{_bindir}/tail
-%{_bindir}/tee
-%{_bindir}/test
-%{_bindir}/timeout
-%{_bindir}/tr
-%{_bindir}/truncate
-%{_bindir}/tsort
-%{_bindir}/tty
-%{_bindir}/unexpand
-%{_bindir}/uniq
-%{_bindir}/users
-%{_bindir}/vdir
-%{_bindir}/wc
-%{_bindir}/who
-%{_bindir}/whoami
-%{_bindir}/yes
+%{_bindir}/*
 %{_infodir}/coreutils*
 %{_libexecdir}/coreutils*
 %{_mandir}/man*/*
-- 
2.5.0


From 2471be1a7b883ab8ca8ee3370b09db204dbf27f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@xxxxxxxxxxxxxx>
Date: Wed, 18 Nov 2015 10:55:55 +0000
Subject: [PATCH 2/2] split package and provide coreutils-single

Notes about coreutils:

 - Drops from 14.2MB to 5.5MB.
 - Still requires coreutils-common, though being separated
   allows for easier removal if required.
 - Explicitly conflicts with coreutils-single to avoid errant installs

Notes about coreutils-single:

 - Contains a single multicall binary which is 1.2MB
 - Have to force install over any existing coreutils package
    so best used for initial install without existing coreutils package
 - Doesn't require (but suggests) coreutils-common
    so install that manually for docs, translations, and colors etc.

Notes about coreutils-common:

 - 8.7MB
 - Having this split out gives an easy way to remove all
   docs and translations.
---
 coreutils.spec | 109 ++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 92 insertions(+), 17 deletions(-)

diff --git a/coreutils.spec b/coreutils.spec
index 4ec62d5..dba3cec 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
 Summary: A set of basic GNU tools commonly used in shell scripts
 Name:    coreutils
 Version: 8.24
-Release: 4%{?dist}
+Release: 100%{?dist}
 License: GPLv3+
 Group:   System Environment/Base
 Url:     http://www.gnu.org/software/coreutils/
@@ -54,6 +54,8 @@ Patch950: coreutils-selinux.patch
 Patch951: coreutils-selinuxmanpages.patch
 
 Conflicts: filesystem < 3
+# To avoid clobbering installs during %post
+Conflicts: coreutils-single
 Provides: /bin/basename
 Provides: /bin/cat
 Provides: /bin/chgrp
@@ -99,6 +101,7 @@ BuildRequires: gmp-devel
 BuildRequires: attr
 BuildRequires: strace
 
+Requires: %{name}-common = %{version}-%{release}
 Requires(pre): /sbin/install-info
 Requires(preun): /sbin/install-info
 Requires(post): /sbin/install-info
@@ -118,11 +121,32 @@ Obsoletes: fileutils <= 4.1.9
 Obsoletes: sh-utils <= 2.0.12
 Obsoletes: stat <= 3.3
 Obsoletes: textutils <= 2.0.21
+Obsoletes: %{name} < 8.24-100
 
 %description
 These are the GNU core utilities.  This package is the combination of
 the old GNU fileutils, sh-utils, and textutils packages.
 
+%package single
+Summary:  coreutils multicall binary
+Suggests: coreutils-common
+Provides: coreutils
+# To avoid clobbering installs during %post
+Conflicts: coreutils < 8.24-100
+%description single
+These are the GNU core utilities,
+packaged as a single multicall binary.
+
+
+%package common
+# yum obsoleting rules explained at:
+# https://bugzilla.redhat.com/show_bug.cgi?id=1107973#c7
+Obsoletes: %{name} < 8.24-100
+Summary:  coreutils common optional components
+%description common
+Optional though recommended components,
+including documentation and translations.
+
 %prep
 %setup -q
 
@@ -167,19 +191,40 @@ touch aclocal.m4 configure config.hin Makefile.in */Makefile.in
 aclocal -I m4
 autoconf --force
 automake --copy --add-missing
-%configure --enable-install-program=arch \
-           --enable-no-install-program=uptime \
-           --with-openssl \
-           --with-tty-group \
-           DEFAULT_POSIX2_VERSION=200112 alternative=199209 || :
-
-make all %{?_smp_mflags}
+for type in separate single; do
+  mkdir $type && \
+  (cd $type && ln -s ../configure && \
+  test $type = 'single' && configure_single='--enable-single-binary'
+  %configure $configure_single \
+             --cache-file=../config.cache \
+             --enable-install-program=arch \
+             --enable-no-install-program=uptime \
+             --with-openssl \
+             --with-tty-group \
+             DEFAULT_POSIX2_VERSION=200112 alternative=199209 || :
+  mkdir src # not needed with coreutils > 8.24
+  make all %{?_smp_mflags})
+done
 
 %check
-make check %{?_smp_mflags}
+for type in separate single; do
+  test $type = 'single' && subdirs='SUBDIRS=.' # Only check gnulib once
+  (cd $type && make check %{?_smp_mflags} $subdirs)
+done
 
 %install
-make DESTDIR=$RPM_BUILD_ROOT install
+for type in separate single; do
+  install=install
+  if test $type = 'single'; then
+    subdir=%{_libexecdir}/%{name}; install=install-exec
+  fi
+  (cd $type && make DESTDIR=$RPM_BUILD_ROOT/$subdir $install)
+  # Include coreutils binary to standard place to satisfy auto Requires
+  if test $type = 'single'; then
+    mv $RPM_BUILD_ROOT/%{_libexecdir}/%{name}/%{_bindir}/coreutils \
+       $RPM_BUILD_ROOT/%{_bindir}
+  fi
+done
 
 # fix japanese catalog file
 if [ -d $RPM_BUILD_ROOT%{_datadir}/locale/ja_JP.EUC/LC_MESSAGES ]; then
@@ -193,9 +238,11 @@ bzip2 -9f ChangeLog
 
 # let be compatible with old fileutils, sh-utils and textutils packages :
 mkdir -p $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}}
+mkdir -p $RPM_BUILD_ROOT/%{_libexecdir}/%{name}/{%{_bindir},%{_sbindir}}
 
 # chroot was in /usr/sbin :
 mv $RPM_BUILD_ROOT{%_bindir,%_sbindir}/chroot
+mv $RPM_BUILD_ROOT/%{_libexecdir}/%{name}/{%_bindir,%_sbindir}/chroot
 
 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
 install -p -c -m644 %SOURCE101 $RPM_BUILD_ROOT%{_sysconfdir}/DIR_COLORS
@@ -209,7 +256,8 @@ install -p -c -m644 %SOURCE106 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.c
 # rather than manually removing here, since tests depending on
 # built utilities are correctly skipped if not present.
 for i in kill ; do
-    rm $RPM_BUILD_ROOT{%{_bindir}/$i,%{_mandir}/man1/$i.1}
+    rm -f $RPM_BUILD_ROOT{%{_bindir}/$i,%{_mandir}/man1/$i.1}
+    rm -f $RPM_BUILD_ROOT/%{_libexecdir}/%{name}/{%{_bindir}/$i,%{_mandir}/man1/$i.1}
 done
 
 # Compress ChangeLogs from before the fileutils/textutils/etc merge
@@ -256,20 +304,47 @@ if [ -f %{_infodir}/%{name}.info.gz ]; then
   /sbin/install-info %{_infodir}/%{name}.info.gz %{_infodir}/dir || :
 fi
 
-%files -f %{name}.lang
+%post single
+# Make links after install as all subpackages need to come from
+# the same buildroot at present:
+# https://www.redhat.com/archives/rpm-list/2002-July/msg00222.html
+for dir in %{_bindir} %{_sbindir} %{_libexecdir}/%{name}; do
+  coreutils --coreutils-prog=mkdir -p $dir
+  coreutils --coreutils-prog=cp -sf %{_libexecdir}/%{name}$dir/* $dir
+done
+
+%files
+%defattr(-,root,root,-)
+%exclude %{_bindir}/coreutils
+%{_bindir}/*
+%{_sbindir}/chroot
+%{_libexecdir}/coreutils/*.so
+
+%files single
+# Note RPM doesn't support separate buildroots for %files
+# http://rpm.org/ticket/874
+# So provide links in %post instead
+%defattr(-,root,root,-)
+%{_bindir}/coreutils
+%{_libexecdir}/%{name}/%{_bindir}/*
+%{_libexecdir}/%{name}/%{_sbindir}/chroot
+%{_libexecdir}/%{name}/%{_libexecdir}/coreutils/*.so
+
+%files common -f %{name}.lang
 %defattr(-,root,root,-)
 %config(noreplace) %{_sysconfdir}/DIR_COLORS*
 %config(noreplace) %{_sysconfdir}/profile.d/*
+%{_infodir}/coreutils*
+%{_mandir}/man*/*
+# The following go to /usr/share/doc/coreutils-common
 %doc ABOUT-NLS NEWS README THANKS TODO
 %{!?_licensedir:%global license %%doc}
 %license COPYING
-%{_bindir}/*
-%{_infodir}/coreutils*
-%{_libexecdir}/coreutils*
-%{_mandir}/man*/*
-%{_sbindir}/chroot
 
 %changelog
+* Wed Nov 18 2015 Pádraig Brady <pbrady@xxxxxxxxxx> - 8.24-100
+- Split package to more easily support smaller installs
+
 * Wed Sep 16 2015 Kamil Dudka <kdudka@xxxxxxxxxx> - 8.24-4
 - fix memory leak in sort/I18N (patches written by Pádraig, #1259942)
 
-- 
2.5.0

-- 
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux