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 \
46 f="$tmpdir/$p/src/guestfs-actions.c"
47 if [ ! -f "$f" ]; then
48 f="$tmpdir/$p/src/actions.c"
49 if [ ! -f "$f" ]; then
50 echo "$t does not contain actions file"
55 grep -Eoh 'guestfs_[a-z0-9][_A-Za-z0-9]+' \
56 "$f" $tmpdir/$p/src/guestfs.c |
60 grep -v '^guestfs_free_' |
61 grep -v '^guestfs_test0' |
62 grep -v '^guestfs_message_error$' |
63 grep -v '^guestfs_message_header$' > $v
69 # GNU ls sorts properly by version with the -v option and backwards by
71 rev_versions=$(ls -vr [01]*)
72 latest=$(ls -v [01]* | tail -1)
76 # Get all the symbols from the latest version.
77 # We are implicitly assuming that symbols are not removed. ABI
78 # guarantee should prevent that from happening.
82 for v in $rev_versions; do
84 for sym in $symbols; do
85 # If symbol is missing from the file, that indicates it
86 # was added in the previous file we checked ($previous).
87 if ! grep -sq $sym $v; then
88 echo $sym $previous >&5
90 next_symbols="$next_symbols $sym"
93 symbols="$next_symbols"
97 # Any remaining were added in the very first version.
98 for sym in $symbols; do
99 echo $sym $previous >&5
102 # Close and sort the output by symbol name.