From e21e9283e684c124083e0b41f9009e11956cb982 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Sun, 23 Dec 2012 18:38:56 -0800 Subject: [PATCH] add packaging --- packaging/baselibs.conf | 23 ++ packaging/bindresvport.blacklist | 14 + packaging/glibc.rpmlintrc | 25 ++ packaging/glibc.spec | 866 +++++++++++++++++++++++++++++++++++++++ packaging/glibc_post_upgrade.c | 348 ++++++++++++++++ packaging/nscd.conf | 1 + packaging/nscd.service | 17 + packaging/nsswitch.conf | 47 +++ 8 files changed, 1341 insertions(+) create mode 100644 packaging/baselibs.conf create mode 100644 packaging/bindresvport.blacklist create mode 100644 packaging/glibc.rpmlintrc create mode 100644 packaging/glibc.spec create mode 100644 packaging/glibc_post_upgrade.c create mode 100644 packaging/nscd.conf create mode 100644 packaging/nscd.service create mode 100644 packaging/nsswitch.conf diff --git a/packaging/baselibs.conf b/packaging/baselibs.conf new file mode 100644 index 0000000..dbf1ea9 --- /dev/null +++ b/packaging/baselibs.conf @@ -0,0 +1,23 @@ +glibc + arch i586 block! + targettype x86 +/etc/ld.so.conf + targettype x86 "/lib/ld-linux.so.2 -> /lib/ld-linux.so.2" + targettype x86 obsoletes "baselibs-x86" + targettype ia32 +/etc/ld.so.conf + targettype ia32 "/lib/ld-linux.so.2 -> /lib/ld-linux.so.2" + prereq -glibc-x86 + +/usr/lib/getconf/[^g] +glibc-locale + arch i586 block! + +/usr/lib(64)?/gconv/gconv-modules + targettype x86 -/usr/lib(64)?/gconv/gconv-modules +glibc-devel + requires "glibc- = %version" + arch i586 block! + +^/usr/include/gnu/stubs-.*\.h$ +glibc-devel-static + arch i586 block! +glibc-profile + arch i586 block! +glibc-utils + arch i586 block! diff --git a/packaging/bindresvport.blacklist b/packaging/bindresvport.blacklist new file mode 100644 index 0000000..6fc9730 --- /dev/null +++ b/packaging/bindresvport.blacklist @@ -0,0 +1,14 @@ +# +# This file contains a list of port numbers between 600 and 1024, +# which should not be used by bindresvport. bindresvport is mostly +# called by RPC services. This mostly solves the problem, that a +# RPC service uses a well known port of another service. +# +623 # ASF, used by IPMI on some cards +631 # cups +636 # ldaps +664 # Secure ASF, used by IPMI on some cards +774 # rpasswd +921 # lwresd +993 # imaps +995 # pops diff --git a/packaging/glibc.rpmlintrc b/packaging/glibc.rpmlintrc new file mode 100644 index 0000000..93f2c63 --- /dev/null +++ b/packaging/glibc.rpmlintrc @@ -0,0 +1,25 @@ +addFilter(".*glibc-profile.* devel-file-in-non-devel-package.*/usr/lib.*/lib.*_p.a") +addFilter(".*glibc.* incorrect-fsf-address") +# False positive - glibc implements gethostbyname +addFilter(".*binary-or-shlib-calls-gethostbyname") +# We do need to keep the symtab (see comments in glibc.spec), so this is intented: +addFilter(".*unstripped-binary-or-object.*") +# The duplication is intented: +addFilter(".*files-duplicate /usr/lib64/libbsd-compat.a /usr/lib.*/libg.a") +# ld.so is special: +addFilter(".*shared-lib-without-dependency-information /lib.*/ld-2.*.so") +# Handled via glibc_post_upgrade: +addFilter(".*permissions-missing-postin missing %set_permissions /usr/.*pt_chown in %post") +# Do not require permissions, this will lead to a cycle (bnc#700925): +addFilter("glibc\..*: permissions-missing-requires") +# We will not rename glibc to follow the shlib policy +addFilter("shlib-policy-missing-suffix") +# The dynamic linker and libnsl call exit - this is fine +addFilter(".*shared-lib-calls-exit.*") +# The man-pages package contains a number of man pages for programs that come +# with glibc, therefore do not warn about them +addFilter(".*glibc.*no-manual-page-for-binary getent") +addFilter(".*glibc.*no-manual-page-for-binary iconv") +addFilter(".*glibc.*no-manual-page-for-binary ldd") +addFilter(".*glibc.*no-manual-page-for-binary ldconfig") +addFilter(".*nscd.*no-manual-page-for-binary nscd") diff --git a/packaging/glibc.spec b/packaging/glibc.spec new file mode 100644 index 0000000..ab14b72 --- /dev/null +++ b/packaging/glibc.spec @@ -0,0 +1,866 @@ +# +# spec file for package glibc +# +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + +# PLEASE run pre_checkin.sh in this directory before submitting +# this package. Otherwise the .spec and .changes for glibc-testsuite +# aren't updated. + +# Run with osc --with=fast_build to have a shorter turnaround +# It will avoid building some parts of glibc +%bcond_with fast_build + +%define crypt_bf_version 1.2 + +Name: glibc +%define testsuite_build ("%{name}" == "glibc-testsuite") +Summary: Standard Shared Libraries (from the GNU C Library) +License: LGPL-2.1+ and SUSE-LGPL-2.1+-with-GCC-exception and GPL-2.0+ +Group: System/Libraries +BuildRequires: fdupes +BuildRequires: libselinux-devel +BuildRequires: makeinfo +BuildRequires: xz +BuildRequires: pkgconfig(systemd) + +%define _filter_GLIBC_PRIVATE 1 +%if %_target_cpu == "i686" +# For i686 let's only build what's different from i586, so +# no need to build documentation +%define build_profile 1 +%define build_locales 1 +%define build_html 0 +%else +%if %{with fast_build} +%define build_profile 0 +%define build_locales 0 +%define build_html 0 +%else +# Default: +%define build_profile 1 +%define build_locales 1 +%define build_html 1 +%endif +%endif + +%define disable_assert 0 +%define enable_stackguard_randomization 1 + + +%ifarch x86_64 +# 2.6.32 is the SLES 11 SP1 kernel +# 2.6.34 is the openSUSE 11.3 kernel +%define enablekernel 2.6.32 +%else +# 2.6.16 is the SLES 10 kernel, use this as oldest supported kernel +%define enablekernel 2.6.16 +%endif +# ngpt was used in 8.1 and SLES8 +Obsoletes: ngpt < 2.2.2 +Obsoletes: ngpt-devel < 2.2.2 +Provides: ngpt = 2.2.2 +Provides: ngpt-devel = 2.2.2 +Conflicts: kernel < %{enablekernel} +%ifarch armv7l armv7hl +# The old runtime linker link gets not provided by rpm find.provides, but it exists +Provides: ld-linux.so.3 +Provides: ld-linux.so.3(GLIBC_2.4) +%endif +Version: 2.16.90 +Release: 0 +%define glibc_major_version 2.16.90 +%define git_id 2bc2d8e82350 +Url: http://www.gnu.org/software/libc/libc.html +Source: glibc-%{version}-%{git_id}.tar.xz +Source5: nsswitch.conf +Source7: bindresvport.blacklist +Source8: glibc_post_upgrade.c +Source9: glibc.rpmlintrc +Source10: baselibs.conf +# For systemd +Source20: nscd.conf +Source21: nscd.service + +Requires(pre): filesystem +Provides: rtld(GNU_HASH) + +%description +The GNU C Library provides the most important standard libraries used +by nearly all programs: the standard C library, the standard math +library, and the POSIX thread library. A system is not functional +without these libraries. + +%package info +Summary: Info Files for the GNU C Library +License: GFDL-1.1 +Group: Documentation/Other +BuildArch: noarch + +%description info +This package contains the documentation for the GNU C library stored as +info files. Due to a lack of resources, this documentation is not +complete and is partially out of date. + +%package html +Summary: HTML Documentation for the GNU C Library +License: GFDL-1.1 +Group: Documentation/HTML +BuildArch: noarch + +%description html +This package contains the HTML documentation for the GNU C library. Due +to a lack of resources, this documentation is not complete and is +partially out of date. + +%package i18ndata +Summary: Database Sources for 'locale' +License: GPL-2.0+ and MIT +Group: System/Libraries +BuildArch: noarch + +%description i18ndata +This package contains the data needed to build the locale data files to +use the internationalization features of the GNU libc. It is normally +not necessary to install this packages, the data files are already +created. + +%package locale +Summary: Locale Data for Localized Programs +License: GPL-2.0+ and MIT and LGPL-2.1+ +Group: System/Libraries +Requires(post): /bin/cat +Requires: glibc = %{version} + +%description locale +Locale data for the internationalisation features of the GNU C library. + +%package -n nscd +Summary: Name Service Caching Daemon +License: GPL-2.0+ +Group: System/Daemons +Provides: glibc:/usr/sbin/nscd +Requires: glibc = %{version} + +%description -n nscd +Nscd caches name service lookups and can dramatically improve +performance with NIS, NIS+, and LDAP. + +%package profile +Summary: Libc Profiling and Debugging Versions +License: LGPL-2.1+ and SUSE-LGPL-2.1+-with-GCC-exception and GPL-2.0+ +Group: Development/Libraries/C and C++ +Requires: glibc = %{version} + +%description profile +This package contains special versions of the GNU C library which are +necessary for profiling and debugging. + +%package devel +Summary: Include Files and Libraries Mandatory for Development +License: BSD-3-Clause and LGPL-2.1+ and SUSE-LGPL-2.1+-with-GCC-exception and GPL-2.0+ +Group: Development/Libraries/C and C++ +Requires: glibc = %{version} +Requires: linux-kernel-headers + +%description devel +These libraries are needed to develop programs which use the standard C +library. + +%package devel-static +Summary: C library static libraries for -static linking +License: BSD-3-Clause and LGPL-2.1+ and SUSE-LGPL-2.1+-with-GCC-exception and GPL-2.0+ +Group: Development/Libraries/C and C++ +Requires: %{name}-devel = %{version} +# Provide Fedora name for package to make packaging easier +Provides: %{name}-static = %version + +%description devel-static +The glibc-devel-static package contains the C library static libraries +for -static linking. You don't need these, unless you link statically, +which is highly discouraged. + +%package utils +Summary: Development utilities from GNU C library +License: LGPL-2.1+ +Group: Development/Languages/C and C++ +Requires: glibc = %{version} + +%description utils +The glibc-utils package contains mtrace, a memory leak tracer and +xtrace, a function call tracer which can be helpful during program +debugging. + +If you are unsure if you need this, don't install this package. + +# makedb requires libselinux. We add this program in a separate +# package so that glibc does not require libselinux. +%package extra +Summary: Extra binaries from GNU C Library +License: LGPL-2.1+ +Group: Development/Languages/C and C++ +Requires: glibc = %{version} + +%description extra +The glibc-extra package contains some extra binaries for glibc that +are not essential but recommend to use. + +makedb: A program to create a database for nss + +%package obsolete +Summary: Obsolete Shared Libraries from the GNU C Library +License: LGPL-2.0+ +Group: System/Libraries +Requires: glibc = %{version} + +%description obsolete +This package provides some old libraries from the GNU C Library which +are no longer supported. Additional it provides a compatibility library +for old binaries linked against glibc 2.0. + +Install this package if you need one of this libraries to get old +binaries working, but since this libraries are not supported and there +is no gurantee that they work for you, you should try to get newer +versions of your software. + +%prep +%setup -n glibc-%{version} -q + +%build +if [ -x /bin/uname.bin ]; then + /bin/uname.bin -a +else + uname -a +fi +uptime || : +ulimit -a +nice +# We do not want configure to figure out the system its building one +# to support a common ground and thus set build and host to the +# target_cpu. +%ifarch %arm +%define target %{_target_cpu}-tizen-linux-gnueabi +%else +%define target %{_target_cpu}-tizen-linux +%endif +# Don't use as-needed, it breaks glibc assumptions +# Before enabling it, run the testsuite and verify that it +# passes completely +export LD_AS_NEEDED=0 +# Adjust glibc version.h +echo "#define CONFHOST \"%{target}\"" >> version.h +echo "#define GITID \"%{git_id}\"" >> version.h +# +# Default CFLAGS and Compiler +# +BuildFlags="%{optflags} -U_FORTIFY_SOURCE" +BuildFlags="$(echo $BuildFlags | sed -e 's#-fstack-protector##' -e 's#-ffortify=[0-9]*##')" +BuildCC="%__cc" +BuildCCplus="%__cxx" +add_ons=",libidn" + + + BuildFlags="$BuildFlags -g" +%if %{disable_assert} + BuildFlags="$BuildFlags -DNDEBUG=1" +%endif +%ifarch %ix86 + add_ons=$add_ons,noversion +%endif +%ifarch %arm + add_ons=$add_ons,ports +%endif +%ifarch %arm + # fails to build otherwise - need to recheck and fix + %define enable_stackguard_randomization 0 +%endif + +configure_and_build_glibc() { + local dirname="$1"; shift + local cflags="$1"; shift + local addons="$1"; shift + mkdir "cc-$dirname" + cd "cc-$dirname" +%ifarch %arm + # remove asynchronous-unwind-tables during configure as it causes + # some checks to fail spuriously on arm + conf_cflags="${cflags/-fasynchronous-unwind-tables/}" + conf_cflags="${conf_cflags/-funwind-tables/}" +%else + conf_cflags="$cflags" +%endif + + profile="--disable-profile" +%if %{build_profile} + if [ "$dirname" = "base" ] ; then + profile="--enable-profile" + fi +%endif + CFLAGS="$conf_cflags" BUILD_CFLAGS="$conf_cflags" \ + CC="$BuildCC" CXX="$BuildCCplus" ../configure \ + --prefix=%{_prefix} \ + --libexecdir=%{_libexecdir} --infodir=%{_infodir} \ + --enable-add-ons=nptl$addons \ + $profile \ + "$@" \ +%if %{enable_stackguard_randomization} + --enable-stackguard-randomization \ +%endif + --build=%{target} --host=%{target} \ +%ifarch %{ix86} x86_64 + --enable-multi-arch \ +%endif + --enable-kernel=%{enablekernel} \ + --enable-bind-now --enable-obsolete-rpc +# Should we enable --enable-systemtap? +# Should we enable --enable-nss-crypt to build use freebl3 hash functions? + # explicitly set CFLAGS to use the full CFLAGS (not the reduced one for configure) + make %{?_smp_mflags} CFLAGS="$cflags" BUILD_CFLAGS="$cflags" + cd .. +} + + # + # Build base glibc + # + configure_and_build_glibc base "$BuildFlags" "$add_ons" + +# +# Build html documentation +# +%if %{build_html} +make -C cc-base html +%endif + +# +# Build glibc_post_upgrade binary +# +$BuildCC -static %{optflags} -Os $RPM_SOURCE_DIR/glibc_post_upgrade.c -o glibc_post_upgrade \ + -Lcc-base -Bcc-base/csu \ + '-DREMOVE_TLS_DIRS' '-DREMOVE_PPC_OPTIMIZE_POWER5' \ + '-DLIBDIR="/%{_lib}"' '-DGCONV_MODULES_DIR="%{_libdir}/gconv"' + + +####################################################################### +### +### CHECK +### +####################################################################### + +%check +# The testsuite will fail if asneeded is used +export LD_AS_NEEDED=0 +%if %{testsuite_build} +# Increase timeout +export TIMEOUTFACTOR=16 +%ifarch alpha %ix86 ppc ppc64 ia64 s390 s390x x86_64 + # ix86: tst-cputimer? fails + # ia64: tst-timer4 fails + # ppc64: tst-pselect, ftwtest fails + # s390,s390x: tst-timer* fails + make %{?_smp_mflags} -C cc-base -k check || echo make check failed +%else + make %{?_smp_mflags} -C cc-base check +%endif +%endif +# This has to pass on all platforms! +# Exceptions: +# None! +make %{?_smp_mflags} -C cc-base check-abi + +####################################################################### +### +### INSTALL +### +####################################################################### + +%install +%if !%{testsuite_build} +# We don't want to strip the .symtab from our libraries in find-debuginfo.sh, +# certainly not from libpthread.so.* because it is used by libthread_db to find +# some non-exported symbols in order to detect if threading support +# should be enabled. These symbols are _not_ exported, and we can't easily +# export them retroactively without changing the ABI. So we have to +# continue to "export" them via .symtab, instead of .dynsym :-( +# But we also want to keep .symtab and .strtab of other libraries since some +# debugging tools currently require these sections directly inside the main +# files - specifically valgrind and PurifyPlus. +export STRIP_KEEP_SYMTAB=*.so* + +# Make sure we will create the gconv-modules.cache +mkdir -p %{buildroot}%{_libdir}/gconv +touch %{buildroot}%{_libdir}/gconv/gconv-modules.cache + +# Install base glibc +make %{?_smp_mflags} install_root=%{buildroot} install -C cc-base + +install_optimized_variant() { + local dirname="$1"; shift + local subdir="$1"; shift + local subdir_up="$1"; shift + +cd "cc-$dirname" +destdir=$RPM_BUILD_ROOT/%{_lib}/$subdir +mkdir -p $destdir +# Don't run a complete make install, we know which libraries +# we want +for lib in libc math/libm nptl/libpthread rt/librt nptl_db/libthread_db +do + libbase=${lib#*/} + libbaseso=$(basename $RPM_BUILD_ROOT/%{_lib}/${libbase}-*.so) + # Only install if different from base lib + if cmp -s ${lib}.so ../cc-base/${lib}.so; then + ln -sf $subdir_up/$libbaseso $destdir/$libbaseso + else + cp -a ${lib}.so $destdir/$libbaseso + fi + # Emulate ldconfig + ln -sf $libbaseso $destdir/$(basename $RPM_BUILD_ROOT/%{_lib}/${libbase}.so.*) +done +cd .. +} + + +# Install locales +%if %{build_locales} + # XXX Do not install locales in parallel! + cd cc-base + # localedef creates hardlinks to other locales if possible + # this will not work if we generate them in parallel. + # thus we need to run fdupes on /usr/lib/locale/ + # Still, on my system this is a speed advantage: + # non-parallel build for install-locales: 9:34mins + # parallel build with fdupes: 7:08mins + make %{?_smp_mflags} install_root=%{buildroot} localedata/install-locales + %fdupes %{buildroot}/usr/lib/locale + cd .. +%endif +# Create file list for glibc-locale package +%{find_lang} libc + +# Prepare obsolete/, used only on some architectures: +export RPM_BUILD_ROOT +%ifarch %ix86 +mkdir -p %{buildroot}/%{_lib}/obsolete +%endif + +# NPTL is not usable outside of glibc, so include +# the generic one (RH#162634) +cp -av bits/stdio-lock.h %{buildroot}%{_includedir}/bits/stdio-lock.h + + +# Miscelanna: + +install -m 0700 glibc_post_upgrade %{buildroot}%{_sbindir} + +install -m 644 %{SOURCE7} %{buildroot}/etc +install -m 644 %{SOURCE5} %{buildroot}/etc +install -m 644 posix/gai.conf %{buildroot}/etc + +mkdir -p %{buildroot}/etc/default +install -m 644 nis/nss %{buildroot}/etc/default/ + +mkdir -p %{buildroot}%{_includedir}/resolv +install -m 0644 resolv/mapv4v6addr.h %{buildroot}%{_includedir}/resolv/ +install -m 0644 resolv/mapv4v6hostent.h %{buildroot}%{_includedir}/resolv/ + +%if %{build_html} +mkdir -p %{buildroot}%{_datadir}/doc/glibc +cp -p cc-base/manual/libc/*.html %{buildroot}%{_datadir}/doc/glibc +%endif + +cd manpages; make install_root=%{buildroot} install; cd .. + +# nscd tools: + +cp nscd/nscd.conf %{buildroot}/etc +mkdir -p %{buildroot}/etc/init.d +ln -sf /sbin/service %{buildroot}/usr/sbin/rcnscd +mkdir -p %{buildroot}/var/run/nscd +touch %{buildroot}/var/run/nscd/{passwd,group,hosts} +touch %{buildroot}/var/run/nscd/{socket,nscd.pid} + +# +# Create ld.so.conf +# +cat > %{buildroot}/etc/ld.so.conf < +os.execute("/usr/bin/chkstat -n --warn --system -e %{_libexecdir}/pt_chown") + +%postun -p /sbin/ldconfig + +%post locale +for l in /usr/share/locale/locale.alias %{_libdir}/gconv/gconv-modules; do + [ -d "$l.d" ] || continue + echo "###X# The following is autogenerated from extra files in the .d directory:" >>"$l" + cat "$l.d"/* >>"$l" +done +/usr/sbin/iconvconfig + +%post info +%install_info --info-dir=%{_infodir} %{_infodir}/libc.info.gz + +%postun info +%install_info_delete --info-dir=%{_infodir} %{_infodir}/libc.info.gz + +%pre -n nscd +%service_add_pre nscd.service + +%preun -n nscd +%service_del_preun nscd.service + +%post -n nscd +%service_add_post nscd.service +mkdir -p /var/run/nscd +# Previously we had nscd.socket, remove it +test -x /usr/bin/systemctl && /usr/bin/systemctl stop nscd.socket 2>/dev/null || : +test -x /usr/bin/systemctl && /usr/bin/systemctl disable nscd.socket 2>/dev/null || : +# Hard removal in case the above did not work +rm -f /etc/systemd/system/sockets.target.wants/nscd.socket +exit 0 + +%postun -n nscd +%service_del_postun nscd.service +exit 0 + +%if !%{testsuite_build} +%files +####################################################################### +### +### FILES +### +####################################################################### + +# glibc +%defattr(-,root,root) +%doc LICENSES +%config(noreplace) /etc/bindresvport.blacklist +%config /etc/ld.so.conf +%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/ld.so.cache +%config(noreplace) /etc/rpc +%verify(not md5 size mtime) %config(noreplace) /etc/nsswitch.conf +%verify(not md5 size mtime) %config(noreplace) /etc/gai.conf +%config(noreplace) /etc/default/nss +%doc %{_mandir}/man1/gencat.1.gz +%doc %{_mandir}/man1/getconf.1.gz +%doc %{_mandir}/man1/locale.1.gz +%doc %{_mandir}/man1/localedef.1.gz +%doc %{_mandir}/man5/* +%doc %{_mandir}/man8/iconvconfig.8.gz +/%{_lib}/ld-%{glibc_major_version}.so + +# Each architecture has a different name for the dynamic linker: +%ifarch %arm +%ifarch armv7l armv7hl +/%{_lib}/ld-linux-armhf.so.3 +# Keep compatibility link +/%{_lib}/ld-linux.so.3 +%else +/%{_lib}/ld-linux.so.3 +%endif +%endif +%ifarch ia64 +/%{_lib}/ld-linux-ia64.so.2 +%endif +%ifarch ppc s390 mips hppa +/%{_lib}/ld.so.1 +%endif +%ifarch ppc64 +/%{_lib}/ld64.so.1 +%endif +%ifarch s390x +/lib/ld64.so.1 +/%{_lib}/ld64.so.1 +%endif +%ifarch x86_64 +/%{_lib}/ld-linux-x86-64.so.2 +%endif +%ifarch %ix86 %sparc +/%{_lib}/ld-linux.so.2 +%endif + +/%{_lib}/libBrokenLocale-%{glibc_major_version}.so +/%{_lib}/libBrokenLocale.so.1 +/%{_lib}/libSegFault.so +/%{_lib}/libanl-%{glibc_major_version}.so +/%{_lib}/libanl.so.1 +/%{_lib}/libc-%{glibc_major_version}.so +/%{_lib}/libc.so.6* +/%{_lib}/libcidn-%{glibc_major_version}.so +/%{_lib}/libcidn.so.1 +/%{_lib}/libcrypt-%{glibc_major_version}.so +/%{_lib}/libcrypt.so.1 +/%{_lib}/libdl-%{glibc_major_version}.so +/%{_lib}/libdl.so.2* +/%{_lib}/libm-%{glibc_major_version}.so +/%{_lib}/libm.so.6* +/%{_lib}/libnsl-%{glibc_major_version}.so +/%{_lib}/libnsl.so.1 +/%{_lib}/libnss_compat-%{glibc_major_version}.so +/%{_lib}/libnss_compat.so.2 +/%{_lib}/libnss_db-%{glibc_major_version}.so +/%{_lib}/libnss_db.so.2 +/%{_lib}/libnss_dns-%{glibc_major_version}.so +/%{_lib}/libnss_dns.so.2 +/%{_lib}/libnss_files-%{glibc_major_version}.so +/%{_lib}/libnss_files.so.2 +/%{_lib}/libnss_hesiod-%{glibc_major_version}.so +/%{_lib}/libnss_hesiod.so.2 +/%{_lib}/libnss_nis-%{glibc_major_version}.so +/%{_lib}/libnss_nis.so.2 +/%{_lib}/libnss_nisplus-%{glibc_major_version}.so +/%{_lib}/libnss_nisplus.so.2 +/%{_lib}/libpthread-%{glibc_major_version}.so +/%{_lib}/libpthread.so.0 +/%{_lib}/libresolv-%{glibc_major_version}.so +/%{_lib}/libresolv.so.2 +/%{_lib}/librt-%{glibc_major_version}.so +/%{_lib}/librt.so.1 +/%{_lib}/libthread_db-1.0.so +/%{_lib}/libthread_db.so.1 +/%{_lib}/libutil-%{glibc_major_version}.so +/%{_lib}/libutil.so.1 +%define optimized_libs() \ + %dir %attr(0755,root,root) /%{_lib}/%1\ + /%{_lib}/%1/libc-%{glibc_major_version}.so\ + /%{_lib}/%1/libc.so.6*\ + /%{_lib}/%1/libm-%{glibc_major_version}.so\ + /%{_lib}/%1/libm.so.6*\ + /%{_lib}/%1/libpthread-%{glibc_major_version}.so\ + /%{_lib}/%1/libpthread.so.0\ + /%{_lib}/%1/librt-%{glibc_major_version}.so\ + /%{_lib}/%1/librt.so.1\ + /%{_lib}/%1/libthread_db-1.0.so\ + /%{_lib}/%1/libthread_db.so.1 + +%dir %attr(0700,root,root) /var/cache/ldconfig +/sbin/ldconfig +%{_bindir}/gencat +%{_bindir}/getconf +%{_bindir}/getent +%{_bindir}/iconv +%attr(755,root,root) %{_bindir}/ldd +%ifarch %ix86 sparc sparcv9 + %{_bindir}/lddlibc4 +%endif +%{_bindir}/locale +%{_bindir}/localedef +%verify(not mode caps) %attr(4755,root,root) %{_libexecdir}/pt_chown +%dir %attr(0755,root,root) %{_libexecdir}/getconf +%{_libexecdir}/getconf/* +%{_sbindir}/glibc_post_upgrade +%{_sbindir}/iconvconfig + +%ifarch %ix86 + +%files obsolete +%defattr (755,root,root,755) +%dir /%{_lib}/obsolete/ + %dir /%{_lib}/obsolete/noversion + /%{_lib}/obsolete/noversion/libNoVersion-%{glibc_major_version}.so + /%{_lib}/obsolete/noversion/libNoVersion.so.1 +%endif + +%files locale -f libc.lang +%defattr(-,root,root) +%{_datadir}/locale/locale.alias +%if %{build_locales} + /usr/lib/locale +%endif +%{_libdir}/gconv + +%files devel +%defattr(-,root,root) +%doc COPYING COPYING.LIB NEWS README BUGS CONFORMANCE +%doc %{_mandir}/man1/catchsegv.1.gz +%doc %{_mandir}/man1/rpcgen.1.gz +%doc %{_mandir}/man1/sprof.1.gz +%doc %{_mandir}/man3/* +%{_bindir}/catchsegv +%{_bindir}/rpcgen +%{_bindir}/sprof +%{_includedir}/* +%{_libdir}/*.o +%{_libdir}/*.so +# These static libraries are needed even for shared builds +%{_libdir}/libbsd-compat.a +%{_libdir}/libc_nonshared.a +%{_libdir}/libg.a +%{_libdir}/libieee.a +%ifarch ppc ppc64 s390 s390x sparc sparcv8 sparcv9 sparcv9v +# This is not built on sparc64. + %{_libdir}/libnldbl_nonshared.a +%endif +%{_libdir}/libmcheck.a +%{_libdir}/libpthread_nonshared.a +%{_libdir}/librpcsvc.a + +%files devel-static +%defattr(-,root,root) +%{_libdir}/libBrokenLocale.a +%{_libdir}/libanl.a +%{_libdir}/libc.a +%{_libdir}/libcrypt.a +%{_libdir}/libdl.a +%{_libdir}/libm.a +%{_libdir}/libnsl.a +%{_libdir}/libpthread.a +%{_libdir}/libresolv.a +%{_libdir}/librt.a +%{_libdir}/libutil.a + +%files info +%defattr(-,root,root) +%doc %{_infodir}/libc.info.gz +%doc %{_infodir}/libc.info-?.gz +%doc %{_infodir}/libc.info-??.gz + +%if %{build_html} +%files html +%defattr(-,root,root) +%doc %{_prefix}/share/doc/glibc +%endif + +%files i18ndata +%defattr(-,root,root) +%{_prefix}/share/i18n + +%files -n nscd +%defattr(-,root,root) +%config(noreplace) /etc/nscd.conf +%{_sbindir}/nscd +%{_sbindir}/rcnscd +/usr/lib/systemd/system/nscd.service +%dir /usr/lib/tmpfiles.d +/usr/lib/tmpfiles.d/nscd.conf +%dir %attr(0755,root,root) %ghost /var/run/nscd +%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/nscd.pid +%attr(0666,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/socket +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/passwd +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/group +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/hosts + +%if %{build_profile} +%files profile +%defattr(-,root,root) +%{_libdir}/libc_p.a +%{_libdir}/libBrokenLocale_p.a +%{_libdir}/libanl_p.a +%{_libdir}/libm_p.a +%{_libdir}/libcrypt_p.a +%{_libdir}/libpthread_p.a +%{_libdir}/libresolv_p.a +%{_libdir}/libnsl_p.a +%{_libdir}/librt_p.a +%{_libdir}/librpcsvc_p.a +%{_libdir}/libutil_p.a +%{_libdir}/libdl_p.a +%endif + +%files utils +%defattr(-,root,root) +/%{_lib}/libmemusage.so +/%{_lib}/libpcprofile.so +%dir /%{_libdir}/audit +/%{_libdir}/audit/sotruss-lib.so +# These need gd-devel for building +# %%{_bindir}/memusage +# %%{_bindir}/memusagestat +%{_bindir}/mtrace +%{_bindir}/pcprofiledump +%{_bindir}/sotruss +%{_bindir}/xtrace +%{_bindir}/pldd +%doc %{_mandir}/man1/mtrace.1.gz + +%files extra +%defattr(-,root,root) +%{_bindir}/makedb +/var/lib/misc/Makefile + +%endif # !%{testsuite_build} + +%changelog diff --git a/packaging/glibc_post_upgrade.c b/packaging/glibc_post_upgrade.c new file mode 100644 index 0000000..3f3ed82 --- /dev/null +++ b/packaging/glibc_post_upgrade.c @@ -0,0 +1,348 @@ +/* skeleton based on version from Fedora Core 3 */ + +#define _GNU_SOURCE + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define verbose_exec(failcode, fail_ok, path...) \ + do \ + { \ + char *const arr[] = { path, NULL }; \ + vexec (failcode, fail_ok, arr); \ + } while (0) + +__attribute__((noinline)) void vexec (int failcode, int fail_ok, char *const path[]); +__attribute__((noinline)) void says (const char *str); +__attribute__((noinline)) void sayn (long num); +__attribute__((noinline)) void message (char *const path[]); +__attribute__((noinline)) int check_elf (const char *name); + +int +main (void) +{ + char initpath[256]; + struct stat root, init_root; + + /* First, get rid of platform-optimized libraries. We remove any we have + ever built, since otherwise we might end up using some old leftover + libraries when new ones aren't installed in their place anymore. */ +#ifdef REMOVE_TLS_DIRS + const char *library[] = {"libc.so.6", "libc.so.6.1", "libm.so.6", + "libm.so.6.1", "librt.so.1", "librtkaio.so.1", + "libpthread.so.0", "libthread_db.so.1"}; + const char *remove_dir[] = { +#ifdef __i386__ + "/lib/i686/", +#endif +#ifdef __powerpc64__ +#ifdef REMOVE_PPC_OPTIMIZE_POWER4 + "/lib64/power4/", + "/lib64/ppc970/", +#endif +#ifdef REMOVE_PPC_OPTIMIZE_POWER5 + "/lib64/power5/", + "/lib64/power5+/", +#endif +#ifdef REMOVE_PPC_OPTIMIZE_POWER6 + "/lib64/power6/", + "/lib64/power6x/", +#endif +#ifdef REMOVE_PPC_OPTIMIZE_POWER7 + "/lib64/power7/", +#endif +#ifdef REMOVE_PPC_OPTIMIZE_CELL + "/lib64/ppc-cell-be/", +#endif +#endif /* __powerpc64__ */ +#ifdef __powerpc__ +#ifdef REMOVE_PPC_OPTIMIZE_POWER4 + "/lib/power4/", + "/lib/ppc970/", +#endif +#ifdef REMOVE_PPC_OPTIMIZE_POWER5 + "/lib/power5/", + "/lib/power5+/", +#endif +#ifdef REMOVE_PPC_OPTIMIZE_POWER6 + "/lib/power6/", + "/lib/power6x/", +#endif +#ifdef REMOVE_PPC_OPTIMIZE_POWER7 + "/lib/power7/", +#endif +#ifdef REMOVE_PPC_OPTIMIZE_CELL + "/lib/ppc-cell-be/", +#endif +#endif /* __powerpc__ */ + LIBDIR"/tls/" }; + int i, j; + + for (i = 0; i < sizeof (remove_dir) / sizeof (remove_dir[0]); ++i) + for (j = 0; j < sizeof (library) / sizeof (library[0]); j++) + { + char buf[strlen (remove_dir[i]) + strlen (library[j]) + 1]; + char readlink_buf[(strlen (remove_dir[i]) + strlen (library[j])) * 2 + 30]; + ssize_t len; + char *cp; + + cp = stpcpy (buf, remove_dir[i]); + strcpy (cp, library[j]); + /* This file could be a symlink to library-%{version}.so, so check + this and don't remove only the link, but also the library itself. */ + cp = stpcpy (readlink_buf, remove_dir[i]); + if ((len = readlink (buf, cp, (sizeof (readlink_buf) + - (cp - readlink_buf) - 1))) > 0) + { + cp[len] = '\0'; + if (cp[0] != '/') cp = readlink_buf; + unlink (cp); + } + unlink (buf); + } +#endif + + /* If installing bi-arch glibc, rpm sometimes doesn't unpack all files + before running one of the lib's %post scriptlet. /sbin/ldconfig will + then be run by the other arch's %post. */ + if (access ("/sbin/ldconfig", X_OK) == 0) + verbose_exec (110, 0, "/sbin/ldconfig", "/sbin/ldconfig", "-X"); + + if (utimes (GCONV_MODULES_DIR "/gconv-modules.cache", NULL) == 0) + { +#ifndef ICONVCONFIG +#define ICONVCONFIG "/usr/sbin/iconvconfig" +#endif + verbose_exec (113, 0, ICONVCONFIG, "/usr/sbin/iconvconfig", + "-o", GCONV_MODULES_DIR"/gconv-modules.cache", + "--nostdlib", GCONV_MODULES_DIR); + } + + /* Implement %set_permissions %{_libexecdir}/pt_chown. */ + if (access ("/usr/bin/chkstat", X_OK) == 0) + verbose_exec (114, 1, "/usr/bin/chkstat", "/usr/bin/chkstat", + "-n", "--set", "--system", "/usr/lib/pt_chown"); + + /* Check if telinit is available and the init fifo as well. */ + if (access ("/sbin/telinit", X_OK) || access ("/dev/initctl", F_OK)) + _exit (0); + /* Check if we are not inside of some chroot, because we'd just + timeout and leave /etc/initrunlvl. */ + if (readlink ("/proc/1/exe", initpath, 256) <= 0 || + readlink ("/proc/1/root", initpath, 256) <= 0 || + stat ("/proc/1/root", &init_root) < 0 || + stat ("/.buildenv", &init_root) < 0 || /* XEN build */ + stat ("/", &root) < 0 || + init_root.st_dev != root.st_dev || init_root.st_ino != root.st_ino) + _exit (0); + + if (check_elf ("/proc/1/exe")) + verbose_exec (116, 0, "/sbin/telinit", "/sbin/telinit", "u"); + +#if 0 + /* Check if we can safely condrestart sshd. */ + if (access ("/sbin/service", X_OK) == 0 + && access ("/usr/sbin/sshd", X_OK) == 0 + && access ("/bin/bash", X_OK) == 0) + { + if (check_elf ("/usr/sbin/sshd")) + verbose_exec (121, 0, "/sbin/service", "/sbin/service", "sshd", "condrestart"); + } +#endif + + _exit(0); +} + +void +vexec (int failcode, int fail_ok, char *const path[]) +{ + pid_t pid; + int status, save_errno; + + pid = vfork (); + if (pid == 0) + { + execv (path[0], path + 1); + save_errno = errno; + message (path); + says (" exec failed with errno "); + sayn (save_errno); + says ("\n"); + _exit (failcode); + } + else if (pid < 0) + { + save_errno = errno; + message (path); + says (" fork failed with errno "); + sayn (save_errno); + says ("\n"); + _exit (failcode + 1); + } + if (waitpid (0, &status, 0) != pid || !WIFEXITED (status)) + { + message (path); + says (" child terminated abnormally\n"); + _exit (failcode + 2); + } + if (WEXITSTATUS (status)) + { + message (path); + says (" child exited with exit code "); + sayn (WEXITSTATUS (status)); + if (fail_ok) + { + says (" (ignored) \n"); + } + else + { + says ("\n"); + _exit (WEXITSTATUS (status)); + } + } +} + +void +says (const char *str) +{ + write (1, str, strlen (str)); +} + +void +sayn (long num) +{ + char string[sizeof (long) * 3 + 1]; + char *p = string + sizeof (string) - 1; + + *p = '\0'; + if (num == 0) + *--p = '0'; + else + while (num) + { + *--p = '0' + num % 10; + num = num / 10; + } + + says (p); +} + +void +message (char *const path[]) +{ + says ("/usr/sbin/glibc_post_upgrade: While trying to execute "); + says (path[0]); +} + +int +check_elf (const char *name) +{ + /* Play safe, if we can't open or read, assume it might be + ELF for the current arch. */ + int ret = 1; + int fd = open (name, O_RDONLY); + if (fd >= 0) + { + Elf32_Ehdr ehdr; + if (read (fd, &ehdr, offsetof (Elf32_Ehdr, e_version)) + == offsetof (Elf32_Ehdr, e_version)) + { + ret = 0; + if (ehdr.e_ident[EI_CLASS] + == (sizeof (long) == 8 ? ELFCLASS64 : ELFCLASS32)) + { +#if defined __i386__ + ret = ehdr.e_machine == EM_386; +#elif defined __x86_64__ + ret = ehdr.e_machine == EM_X86_64; +#elif defined __ia64__ + ret = ehdr.e_machine == EM_IA_64; +#elif defined __powerpc64__ + ret = ehdr.e_machine == EM_PPC64; +#elif defined __powerpc__ + ret = ehdr.e_machine == EM_PPC; +#elif defined __s390__ || defined __s390x__ + ret = ehdr.e_machine == EM_S390; +#elif defined __x86_64__ + ret = ehdr.e_machine == EM_X86_64; +#elif defined __sparc__ + if (sizeof (long) == 8) + ret = ehdr.e_machine == EM_SPARCV9; + else + ret = (ehdr.e_machine == EM_SPARC + || ehdr.e_machine == EM_SPARC32PLUS); +#else + ret = 1; +#endif + } + } + close (fd); + } + return ret; +} + +#ifdef SMALL_BINARY + +int __libc_multiple_threads __attribute__((nocommon)); +int __libc_enable_asynccancel (void) { return 0; } +void __libc_disable_asynccancel (int x) { } +void __libc_csu_init (void) { } +void __libc_csu_fini (void) { } +pid_t __fork (void) { return -1; } +char thr_buf[65536]; + +#ifndef __powerpc__ +int +__libc_start_main (int (*main) (void), int argc, char **argv, + void (*init) (void), void (*fini) (void), + void (*rtld_fini) (void), void * stack_end) +#else +struct startup_info +{ + void *sda_base; + int (*main) (int, char **, char **, void *); + int (*init) (int, char **, char **, void *); + void (*fini) (void); +}; + +int +__libc_start_main (int argc, char **ubp_av, char **ubp_ev, + void *auxvec, void (*rtld_fini) (void), + struct startup_info *stinfo, + char **stack_on_entry) +#endif +{ +#if defined __ia64__ || defined __powerpc64__ + register void *r13 __asm ("r13") = thr_buf + 32768; + __asm ("" : : "r" (r13)); +#elif defined __sparc__ + register void *g6 __asm ("g6") = thr_buf + 32768; +# ifdef __arch64__ + __thread_self = thr_buf + 32768; +# else + register void *__thread_self __asm ("g7") = thr_buf + 32768; +# endif + __asm ("" : : "r" (g6), "r" (__thread_self)); +#elif defined __s390__ && !defined __s390x__ + __asm ("sar %%a0,%0" : : "d" (thr_buf + 32768)); +#elif defined __s390x__ + __asm ("sar %%a1,%0; srlg 0,%0,32; sar %%a0,0" : : "d" (thr_buf + 32768) : "0"); +#elif defined __powerpc__ && !defined __powerpc64__ + register void *r2 __asm ("r2") = thr_buf + 32768; + __asm ("" : : "r" (r2)); +#endif + main(); + return 0; +} + +#endif diff --git a/packaging/nscd.conf b/packaging/nscd.conf new file mode 100644 index 0000000..ba48981 --- /dev/null +++ b/packaging/nscd.conf @@ -0,0 +1 @@ +d /var/run/nscd 0755 root root diff --git a/packaging/nscd.service b/packaging/nscd.service new file mode 100644 index 0000000..6b4ea0e --- /dev/null +++ b/packaging/nscd.service @@ -0,0 +1,17 @@ +[Unit] +Description=Name Service Cache Daemon +After=syslog.target + +[Service] +ExecStart=/usr/sbin/nscd --foreground +ExecStop=/usr/sbin/nscd --shutdown +ExecReload=/usr/sbin/nscd -i passwd +ExecReload=/usr/sbin/nscd -i group +ExecReload=/usr/sbin/nscd -i hosts +ExecReload=/usr/sbin/nscd -i services +ExecReload=/usr/sbin/nscd -i netgroup +Restart=always + +[Install] +WantedBy=multi-user.target + diff --git a/packaging/nsswitch.conf b/packaging/nsswitch.conf new file mode 100644 index 0000000..0062365 --- /dev/null +++ b/packaging/nsswitch.conf @@ -0,0 +1,47 @@ +# +# /etc/nsswitch.conf +# +# An example Name Service Switch config file. This file should be +# sorted with the most-used services at the beginning. +# +# The entry '[NOTFOUND=return]' means that the search for an +# entry should stop if the search in the previous entry turned +# up nothing. Note that if the search failed due to some other reason +# (like no NIS server responding) then the search continues with the +# next entry. +# +# Legal entries are: +# +# compat Use compatibility setup +# nisplus Use NIS+ (NIS version 3) +# nis Use NIS (NIS version 2), also called YP +# dns Use DNS (Domain Name Service) +# files Use the local files +# [NOTFOUND=return] Stop searching if not found so far +# +# For more information, please read the nsswitch.conf.5 manual page. +# + +# passwd: files nis +# shadow: files nis +# group: files nis + +passwd: compat +group: compat + +hosts: files dns +networks: files dns + +services: files +protocols: files +rpc: files +ethers: files +netmasks: files +netgroup: files nis +publickey: files + +bootparams: files +automount: files nis +aliases: files + + -- 2.7.4