From d56cfc6775f499f166df6033a96fb70d7e8a0937 Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Thu, 15 Mar 2018 00:10:49 -0400 Subject: [PATCH] Use symlinks instead of hardlinks for installed binaries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A recent discussion on the git list¹ suggested that using symlinks should be clearer and have no drawbacks (except on filesystems where symlinks are not well supported, e.g. on Windows). This shrinks the git-core package by nearly 25% and saves almost 6MB in the debuginfo package. See also 6ef5f1f ("Disable cross-directory hardlinks", 2017-11-10). ¹ https://public-inbox.org/git/87y3iwp2z0.fsf@evledraar.gmail.com/#t --- .rpmlint | 3 +++ git.spec | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.rpmlint b/.rpmlint index 08c9108..8066d36 100644 --- a/.rpmlint +++ b/.rpmlint @@ -10,6 +10,9 @@ addFilter("git\.(spec|src):.* rpm-buildroot-usage %prep DESTDIR = %{buildroot}") # git-core-doc requires git-core, which provides the symlink target addFilter("git(-core-doc)?\..*: W: dangling-relative-symlink /usr/share/doc/git/contrib/hooks ../../../git-core/contrib/hooks") +# git requires git-core, which provides the symlink target +addFilter("git\..*: W: dangling-relative-symlink /usr/libexec/git-core/git-difftool git") + # git-gui requires git, which provides the git binary addFilter("git-gui.noarch: W: desktopfile-without-binary /usr/share/applications/git-gui.desktop git") diff --git a/git.spec b/git.spec index 0586bfb..a3a5f75 100644 --- a/git.spec +++ b/git.spec @@ -391,6 +391,7 @@ INSTALL = install -p GITWEB_PROJECTROOT = %{_localstatedir}/lib/git GNU_ROFF = 1 NO_CROSS_DIRECTORY_HARDLINKS = 1 +NO_INSTALL_HARDLINKS = 1 PYTHON_PATH = %{__python2} htmldir = %{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}} prefix = %{_prefix} @@ -454,6 +455,11 @@ sed -i -e '1s|#!%{__python2}$|#!%{__python3}|' \ %install make %{?_smp_mflags} INSTALLDIRS=vendor install %{?with_docs:install-doc} +# symlink %%{gitexecdir} copies of git, git-shell, and git-upload-pack +for i in git git-shell git-upload-pack; do + ln -sf ../../bin/$i %{buildroot}%{gitexecdir}/$i +done + %global elispdir %{_emacs_sitelispdir}/git make -C contrib/emacs install \ emacsdir=%{buildroot}%{elispdir} @@ -491,7 +497,7 @@ rm -rf contrib/subtree/{INSTALL,Makefile,git-subtree{,.{1,html,sh,txt,xml}},t} find %{buildroot} Documentation -type f -name 'git-archimport*' -exec rm -f {} ';' exclude_re="archimport|email|git-citool|git-cvs|git-daemon|git-gui|git-remote-bzr|git-remote-hg|git-subtree|gitk|p4|svn" -(find %{buildroot}{%{_bindir},%{_libexecdir}} -type f | grep -vE "$exclude_re" | sed -e s@^%{buildroot}@@) > bin-man-doc-files +(find %{buildroot}{%{_bindir},%{_libexecdir}} -type f -o -type l | grep -vE "$exclude_re" | sed -e s@^%{buildroot}@@) > bin-man-doc-files (find %{buildroot}{%{_bindir},%{_libexecdir}} -mindepth 1 -type d | grep -vE "$exclude_re" | sed -e 's@^%{buildroot}@%dir @') >> bin-man-doc-files (find %{buildroot}%{perl_vendorlib} -type f | sed -e s@^%{buildroot}@@) > perl-git-files (find %{buildroot}%{perl_vendorlib} -mindepth 1 -type d | sed -e 's@^%{buildroot}@%dir @') >> perl-git-files @@ -792,6 +798,9 @@ make test || ./print-failed-test-output %{?with_docs:%{_pkgdocdir}/*svn*.html} %changelog +* Thu Mar 15 2018 Todd Zullinger +- Use symlinks instead of hardlinks for installed binaries + * Fri Feb 23 2018 Todd Zullinger - Improve hardening flags for EL-6 & EL-7