3 # Copyright (C) 2010 Red Hat Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 if [ ! -f HACKING ]; then
20 echo "You should run this script from the top source directory."
30 website=$HOME/d/redhat/websites/libguestfs
31 tarballs="$website/download/1.*-*/libguestfs-*.tar.gz"
33 for t in $tarballs; do
35 p=$(basename $t .tar.gz)
37 v=$(echo $p | sed 's/^libguestfs-//')
39 if [ $v != "1.2.0" -a $v != "1.3.0" -a ! -f $v ]; then
42 -zxf $t $p/src/guestfs-actions.c $p/src/actions.c 2>/dev/null ||:
44 f="$tmpdir/$p/src/guestfs-actions.c"
45 if [ ! -f "$f" ]; then
46 f="$tmpdir/$p/src/actions.c"
47 if [ ! -f "$f" ]; then
48 echo "$t does not contain actions file"
53 grep -Eo 'guestfs_[a-z0-9][_A-Za-z0-9]+' "$f" |
57 grep -v '^guestfs_free_' |
58 grep -v '^guestfs_test0' |
59 grep -v '^guestfs_message_error$' |
60 grep -v '^guestfs_message_header$' > $v
66 # GNU ls sorts properly by version with the -v option and backwards by
68 rev_versions=$(ls -vr [01]*)
69 latest=$(ls -v [01]* | tail -1)
73 # Get all the symbols from the latest version.
74 # We are implicitly assuming that symbols are not removed. ABI
75 # guarantee should prevent that from happening.
79 for v in $rev_versions; do
81 for sym in $symbols; do
82 # If symbol is missing from the file, that indicates it
83 # was added in the previous file we checked ($previous).
84 if ! grep -sq $sym $v; then
85 echo $sym $previous >&5
87 next_symbols="$next_symbols $sym"
90 symbols="$next_symbols"
94 # Any remaining were added in the very first version.
95 for sym in $symbols; do
96 echo $sym $previous >&5
99 # Close and sort the output by symbol name.