diff --git a/glibc.spec b/glibc.spec index 4b6604a..f29d68e 100644 --- a/glibc.spec +++ b/glibc.spec @@ -87,7 +87,7 @@ Name: glibc Version: 2.40 -Release: 3mamba +Release: 4mamba Summary: The GNU libc libraries Group: System/Libraries Vendor: openmamba @@ -104,12 +104,6 @@ Patch5: glibc-2.16.0-localedata_openmamba.patch Patch17: glibc-2.21-prevent-ehaustion-of-tls-slots.patch License: LGPL ## AUTOBUILDREQ-BEGIN -BuildRequires: libaudit-devel -BuildRequires: libcap-devel -BuildRequires: libgd-devel -BuildRequires: libpng-devel -BuildRequires: libselinux-devel -BuildRequires: libz-devel ## AUTOBUILDREQ-END BuildRequires: libidn-devel BuildRequires: binutils >= 2.13 @@ -135,9 +129,9 @@ BuildRequires: kernelsanitisedheaders BuildRequires: libpython3-devel BuildRequires: elfutils %endif -Requires(post): ldconfig = %{?epoch:%epoch:}%{version}-%{release} -Requires(post): glibc-utils = %{?epoch:%epoch:}%{version}-%{release} -Requires(post): glibc-common = %{?epoch:%epoch:}%{version}-%{release} +Requires: ldconfig = %{?epoch:%epoch:}%{version}-%{release} +Requires: glibc-common = %{?epoch:%epoch:}%{version}-%{release} +Requires: glibc-utils = %{?epoch:%epoch:}%{version}-%{release} Requires(pre): libxcrypt %systemd_requires @@ -222,7 +216,8 @@ Pregenerated locales for the GNU C Library. %package utils Summary: Development utilities from GNU C library Group: Development/Tools -Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} +Requires(post): %{name} = %{?epoch:%epoch:}%{version}-%{release} +Requires(post): glibc-common = %{?epoch:%epoch:}%{version}-%{release} %description utils The glibc-utils package contains memusage, a memory usage profiler, mtrace, a memory leak tracer and, a function call tracer which can be helpful during program debugging. @@ -409,9 +404,9 @@ _configure_flags=( #:<< __EOF # Build -rm -rf ../glibc-build -mkdir ../glibc-build -cd ../glibc-build +rm -rf ../glibc-build-%{_target_platform} +mkdir ../glibc-build-%{_target_platform} +cd ../glibc-build-%{_target_platform} export CFLAGS="$buildflags" export CXXFLAGS="$buildflags" @@ -460,9 +455,9 @@ make pdf html %if "%{?stage1}" != "1" %if "%{?stage2}" != "1" # Multilib -rm -rf ../glibc-multilib-build -mkdir ../glibc-multilib-build -cd ../glibc-multilib-build +rm -rf ../glibc-multilib-build-%{_target_platform} +mkdir ../glibc-multilib-build-%{_target_platform} +cd ../glibc-multilib-build-%{_target_platform} export CC="gcc -m32 -mstackrealign" export CXX="g++ -m32 -mstackrealign" @@ -502,7 +497,7 @@ _EOF %if "%{_target_platform}" == "%{_host}" # Multilib %ifarch x86_64 -%makeinstall -C ../glibc-multilib-build +%makeinstall -C ../glibc-multilib-build-%{_target_platform} cat > %{buildroot}%{_sysconfdir}/ld.so.conf.d/lib32-glibc.conf << _EOF /usr/lib32 _EOF @@ -511,7 +506,7 @@ ln -s ../lib/locale %{buildroot}/usr/lib32/locale %endif %endif -%makeinstall -C ../glibc-build +%makeinstall -C ../glibc-build-%{_target_platform} %if "%{_target_platform}" == "%{_build}" %ifarch aarch64 @@ -526,12 +521,12 @@ ln -s ../lib/locale %{buildroot}/usr/lib32/locale sed -e '1,3d' -e 's|/| |g' -e 's| \\||g' -e 's|^|#|g' \ localedata/SUPPORTED >> %{buildroot}%{_sysconfdir}/locale.gen sed -i '/#C\.UTF-8 /d' %{buildroot}%{_sysconfdir}/locale.gen - make localedata/install-locale-files -C ../glibc-build install_root=%{buildroot} + make localedata/install-locale-files -C ../glibc-build-%{_target_platform} install_root=%{buildroot} %else # WORKAROUND: worked up to 2.21 mkdir -p %{buildroot}%{_prefix}/lib/locale - make LOCALEDEF="I18NPATH=. LC_ALL=C localedef" localedata/install-locale-files -C ../glibc-build install_root=%{buildroot} + make LOCALEDEF="I18NPATH=. LC_ALL=C localedef" localedata/install-locale-files -C ../glibc-build-%{_target_platform} install_root=%{buildroot} install -d -m0755 %{buildroot}%{glibc_prefix}/lib/locale/ mv %{buildroot}%{_prefix}/lib/locale/* %{buildroot}%{glibc_prefix}/lib/locale/ %endif @@ -549,7 +544,7 @@ ln -s ../lib/locale %{buildroot}/usr/lib32/locale [-e %{buildroot}%{glibc_libdir}/libbsd-compat.a ] && ln -sf libbsd-compat.a %{buildroot}%{glibc_libdir}/libbsd.a %else # stage 1 - make -C ../glibc-build install-headers install_root=%{buildroot} cross-compiling=yes + make -C ../glibc-build-%{_target_platform} install-headers install_root=%{buildroot} cross-compiling=yes # the following files are generated during the glibc build. # Fortunately, it is sufficient to substitute empty files for a first stage gcc build touch %{buildroot}%{glibc_includedir}/gnu/stubs.h @@ -623,8 +618,8 @@ ln -s locale.h %{buildroot}%{_includedir}/xlocale.h #install api documentation %if %{build_doc} install -d %{buildroot}%{_docdir}/libc/html -cp -a ../glibc-build/manual/libc/* %{buildroot}%{_docdir}/libc/html/ -cp -a ../glibc-build/manual/libc.pdf %{buildroot}%{_docdir}/libc/ +cp -a ../glibc-build-%{_target_platform}/manual/libc/* %{buildroot}%{_docdir}/libc/html/ +cp -a ../glibc-build-%{_target_platform}/manual/libc.pdf %{buildroot}%{_docdir}/libc/ %endif %endif @@ -638,123 +633,24 @@ rm -rf %{buildroot}%{glibc_datadir}/zoneinfo %clean [ "%{buildroot}" != / ] && rm -rf %{buildroot} -%post +%post utils if [ $1 -ge 1 ]; then - cat > /tmp/migrate-libdirs.sh << _EOF -#!/bin/bash -d=\$1 -echo "Migrating /\$d.notmigrated/* to /usr/\$d..." -for f in \${d}.notmigrated/*; do - dest=/usr\${f/.notmigrated} - if [ -e \$dest ]; then - #echo "\$f exists as \$dest" - if [ -L \$f ]; then - linkdest=\`readlink \$f\` - #echo "\$f is a symlink to \$linkdest" - /usr/bin/rm -f \$f - elif [ -L \$dest ]; then - linkdest=\`readlink \$dest\` - #echo "\$dest is a symlink to \$linkdest" - /usr/bin/rm -f \$dest && mv \$f \$dest - else - #echo "\$f exists as a file also as \$linkdest" - if [ -d \${f} ]; then - # second level - for f1 in \${f}/*; do - dest=/usr\${f1/.notmigrated} - if [ -e \$dest ]; then - #echo "$f1 exists as $dest" - if [ -L \$f1 ]; then - linkdest=\`readlink \$f1\` - #echo "$f1 is a symlink to $linkdest" - /usr/bin/rm -f \$f1 - elif [ -L \$dest ]; then - linkdest=\`readlink \$dest\` - #echo "$dest is a symlink to $linkdest" - /usr/bin/rm -f \$dest && mv \$f1 \$dest - else - /usr/bin/rm -f \$f1 - fi - else - if [ -L \$f1 ]; then - linkdest=\`readlink \$f1\` - if [ "\${linkdest:0:3}" = "../" ]; then - fulllinkdest=\`readlink -f \$f1\` - #echo "$f1 is a symlink pointing to ../ -> fixing" - /usr/bin/ln -s \$fulllinkdest \$dest - /usr/bin/rm -f \$f1 - else - /usr/bin/mv \$f1 \$dest - fi - else - /usr/bin/mv \$f1 \$dest - fi - fi - [ -d \${f1} ] && /usr/bin/rmdir \${f1} - done - /usr/bin/rmdir \${f} - else - /usr/bin/rm -f \$f - fi - fi - else - if [ -L \$f ]; then - linkdest=\`readlink \$f\` - if [ "\${linkdest:0:3}" = "../" ]; then - fulllinkdest=\`readlink -f \$f\` - #echo "\$f is a symlink pointing to ../ -> fixing" - /usr/bin/ln -s \$fulllinkdest \$dest - /usr/bin/rm -f \$f - else - /usr/bin/mv \$f \$dest - fi - else - /usr/bin/mv \$f \$dest - fi - fi -done -/usr/bin/rmdir \${d}.notmigrated -_EOF -chmod +x /tmp/migrate-libdirs.sh + # update locale.gen to make sure current LANG locale is enabled + LOCALES=(`grep ${LANG/utf*/UTF-8} %{glibc_datadir}/i18n/SUPPORTED | awk '{ print $1 }'`); + for l in ${LOCALES[*]/\/*/}; do + sed -i "s|#${l}|${l}|" %{_sysconfdir}/locale.gen + done + # update locale-archive according to locale.gen + locale-gen fi - -# update locale.gen to make sure current LANG locale is enabled -LOCALES=(`grep ${LANG/utf*/UTF-8} %{glibc_datadir}/i18n/SUPPORTED | awk '{ print $1 }'`); -for l in ${LOCALES[*]/\/*/}; do - sed -i "s|#${l}|${l}|" %{_sysconfdir}/locale.gen -done -# update locale-archive according to locale.gen -locale-gen : -# Restore ld-linux loader after removing from /lib[64] to fix /usr/lib[64] migration -%triggerpostun -p -- glibc < 2.34-4mamba -local libdirs = { - [1] = "/lib64", - [2] = "/lib", -} -for i, l in ipairs(libdirs) do - stat_libdir = posix.stat(l) - if stat_libdir ~= nil then - if stat_libdir.mode ~= "rwxrwxrwx" then - -- lib dir exists and is not already a symlink - -- Check that old glibc has been cleaned in this dir (or fails on multilib glibc on x86_64) - stat_check_cleaned = posix.stat(l .. "/libc.so.6") - if stat_check_cleaned == nil then - -- All seems ok to migrate - print("Migrating " .. l .. " to /usr" .. l .. "..") - os.rename(l, l .. ".notmigrated") - posix.symlink("usr" .. l,l) - local pid = posix.fork() - if pid == 0 then - posix.exec("/tmp/migrate-libdirs.sh", l) - elseif pid > 0 then - posix.wait(pid) - end - end - end - end -end +%posttrans utils +if [ $1 -ge 1 ]; then + # Regenerated locale-archive if it has been deleted by a old glibc + [ -e /usr/lib/locale/locale-archive ] || locale-gen +fi +: %ifarch x86_64 %transfiletriggerin -n ldconfig -P 2000000 -- %{_libdir} %{_prefix}/lib @@ -967,6 +863,9 @@ fi %endif %changelog +* Sun Oct 13 2024 Silvan Calarco 2.40-4mamba +- move locale.gen configuration from glibc to glibc-utils to fix some upgrade failures cases + * Fri Oct 11 2024 Silvan Calarco 2.40-3mamba - provide locale-gen and /etc/locale.gen mechanism to generate /usr/lib/locale-archive - provide C.utf8 as always preinstalled locale