summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas K. Hüttel <dilfridge@gentoo.org>2020-05-13 10:56:28 +0300
committerAndreas K. Hüttel <dilfridge@gentoo.org>2020-05-13 11:03:56 +0300
commitfbd0918c2d6531cafeab6eb83d0a45dab997f8fb (patch)
treeb32de69cfdb6da83e869c38c19ac7068b5390a93
downloadglibc-patches-fbd0918c2d6531cafeab6eb83d0a45dab997f8fb.tar.gz
glibc-patches-fbd0918c2d6531cafeab6eb83d0a45dab997f8fb.tar.bz2
glibc-patches-fbd0918c2d6531cafeab6eb83d0a45dab997f8fb.zip
Copy exact files from glibc repo, tag gentoo/glibc-9999-17
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
-rw-r--r--9999/0001-Gentoo-disable-ldconfig-during-install.patch31
-rw-r--r--9999/0002-Gentoo-support-running-tests-under-sandbox.patch67
-rw-r--r--9999/0003-no-patch-Gentoo-Add-support-files.patch962
-rw-r--r--9999/0004-Revert-sysdeps-posix-getaddrinfo.c-gaih_inet-Only-us.patch41
-rw-r--r--9999/0005-Gentoo-disable-tests-that-fail-only-in-sandbox.patch144
-rw-r--r--9999/0006-Gentoo-Disable-test-that-fails-because-of-the-gethos.patch25
-rw-r--r--9999/0007-Gentoo-Adapt-to-Gentoo-specific-etc-mail-aliases.patch32
-rw-r--r--9999/0008-Gentoo-Add-a-C.UTF-8-locale.patch287
-rw-r--r--9999/0009-Gentoo-force-O0-in-conform-tests-to-survive-CC-chang.patch66
-rw-r--r--9999/0010-Gentoo-Adapt-tests-to-etc-mail-alias-location.patch89
-rw-r--r--9999/0011-no-patch-Gentoo-remove-locale-gen-from-repo-packaged.patch684
-rw-r--r--9999/0012-no-patch-Gentoo-remove-etc-files-now-in-FILESDIR.patch141
-rw-r--r--README.Gentoo.patches26
-rwxr-xr-xmake-tarball.sh107
14 files changed, 2702 insertions, 0 deletions
diff --git a/9999/0001-Gentoo-disable-ldconfig-during-install.patch b/9999/0001-Gentoo-disable-ldconfig-during-install.patch
new file mode 100644
index 0000000..c5595aa
--- /dev/null
+++ b/9999/0001-Gentoo-disable-ldconfig-during-install.patch
@@ -0,0 +1,31 @@
+From c42be799cdc293c6f454e26124f30f87d9bb69a9 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Wed, 1 Apr 2009 02:15:48 -0400
+Subject: [PATCH 01/12] Gentoo: disable ldconfig during install
+
+Do not bother running ldconfig on DESTDIR. It's a waste of time as we
+won't use the result (portage will rebuild the cache after install).
+Also, the Gentoo sandbox does not currently catch chroot() behavior so
+we end up (incorrectly) flagging it as a violation as a write to /etc.
+
+http://sourceware.org/ml/libc-alpha/2012-08/msg00118.html
+https://bugs.gentoo.org/431038
+---
+ Makefile | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/Makefile b/Makefile
+index 8f0a93aceb..7c3887d5c4 100644
+--- a/Makefile
++++ b/Makefile
+@@ -116,6 +116,7 @@ install-symbolic-link: subdir_install
+ rm -f $(symbolic-link-list)
+
+ install:
++dont-bother-with-destdir:
+ -test ! -x $(elf-objpfx)ldconfig || LC_ALL=C \
+ $(elf-objpfx)ldconfig $(addprefix -r ,$(install_root)) \
+ $(slibdir) $(libdir)
+--
+2.26.2
+
diff --git a/9999/0002-Gentoo-support-running-tests-under-sandbox.patch b/9999/0002-Gentoo-support-running-tests-under-sandbox.patch
new file mode 100644
index 0000000..1bc7be2
--- /dev/null
+++ b/9999/0002-Gentoo-support-running-tests-under-sandbox.patch
@@ -0,0 +1,67 @@
+From a4ec232302f8b30f6fc7eb7a53aadf99b3fad312 Mon Sep 17 00:00:00 2001
+From: "Stephanie J. Lockwood-Childs" <wormo@gentoo.org>
+Date: Tue, 13 Mar 2007 01:57:21 -0400
+Subject: [PATCH 02/12] Gentoo: support running tests under sandbox
+
+when glibc runs its tests, it does so by invoking the local library loader.
+in Gentoo, we build/run inside of our "sandbox" which itself is linked against
+libdl (so that it can load libraries and pull out symbols). the trouble
+is that when you upgrade from an older glibc to the new one, often times
+internal symbols change name or abi. this is normally OK as you cannot use
+libc.so from say version 2.3.6 but libpthread.so from say version 2.5, so
+we always say "keep all of the glibc libraries from the same build". but
+when glibc runs its tests, it uses dynamic paths to point to its new local
+copies of libraries. if the test doesnt use libdl, then glibc doesnt add
+its path, and when sandbox triggers the loading of libdl, glibc does so
+from the host system system. this gets us into the case of all libraries
+are from the locally compiled version of glibc except for libdl.so.
+
+http://bugs.gentoo.org/56898
+---
+ Makeconfig | 2 +-
+ iconvdata/run-iconv-test.sh | 2 +-
+ nptl/tst-tls6.sh | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/Makeconfig b/Makeconfig
+index f252842979..5076902c87 100644
+--- a/Makeconfig
++++ b/Makeconfig
+@@ -728,7 +728,7 @@ comma = ,
+ sysdep-library-path = \
+ $(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
+ $(filter -Wl$(comma)-rpath-link=%,\
+- $(sysdep-LDFLAGS)))))
++ $(sysdep-LDFLAGS)))) $(common-objpfx)/dlfcn)
+ # $(run-via-rtld-prefix) is a command that, when prepended to the name
+ # of a program built with the newly built library, produces a command
+ # that, executed on the host for which the library is built, runs that
+diff --git a/iconvdata/run-iconv-test.sh b/iconvdata/run-iconv-test.sh
+index 56b6630a6d..be74dbf302 100755
+--- a/iconvdata/run-iconv-test.sh
++++ b/iconvdata/run-iconv-test.sh
+@@ -31,7 +31,7 @@ temp2=$codir/iconvdata/iconv-test.yyy
+ trap "rm -f $temp1 $temp2" 1 2 3 15
+
+ # We have to have some directories in the library path.
+-LIBPATH=$codir:$codir/iconvdata
++LIBPATH=$codir:$codir/iconvdata:$codir/dlfcn
+
+ # How the start the iconv(1) program.
+ ICONV='$codir/elf/ld.so --library-path $LIBPATH --inhibit-rpath ${from}.so \
+diff --git a/nptl/tst-tls6.sh b/nptl/tst-tls6.sh
+index e6dc20572a..a25b167b2d 100755
+--- a/nptl/tst-tls6.sh
++++ b/nptl/tst-tls6.sh
+@@ -26,7 +26,7 @@ run_program_env=$1; shift
+ logfile=$common_objpfx/nptl/tst-tls6.out
+
+ # We have to find libc and nptl
+-library_path=${common_objpfx}:${common_objpfx}nptl
++library_path=${common_objpfx}:${common_objpfx}nptl:${common_objpfx}/dlfcn
+ tst_tls5="${test_via_rtld_prefix} ${common_objpfx}/nptl/tst-tls5"
+
+ > $logfile
+--
+2.26.2
+
diff --git a/9999/0003-no-patch-Gentoo-Add-support-files.patch b/9999/0003-no-patch-Gentoo-Add-support-files.patch
new file mode 100644
index 0000000..da110ea
--- /dev/null
+++ b/9999/0003-no-patch-Gentoo-Add-support-files.patch
@@ -0,0 +1,962 @@
+From 4b65799eb71b3715f2b283d49eb253d756a326f4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
+Date: Wed, 23 Aug 2017 13:26:49 +0200
+Subject: [PATCH 03/12] [no-patch] Gentoo: Add support files
+
+* Source: https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/extra/
+* The make-tarball script has been completely rewritten to work with git.
+* The c-stubs addon has been dropped since the addon mechanism is gone.
+* Updates to the nscd init script, see Gentoo bug 492814
+* Make patchset generation script also work with master
+* locale-gen: suppress ignored error when emptying already empty directory, bug 647188
+---
+ scripts/gentoo/README.Gentoo.patches | 26 ++
+ scripts/gentoo/extra/README | 5 +
+ scripts/gentoo/extra/etc/host.conf | 24 ++
+ scripts/gentoo/extra/etc/nscd | 85 +++++
+ scripts/gentoo/extra/locale/locale-gen | 444 +++++++++++++++++++++++
+ scripts/gentoo/extra/locale/locale-gen.8 | 69 ++++
+ scripts/gentoo/extra/locale/locale.gen | 36 ++
+ scripts/gentoo/extra/locale/locale.gen.5 | 77 ++++
+ scripts/gentoo/make-tarball.sh | 107 ++++++
+ 9 files changed, 873 insertions(+)
+ create mode 100644 scripts/gentoo/README.Gentoo.patches
+ create mode 100644 scripts/gentoo/extra/README
+ create mode 100644 scripts/gentoo/extra/etc/host.conf
+ create mode 100644 scripts/gentoo/extra/etc/nscd
+ create mode 100755 scripts/gentoo/extra/locale/locale-gen
+ create mode 100644 scripts/gentoo/extra/locale/locale-gen.8
+ create mode 100644 scripts/gentoo/extra/locale/locale.gen
+ create mode 100644 scripts/gentoo/extra/locale/locale.gen.5
+ create mode 100755 scripts/gentoo/make-tarball.sh
+
+diff --git a/scripts/gentoo/README.Gentoo.patches b/scripts/gentoo/README.Gentoo.patches
+new file mode 100644
+index 0000000000..c6f94dc863
+--- /dev/null
++++ b/scripts/gentoo/README.Gentoo.patches
+@@ -0,0 +1,26 @@
++ ============
++ === What ===
++ ============
++
++Gentoo patchsets for glibc are maintained as vendor branches of the upstream
++glibc git repository. From there, we bundle all the commits into a tarball
++and distribute it via our public mirroring system.
++
++If you want specific info about a patch (like what it does or whose great idea
++it was to change the code), read the patch! We try to fill out the commit
++messages with useful info such as what it does, why it's needed, bug reports,
++original creators, etc...
++
++ =============
++ === Where ===
++ =============
++
++Currently, https://github.com/gentoo/glibc
++
++ ===========
++ === How ===
++ ===========
++
++Patches are named exactly as generated by "git format-patch".
++All patches thus apply with -p1 (so they can be used both with the legacy
++epatch function and the new, more strict eapply function).
+diff --git a/scripts/gentoo/extra/README b/scripts/gentoo/extra/README
+new file mode 100644
+index 0000000000..1942999684
+--- /dev/null
++++ b/scripts/gentoo/extra/README
+@@ -0,0 +1,5 @@
++What is all this you may wonder.
++
++locale/
++ a port/rewrite of Debian's locale-gen. see the man pages in the
++ subdir for more information.
+diff --git a/scripts/gentoo/extra/etc/host.conf b/scripts/gentoo/extra/etc/host.conf
+new file mode 100644
+index 0000000000..4c58e52d6b
+--- /dev/null
++++ b/scripts/gentoo/extra/etc/host.conf
+@@ -0,0 +1,24 @@
++# /etc/host.conf:
++# $Header: /var/cvsroot/gentoo/src/patchsets/glibc/extra/etc/host.conf,v 1.1 2006/09/29 23:52:23 vapier Exp $
++
++# The file /etc/host.conf contains configuration information specific to
++# the resolver library. It should contain one configuration keyword per
++# line, followed by appropriate configuration information. The keywords
++# recognized are order, trim, mdns, multi, nospoof, spoof, and reorder.
++
++
++
++# This keyword specifies how host lookups are to be performed. It
++# should be followed by one or more lookup methods, separated by
++# commas. Valid methods are bind, hosts, and nis.
++#
++order hosts, bind
++
++
++# Valid values are on and off. If set to on, the resolv+ library
++# will return all valid addresses for a host that appears in the
++# /etc/hosts file, instead of only the first. This is off by
++# default, as it may cause a substantial performance loss at sites
++# with large hosts files.
++#
++multi off
+diff --git a/scripts/gentoo/extra/etc/nscd b/scripts/gentoo/extra/etc/nscd
+new file mode 100644
+index 0000000000..abe31f892d
+--- /dev/null
++++ b/scripts/gentoo/extra/etc/nscd
+@@ -0,0 +1,85 @@
++#!/sbin/openrc-run
++# Copyright 1999-2017 Gentoo Foundation
++# Distributed under the terms of the GNU General Public License v2
++
++description="The 'Name Service Cache Daemon' is a daemon that provides a cache"
++description="${description} for the most common name service requests"
++
++extra_started_commands="flush_all flush_hosts flush_group flush_passwd flush_netgroup flush_services"
++
++description_flush_all="Will invalidate hosts, group, passwd, netgroup and services cache"
++description_flush_hosts="Will invalidate hosts cache"
++description_flush_group="Will invalidate group cache"
++description_flush_passwd="Will invalidate passwd cache"
++description_flush_netgroup="Will invalidate netgroup cache"
++description_flush_services="Will invalidate services cache"
++
++pidfile="/run/nscd/nscd.pid"
++command="/usr/sbin/nscd"
++
++depend() {
++ use dns ldap net slapd logger
++}
++
++checkconfig() {
++ if [ ! -d /run/nscd ] ; then
++ checkpath -d -m 755 /run/nscd
++ fi
++
++ if [ -z "${NSCD_PERMS_OK}" ] && [ "$(stat -c %a /run/nscd)" != "755" ] ; then
++ ewarn "nscd run dir is not world readable, you should reset the perms:"
++ ewarn "chmod 755 /run/nscd"
++ ewarn "chmod a+rw /run/nscd/socket"
++ ewarn "To disable this warning, set 'NSCD_PERMS_OK' in /etc/conf.d/nscd"
++ fi
++
++ if grep -qs '^[[:space:]]*persistent\>' /etc/nscd.conf ; then
++ checkpath -d -m 700 /var/db/nscd
++ fi
++}
++
++_flush() {
++ local table=$1
++
++ ebegin "Flushing ${table} table"
++ ${command} --invalidate ${table}
++ eend $?
++}
++
++flush_all() {
++ local has_errors=0
++
++ ebegin "Flushing all caches"
++
++ local table=
++ for table in passwd group hosts netgroup services; do
++ ${command} --invalidate ${table}
++ [ $? -ne 0 ] && has_errors=1
++ done
++
++ eend ${has_errors}
++}
++
++flush_hosts() {
++ _flush hosts
++}
++
++flush_group() {
++ _flush group
++}
++
++flush_passwd() {
++ _flush passwd
++}
++
++flush_netgroup() {
++ _flush netgroup
++}
++
++flush_services() {
++ _flush services
++}
++
++start_pre() {
++ checkconfig
++}
+diff --git a/scripts/gentoo/extra/locale/locale-gen b/scripts/gentoo/extra/locale/locale-gen
+new file mode 100755
+index 0000000000..8afb5d1a68
+--- /dev/null
++++ b/scripts/gentoo/extra/locale/locale-gen
+@@ -0,0 +1,444 @@
++#!/bin/bash
++
++#
++# Based upon Debian's locale-gen, fetched from glibc_2.3.6-7.diff.gz
++#
++
++unset POSIXLY_CORRECT IFS
++umask 0022
++
++argv0=${0##*/}
++
++EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
++if [[ ${EPREFIX} == "@"GENTOO_PORTAGE_EPREFIX"@" ]] ; then
++ EPREFIX=""
++fi
++
++FUNCTIONS_SH="/lib/gentoo/functions.sh"
++source "${EPREFIX}"${FUNCTIONS_SH} || {
++ echo "${argv0}: Could not source ${FUNCTIONS_SH}!" 1>&2
++ exit 1
++}
++
++COMPILED_LOCALES=""
++
++show_usage() {
++ cat <<-EOF
++ Usage: ${HILITE}${argv0}${NORMAL} ${GOOD}[options]${NORMAL} -- ${GOOD}[localedef options]${NORMAL}
++
++ Generate locales based upon the config file /etc/locale.gen.
++
++ ${HILITE}Options:${NORMAL}
++ ${GOOD}-k, --keep${NORMAL} Don't nuke existing locales
++ ${GOOD}-d, --destdir <dir>${NORMAL} Use locale data in specified DESTDIR tree
++ ${GOOD}-c, --config <config>${NORMAL} Use specified config instead of default locale.gen
++ ${GOOD}-l, --list${NORMAL} List all the locales to be generated
++ ${GOOD}-a, --ask${NORMAL} Ask before generating each locale
++ ${GOOD}-A, --all${NORMAL} Pretend the locale list contains all locales
++ ${GOOD}-u, --update${NORMAL} Only generate locales that are missing
++ ${GOOD}-G, --generate <locale>${NORMAL} Generate specified locale (one shot; implies -k -u)
++ ${GOOD}-j, --jobs <num>${NORMAL} Number of locales to generate at a time (parallel)
++ ${GOOD}-q, --quiet${NORMAL} Only show errors
++ ${GOOD}-V, --version${NORMAL} Meaningless version information
++ ${GOOD}-h, --help${NORMAL} Show this help cruft
++
++ ${HILITE}Localedef Options:${NORMAL}
++ By default, ${GOOD}${LOCALEDEF_OPTS}${NORMAL} is passed to localedef.
++
++ For more info, see the ${HILITE}locale-gen${NORMAL}(1) and ${HILITE}locale.gen${NORMAL}(8) manpages.
++ EOF
++ [[ $# -eq 0 ]] && exit 0
++ echo ""
++ eerror "Unknown option '$1'"
++ exit 1
++}
++show_version() {
++ local b="(" a=")"
++ local cvsver="$Revision: 1.42 $b $Date: 2017/08/12 16:30:06 $a"
++ echo "locale-gen-${cvsver//: }"
++ exit 0
++}
++
++
++
++LOCALEDEF_OPTS=""
++KEEP=""
++DESTDIR=""
++CONFIG=""
++JUST_LIST=""
++ASK=""
++ALL=""
++UPDATE=""
++GENERATE=""
++JOBS_MAX=""
++QUIET=0
++SET_X=""
++LOCALE_ARCHIVE=true
++CUTF_ADDED=""
++INPLACE_GLIBC=""
++while [[ $# -gt 0 ]] ; do
++ case $1 in
++ --inplace-glibc) INPLACE_GLIBC=$1;;
++ -k|--keep|--keep-existing) KEEP=$1;;
++ -d|--destdir) shift; DESTDIR=$1; unset ROOT;;
++ -c|--config) shift; CONFIG=$1;;
++ -l|--list) JUST_LIST=$1;;
++ -a|--ask) ASK=$1;;
++ -A|--all) ALL=$1;;
++ -u|--update) UPDATE=$1;;
++ -G|--generate) shift; GENERATE=$1;;
++ -j|--jobs) shift; JOBS_MAX=$(( $1 ));;
++ -j*) : $(( JOBS_MAX = ${1#-j} ));;
++ -q|--quiet) : $(( ++QUIET ));;
++ -x|--debug) SET_X="true";;
++ -V|--version) show_version;;
++ -h|--help) show_usage;;
++ --) shift; LOCALEDEF_OPTS=$*; break;;
++ *) show_usage $1;;
++ esac
++ shift
++done
++
++if [[ -n ${COMPILED_LOCALES} ]] ; then
++ ewarn "All locales have been installed and registered by the package manager. If you"
++ ewarn "rebuild the locale archive now, file integrity tools may show it as corrupted."
++ ewarn "This is not really a big problem, but a better solution is to disable"
++ ewarn "USE=compile-locales and re-install glibc if you dont need all locales."
++ echo
++fi
++
++if [[ -z ${JOBS_MAX} ]] ; then
++ JOBS_MAX=$(getconf _NPROCESSORS_ONLN 2>/dev/null)
++ : ${JOBS_MAX:=1}
++fi
++[[ ${JOBS_MAX} -lt 1 ]] && JOBS_MAX=1
++[[ -n ${SET_X} ]] && set -x
++: ${KEEP:=${JUST_LIST}}
++[[ -n ${GENERATE} ]] && UPDATE="true" && KEEP="true"
++
++: ${ROOT:=/}
++ROOT="${ROOT%/}/"
++if [[ -n ${DESTDIR} ]] && [[ ${ROOT} != "/" ]] ; then
++ eerror "DESTDIR and ROOT are mutually exclusive options"
++ exit 1
++fi
++: ${EROOT:="${ROOT%/}${EPREFIX}/"}
++if [[ ${EROOT} != "/" ]] ; then
++ einfo "Using locale.gen from ROOT ${EROOT}etc/"
++fi
++if [[ -n ${DESTDIR} ]] ; then
++ einfo "Building locales in DESTDIR '${DESTDIR}'"
++else
++ DESTDIR=${EROOT}
++fi
++
++# XXX: should fix this ...
++if [[ ${ROOT} != "/" ]] ; then
++ eerror "Sorry, but ROOT support is incomplete at this time."
++ exit 0
++fi
++
++: ${CONFIG:=${EROOT}etc/locale.gen}
++LOCALES=${DESTDIR}usr/share/i18n/locales
++CHARMAPS=${DESTDIR}usr/share/i18n/charmaps
++SUPPORTED=${DESTDIR}usr/share/i18n/SUPPORTED
++ALIAS=${DESTDIR}usr/share/locale/locale.alias
++
++#
++# Grab any user options in their config file
++options=$(sed -n \
++ -e '/^[[:space:]]*#%/s:^[[:space:]]*#%[[:space:]]*::p'\
++ "${CONFIG}" 2>/dev/null
++)
++IFS=$'\n'
++for option in ${options} ; do
++ case ${option} in
++ no-locale-archive)
++ LOCALE_ARCHIVE=false
++ ;;
++ *)
++ ewarn "Unrecognized option '${option}'"
++ ;;
++ esac
++done
++unset IFS
++
++[[ -n ${ALL} ]] && CONFIG=${SUPPORTED}
++
++# Extract the location of the locale dir on the fly as `localedef --help` has:
++# locale path : /usr/lib64/locale:/usr/share/i18n
++# For long paths, the line may get wrapped into two, in which case space (' ') is replaced
++# by newline (\n).
++LOCALEDIR=$(LC_ALL="C" "${DESTDIR}"usr/bin/localedef --help | sed -n -r '/locale path/{N;s|.*:[ \n](.*):/.*|\1|;p}')
++LOCALEDIR="${DESTDIR}${LOCALEDIR#${EPREFIX}}"
++if [[ $? -ne 0 ]] || [[ -z ${LOCALEDIR} ]] || [[ ${LOCALEDIR} != ${DESTDIR}/usr/lib*/locale ]] ; then
++ eerror "Unable to parse the output of your localedef utility." 1>&2
++ eerror "File a bug about this issue and include the output of 'localedef --help'." 1>&2
++ exit 1
++fi
++
++# Only generate locales the user specified before falling back to the config.
++locales_to_generate=${GENERATE}
++
++if [[ -z ${locales_to_generate} ]] && [[ -e ${CONFIG} ]] ; then
++ locales_to_generate=$(sed \
++ -e 's:#.*::' \
++ -e '/^[[:space:]]*$/d' \
++ "${CONFIG}" | sort)
++ # Sanity check to make sure people did not duplicate entries. #550884
++ # The first column must be unique specifically. #235555
++ dup_locales_to_generate=$(
++ echo "${locales_to_generate}" | \
++ awk '{ if ($1 == last) { print lastline; print; } else { lastline = $0; last = $1; } }')
++ if [[ -n ${dup_locales_to_generate} ]] ; then
++ ewarn "These locales have been duplicated in your config:\n${dup_locales_to_generate}"
++ ewarn "Some might be filtered, but you must fix it."
++ locales_to_generate=$(echo "${locales_to_generate}" | uniq)
++ fi
++
++ if echo ${locales_to_generate} | grep -vq 'C.UTF-8' ; then
++ if [[ -z ${locales_to_generate} ]] ; then
++ locales_to_generate='C.UTF-8 UTF-8'
++ else
++ locales_to_generate=$(echo "${locales_to_generate}" ; echo -n 'C.UTF-8 UTF-8')
++ fi
++ CUTF_ADDED="true"
++ fi
++fi
++
++if [[ -z ${locales_to_generate} ]] ; then
++ [[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
++ ewarn "No locales found, keeping locale archive"
++ exit 0
++fi
++
++if [[ ${locales_to_generate} == "C.UTF-8 UTF-8" ]] && [[ -n ${CUTF_ADDED} ]] ; then
++ [[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
++ ewarn "No locales found, keeping locale archive"
++ exit 0
++fi
++
++mkdir -p "${LOCALEDIR}"
++if [[ -z ${KEEP} && -z ${UPDATE} ]] ; then
++ # Remove all old locale dir and locale-archive before generating new
++ # locale data. Scrubbing via update is done elsewhere.
++ rm -rf "${LOCALEDIR}"/* &> /dev/null || true
++fi
++
++# Transform the name in locales.gen to the name used when storing
++# the locale data in /usr/lib/locale/ ... this normalize algo is
++# taken out of the glibc localedef source code ...
++normalize() {
++ if [[ $1 == *.* ]] ; then
++ local ret=$(echo ${1##*.} | tr '[[:upper:]]' '[[:lower:]]')
++ echo ${1%%.*}.${ret//-}
++ else
++ echo $1
++ fi
++}
++
++# These funky sed's are based on the stuff in glibc's localedata/Makefile
++# Basically we want to rewrite the display like so:
++# <locale without a . or @>.<charmap>[@extra stuff after the @ in the locale]
++# en_US ISO-8859-1 -> en_US.ISO-8859-1
++# en_US.UTF-8 UTF-8 -> en_US.UTF-8
++# de_DE@euro ISO-8859-15 -> de_DE.ISO-8859-15@euro
++locales_disp=$(echo "${locales_to_generate}" | sed \
++ -e ' /@/ s:[[:space:]]*\([^@[:space:]]*\)\([^[:space:]]*\)[[:space:]]\+\([^[:space:]]*\):\1.\3\2:' \
++ -e '/^[^@]*$/s:[[:space:]]*\([^.[:space:]]*\)\([^[:space:]]*\)[[:space:]]\+\([^[:space:]]*\):\1.\3:')
++
++eval declare -a locales_disp=(${locales_disp})
++eval declare -a locales_to_generate=(${locales_to_generate})
++total=$(( ${#locales_to_generate[*]} / 2 ))
++
++[[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
++einfo "Generating ${total} locales (this might take a while) with ${JOBS_MAX} jobs"
++
++if [[ -n ${UPDATE} ]] ; then
++ # normalize newlines into spaces
++ existing_locales=" $(echo $(locale -a 2>/dev/null)) "
++fi
++
++generate_locale() {
++ local output=""
++
++ if [[ -z ${ASK} ]] && [[ ${QUIET} -eq 0 ]] ; then
++ output=" (${cnt_fmt}/${total}) Generating ${disp}"
++ fi
++
++ if [[ $(( JOB_IDX_E - JOB_IDX_S )) == ${JOBS_MAX} ]] ; then
++ wait ${JOB_PIDS[$(( JOB_IDX_S++ ))]}
++ JOB_RETS+=( $? )
++ fi
++ (
++ # Accumulate all the output in one go so the parallel
++ # jobs don't tromp on each other
++ x=$(
++ [[ -n ${output} ]] && ebegin "${output}"
++ # In most cases, localedef can just use the system glibc.
++ # However, if we are within a major glibc upgrade, this may fail
++ # in src_* phases since the new localedef links against the new
++ # glibc, but the new glibc is not installed yet...
++ if [[ -z ${INPLACE_GLIBC} ]] ; then
++ "${DESTDIR}"usr/bin/localedef ${LOCALEDEF_OPTS} \
++ --no-archive \
++ -i "${input}" \
++ -f "${charmap}" \
++ -A "${ALIAS}" \
++ --prefix "${DESTDIR%${EPREFIX}/}/" \
++ "${locale}" 2>&1
++ else
++ # We assume that the current directory is "${ED}"/$(get_libdir),
++ # see the glibc ebuild, function glibc_sanity_check(), for why.
++ LC_ALL=C ./ld-*.so --library-path . \
++ "${DESTDIR}"usr/bin/localedef ${LOCALEDEF_OPTS} \
++ --no-archive \
++ -i "${input}" \
++ -f "${charmap}" \
++ -A "${ALIAS}" \
++ --prefix "${DESTDIR%${EPREFIX}/}/" \
++ "${locale}" 2>&1
++ fi
++ ret=$?
++ [[ -n ${output} ]] && eend ${ret}
++ exit ${ret}
++ )
++ ret=$?
++ if [[ -n ${output} ]] ; then
++ echo "${x}"
++ elif [[ ${ret} -ne 0 ]] ; then
++ eerror "${disp}: ${x}"
++ fi
++ exit ${ret}
++ ) &
++ JOB_PIDS+=( $! )
++ : $(( ++JOB_IDX_E ))
++
++ if [[ ${ret} != 0 && ${locale} == */* ]] ; then
++ ewarn "Perhaps you meant to use a space instead of a / in your config file ?"
++ fi
++}
++
++JOB_PIDS=()
++JOB_RETS=()
++JOB_IDX_S=0
++JOB_IDX_E=0
++cnt=0
++lidx=0
++while [[ -n ${locales_to_generate[${lidx}]} ]] ; do
++ : $(( ++cnt ))
++ locale=${locales_to_generate[$((lidx++))]}
++ charmap=${locales_to_generate[$((lidx++))]}
++
++ # XXX: if we wanted to, we could check existence of
++ # ${LOCALES}/${locale} and ${CHARMAPS}/${charmap}
++ # this would fail for things like "en_US.UTF8", but
++ # in that case we could fall back to checking the
++ # SUPPORTED file ... then again, the localedef
++ # below will abort nicely for us ...
++ if [[ -z ${locale} || -z ${charmap} ]] ; then
++ eerror "Bad entry in locale.gen: '${locale} ${charmap}'; skipping"
++ continue
++ fi
++
++ disp=${locales_disp[$(( cnt - 1 ))]}
++
++ if [[ -n ${UPDATE} ]] ; then
++ normalized_locale=$(normalize ${locale})
++ if [[ ${existing_locales} == *" ${normalized_locale} "* ]] ; then
++ existing_locales=${existing_locales/ ${normalized_locale} / }
++ if [[ ${QUIET} -eq 0 ]] ; then
++ cnt_fmt=$(printf "%${#total}i" ${cnt})
++ einfo " (${cnt_fmt}/${total}) Skipping ${disp}"
++ fi
++ continue
++ fi
++ fi
++
++ # If the locale is like 'en_US.UTF8', then we really want 'en_US'
++ if [[ -f ${LOCALES}/${locale} ]] ; then
++ input=${locale}
++ else
++ input=${locale%%.*}
++ fi
++
++ if [[ -z ${JUST_LIST} ]] ; then
++ # Format the output for the question/status
++ cnt_fmt=$(printf "%${#total}i" ${cnt})
++ if [[ -n ${ASK} ]] ; then
++ einfon " (${cnt_fmt}/${total}) Generate ${disp} ? (Y/n) "
++ read user_answer
++ [[ ${user_answer} == [nN]* ]] && continue
++ fi
++ generate_locale
++ else
++ echo "${disp}"
++ fi
++done
++
++for (( i = JOB_IDX_S; i < JOB_IDX_E; ++i )) ; do
++ wait ${JOB_PIDS[i]}
++ JOB_RETS+=( $? )
++done
++ret=$(( 0 ${JOB_RETS[@]/#/+} ))
++
++[[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
++einfo "Generation complete"
++
++if ${LOCALE_ARCHIVE} && [[ -z ${JUST_LIST} ]] ; then
++ ebegin "Adding locales to archive"
++ # The pattern ends with / on purpose: we don't care about files (like
++ # locale-archive) in the locale subdir, and we definitely don't want to
++ # delete them!
++ for LOC in "${LOCALEDIR}"/*/; do
++ LOC=${LOC%/} # Strip trailing /, since localedef doesn't like it
++ x=$(
++ # In most cases, localedef can just use the system glibc.
++ # However, if we are within a major glibc upgrade, this may fail
++ # in src_* phases since the new localedef links against the new
++ # glibc, but the new glibc is not installed yet...
++ if [[ -z ${INPLACE_GLIBC} ]] ; then
++ "${DESTDIR}"usr/bin/localedef \
++ --add-to-archive "${LOC}" \
++ --replace \
++ --prefix "${DESTDIR%${EPREFIX}/}/"
++ else
++ # We assume that the current directory is "${ED}"/$(get_libdir),
++ # see the glibc ebuild, function glibc_sanity_check(), for why.
++ LC_ALL=C ./ld-*.so --library-path . \
++ "${DESTDIR}"usr/bin/localedef \
++ --add-to-archive "${LOC}" \
++ --replace \
++ --prefix "${DESTDIR%${EPREFIX}/}/"
++ fi
++ ret=$?
++ if [[ -n ${output} ]] ; then
++ echo "${x}"
++ elif [[ ${ret} -ne 0 ]] ; then
++ eerror "${disp}: ${x}"
++ fi
++ if [[ $ret -eq 0 ]]; then
++ rm -r "${LOC}"
++ fi
++ exit ${ret}
++ )
++ done
++ eend $ret
++fi
++
++# Remove locales that existed but were not requested
++if [[ -n ${UPDATE} ]] && [[ -z ${JUST_LIST} ]] ; then
++ # Ignore these pseudo locales
++ existing_locales=${existing_locales/ C / }
++ existing_locales=${existing_locales/ POSIX / }
++ if [[ -n ${existing_locales// } ]] ; then
++ if [[ -z ${KEEP} ]] ; then
++ [[ ${QUIET} -eq 0 ]] && einfo "Scrubbing old locales:"${existing_locales}
++ cd "${LOCALEDIR}" && rm -rf ${existing_locales}
++ else
++ [[ ${QUIET} -eq 0 ]] && einfo "Keeping old locales:"${existing_locales}
++ fi
++ fi
++fi
++
++exit ${ret}
+diff --git a/scripts/gentoo/extra/locale/locale-gen.8 b/scripts/gentoo/extra/locale/locale-gen.8
+new file mode 100644
+index 0000000000..a194be742c
+--- /dev/null
++++ b/scripts/gentoo/extra/locale/locale-gen.8
+@@ -0,0 +1,69 @@
++.TH "locale-gen" "8" "Aug 2007" "Gentoo"
++.SH "NAME"
++locale\-gen \- generate locales on the fly
++.SH "DESCRIPTION"
++The locale\-gen utility is used to manage locales on your system. Often times
++it merely generates a user configurable list of locales, but it can be used to
++generate a few locales on the fly as needed.
++
++Normally all locales would be generated at build time, but this leads to waste
++of disk and time as many users really just want a handful on their system.
++.SH "OPTIONS"
++.TP
++\fB\-a\fR, \fB\-\-ask\fR
++Ask before generating each locale
++.TP
++\fB\-A\fR, \fB\-\-all\fR
++Generate all possible locales
++.TP
++\fB\-c\fR, \fB\-\-config\fR \fI<config>\fR
++Use specified \fIconfig\fR file rather than default /etc/locale.gen
++.TP
++\fB\-d\fR, \fB\-\-destdir\fR \fI<dir>\fR
++Look for locale definitions and store generated locale data in the specified
++\fIdirectory\fR
++.TP
++\fB\-G\fR, \fB\-\-generate\fR \fI<locale>\fR
++Only generate the specified \fIlocale\fR (implies \-\-keep \-\-update);
++format of \fIlocale\fR matches a single line in the \fBlocale.gen\fR(5)
++config file
++.TP
++\fB\-h\fR, \fB\-\-help\fR
++Show the help output (imagine that)
++.TP
++\fB\-j\fR, \fB\-\-jobs\fR \fI<num>\fR
++Generate the specified \fInumber\fR of locales in parallel
++.TP
++\fB\-k\fR, \fB\-\-keep\fR
++Keep all existing locales even if they are not in the config file
++.TP
++\fB\-l\fR, \fB\-\-list\fR
++List all the locales that we think should exist according to the config
++.TP
++\fB\-q\fR, \fB\-\-quiet\fR
++Only spit out errors
++.TP
++\fB\-u\fR, \fB\-\-update\fR
++Only generate locales that do not already exist (normally existing locales are regenerated)
++.TP
++\fB\-V\fR, \fB\-\-version\fR
++Report the program version
++.TP
++\fB\-\-\fR
++To pass custom options directly to the \fBlocaledef\fR utility, end the
++\fBlocale\-gen\fR option list with \-\- and then everything after that will be
++passed on through unmolested (the options \-c are passed by default)
++.SH "AUTHORS"
++.fi
++Mike Frysinger <vapier@gentoo.org>
++.nf
++.SH "REPORTING BUGS"
++Please report bugs via http://bugs.gentoo.org/
++.SH "FILES"
++\fB/etc/locale.gen\fR \- locale list
++.SH "SEE ALSO"
++.BR locale (1),
++.BR localedef (1),
++.BR locale (5),
++.BR locale.gen (5),
++.BR locale (7)
+diff --git a/scripts/gentoo/extra/locale/locale.gen b/scripts/gentoo/extra/locale/locale.gen
+new file mode 100644
+index 0000000000..0786f1725f
+--- /dev/null
++++ b/scripts/gentoo/extra/locale/locale.gen
+@@ -0,0 +1,36 @@
++# /etc/locale.gen: list all of the locales you want to have on your system.
++# See the locale.gen(5) man page for more details.
++#
++# The format of each line:
++# <locale name> <charset>
++#
++# Where <locale name> starts with a name as found in /usr/share/i18n/locales/.
++# It must be unique in the file as it is used as the key to locale variables.
++# For non-default encodings, the <charset> is typically appended.
++#
++# Where <charset> is a charset located in /usr/share/i18n/charmaps/ (sans any
++# suffix like ".gz").
++#
++# All blank lines and lines starting with # are ignored.
++#
++# For the default list of supported combinations, see the file:
++# /usr/share/i18n/SUPPORTED
++#
++# Whenever glibc is emerged, the locales listed here will be automatically
++# rebuilt for you. After updating this file, you can simply run `locale-gen`
++# yourself instead of re-emerging glibc.
++
++#en_US ISO-8859-1
++#en_US.UTF-8 UTF-8
++#ja_JP.EUC-JP EUC-JP
++#ja_JP.UTF-8 UTF-8
++#ja_JP EUC-JP
++#en_HK ISO-8859-1
++#en_PH ISO-8859-1
++#de_DE ISO-8859-1
++#de_DE@euro ISO-8859-15
++#es_MX ISO-8859-1
++#fa_IR UTF-8
++#fr_FR ISO-8859-1
++#fr_FR@euro ISO-8859-15
++#it_IT ISO-8859-1
+diff --git a/scripts/gentoo/extra/locale/locale.gen.5 b/scripts/gentoo/extra/locale/locale.gen.5
+new file mode 100644
+index 0000000000..dbcc8c6347
+--- /dev/null
++++ b/scripts/gentoo/extra/locale/locale.gen.5
+@@ -0,0 +1,77 @@
++.\" -*- nroff -*-
++.\" Copyright (C) 2002, 2005 Free Software Foundation, Inc.
++.\"
++.\" This program is free software; you can redistribute it and/or modify
++.\" it under the terms of the GNU General Public License as published by
++.\" the Free Software Foundation; either version 2, or (at your option)
++.\" any later version.
++.\"
++.\" This program is distributed in the hope that it will be useful,
++.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
++.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++.\" GNU General Public License for more details.
++.\"
++.\" You should have received a copy of the GNU General Public License
++.\" along with this program; if not, write to the Free Software Foundation,
++.\" Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++.TH locale.gen 5 "July 2005" "Debian GNU/Linux"
++.SH "NAME"
++locale.gen \- Configuration file for locale-gen
++.SH "DESCRIPTION"
++The file \fB/etc/locale.gen\fP lists the locales that are to be generated
++by the \fBlocale-gen\fP command.
++
++Each line is of the form:
++
++<locale name> <charset>
++
++Where <locale name> starts with a name as found in
++.BR /usr/share/i18n/locales/ .
++It must be unique in the file as it is used as the key to locale variables
++(e.g. when you do `export LANG="<locale name>"`). For default encodings,
++the <charset> is typically omitted, else it is appended with a "." separator.
++
++Where <charset> is one of the character sets listed in
++.B /usr/share/i18n/charmaps
++(sans any suffix like ".gz"). It should use the same naming conventions too --
++all caps, and dashes/underscores included. e.g. Use "UTF-8", not "utf8".
++
++The
++.B locale-gen
++command will generate all the locales, placing them in
++\fB/usr/lib/locale\fP.
++
++Comments start with the hash mark # and may only be on new lines.
++.SH "OPTIONS"
++Options start with #% (to preserve backwards compatibility).
++
++# This enables the "foo" option.
++.br
++#%foo
++.TP
++.B no-locale-archive
++Disable generation of the locale archive file and instead generate multiple
++files/directories for each locale. This slows down runtime greatly (by having
++multiple files spread out in the filesystem instead of a single binary file),
++but it does mean build time is much faster (as you can generate in parallel).
++
++You should not use this option.
++.SH "EXAMPLES"
++.nf
++# Create a "en_US" locale using ISO-8859-1 encoding.
++# When you set LANG=en_US or LANG=en_US.ISO-8859-1, this is used.
++.B en_US ISO-8859-1
++
++# Create a "en_US" locale using UTF-8 encoding.
++# When you set LANG=en_US.UTF-8, this is used.
++.B en_US.UTF-8 UTF-8
++.fi
++.SH "SEE ALSO"
++.BR locale (1),
++.BR localedef (1),
++.BR locale-gen (8)
++.SH "AUTHORS"
++.nf
++Alastair McKinstry <mckinstry@computer.org>
++Mike Frysinger <vapier@gentoo.org>
++.fi
+diff --git a/scripts/gentoo/make-tarball.sh b/scripts/gentoo/make-tarball.sh
+new file mode 100755
+index 0000000000..a4f380d632
+--- /dev/null
++++ b/scripts/gentoo/make-tarball.sh
+@@ -0,0 +1,107 @@
++#!/bin/bash
++
++PN="glibc"
++PV=${1%/}
++pver=$2
++
++if [[ -z ${PV} ]] ; then
++ echo "Usage: $0 glibc-version patchset-version-to-be-created"
++ echo "Please read the script before trying to use it :)"
++ exit 1
++fi
++
++# check that we're in the root of a glibc git repo
++
++if [[ ! -f libc-abis ]] || [[ ! -d .git ]] ; then
++ echo "Error: You need to call this script in the main directory of a Gentoo glibc git clone"
++ exit 1
++fi
++
++# check that we're on a branch gentoo/${PV}
++
++mybranchinfo=$(git status --porcelain -b|grep '^##')
++mybranch=$(echo ${mybranchinfo}|sed -e 's:^## ::' -e 's:\.\.\..*$::')
++if [[ ! "gentoo/${PV}" == "${mybranch}" ]] ; then
++ echo "Error: Your git repository is on the incorrect branch ${mybranch}; should be gentoo/${PV}"
++ exit 1
++fi
++
++# check that the working directory is clean
++
++mystatusinfo=$(git status --porcelain)
++if [[ ! -z "${mystatusinfo}" ]] ; then
++ echo "Error: Your working directory is not clean"
++ exit 1
++fi
++
++# check if the tag already exists
++
++mytaginfo=$(git tag -l|grep "gentoo/glibc-${PV}-${pver}")
++if [[ ! -z "${mytaginfo}" ]] ; then
++ echo "Error: A tag corresponding to this patch level already exists (gentoo/glibc-${PV}-${pver})"
++ exit 1
++fi
++
++# luckily glibc git has no /tmp dir and no tar.xz files, but let's better check and be pathologically careful
++
++if [[ -e tmp ]] || [[ -e ${PN}-${PV}-patches-${pver}.tar.xz ]] ; then
++ echo "Error: tmp or ${PN}-${PV}-patches-${pver}.tar.xz exists in git"
++ exit 1
++fi
++rm -rf tmp
++rm -f ${PN}-${PV}-*.tar.xz
++
++for myname in 0*.patch ; do
++ if [[ -e ${myname} ]]; then
++ echo "Error: ${myname} exists in git"
++ exit 1
++ fi
++done
++rm -f 0*.patch
++
++mkdir -p tmp/patches
++
++# copy README.Gentoo.patches
++
++cp scripts/gentoo/README.Gentoo.patches tmp/ || exit 1
++
++# create and rename patches
++
++if [[ "${PV}" == "9999" ]]; then
++ # we're working with master, start from upstream master
++ startpoint="master"
++else
++ # release branch, start from upstream release tag
++ startpoint="glibc-${PV}"
++fi
++
++git format-patch ${startpoint}..HEAD > /dev/null
++
++# remove all patches where the summary line starts with [no-tarball] or [no-patch]
++
++rm -f 0???-no-tarball-*.patch
++rm -f 0???-no-patch-*.patch
++
++# move patches into temporary directory
++
++mv 0*.patch tmp/patches/ || exit 1
++
++# copy support files
++
++cp -r scripts/gentoo/extra tmp/ || exit 1
++
++# add a history file
++
++git log --stat --decorate ${startpoint}..HEAD > tmp/patches/README.history || exit 1
++
++# package everything up
++
++tar -Jcf ${PN}-${PV}-patches-${pver}.tar.xz \
++ -C tmp patches extra README.Gentoo.patches || exit 1
++rm -r tmp
++
++du -b *.tar.xz
++
++# tag the commit
++
++git tag -s -m "Gentoo patchset ${PV}-${pver}" "gentoo/glibc-${PV}-${pver}"
+--
+2.26.2
+
diff --git a/9999/0004-Revert-sysdeps-posix-getaddrinfo.c-gaih_inet-Only-us.patch b/9999/0004-Revert-sysdeps-posix-getaddrinfo.c-gaih_inet-Only-us.patch
new file mode 100644
index 0000000..4002a64
--- /dev/null
+++ b/9999/0004-Revert-sysdeps-posix-getaddrinfo.c-gaih_inet-Only-us.patch
@@ -0,0 +1,41 @@
+From 493fd65c116f423e9bb0a374314775fd475575c3 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
+Date: Tue, 29 Aug 2017 22:58:50 +0200
+Subject: [PATCH 04/12] Revert " * sysdeps/posix/getaddrinfo.c (gaih_inet):
+ Only use gethostbyname4_r"
+
+This reverts commit 8479f23aa1d5e5477a37f46823856bdafaedfa46.
+
+See for the background
+ https://sourceware.org/bugzilla/show_bug.cgi?id=16826
+ https://bugs.gentoo.org/show_bug.cgi?id=600632
+
+This makes test resolv/tst-res_use_inet6 fail. Disable it.
+(cherry picked from commit 06a2a073a2c6fb3e1489af96e125daca248d0a03)
+---
+ sysdeps/posix/getaddrinfo.c | 9 ++-------
+ 1 file changed, 2 insertions(+), 7 deletions(-)
+
+diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
+index ed04e564f9..ce9e0d342d 100644
+--- a/sysdeps/posix/getaddrinfo.c
++++ b/sysdeps/posix/getaddrinfo.c
+@@ -739,13 +739,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
+ while (!no_more)
+ {
+ no_data = 0;
+- nss_gethostbyname4_r *fct4 = NULL;
+-
+- /* gethostbyname4_r sends out parallel A and AAAA queries and
+- is thus only suitable for PF_UNSPEC. */
+- if (req->ai_family == PF_UNSPEC)
+- fct4 = __nss_lookup_function (nip, "gethostbyname4_r");
+-
++ nss_gethostbyname4_r *fct4
++ = __nss_lookup_function (nip, "gethostbyname4_r");
+ if (fct4 != NULL)
+ {
+ while (1)
+--
+2.26.2
+
diff --git a/9999/0005-Gentoo-disable-tests-that-fail-only-in-sandbox.patch b/9999/0005-Gentoo-disable-tests-that-fail-only-in-sandbox.patch
new file mode 100644
index 0000000..f0b00a5
--- /dev/null
+++ b/9999/0005-Gentoo-disable-tests-that-fail-only-in-sandbox.patch
@@ -0,0 +1,144 @@
+From 8c012e90bf4645d37cb022d273d814b3fbc33a94 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
+Date: Mon, 11 Sep 2017 13:14:46 +0200
+Subject: [PATCH 05/12] Gentoo: disable tests that fail only in sandbox
+
+---
+ elf/Makefile | 16 +---------------
+ io/Makefile | 2 +-
+ nptl/Makefile | 7 +++++--
+ posix/Makefile | 4 ++--
+ resolv/Makefile | 2 --
+ sysdeps/unix/sysv/linux/Makefile | 2 +-
+ 6 files changed, 10 insertions(+), 23 deletions(-)
+
+diff --git a/elf/Makefile b/elf/Makefile
+index da689a2c7b..dcf29d47b9 100644
+--- a/elf/Makefile
++++ b/elf/Makefile
+@@ -413,8 +413,7 @@ tests-special += $(objpfx)order-cmp.out $(objpfx)tst-array1-cmp.out \
+ $(objpfx)tst-array4-cmp.out $(objpfx)tst-array5-cmp.out \
+ $(objpfx)tst-array5-static-cmp.out $(objpfx)order2-cmp.out \
+ $(objpfx)tst-initorder-cmp.out \
+- $(objpfx)tst-initorder2-cmp.out $(objpfx)tst-unused-dep.out \
+- $(objpfx)tst-unused-dep-cmp.out
++ $(objpfx)tst-initorder2-cmp.out
+ endif
+
+ check-abi: $(objpfx)check-abi-ld.out
+@@ -1461,19 +1460,6 @@ $(objpfx)tst-relsort1mod2.so: $(libm)
+ $(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
+ $(objpfx)tst-relsort1mod2.so
+
+-$(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
+- $(test-wrapper-env) \
+- LD_TRACE_LOADED_OBJECTS=1 \
+- LD_DEBUG=unused \
+- LD_PRELOAD= \
+- $(rtld-prefix) \
+- $< > $@; \
+- $(evaluate-test)
+-
+-$(objpfx)tst-unused-dep-cmp.out: $(objpfx)tst-unused-dep.out
+- cmp $< /dev/null > $@; \
+- $(evaluate-test)
+-
+ $(objpfx)tst-audit11.out: $(objpfx)tst-auditmod11.so $(objpfx)tst-audit11mod1.so
+ $(objpfx)tst-audit11: $(libdl)
+ tst-audit11-ENV = LD_AUDIT=$(objpfx)tst-auditmod11.so
+diff --git a/io/Makefile b/io/Makefile
+index cf380f3516..b6fe301f77 100644
+--- a/io/Makefile
++++ b/io/Makefile
+@@ -73,7 +73,7 @@ tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \
+ tst-mknodat tst-mkfifoat tst-ttyname_r bug-ftw5 \
+ tst-posix_fallocate tst-posix_fallocate64 \
+ tst-fts tst-fts-lfs tst-open-tmpfile \
+- tst-copy_file_range tst-getcwd-abspath tst-lockf \
++ tst-getcwd-abspath tst-lockf \
+ tst-ftw-lnk tst-file_change_detection tst-lchmod
+
+ # Likewise for statx, but we do not need static linking here.
+diff --git a/nptl/Makefile b/nptl/Makefile
+index e554a3898d..8373b6989d 100644
+--- a/nptl/Makefile
++++ b/nptl/Makefile
+@@ -282,7 +282,7 @@ tests = tst-attr2 tst-attr3 tst-default-attr \
+ tst-atfork1 \
+ tst-cancel1 tst-cancel2 tst-cancel3 tst-cancel4 tst-cancel4_1 \
+ tst-cancel4_2 tst-cancel5 \
+- tst-cancel6 tst-cancel7 tst-cancel8 tst-cancel9 tst-cancel10 \
++ tst-cancel6 tst-cancel8 tst-cancel9 tst-cancel10 \
+ tst-cancel11 tst-cancel12 tst-cancel13 tst-cancel14 tst-cancel15 \
+ tst-cancel16 tst-cancel17 tst-cancel18 tst-cancel19 tst-cancel20 \
+ tst-cancel21 tst-cancel22 tst-cancel23 tst-cancel24 \
+@@ -319,6 +319,9 @@ tests = tst-attr2 tst-attr3 tst-default-attr \
+ tst-robust-fork tst-create-detached tst-memstream \
+ tst-thread-exit-clobber tst-minstack-cancel tst-minstack-exit \
+ tst-minstack-throw \
++ tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
++ tst-cnd-timedwait tst-thrd-detach tst-mtx-basic tst-thrd-sleep \
++ tst-mtx-recursive tst-call-once tst-mtx-timedlock \
+ tst-rwlock-pwn \
+ tst-unwind-thread
+
+@@ -384,7 +387,7 @@ CFLAGS-tst-cleanup2.c += -fno-builtin
+ CFLAGS-tst-cleanupx2.c += -fno-builtin
+
+ tests += tst-cancelx2 tst-cancelx3 tst-cancelx4 tst-cancelx5 \
+- tst-cancelx6 tst-cancelx7 tst-cancelx8 tst-cancelx9 tst-cancelx10 \
++ tst-cancelx6 tst-cancelx8 tst-cancelx9 tst-cancelx10 \
+ tst-cancelx11 tst-cancelx12 tst-cancelx13 tst-cancelx14 tst-cancelx15 \
+ tst-cancelx16 tst-cancelx17 tst-cancelx18 tst-cancelx20 tst-cancelx21 \
+ tst-cleanupx0 tst-cleanupx1 tst-cleanupx2 tst-cleanupx3 tst-cleanupx4
+diff --git a/posix/Makefile b/posix/Makefile
+index 4507d84bf1..28075ed5bf 100644
+--- a/posix/Makefile
++++ b/posix/Makefile
+@@ -68,7 +68,7 @@ routines := \
+ streams-compat
+
+ aux := init-posix environ
+-tests := test-errno tstgetopt testfnm runtests runptests \
++tests := tstgetopt testfnm runtests runptests \
+ tst-preadwrite tst-preadwrite64 test-vfork regexbug1 \
+ tst-mmap tst-mmap-offset tst-getaddrinfo tst-truncate \
+ tst-truncate64 tst-fork tst-fnmatch tst-regexloc tst-dir \
+@@ -89,7 +89,7 @@ tests := test-errno tstgetopt testfnm runtests runptests \
+ tst-execve1 tst-execve2 tst-execle1 tst-execle2 \
+ tst-execvp3 tst-execvp4 \
+ tst-execvpe1 tst-execvpe2 tst-execvpe3 tst-execvpe4 \
+- tst-execvpe5 tst-execvpe6 \
++ tst-execvpe6 \
+ tst-getaddrinfo3 tst-fnmatch2 tst-cpucount tst-cpuset \
+ bug-getopt1 bug-getopt2 bug-getopt3 bug-getopt4 \
+ bug-getopt5 tst-getopt_long1 bug-regex34 bug-regex35 \
+diff --git a/resolv/Makefile b/resolv/Makefile
+index f131e4b014..6ee6570345 100644
+--- a/resolv/Makefile
++++ b/resolv/Makefile
+@@ -72,8 +72,6 @@ tests += \
+
+ # Needs resolv_context.
+ tests-internal += \
+- tst-resolv-res_init \
+- tst-resolv-res_init-thread \
+ tst-resolv-res_ninit \
+ tst-resolv-threads \
+
+diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
+index 60dc5cf9e5..158b2be0d2 100644
+--- a/sysdeps/unix/sysv/linux/Makefile
++++ b/sysdeps/unix/sysv/linux/Makefile
+@@ -95,7 +95,7 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
+ bits/ipc-perm.h
+
+ tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
+- tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \
++ tst-quota tst-sync_file_range tst-sysconf-iov_max \
+ test-errno-linux tst-memfd_create tst-mlock2 tst-pkey \
+ tst-rlimit-infinity tst-ofdlocks tst-gettid tst-gettid-kill \
+ tst-tgkill
+--
+2.26.2
+
diff --git a/9999/0006-Gentoo-Disable-test-that-fails-because-of-the-gethos.patch b/9999/0006-Gentoo-Disable-test-that-fails-because-of-the-gethos.patch
new file mode 100644
index 0000000..30b2308
--- /dev/null
+++ b/9999/0006-Gentoo-Disable-test-that-fails-because-of-the-gethos.patch
@@ -0,0 +1,25 @@
+From 3b6603fa966a37830261f1452d83f0aa80a1ec7d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
+Date: Wed, 17 Jan 2018 01:02:19 +0100
+Subject: [PATCH 06/12] Gentoo: Disable test that fails because of the
+ gethostbyname4_r revert
+
+---
+ nss/Makefile | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/nss/Makefile b/nss/Makefile
+index 97bab5bb75..7a6ddebde2 100644
+--- a/nss/Makefile
++++ b/nss/Makefile
+@@ -68,7 +68,6 @@ tests-container = \
+ # Tests which need libdl
+ ifeq (yes,$(build-shared))
+ tests += tst-nss-files-hosts-erange
+-tests += tst-nss-files-hosts-multi
+ tests += tst-nss-files-hosts-getent
+ tests += tst-nss-files-alias-leak
+ tests += tst-nss-files-alias-truncated
+--
+2.26.2
+
diff --git a/9999/0007-Gentoo-Adapt-to-Gentoo-specific-etc-mail-aliases.patch b/9999/0007-Gentoo-Adapt-to-Gentoo-specific-etc-mail-aliases.patch
new file mode 100644
index 0000000..0196398
--- /dev/null
+++ b/9999/0007-Gentoo-Adapt-to-Gentoo-specific-etc-mail-aliases.patch
@@ -0,0 +1,32 @@
+From 9de1a12253bcbec66b56b5058fcc04e775f59e75 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
+Date: Mon, 22 Oct 2018 22:34:13 +0200
+Subject: [PATCH 07/12] Gentoo: Adapt to Gentoo-specific /etc/mail/aliases
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Patch by pacho2
+
+Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
+(cherry picked from commit 4e616cda056f471b799beba2b1cedc787ad4ecc0)
+---
+ nss/nss_files/files-alias.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/nss/nss_files/files-alias.c b/nss/nss_files/files-alias.c
+index 6aff7b4c10..bb6d9b5765 100644
+--- a/nss/nss_files/files-alias.c
++++ b/nss/nss_files/files-alias.c
+@@ -49,7 +49,7 @@ internal_setent (FILE **stream)
+
+ if (*stream == NULL)
+ {
+- *stream = fopen ("/etc/aliases", "rce");
++ *stream = fopen ("/etc/mail/aliases", "rce");
+
+ if (*stream == NULL)
+ status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
+--
+2.26.2
+
diff --git a/9999/0008-Gentoo-Add-a-C.UTF-8-locale.patch b/9999/0008-Gentoo-Add-a-C.UTF-8-locale.patch
new file mode 100644
index 0000000..31903b6
--- /dev/null
+++ b/9999/0008-Gentoo-Add-a-C.UTF-8-locale.patch
@@ -0,0 +1,287 @@
+From baeb7948ba8b6cc25059cf9659d045e24cd7d879 Mon Sep 17 00:00:00 2001
+From: Mike FABIAN <mfabian@redhat.com>
+Date: Mon, 10 Aug 2015 15:58:12 +0200
+Subject: [PATCH 08/12] Gentoo: Add a C.UTF-8 locale
+
+Source:
+https://src.fedoraproject.org/rpms/glibc/raw/master/f/glibc-c-utf8-locale.patch
+
+Notes from there:
+This patch needs to upstream as part of Carlos O'Donell
+<carlos@redhat.com>'s work on enabling upstream C.UTF-8 support. This
+work is currently blocked on cleaning up the test results to prove that
+full code-point sorting is working as intended.
+Note that this patch does not provide full code-point sorting as
+expected.
+This patch needs to upstream as soon as possible since it would be nice
+to have this in F29 and fixed.
+
+Further information:
+https://bugzilla.redhat.com/show_bug.cgi?id=902094
+https://sourceware.org/bugzilla/show_bug.cgi?id=17318
+https://bugs.gentoo.org/671024
+---
+ localedata/SUPPORTED | 1 +
+ localedata/locales/C | 238 +++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 239 insertions(+)
+ create mode 100644 localedata/locales/C
+
+diff --git a/localedata/SUPPORTED b/localedata/SUPPORTED
+index 1ee5b5e8c8..5fa87f1315 100644
+--- a/localedata/SUPPORTED
++++ b/localedata/SUPPORTED
+@@ -1,6 +1,7 @@
+ # This file names the currently supported and somewhat tested locales.
+ # If you have any additions please file a glibc bug report.
+ SUPPORTED-LOCALES=\
++C.UTF-8/UTF-8 \
+ aa_DJ.UTF-8/UTF-8 \
+ aa_DJ/ISO-8859-1 \
+ aa_ER/UTF-8 \
+diff --git a/localedata/locales/C b/localedata/locales/C
+new file mode 100644
+index 0000000000..b2c2d1dc41
+--- /dev/null
++++ b/localedata/locales/C
+@@ -0,0 +1,238 @@
++escape_char /
++comment_char %
++% Locale for C locale in UTF-8
++
++LC_IDENTIFICATION
++title "C locale"
++source ""
++address ""
++contact ""
++email "mfabian@redhat.com"
++tel ""
++fax ""
++language "C"
++territory ""
++revision "1.0"
++date "2015-08-10"
++%
++category "i18n:2012";LC_IDENTIFICATION
++category "i18n:2012";LC_CTYPE
++category "i18n:2012";LC_COLLATE
++category "i18n:2012";LC_TIME
++category "i18n:2012";LC_NUMERIC
++category "i18n:2012";LC_MONETARY
++category "i18n:2012";LC_MESSAGES
++category "i18n:2012";LC_PAPER
++category "i18n:2012";LC_NAME
++category "i18n:2012";LC_ADDRESS
++category "i18n:2012";LC_TELEPHONE
++category "i18n:2012";LC_MEASUREMENT
++END LC_IDENTIFICATION
++
++LC_CTYPE
++copy "i18n"
++
++translit_start
++include "translit_combining";""
++translit_end
++
++END LC_CTYPE
++
++LC_COLLATE
++order_start forward
++<U0000>
++..
++<UFFFF>
++<U10000>
++..
++<U1FFFF>
++<U20000>
++..
++<U2FFFF>
++<UE0000>
++..
++<UEFFFF>
++<UF0000>
++..
++<UFFFFF>
++<U100000>
++..
++<U10FFFF>
++UNDEFINED
++order_end
++END LC_COLLATE
++
++LC_MONETARY
++% This is the 14652 i18n fdcc-set definition for
++% the LC_MONETARY category
++% (except for the int_curr_symbol and currency_symbol, they are empty in
++% the 14652 i18n fdcc-set definition and also empty in
++% glibc/locale/C-monetary.c. But localedef complains in that case).
++%
++% Using "USD" for int_curr_symbol. But maybe "XXX" would be better?
++% XXX is "No currency" (https://en.wikipedia.org/wiki/ISO_4217)
++int_curr_symbol "<U0055><U0053><U0044><U0020>"
++% Using "$" for currency_symbol. But maybe <U00A4> would be better?
++% U+00A4 is the "generic currency symbol"
++% (https://en.wikipedia.org/wiki/Currency_sign_%28typography%29)
++currency_symbol "<U0024>"
++mon_decimal_point "<U002E>"
++mon_thousands_sep ""
++mon_grouping -1
++positive_sign ""
++negative_sign "<U002D>"
++int_frac_digits -1
++frac_digits -1
++p_cs_precedes -1
++int_p_sep_by_space -1
++p_sep_by_space -1
++n_cs_precedes -1
++int_n_sep_by_space -1
++n_sep_by_space -1
++p_sign_posn -1
++n_sign_posn -1
++%
++END LC_MONETARY
++
++LC_NUMERIC
++% This is the POSIX Locale definition for
++% the LC_NUMERIC category.
++%
++decimal_point "<U002E>"
++thousands_sep ""
++grouping -1
++END LC_NUMERIC
++
++LC_TIME
++% This is the POSIX Locale definition for
++% the LC_TIME category.
++%
++% Abbreviated weekday names (%a)
++abday "<U0053><U0075><U006E>";"<U004D><U006F><U006E>";/
++ "<U0054><U0075><U0065>";"<U0057><U0065><U0064>";/
++ "<U0054><U0068><U0075>";"<U0046><U0072><U0069>";/
++ "<U0053><U0061><U0074>"
++
++% Full weekday names (%A)
++day "<U0053><U0075><U006E><U0064><U0061><U0079>";/
++ "<U004D><U006F><U006E><U0064><U0061><U0079>";/
++ "<U0054><U0075><U0065><U0073><U0064><U0061><U0079>";/
++ "<U0057><U0065><U0064><U006E><U0065><U0073><U0064><U0061><U0079>";/
++ "<U0054><U0068><U0075><U0072><U0073><U0064><U0061><U0079>";/
++ "<U0046><U0072><U0069><U0064><U0061><U0079>";/
++ "<U0053><U0061><U0074><U0075><U0072><U0064><U0061><U0079>"
++
++% Abbreviated month names (%b)
++abmon "<U004A><U0061><U006E>";"<U0046><U0065><U0062>";/
++ "<U004D><U0061><U0072>";"<U0041><U0070><U0072>";/
++ "<U004D><U0061><U0079>";"<U004A><U0075><U006E>";/
++ "<U004A><U0075><U006C>";"<U0041><U0075><U0067>";/
++ "<U0053><U0065><U0070>";"<U004F><U0063><U0074>";/
++ "<U004E><U006F><U0076>";"<U0044><U0065><U0063>"
++
++% Full month names (%B)
++mon "<U004A><U0061><U006E><U0075><U0061><U0072><U0079>";/
++ "<U0046><U0065><U0062><U0072><U0075><U0061><U0072><U0079>";/
++ "<U004D><U0061><U0072><U0063><U0068>";/
++ "<U0041><U0070><U0072><U0069><U006C>";/
++ "<U004D><U0061><U0079>";/
++ "<U004A><U0075><U006E><U0065>";/
++ "<U004A><U0075><U006C><U0079>";/
++ "<U0041><U0075><U0067><U0075><U0073><U0074>";/
++ "<U0053><U0065><U0070><U0074><U0065><U006D><U0062><U0065><U0072>";/
++ "<U004F><U0063><U0074><U006F><U0062><U0065><U0072>";/
++ "<U004E><U006F><U0076><U0065><U006D><U0062><U0065><U0072>";/
++ "<U0044><U0065><U0063><U0065><U006D><U0062><U0065><U0072>"
++
++% Week description, consists of three fields:
++% 1. Number of days in a week.
++% 2. Gregorian date that is a first weekday (19971130 for Sunday, 19971201 for Monday).
++% 3. The weekday number to be contained in the first week of the year.
++%
++% ISO 8601 conforming applications should use the values 7, 19971201 (a
++% Monday), and 4 (Thursday), respectively.
++week 7;19971201;4
++first_weekday 1
++first_workday 1
++
++% Appropriate date and time representation (%c)
++% "%a %b %e %H:%M:%S %Y"
++d_t_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065><U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U0059>"
++
++% Appropriate date representation (%x)
++% "%m/%d/%y"
++d_fmt "<U0025><U006D><U002F><U0025><U0064><U002F><U0025><U0079>"
++
++% Appropriate time representation (%X)
++% "%H:%M:%S"
++t_fmt "<U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053>"
++
++% Appropriate AM/PM time representation (%r)
++% "%I:%M:%S %p"
++t_fmt_ampm "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U0070>"
++
++% Equivalent of AM/PM (%p) "AM"/"PM"
++%
++am_pm "<U0041><U004D>";"<U0050><U004D>"
++
++% Appropriate date representation (date(1)) "%a %b %e %H:%M:%S %Z %Y"
++date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065><U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U005A><U0020><U0025><U0059>"
++END LC_TIME
++
++LC_MESSAGES
++% This is the POSIX Locale definition for
++% the LC_NUMERIC category.
++%
++yesexpr "<U005E><U005B><U0079><U0059><U005D>"
++noexpr "<U005E><U005B><U006E><U004E><U005D>"
++yesstr "<U0059><U0065><U0073>"
++nostr "<U004E><U006F>"
++END LC_MESSAGES
++
++LC_PAPER
++% This is the ISO/IEC 14652 "i18n" definition for
++% the LC_PAPER category.
++% (A4 paper, this is also used in the built in C/POSIX
++% locale in glibc/locale/C-paper.c)
++height 297
++width 210
++END LC_PAPER
++
++LC_NAME
++% This is the ISO/IEC 14652 "i18n" definition for
++% the LC_NAME category.
++% "%p%t%g%t%m%t%f"
++% (also used in the built in C/POSIX locale in glibc/locale/C-name.c)
++name_fmt "<U0025><U0070><U0025><U0074><U0025><U0067><U0025><U0074>/
++<U0025><U006D><U0025><U0074><U0025><U0066>"
++END LC_NAME
++
++LC_ADDRESS
++% This is the ISO/IEC 14652 "i18n" definition for
++% the LC_ADDRESS category.
++% "%a%N%f%N%d%N%b%N%s %h %e %r%N%C-%z %T%N%c%N"
++% (also used in the built in C/POSIX locale in glibc/locale/C-address.c)
++postal_fmt "<U0025><U0061><U0025><U004E><U0025><U0066><U0025><U004E>/
++<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
++<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
++<U004E><U0025><U0043><U002D><U0025><U007A><U0020><U0025><U0054><U0025>/
++<U004E><U0025><U0063><U0025><U004E>"
++END LC_ADDRESS
++
++LC_TELEPHONE
++% This is the ISO/IEC 14652 "i18n" definition for
++% the LC_TELEPHONE category.
++% "+%c %a %l"
++tel_int_fmt "<U002B><U0025><U0063><U0020><U0025><U0061><U0020><U0025>/
++<U006C>"
++% (also used in the built in C/POSIX locale in glibc/locale/C-telephone.c)
++END LC_TELEPHONE
++
++LC_MEASUREMENT
++% This is the ISO/IEC 14652 "i18n" definition for
++% the LC_MEASUREMENT category.
++% (same as in the built in C/POSIX locale in glibc/locale/C-measurement.c)
++%metric
++measurement 1
++END LC_MEASUREMENT
++
+--
+2.26.2
+
diff --git a/9999/0009-Gentoo-force-O0-in-conform-tests-to-survive-CC-chang.patch b/9999/0009-Gentoo-force-O0-in-conform-tests-to-survive-CC-chang.patch
new file mode 100644
index 0000000..9504792
--- /dev/null
+++ b/9999/0009-Gentoo-force-O0-in-conform-tests-to-survive-CC-chang.patch
@@ -0,0 +1,66 @@
+From 1c39b1dd8ad727a48cb3c9fbcd9d005f690752eb Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
+Date: Fri, 14 Dec 2018 20:43:04 +0100
+Subject: [PATCH 09/12] Gentoo: force -O0 in conform tests to survive $CC
+ changes
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+In bug #659030 Gentoo started passing user's CFLAGS via $CC variable.
+conform tests should but are not ready to handle -O1/-O2 yet.
+Tests fail to validate headers due to inlining of weak symbol aliases
+and other problems. Let's force it back to -O0 until it's fixed upstream.
+
+Original patch by Sergei, ported to the new python test framework by Andreas
+
+Bug: https://bugs.gentoo.org/659030
+Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
+---
+ conform/conformtest.py | 6 ++++--
+ conform/linknamespace.py | 4 +++-
+ 2 files changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/conform/conformtest.py b/conform/conformtest.py
+index cb2bd97eca..6076b615df 100644
+--- a/conform/conformtest.py
++++ b/conform/conformtest.py
+@@ -562,7 +562,7 @@ class HeaderTests(object):
+ o_file = os.path.join(self.temp_dir, 'test.o')
+ with open(c_file, 'w') as c_file_out:
+ c_file_out.write('#include <%s>\n%s' % (self.header, text))
+- cmd = ('%s %s -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
++ cmd = ('%s %s -O0 -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
+ try:
+ subprocess.check_call(cmd, shell=True)
+ except subprocess.CalledProcessError:
+@@ -613,7 +613,9 @@ class HeaderTests(object):
+ out_file = os.path.join(self.temp_dir, 'namespace-out')
+ with open(c_file, 'w') as c_file_out:
+ c_file_out.write('#include <%s>\n' % self.header)
+- cmd = ('%s %s -E %s -P -Wp,-dN > %s'
++ # -O0 to negate effect of possible -O<N> passed to $CC
++ # See https://bugs.gentoo.org/659030#c6
++ cmd = ('%s -O0 %s -E %s -P -Wp,-dN > %s'
+ % (self.cc, self.cflags_namespace, c_file, out_file))
+ subprocess.check_call(cmd, shell=True)
+ bad_tokens = set()
+diff --git a/conform/linknamespace.py b/conform/linknamespace.py
+index 1d27e4cfba..b0d2b9bbc2 100644
+--- a/conform/linknamespace.py
++++ b/conform/linknamespace.py
+@@ -157,7 +157,9 @@ def main():
+ files_seen = set()
+ all_undef = {}
+ current_undef = {}
+- compiler = '%s %s' % (args.cc, args.flags)
++ # -O0 avoid failures like
++ # '[initial] ptsname_r -> [libc.a(ptsname.o)] ptsname'
++ compiler = '%s %s -O0' % (args.cc, args.flags)
+ c_syms = glibcconform.list_exported_functions(compiler, args.standard,
+ args.header)
+ with tempfile.TemporaryDirectory() as temp_dir:
+--
+2.26.2
+
diff --git a/9999/0010-Gentoo-Adapt-tests-to-etc-mail-alias-location.patch b/9999/0010-Gentoo-Adapt-tests-to-etc-mail-alias-location.patch
new file mode 100644
index 0000000..bcf87ab
--- /dev/null
+++ b/9999/0010-Gentoo-Adapt-tests-to-etc-mail-alias-location.patch
@@ -0,0 +1,89 @@
+From 96f7387cdee162005d2373cbdcd1f7b65dfccd2c Mon Sep 17 00:00:00 2001
+From: "Andreas K. Huettel" <dilfridge@gentoo.org>
+Date: Sat, 21 Mar 2020 15:54:14 +0100
+Subject: [PATCH 10/12] Gentoo: Adapt tests to /etc/mail/alias location
+
+Signed-off-by: Andreas K. Huettel <dilfridge@gentoo.org>
+(cherry picked from commit 03fb405d759b9806fa150813f04dfe1aaa658ac6)
+---
+ nss/tst-nss-files-alias-leak.c | 18 +++++++++---------
+ support/support_chroot.c | 8 +++++++-
+ 2 files changed, 16 insertions(+), 10 deletions(-)
+
+diff --git a/nss/tst-nss-files-alias-leak.c b/nss/tst-nss-files-alias-leak.c
+index daebbf4ed4..095bb753a6 100644
+--- a/nss/tst-nss-files-alias-leak.c
++++ b/nss/tst-nss-files-alias-leak.c
+@@ -45,27 +45,27 @@ prepare (int argc, char **argv)
+ chroot_env = support_chroot_create
+ ((struct support_chroot_configuration) { } );
+
+- char *path = xasprintf ("%s/etc/aliases", chroot_env->path_chroot);
++ char *path = xasprintf ("%s/etc/mail/aliases", chroot_env->path_chroot);
+ add_temp_file (path);
+ support_write_file_string
+ (path,
+- "user1: :include:/etc/aliases.user1\n"
+- "user2: :include:/etc/aliases.user2\n"
+- "comment: comment1, :include:/etc/aliases.comment\n"
+- "many: :include:/etc/aliases.many\n");
++ "user1: :include:/etc/mail/aliases.user1\n"
++ "user2: :include:/etc/mail/aliases.user2\n"
++ "comment: comment1, :include:/etc/mail/aliases.comment\n"
++ "many: :include:/etc/mail/aliases.many\n");
+ free (path);
+
+- path = xasprintf ("%s/etc/aliases.user1", chroot_env->path_chroot);
++ path = xasprintf ("%s/etc/mail/aliases.user1", chroot_env->path_chroot);
+ add_temp_file (path);
+ support_write_file_string (path, "alias1\n");
+ free (path);
+
+- path = xasprintf ("%s/etc/aliases.user2", chroot_env->path_chroot);
++ path = xasprintf ("%s/etc/mail/aliases.user2", chroot_env->path_chroot);
+ add_temp_file (path);
+ support_write_file_string (path, "alias1a, alias2\n");
+ free (path);
+
+- path = xasprintf ("%s/etc/aliases.comment", chroot_env->path_chroot);
++ path = xasprintf ("%s/etc/mail/aliases.comment", chroot_env->path_chroot);
+ add_temp_file (path);
+ support_write_file_string
+ (path,
+@@ -75,7 +75,7 @@ prepare (int argc, char **argv)
+ "comment2\n");
+ free (path);
+
+- path = xasprintf ("%s/etc/aliases.many", chroot_env->path_chroot);
++ path = xasprintf ("%s/etc/mail/aliases.many", chroot_env->path_chroot);
+ add_temp_file (path);
+ FILE *fp = xfopen (path, "w");
+ for (int i = 0; i < many_aliases; ++i)
+diff --git a/support/support_chroot.c b/support/support_chroot.c
+index 4f435c1ac1..e7ca2c714b 100644
+--- a/support/support_chroot.c
++++ b/support/support_chroot.c
+@@ -52,13 +52,19 @@ support_chroot_create (struct support_chroot_configuration conf)
+ xmkdir (path_etc, 0777);
+ add_temp_file (path_etc);
+
++ /* Create the /etc/mail directory in the chroot environment. */
++ char *path_etc_mail = xasprintf ("%s/etc/mail", chroot->path_chroot);
++ xmkdir (path_etc_mail, 0777);
++ add_temp_file (path_etc_mail);
++
+ write_file (path_etc, "resolv.conf", conf.resolv_conf,
+ &chroot->path_resolv_conf);
+ write_file (path_etc, "hosts", conf.hosts, &chroot->path_hosts);
+ write_file (path_etc, "host.conf", conf.host_conf, &chroot->path_host_conf);
+- write_file (path_etc, "aliases", conf.aliases, &chroot->path_aliases);
++ write_file (path_etc_mail, "aliases", conf.aliases, &chroot->path_aliases);
+
+ free (path_etc);
++ free (path_etc_mail);
+
+ /* valgrind needs a temporary directory in the chroot. */
+ {
+--
+2.26.2
+
diff --git a/9999/0011-no-patch-Gentoo-remove-locale-gen-from-repo-packaged.patch b/9999/0011-no-patch-Gentoo-remove-locale-gen-from-repo-packaged.patch
new file mode 100644
index 0000000..a7e79bd
--- /dev/null
+++ b/9999/0011-no-patch-Gentoo-remove-locale-gen-from-repo-packaged.patch
@@ -0,0 +1,684 @@
+From 10fc5bbbafb3164c39780eff171627137c2a6ae1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
+Date: Tue, 12 May 2020 18:28:56 +0300
+Subject: [PATCH 11/12] [no-patch] Gentoo: remove locale-gen from repo,
+ packaged separately now
+
+(cherry picked from commit b679ab84afd953996e73a247a4e7e52580c4f90f)
+---
+ scripts/gentoo/extra/README | 5 -
+ scripts/gentoo/extra/locale/locale-gen | 444 -----------------------
+ scripts/gentoo/extra/locale/locale-gen.8 | 69 ----
+ scripts/gentoo/extra/locale/locale.gen | 36 --
+ scripts/gentoo/extra/locale/locale.gen.5 | 77 ----
+ 5 files changed, 631 deletions(-)
+ delete mode 100644 scripts/gentoo/extra/README
+ delete mode 100755 scripts/gentoo/extra/locale/locale-gen
+ delete mode 100644 scripts/gentoo/extra/locale/locale-gen.8
+ delete mode 100644 scripts/gentoo/extra/locale/locale.gen
+ delete mode 100644 scripts/gentoo/extra/locale/locale.gen.5
+
+diff --git a/scripts/gentoo/extra/README b/scripts/gentoo/extra/README
+deleted file mode 100644
+index 1942999684..0000000000
+--- a/scripts/gentoo/extra/README
++++ /dev/null
+@@ -1,5 +0,0 @@
+-What is all this you may wonder.
+-
+-locale/
+- a port/rewrite of Debian's locale-gen. see the man pages in the
+- subdir for more information.
+diff --git a/scripts/gentoo/extra/locale/locale-gen b/scripts/gentoo/extra/locale/locale-gen
+deleted file mode 100755
+index 8afb5d1a68..0000000000
+--- a/scripts/gentoo/extra/locale/locale-gen
++++ /dev/null
+@@ -1,444 +0,0 @@
+-#!/bin/bash
+-
+-#
+-# Based upon Debian's locale-gen, fetched from glibc_2.3.6-7.diff.gz
+-#
+-
+-unset POSIXLY_CORRECT IFS
+-umask 0022
+-
+-argv0=${0##*/}
+-
+-EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
+-if [[ ${EPREFIX} == "@"GENTOO_PORTAGE_EPREFIX"@" ]] ; then
+- EPREFIX=""
+-fi
+-
+-FUNCTIONS_SH="/lib/gentoo/functions.sh"
+-source "${EPREFIX}"${FUNCTIONS_SH} || {
+- echo "${argv0}: Could not source ${FUNCTIONS_SH}!" 1>&2
+- exit 1
+-}
+-
+-COMPILED_LOCALES=""
+-
+-show_usage() {
+- cat <<-EOF
+- Usage: ${HILITE}${argv0}${NORMAL} ${GOOD}[options]${NORMAL} -- ${GOOD}[localedef options]${NORMAL}
+-
+- Generate locales based upon the config file /etc/locale.gen.
+-
+- ${HILITE}Options:${NORMAL}
+- ${GOOD}-k, --keep${NORMAL} Don't nuke existing locales
+- ${GOOD}-d, --destdir <dir>${NORMAL} Use locale data in specified DESTDIR tree
+- ${GOOD}-c, --config <config>${NORMAL} Use specified config instead of default locale.gen
+- ${GOOD}-l, --list${NORMAL} List all the locales to be generated
+- ${GOOD}-a, --ask${NORMAL} Ask before generating each locale
+- ${GOOD}-A, --all${NORMAL} Pretend the locale list contains all locales
+- ${GOOD}-u, --update${NORMAL} Only generate locales that are missing
+- ${GOOD}-G, --generate <locale>${NORMAL} Generate specified locale (one shot; implies -k -u)
+- ${GOOD}-j, --jobs <num>${NORMAL} Number of locales to generate at a time (parallel)
+- ${GOOD}-q, --quiet${NORMAL} Only show errors
+- ${GOOD}-V, --version${NORMAL} Meaningless version information
+- ${GOOD}-h, --help${NORMAL} Show this help cruft
+-
+- ${HILITE}Localedef Options:${NORMAL}
+- By default, ${GOOD}${LOCALEDEF_OPTS}${NORMAL} is passed to localedef.
+-
+- For more info, see the ${HILITE}locale-gen${NORMAL}(1) and ${HILITE}locale.gen${NORMAL}(8) manpages.
+- EOF
+- [[ $# -eq 0 ]] && exit 0
+- echo ""
+- eerror "Unknown option '$1'"
+- exit 1
+-}
+-show_version() {
+- local b="(" a=")"
+- local cvsver="$Revision: 1.42 $b $Date: 2017/08/12 16:30:06 $a"
+- echo "locale-gen-${cvsver//: }"
+- exit 0
+-}
+-
+-
+-
+-LOCALEDEF_OPTS=""
+-KEEP=""
+-DESTDIR=""
+-CONFIG=""
+-JUST_LIST=""
+-ASK=""
+-ALL=""
+-UPDATE=""
+-GENERATE=""
+-JOBS_MAX=""
+-QUIET=0
+-SET_X=""
+-LOCALE_ARCHIVE=true
+-CUTF_ADDED=""
+-INPLACE_GLIBC=""
+-while [[ $# -gt 0 ]] ; do
+- case $1 in
+- --inplace-glibc) INPLACE_GLIBC=$1;;
+- -k|--keep|--keep-existing) KEEP=$1;;
+- -d|--destdir) shift; DESTDIR=$1; unset ROOT;;
+- -c|--config) shift; CONFIG=$1;;
+- -l|--list) JUST_LIST=$1;;
+- -a|--ask) ASK=$1;;
+- -A|--all) ALL=$1;;
+- -u|--update) UPDATE=$1;;
+- -G|--generate) shift; GENERATE=$1;;
+- -j|--jobs) shift; JOBS_MAX=$(( $1 ));;
+- -j*) : $(( JOBS_MAX = ${1#-j} ));;
+- -q|--quiet) : $(( ++QUIET ));;
+- -x|--debug) SET_X="true";;
+- -V|--version) show_version;;
+- -h|--help) show_usage;;
+- --) shift; LOCALEDEF_OPTS=$*; break;;
+- *) show_usage $1;;
+- esac
+- shift
+-done
+-
+-if [[ -n ${COMPILED_LOCALES} ]] ; then
+- ewarn "All locales have been installed and registered by the package manager. If you"
+- ewarn "rebuild the locale archive now, file integrity tools may show it as corrupted."
+- ewarn "This is not really a big problem, but a better solution is to disable"
+- ewarn "USE=compile-locales and re-install glibc if you dont need all locales."
+- echo
+-fi
+-
+-if [[ -z ${JOBS_MAX} ]] ; then
+- JOBS_MAX=$(getconf _NPROCESSORS_ONLN 2>/dev/null)
+- : ${JOBS_MAX:=1}
+-fi
+-[[ ${JOBS_MAX} -lt 1 ]] && JOBS_MAX=1
+-[[ -n ${SET_X} ]] && set -x
+-: ${KEEP:=${JUST_LIST}}
+-[[ -n ${GENERATE} ]] && UPDATE="true" && KEEP="true"
+-
+-: ${ROOT:=/}
+-ROOT="${ROOT%/}/"
+-if [[ -n ${DESTDIR} ]] && [[ ${ROOT} != "/" ]] ; then
+- eerror "DESTDIR and ROOT are mutually exclusive options"
+- exit 1
+-fi
+-: ${EROOT:="${ROOT%/}${EPREFIX}/"}
+-if [[ ${EROOT} != "/" ]] ; then
+- einfo "Using locale.gen from ROOT ${EROOT}etc/"
+-fi
+-if [[ -n ${DESTDIR} ]] ; then
+- einfo "Building locales in DESTDIR '${DESTDIR}'"
+-else
+- DESTDIR=${EROOT}
+-fi
+-
+-# XXX: should fix this ...
+-if [[ ${ROOT} != "/" ]] ; then
+- eerror "Sorry, but ROOT support is incomplete at this time."
+- exit 0
+-fi
+-
+-: ${CONFIG:=${EROOT}etc/locale.gen}
+-LOCALES=${DESTDIR}usr/share/i18n/locales
+-CHARMAPS=${DESTDIR}usr/share/i18n/charmaps
+-SUPPORTED=${DESTDIR}usr/share/i18n/SUPPORTED
+-ALIAS=${DESTDIR}usr/share/locale/locale.alias
+-
+-#
+-# Grab any user options in their config file
+-options=$(sed -n \
+- -e '/^[[:space:]]*#%/s:^[[:space:]]*#%[[:space:]]*::p'\
+- "${CONFIG}" 2>/dev/null
+-)
+-IFS=$'\n'
+-for option in ${options} ; do
+- case ${option} in
+- no-locale-archive)
+- LOCALE_ARCHIVE=false
+- ;;
+- *)
+- ewarn "Unrecognized option '${option}'"
+- ;;
+- esac
+-done
+-unset IFS
+-
+-[[ -n ${ALL} ]] && CONFIG=${SUPPORTED}
+-
+-# Extract the location of the locale dir on the fly as `localedef --help` has:
+-# locale path : /usr/lib64/locale:/usr/share/i18n
+-# For long paths, the line may get wrapped into two, in which case space (' ') is replaced
+-# by newline (\n).
+-LOCALEDIR=$(LC_ALL="C" "${DESTDIR}"usr/bin/localedef --help | sed -n -r '/locale path/{N;s|.*:[ \n](.*):/.*|\1|;p}')
+-LOCALEDIR="${DESTDIR}${LOCALEDIR#${EPREFIX}}"
+-if [[ $? -ne 0 ]] || [[ -z ${LOCALEDIR} ]] || [[ ${LOCALEDIR} != ${DESTDIR}/usr/lib*/locale ]] ; then
+- eerror "Unable to parse the output of your localedef utility." 1>&2
+- eerror "File a bug about this issue and include the output of 'localedef --help'." 1>&2
+- exit 1
+-fi
+-
+-# Only generate locales the user specified before falling back to the config.
+-locales_to_generate=${GENERATE}
+-
+-if [[ -z ${locales_to_generate} ]] && [[ -e ${CONFIG} ]] ; then
+- locales_to_generate=$(sed \
+- -e 's:#.*::' \
+- -e '/^[[:space:]]*$/d' \
+- "${CONFIG}" | sort)
+- # Sanity check to make sure people did not duplicate entries. #550884
+- # The first column must be unique specifically. #235555
+- dup_locales_to_generate=$(
+- echo "${locales_to_generate}" | \
+- awk '{ if ($1 == last) { print lastline; print; } else { lastline = $0; last = $1; } }')
+- if [[ -n ${dup_locales_to_generate} ]] ; then
+- ewarn "These locales have been duplicated in your config:\n${dup_locales_to_generate}"
+- ewarn "Some might be filtered, but you must fix it."
+- locales_to_generate=$(echo "${locales_to_generate}" | uniq)
+- fi
+-
+- if echo ${locales_to_generate} | grep -vq 'C.UTF-8' ; then
+- if [[ -z ${locales_to_generate} ]] ; then
+- locales_to_generate='C.UTF-8 UTF-8'
+- else
+- locales_to_generate=$(echo "${locales_to_generate}" ; echo -n 'C.UTF-8 UTF-8')
+- fi
+- CUTF_ADDED="true"
+- fi
+-fi
+-
+-if [[ -z ${locales_to_generate} ]] ; then
+- [[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
+- ewarn "No locales found, keeping locale archive"
+- exit 0
+-fi
+-
+-if [[ ${locales_to_generate} == "C.UTF-8 UTF-8" ]] && [[ -n ${CUTF_ADDED} ]] ; then
+- [[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
+- ewarn "No locales found, keeping locale archive"
+- exit 0
+-fi
+-
+-mkdir -p "${LOCALEDIR}"
+-if [[ -z ${KEEP} && -z ${UPDATE} ]] ; then
+- # Remove all old locale dir and locale-archive before generating new
+- # locale data. Scrubbing via update is done elsewhere.
+- rm -rf "${LOCALEDIR}"/* &> /dev/null || true
+-fi
+-
+-# Transform the name in locales.gen to the name used when storing
+-# the locale data in /usr/lib/locale/ ... this normalize algo is
+-# taken out of the glibc localedef source code ...
+-normalize() {
+- if [[ $1 == *.* ]] ; then
+- local ret=$(echo ${1##*.} | tr '[[:upper:]]' '[[:lower:]]')
+- echo ${1%%.*}.${ret//-}
+- else
+- echo $1
+- fi
+-}
+-
+-# These funky sed's are based on the stuff in glibc's localedata/Makefile
+-# Basically we want to rewrite the display like so:
+-# <locale without a . or @>.<charmap>[@extra stuff after the @ in the locale]
+-# en_US ISO-8859-1 -> en_US.ISO-8859-1
+-# en_US.UTF-8 UTF-8 -> en_US.UTF-8
+-# de_DE@euro ISO-8859-15 -> de_DE.ISO-8859-15@euro
+-locales_disp=$(echo "${locales_to_generate}" | sed \
+- -e ' /@/ s:[[:space:]]*\([^@[:space:]]*\)\([^[:space:]]*\)[[:space:]]\+\([^[:space:]]*\):\1.\3\2:' \
+- -e '/^[^@]*$/s:[[:space:]]*\([^.[:space:]]*\)\([^[:space:]]*\)[[:space:]]\+\([^[:space:]]*\):\1.\3:')
+-
+-eval declare -a locales_disp=(${locales_disp})
+-eval declare -a locales_to_generate=(${locales_to_generate})
+-total=$(( ${#locales_to_generate[*]} / 2 ))
+-
+-[[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
+-einfo "Generating ${total} locales (this might take a while) with ${JOBS_MAX} jobs"
+-
+-if [[ -n ${UPDATE} ]] ; then
+- # normalize newlines into spaces
+- existing_locales=" $(echo $(locale -a 2>/dev/null)) "
+-fi
+-
+-generate_locale() {
+- local output=""
+-
+- if [[ -z ${ASK} ]] && [[ ${QUIET} -eq 0 ]] ; then
+- output=" (${cnt_fmt}/${total}) Generating ${disp}"
+- fi
+-
+- if [[ $(( JOB_IDX_E - JOB_IDX_S )) == ${JOBS_MAX} ]] ; then
+- wait ${JOB_PIDS[$(( JOB_IDX_S++ ))]}
+- JOB_RETS+=( $? )
+- fi
+- (
+- # Accumulate all the output in one go so the parallel
+- # jobs don't tromp on each other
+- x=$(
+- [[ -n ${output} ]] && ebegin "${output}"
+- # In most cases, localedef can just use the system glibc.
+- # However, if we are within a major glibc upgrade, this may fail
+- # in src_* phases since the new localedef links against the new
+- # glibc, but the new glibc is not installed yet...
+- if [[ -z ${INPLACE_GLIBC} ]] ; then
+- "${DESTDIR}"usr/bin/localedef ${LOCALEDEF_OPTS} \
+- --no-archive \
+- -i "${input}" \
+- -f "${charmap}" \
+- -A "${ALIAS}" \
+- --prefix "${DESTDIR%${EPREFIX}/}/" \
+- "${locale}" 2>&1
+- else
+- # We assume that the current directory is "${ED}"/$(get_libdir),
+- # see the glibc ebuild, function glibc_sanity_check(), for why.
+- LC_ALL=C ./ld-*.so --library-path . \
+- "${DESTDIR}"usr/bin/localedef ${LOCALEDEF_OPTS} \
+- --no-archive \
+- -i "${input}" \
+- -f "${charmap}" \
+- -A "${ALIAS}" \
+- --prefix "${DESTDIR%${EPREFIX}/}/" \
+- "${locale}" 2>&1
+- fi
+- ret=$?
+- [[ -n ${output} ]] && eend ${ret}
+- exit ${ret}
+- )
+- ret=$?
+- if [[ -n ${output} ]] ; then
+- echo "${x}"
+- elif [[ ${ret} -ne 0 ]] ; then
+- eerror "${disp}: ${x}"
+- fi
+- exit ${ret}
+- ) &
+- JOB_PIDS+=( $! )
+- : $(( ++JOB_IDX_E ))
+-
+- if [[ ${ret} != 0 && ${locale} == */* ]] ; then
+- ewarn "Perhaps you meant to use a space instead of a / in your config file ?"
+- fi
+-}
+-
+-JOB_PIDS=()
+-JOB_RETS=()
+-JOB_IDX_S=0
+-JOB_IDX_E=0
+-cnt=0
+-lidx=0
+-while [[ -n ${locales_to_generate[${lidx}]} ]] ; do
+- : $(( ++cnt ))
+- locale=${locales_to_generate[$((lidx++))]}
+- charmap=${locales_to_generate[$((lidx++))]}
+-
+- # XXX: if we wanted to, we could check existence of
+- # ${LOCALES}/${locale} and ${CHARMAPS}/${charmap}
+- # this would fail for things like "en_US.UTF8", but
+- # in that case we could fall back to checking the
+- # SUPPORTED file ... then again, the localedef
+- # below will abort nicely for us ...
+- if [[ -z ${locale} || -z ${charmap} ]] ; then
+- eerror "Bad entry in locale.gen: '${locale} ${charmap}'; skipping"
+- continue
+- fi
+-
+- disp=${locales_disp[$(( cnt - 1 ))]}
+-
+- if [[ -n ${UPDATE} ]] ; then
+- normalized_locale=$(normalize ${locale})
+- if [[ ${existing_locales} == *" ${normalized_locale} "* ]] ; then
+- existing_locales=${existing_locales/ ${normalized_locale} / }
+- if [[ ${QUIET} -eq 0 ]] ; then
+- cnt_fmt=$(printf "%${#total}i" ${cnt})
+- einfo " (${cnt_fmt}/${total}) Skipping ${disp}"
+- fi
+- continue
+- fi
+- fi
+-
+- # If the locale is like 'en_US.UTF8', then we really want 'en_US'
+- if [[ -f ${LOCALES}/${locale} ]] ; then
+- input=${locale}
+- else
+- input=${locale%%.*}
+- fi
+-
+- if [[ -z ${JUST_LIST} ]] ; then
+- # Format the output for the question/status
+- cnt_fmt=$(printf "%${#total}i" ${cnt})
+- if [[ -n ${ASK} ]] ; then
+- einfon " (${cnt_fmt}/${total}) Generate ${disp} ? (Y/n) "
+- read user_answer
+- [[ ${user_answer} == [nN]* ]] && continue
+- fi
+- generate_locale
+- else
+- echo "${disp}"
+- fi
+-done
+-
+-for (( i = JOB_IDX_S; i < JOB_IDX_E; ++i )) ; do
+- wait ${JOB_PIDS[i]}
+- JOB_RETS+=( $? )
+-done
+-ret=$(( 0 ${JOB_RETS[@]/#/+} ))
+-
+-[[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
+-einfo "Generation complete"
+-
+-if ${LOCALE_ARCHIVE} && [[ -z ${JUST_LIST} ]] ; then
+- ebegin "Adding locales to archive"
+- # The pattern ends with / on purpose: we don't care about files (like
+- # locale-archive) in the locale subdir, and we definitely don't want to
+- # delete them!
+- for LOC in "${LOCALEDIR}"/*/; do
+- LOC=${LOC%/} # Strip trailing /, since localedef doesn't like it
+- x=$(
+- # In most cases, localedef can just use the system glibc.
+- # However, if we are within a major glibc upgrade, this may fail
+- # in src_* phases since the new localedef links against the new
+- # glibc, but the new glibc is not installed yet...
+- if [[ -z ${INPLACE_GLIBC} ]] ; then
+- "${DESTDIR}"usr/bin/localedef \
+- --add-to-archive "${LOC}" \
+- --replace \
+- --prefix "${DESTDIR%${EPREFIX}/}/"
+- else
+- # We assume that the current directory is "${ED}"/$(get_libdir),
+- # see the glibc ebuild, function glibc_sanity_check(), for why.
+- LC_ALL=C ./ld-*.so --library-path . \
+- "${DESTDIR}"usr/bin/localedef \
+- --add-to-archive "${LOC}" \
+- --replace \
+- --prefix "${DESTDIR%${EPREFIX}/}/"
+- fi
+- ret=$?
+- if [[ -n ${output} ]] ; then
+- echo "${x}"
+- elif [[ ${ret} -ne 0 ]] ; then
+- eerror "${disp}: ${x}"
+- fi
+- if [[ $ret -eq 0 ]]; then
+- rm -r "${LOC}"
+- fi
+- exit ${ret}
+- )
+- done
+- eend $ret
+-fi
+-
+-# Remove locales that existed but were not requested
+-if [[ -n ${UPDATE} ]] && [[ -z ${JUST_LIST} ]] ; then
+- # Ignore these pseudo locales
+- existing_locales=${existing_locales/ C / }
+- existing_locales=${existing_locales/ POSIX / }
+- if [[ -n ${existing_locales// } ]] ; then
+- if [[ -z ${KEEP} ]] ; then
+- [[ ${QUIET} -eq 0 ]] && einfo "Scrubbing old locales:"${existing_locales}
+- cd "${LOCALEDIR}" && rm -rf ${existing_locales}
+- else
+- [[ ${QUIET} -eq 0 ]] && einfo "Keeping old locales:"${existing_locales}
+- fi
+- fi
+-fi
+-
+-exit ${ret}
+diff --git a/scripts/gentoo/extra/locale/locale-gen.8 b/scripts/gentoo/extra/locale/locale-gen.8
+deleted file mode 100644
+index a194be742c..0000000000
+--- a/scripts/gentoo/extra/locale/locale-gen.8
++++ /dev/null
+@@ -1,69 +0,0 @@
+-.TH "locale-gen" "8" "Aug 2007" "Gentoo"
+-.SH "NAME"
+-locale\-gen \- generate locales on the fly
+-.SH "DESCRIPTION"
+-The locale\-gen utility is used to manage locales on your system. Often times
+-it merely generates a user configurable list of locales, but it can be used to
+-generate a few locales on the fly as needed.
+-
+-Normally all locales would be generated at build time, but this leads to waste
+-of disk and time as many users really just want a handful on their system.
+-.SH "OPTIONS"
+-.TP
+-\fB\-a\fR, \fB\-\-ask\fR
+-Ask before generating each locale
+-.TP
+-\fB\-A\fR, \fB\-\-all\fR
+-Generate all possible locales
+-.TP
+-\fB\-c\fR, \fB\-\-config\fR \fI<config>\fR
+-Use specified \fIconfig\fR file rather than default /etc/locale.gen
+-.TP
+-\fB\-d\fR, \fB\-\-destdir\fR \fI<dir>\fR
+-Look for locale definitions and store generated locale data in the specified
+-\fIdirectory\fR
+-.TP
+-\fB\-G\fR, \fB\-\-generate\fR \fI<locale>\fR
+-Only generate the specified \fIlocale\fR (implies \-\-keep \-\-update);
+-format of \fIlocale\fR matches a single line in the \fBlocale.gen\fR(5)
+-config file
+-.TP
+-\fB\-h\fR, \fB\-\-help\fR
+-Show the help output (imagine that)
+-.TP
+-\fB\-j\fR, \fB\-\-jobs\fR \fI<num>\fR
+-Generate the specified \fInumber\fR of locales in parallel
+-.TP
+-\fB\-k\fR, \fB\-\-keep\fR
+-Keep all existing locales even if they are not in the config file
+-.TP
+-\fB\-l\fR, \fB\-\-list\fR
+-List all the locales that we think should exist according to the config
+-.TP
+-\fB\-q\fR, \fB\-\-quiet\fR
+-Only spit out errors
+-.TP
+-\fB\-u\fR, \fB\-\-update\fR
+-Only generate locales that do not already exist (normally existing locales are regenerated)
+-.TP
+-\fB\-V\fR, \fB\-\-version\fR
+-Report the program version
+-.TP
+-\fB\-\-\fR
+-To pass custom options directly to the \fBlocaledef\fR utility, end the
+-\fBlocale\-gen\fR option list with \-\- and then everything after that will be
+-passed on through unmolested (the options \-c are passed by default)
+-.SH "AUTHORS"
+-.fi
+-Mike Frysinger <vapier@gentoo.org>
+-.nf
+-.SH "REPORTING BUGS"
+-Please report bugs via http://bugs.gentoo.org/
+-.SH "FILES"
+-\fB/etc/locale.gen\fR \- locale list
+-.SH "SEE ALSO"
+-.BR locale (1),
+-.BR localedef (1),
+-.BR locale (5),
+-.BR locale.gen (5),
+-.BR locale (7)
+diff --git a/scripts/gentoo/extra/locale/locale.gen b/scripts/gentoo/extra/locale/locale.gen
+deleted file mode 100644
+index 0786f1725f..0000000000
+--- a/scripts/gentoo/extra/locale/locale.gen
++++ /dev/null
+@@ -1,36 +0,0 @@
+-# /etc/locale.gen: list all of the locales you want to have on your system.
+-# See the locale.gen(5) man page for more details.
+-#
+-# The format of each line:
+-# <locale name> <charset>
+-#
+-# Where <locale name> starts with a name as found in /usr/share/i18n/locales/.
+-# It must be unique in the file as it is used as the key to locale variables.
+-# For non-default encodings, the <charset> is typically appended.
+-#
+-# Where <charset> is a charset located in /usr/share/i18n/charmaps/ (sans any
+-# suffix like ".gz").
+-#
+-# All blank lines and lines starting with # are ignored.
+-#
+-# For the default list of supported combinations, see the file:
+-# /usr/share/i18n/SUPPORTED
+-#
+-# Whenever glibc is emerged, the locales listed here will be automatically
+-# rebuilt for you. After updating this file, you can simply run `locale-gen`
+-# yourself instead of re-emerging glibc.
+-
+-#en_US ISO-8859-1
+-#en_US.UTF-8 UTF-8
+-#ja_JP.EUC-JP EUC-JP
+-#ja_JP.UTF-8 UTF-8
+-#ja_JP EUC-JP
+-#en_HK ISO-8859-1
+-#en_PH ISO-8859-1
+-#de_DE ISO-8859-1
+-#de_DE@euro ISO-8859-15
+-#es_MX ISO-8859-1
+-#fa_IR UTF-8
+-#fr_FR ISO-8859-1
+-#fr_FR@euro ISO-8859-15
+-#it_IT ISO-8859-1
+diff --git a/scripts/gentoo/extra/locale/locale.gen.5 b/scripts/gentoo/extra/locale/locale.gen.5
+deleted file mode 100644
+index dbcc8c6347..0000000000
+--- a/scripts/gentoo/extra/locale/locale.gen.5
++++ /dev/null
+@@ -1,77 +0,0 @@
+-.\" -*- nroff -*-
+-.\" Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+-.\"
+-.\" This program is free software; you can redistribute it and/or modify
+-.\" it under the terms of the GNU General Public License as published by
+-.\" the Free Software Foundation; either version 2, or (at your option)
+-.\" any later version.
+-.\"
+-.\" This program is distributed in the hope that it will be useful,
+-.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
+-.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-.\" GNU General Public License for more details.
+-.\"
+-.\" You should have received a copy of the GNU General Public License
+-.\" along with this program; if not, write to the Free Software Foundation,
+-.\" Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+-.TH locale.gen 5 "July 2005" "Debian GNU/Linux"
+-.SH "NAME"
+-locale.gen \- Configuration file for locale-gen
+-.SH "DESCRIPTION"
+-The file \fB/etc/locale.gen\fP lists the locales that are to be generated
+-by the \fBlocale-gen\fP command.
+-
+-Each line is of the form:
+-
+-<locale name> <charset>
+-
+-Where <locale name> starts with a name as found in
+-.BR /usr/share/i18n/locales/ .
+-It must be unique in the file as it is used as the key to locale variables
+-(e.g. when you do `export LANG="<locale name>"`). For default encodings,
+-the <charset> is typically omitted, else it is appended with a "." separator.
+-
+-Where <charset> is one of the character sets listed in
+-.B /usr/share/i18n/charmaps
+-(sans any suffix like ".gz"). It should use the same naming conventions too --
+-all caps, and dashes/underscores included. e.g. Use "UTF-8", not "utf8".
+-
+-The
+-.B locale-gen
+-command will generate all the locales, placing them in
+-\fB/usr/lib/locale\fP.
+-
+-Comments start with the hash mark # and may only be on new lines.
+-.SH "OPTIONS"
+-Options start with #% (to preserve backwards compatibility).
+-
+-# This enables the "foo" option.
+-.br
+-#%foo
+-.TP
+-.B no-locale-archive
+-Disable generation of the locale archive file and instead generate multiple
+-files/directories for each locale. This slows down runtime greatly (by having
+-multiple files spread out in the filesystem instead of a single binary file),
+-but it does mean build time is much faster (as you can generate in parallel).
+-
+-You should not use this option.
+-.SH "EXAMPLES"
+-.nf
+-# Create a "en_US" locale using ISO-8859-1 encoding.
+-# When you set LANG=en_US or LANG=en_US.ISO-8859-1, this is used.
+-.B en_US ISO-8859-1
+-
+-# Create a "en_US" locale using UTF-8 encoding.
+-# When you set LANG=en_US.UTF-8, this is used.
+-.B en_US.UTF-8 UTF-8
+-.fi
+-.SH "SEE ALSO"
+-.BR locale (1),
+-.BR localedef (1),
+-.BR locale-gen (8)
+-.SH "AUTHORS"
+-.nf
+-Alastair McKinstry <mckinstry@computer.org>
+-Mike Frysinger <vapier@gentoo.org>
+-.fi
+--
+2.26.2
+
diff --git a/9999/0012-no-patch-Gentoo-remove-etc-files-now-in-FILESDIR.patch b/9999/0012-no-patch-Gentoo-remove-etc-files-now-in-FILESDIR.patch
new file mode 100644
index 0000000..d5574b5
--- /dev/null
+++ b/9999/0012-no-patch-Gentoo-remove-etc-files-now-in-FILESDIR.patch
@@ -0,0 +1,141 @@
+From a9f217bf09f9b82659bb5f330a26e2f1b51e6d7a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
+Date: Tue, 12 May 2020 23:46:17 +0300
+Subject: [PATCH 12/12] [no-patch] Gentoo: remove etc files, now in FILESDIR
+
+---
+ scripts/gentoo/extra/.keep | 0
+ scripts/gentoo/extra/etc/host.conf | 24 ---------
+ scripts/gentoo/extra/etc/nscd | 85 ------------------------------
+ 3 files changed, 109 deletions(-)
+ create mode 100644 scripts/gentoo/extra/.keep
+ delete mode 100644 scripts/gentoo/extra/etc/host.conf
+ delete mode 100644 scripts/gentoo/extra/etc/nscd
+
+diff --git a/scripts/gentoo/extra/.keep b/scripts/gentoo/extra/.keep
+new file mode 100644
+index 0000000000..e69de29bb2
+diff --git a/scripts/gentoo/extra/etc/host.conf b/scripts/gentoo/extra/etc/host.conf
+deleted file mode 100644
+index 4c58e52d6b..0000000000
+--- a/scripts/gentoo/extra/etc/host.conf
++++ /dev/null
+@@ -1,24 +0,0 @@
+-# /etc/host.conf:
+-# $Header: /var/cvsroot/gentoo/src/patchsets/glibc/extra/etc/host.conf,v 1.1 2006/09/29 23:52:23 vapier Exp $
+-
+-# The file /etc/host.conf contains configuration information specific to
+-# the resolver library. It should contain one configuration keyword per
+-# line, followed by appropriate configuration information. The keywords
+-# recognized are order, trim, mdns, multi, nospoof, spoof, and reorder.
+-
+-
+-
+-# This keyword specifies how host lookups are to be performed. It
+-# should be followed by one or more lookup methods, separated by
+-# commas. Valid methods are bind, hosts, and nis.
+-#
+-order hosts, bind
+-
+-
+-# Valid values are on and off. If set to on, the resolv+ library
+-# will return all valid addresses for a host that appears in the
+-# /etc/hosts file, instead of only the first. This is off by
+-# default, as it may cause a substantial performance loss at sites
+-# with large hosts files.
+-#
+-multi off
+diff --git a/scripts/gentoo/extra/etc/nscd b/scripts/gentoo/extra/etc/nscd
+deleted file mode 100644
+index abe31f892d..0000000000
+--- a/scripts/gentoo/extra/etc/nscd
++++ /dev/null
+@@ -1,85 +0,0 @@
+-#!/sbin/openrc-run
+-# Copyright 1999-2017 Gentoo Foundation
+-# Distributed under the terms of the GNU General Public License v2
+-
+-description="The 'Name Service Cache Daemon' is a daemon that provides a cache"
+-description="${description} for the most common name service requests"
+-
+-extra_started_commands="flush_all flush_hosts flush_group flush_passwd flush_netgroup flush_services"
+-
+-description_flush_all="Will invalidate hosts, group, passwd, netgroup and services cache"
+-description_flush_hosts="Will invalidate hosts cache"
+-description_flush_group="Will invalidate group cache"
+-description_flush_passwd="Will invalidate passwd cache"
+-description_flush_netgroup="Will invalidate netgroup cache"
+-description_flush_services="Will invalidate services cache"
+-
+-pidfile="/run/nscd/nscd.pid"
+-command="/usr/sbin/nscd"
+-
+-depend() {
+- use dns ldap net slapd logger
+-}
+-
+-checkconfig() {
+- if [ ! -d /run/nscd ] ; then
+- checkpath -d -m 755 /run/nscd
+- fi
+-
+- if [ -z "${NSCD_PERMS_OK}" ] && [ "$(stat -c %a /run/nscd)" != "755" ] ; then
+- ewarn "nscd run dir is not world readable, you should reset the perms:"
+- ewarn "chmod 755 /run/nscd"
+- ewarn "chmod a+rw /run/nscd/socket"
+- ewarn "To disable this warning, set 'NSCD_PERMS_OK' in /etc/conf.d/nscd"
+- fi
+-
+- if grep -qs '^[[:space:]]*persistent\>' /etc/nscd.conf ; then
+- checkpath -d -m 700 /var/db/nscd
+- fi
+-}
+-
+-_flush() {
+- local table=$1
+-
+- ebegin "Flushing ${table} table"
+- ${command} --invalidate ${table}
+- eend $?
+-}
+-
+-flush_all() {
+- local has_errors=0
+-
+- ebegin "Flushing all caches"
+-
+- local table=
+- for table in passwd group hosts netgroup services; do
+- ${command} --invalidate ${table}
+- [ $? -ne 0 ] && has_errors=1
+- done
+-
+- eend ${has_errors}
+-}
+-
+-flush_hosts() {
+- _flush hosts
+-}
+-
+-flush_group() {
+- _flush group
+-}
+-
+-flush_passwd() {
+- _flush passwd
+-}
+-
+-flush_netgroup() {
+- _flush netgroup
+-}
+-
+-flush_services() {
+- _flush services
+-}
+-
+-start_pre() {
+- checkconfig
+-}
+--
+2.26.2
+
diff --git a/README.Gentoo.patches b/README.Gentoo.patches
new file mode 100644
index 0000000..c6f94dc
--- /dev/null
+++ b/README.Gentoo.patches
@@ -0,0 +1,26 @@
+ ============
+ === What ===
+ ============
+
+Gentoo patchsets for glibc are maintained as vendor branches of the upstream
+glibc git repository. From there, we bundle all the commits into a tarball
+and distribute it via our public mirroring system.
+
+If you want specific info about a patch (like what it does or whose great idea
+it was to change the code), read the patch! We try to fill out the commit
+messages with useful info such as what it does, why it's needed, bug reports,
+original creators, etc...
+
+ =============
+ === Where ===
+ =============
+
+Currently, https://github.com/gentoo/glibc
+
+ ===========
+ === How ===
+ ===========
+
+Patches are named exactly as generated by "git format-patch".
+All patches thus apply with -p1 (so they can be used both with the legacy
+epatch function and the new, more strict eapply function).
diff --git a/make-tarball.sh b/make-tarball.sh
new file mode 100755
index 0000000..a4f380d
--- /dev/null
+++ b/make-tarball.sh
@@ -0,0 +1,107 @@
+#!/bin/bash
+
+PN="glibc"
+PV=${1%/}
+pver=$2
+
+if [[ -z ${PV} ]] ; then
+ echo "Usage: $0 glibc-version patchset-version-to-be-created"
+ echo "Please read the script before trying to use it :)"
+ exit 1
+fi
+
+# check that we're in the root of a glibc git repo
+
+if [[ ! -f libc-abis ]] || [[ ! -d .git ]] ; then
+ echo "Error: You need to call this script in the main directory of a Gentoo glibc git clone"
+ exit 1
+fi
+
+# check that we're on a branch gentoo/${PV}
+
+mybranchinfo=$(git status --porcelain -b|grep '^##')
+mybranch=$(echo ${mybranchinfo}|sed -e 's:^## ::' -e 's:\.\.\..*$::')
+if [[ ! "gentoo/${PV}" == "${mybranch}" ]] ; then
+ echo "Error: Your git repository is on the incorrect branch ${mybranch}; should be gentoo/${PV}"
+ exit 1
+fi
+
+# check that the working directory is clean
+
+mystatusinfo=$(git status --porcelain)
+if [[ ! -z "${mystatusinfo}" ]] ; then
+ echo "Error: Your working directory is not clean"
+ exit 1
+fi
+
+# check if the tag already exists
+
+mytaginfo=$(git tag -l|grep "gentoo/glibc-${PV}-${pver}")
+if [[ ! -z "${mytaginfo}" ]] ; then
+ echo "Error: A tag corresponding to this patch level already exists (gentoo/glibc-${PV}-${pver})"
+ exit 1
+fi
+
+# luckily glibc git has no /tmp dir and no tar.xz files, but let's better check and be pathologically careful
+
+if [[ -e tmp ]] || [[ -e ${PN}-${PV}-patches-${pver}.tar.xz ]] ; then
+ echo "Error: tmp or ${PN}-${PV}-patches-${pver}.tar.xz exists in git"
+ exit 1
+fi
+rm -rf tmp
+rm -f ${PN}-${PV}-*.tar.xz
+
+for myname in 0*.patch ; do
+ if [[ -e ${myname} ]]; then
+ echo "Error: ${myname} exists in git"
+ exit 1
+ fi
+done
+rm -f 0*.patch
+
+mkdir -p tmp/patches
+
+# copy README.Gentoo.patches
+
+cp scripts/gentoo/README.Gentoo.patches tmp/ || exit 1
+
+# create and rename patches
+
+if [[ "${PV}" == "9999" ]]; then
+ # we're working with master, start from upstream master
+ startpoint="master"
+else
+ # release branch, start from upstream release tag
+ startpoint="glibc-${PV}"
+fi
+
+git format-patch ${startpoint}..HEAD > /dev/null
+
+# remove all patches where the summary line starts with [no-tarball] or [no-patch]
+
+rm -f 0???-no-tarball-*.patch
+rm -f 0???-no-patch-*.patch
+
+# move patches into temporary directory
+
+mv 0*.patch tmp/patches/ || exit 1
+
+# copy support files
+
+cp -r scripts/gentoo/extra tmp/ || exit 1
+
+# add a history file
+
+git log --stat --decorate ${startpoint}..HEAD > tmp/patches/README.history || exit 1
+
+# package everything up
+
+tar -Jcf ${PN}-${PV}-patches-${pver}.tar.xz \
+ -C tmp patches extra README.Gentoo.patches || exit 1
+rm -r tmp
+
+du -b *.tar.xz
+
+# tag the commit
+
+git tag -s -m "Gentoo patchset ${PV}-${pver}" "gentoo/glibc-${PV}-${pver}"