2 # Update abilist files based on differences on one architecture.
3 # Copyright (C) 2015-2017 Free Software Foundation, Inc.
4 # This file is part of the GNU C Library.
6 # The GNU C Library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
11 # The GNU C Library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with the GNU C Library; if not, see
18 # <http://www.gnu.org/licenses/>.
24 echo "usage: $0 OLD-FILE NEW-FILE FILES-TO-BE-PATCHED..." 1>&2
33 tmp_old_sorted
="$(mktemp)"
34 tmp_new_sorted
="$(mktemp)"
35 tmp_new_symbols
="$(mktemp)"
36 tmp_patched
="$(mktemp)"
39 rm -f -- "$tmp_old_sorted" "$tmp_new_sorted" \
40 "$tmp_new_symbols" "$tmp_patched"
45 sort -u -o "$tmp_old_sorted" -- "$old_file"
46 sort -u -o "$tmp_new_sorted" -- "$new_file"
48 # -1 skips symbols only in $old_file (deleted symbols).
49 # -3 skips symbols in both files (unchanged symbols).
50 comm -1 -3 "$tmp_old_sorted" "$tmp_new_sorted" > "$tmp_new_symbols"
52 new_symbol_count
="$(wc -l < "$tmp_new_symbols")"
53 if [ "$new_symbol_count" -eq 0 ]; then
54 echo "info: no symbols added" 1>&2
58 echo "info: $new_symbol_count symbol(s) added" 1>&2
60 for to_be_patched
in "$@" ; do
61 sort -u -o "$tmp_patched" -- "$to_be_patched" "$tmp_new_symbols"
62 if ! cmp -s -- "$to_be_patched" "$tmp_patched"; then
63 echo "info: updating $to_be_patched" 1>&2
64 cp -- "$tmp_patched" "$to_be_patched"