lib: Split symbol versioning into -released and -devel

So far a lot of submitted PR have added symbols into the first
section.  Split the file into `-released` and `-devel` to make
this more obvious.

To further enforce things, we hardcode a checksum of the `-released`
file in `test-symbols.sh`.  Only release commits should update that
checksum.

Did you notice I like checksums?

Closes: #931
Approved by: pwithnall
This commit is contained in:
Colin Walters 2017-06-14 21:44:04 -04:00 committed by Atomic Bot
parent 3e3a0f0766
commit 2bab43fb22
5 changed files with 69 additions and 38 deletions

View File

@ -155,24 +155,24 @@ libostree_1_la_SOURCES += \
$(NULL) $(NULL)
endif endif
symbol_files = $(top_srcdir)/src/libostree/libostree-released.sym \
$(top_srcdir)/src/libostree/libostree-devel.sym
if ENABLE_EXPERIMENTAL_API
symbol_files += $(top_srcdir)/src/libostree/libostree-experimental.sym
endif
# http://blog.jgc.org/2007/06/escaping-comma-and-space-in-gnu-make.html
wl_versionscript_arg = -Wl,--version-script=
EXTRA_DIST += $(symbol_files)
libostree_1_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/bsdiff -I$(srcdir)/libglnx -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(builddir)/src/libostree \ libostree_1_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/bsdiff -I$(srcdir)/libglnx -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(builddir)/src/libostree \
$(OT_INTERNAL_GIO_UNIX_CFLAGS) $(OT_INTERNAL_GPGME_CFLAGS) $(OT_DEP_LZMA_CFLAGS) $(OT_DEP_ZLIB_CFLAGS) $(OT_DEP_OPENSSL_CFLAGS) \ $(OT_INTERNAL_GIO_UNIX_CFLAGS) $(OT_INTERNAL_GPGME_CFLAGS) $(OT_DEP_LZMA_CFLAGS) $(OT_DEP_ZLIB_CFLAGS) $(OT_DEP_OPENSSL_CFLAGS) \
-fvisibility=hidden '-D_OSTREE_PUBLIC=__attribute__((visibility("default"))) extern' -fvisibility=hidden '-D_OSTREE_PUBLIC=__attribute__((visibility("default"))) extern'
libostree_1_la_LDFLAGS = -version-number 1:0:0 -Bsymbolic-functions -Wl,--version-script=$(top_srcdir)/src/libostree/libostree.sym libostree_1_la_LDFLAGS = -version-number 1:0:0 -Bsymbolic-functions $(addprefix $(wl_versionscript_arg),$(symbol_files))
libostree_1_la_LIBADD = libotutil.la libglnx.la libbsdiff.la libostree-kernel-args.la $(OT_INTERNAL_GIO_UNIX_LIBS) $(OT_INTERNAL_GPGME_LIBS) \ libostree_1_la_LIBADD = libotutil.la libglnx.la libbsdiff.la libostree-kernel-args.la $(OT_INTERNAL_GIO_UNIX_LIBS) $(OT_INTERNAL_GPGME_LIBS) \
$(OT_DEP_LZMA_LIBS) $(OT_DEP_ZLIB_LIBS) $(OT_DEP_OPENSSL_LIBS) $(OT_DEP_LZMA_LIBS) $(OT_DEP_ZLIB_LIBS) $(OT_DEP_OPENSSL_LIBS)
libostree_1_la_LIBADD += $(bupsplitpath) libostree_1_la_LIBADD += $(bupsplitpath)
EXTRA_libostree_1_la_DEPENDENCIES = $(top_srcdir)/src/libostree/libostree.sym EXTRA_libostree_1_la_DEPENDENCIES = $(symbol_files)
EXTRA_DIST += \
src/libostree/libostree.sym \
src/libostree/libostree-experimental.sym \
$(NULL)
if ENABLE_EXPERIMENTAL_API
libostree_1_la_LDFLAGS += -Wl,--version-script=$(top_srcdir)/src/libostree/libostree-experimental.sym
EXTRA_libostree_1_la_DEPENDENCIES += $(top_srcdir)/src/libostree/libostree-experimental.sym
endif
if USE_LIBARCHIVE if USE_LIBARCHIVE
libostree_1_la_CFLAGS += $(OT_DEP_LIBARCHIVE_CFLAGS) libostree_1_la_CFLAGS += $(OT_DEP_LIBARCHIVE_CFLAGS)

View File

@ -1,5 +1,7 @@
AC_PREREQ([2.63]) AC_PREREQ([2.63])
dnl If incrementing the version here, remember to update libostree.sym too dnl If doing a final release, remember to follow the instructions to
dnl update libostree-released.sym from libostree-devel.sym, and update the checksum
dnl in test-symbols.sh
m4_define([year_version], [2017]) m4_define([year_version], [2017])
m4_define([release_version], [7]) m4_define([release_version], [7])
m4_define([package_version], [year_version.release_version]) m4_define([package_version], [year_version.release_version])

View File

@ -0,0 +1,35 @@
/* DEVEL symbol file - add new symbols here
Copyright (C) 2016 Colin Walters <walters@verbum.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
***/
/* Add new symbols here. Release commits should copy this section into -released.sym. */
LIBOSTREE_2017.7 {
global:
ostree_sysroot_repo;
ostree_sysroot_query_deployments_for;
} LIBOSTREE_2017.6;
/* Stub section for the stable release *after* this development one; don't
* edit this other than to update the last number. This is just a copy/paste
* source. Replace $LASTSTABLE with the last stable version, and $NEWVERSION
* with whatever the next version with new symbols will be.
LIBOSTREE_2017.$NEWVERSION {
global:
someostree_symbol_deleteme;
} LIBOSTREE_2017.$LASTSTABLE;
*/

View File

@ -1,4 +1,6 @@
/*** /* Released symbol file: DO NOT EDIT except in release commits!
Edit libostree-devel.sym instead.
Copyright (C) 2016 Colin Walters <walters@verbum.org> Copyright (C) 2016 Colin Walters <walters@verbum.org>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
@ -17,6 +19,9 @@
Boston, MA 02111-1307, USA. Boston, MA 02111-1307, USA.
***/ ***/
/* DO NOT EDIT this file - use libostree-devel.sym instead. Release
* commits will move symbols from libostree-devel.sym to libostree-released.sym.
*/
/* /*
Retroactively make all of these symbols 2016.3, which is Retroactively make all of these symbols 2016.3, which is
@ -396,24 +401,3 @@ global:
ostree_async_progress_get_variant; ostree_async_progress_get_variant;
ostree_async_progress_set_variant; ostree_async_progress_set_variant;
} LIBOSTREE_2017.4; } LIBOSTREE_2017.4;
/* NOTE NOTE NOTE
* Versions above here are released. Only add symbols below this line.
* NOTE NOTE NOTE
*/
LIBOSTREE_2017.7 {
global:
ostree_sysroot_repo;
ostree_sysroot_query_deployments_for;
} LIBOSTREE_2017.6;
/* Stub section for the stable release *after* this development one; don't
* edit this other than to update the last number. This is just a copy/paste
* source. Replace $LASTSTABLE with the last stable version, and $NEWVERSION
* with whatever the next version with new symbols will be.
LIBOSTREE_2017.$NEWVERSION {
global:
someostree_symbol_deleteme;
} LIBOSTREE_2017.$LASTSTABLE;
*/

View File

@ -17,10 +17,12 @@
# Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA. # Boston, MA 02111-1307, USA.
set -euo pipefail set -xeuo pipefail
echo '1..2' echo '1..3'
released_syms=${G_TEST_SRCDIR}/src/libostree/libostree-released.sym
devel_syms=${G_TEST_SRCDIR}/src/libostree/libostree-devel.sym
if echo "$OSTREE_FEATURES" | grep --quiet --no-messages "experimental"; then if echo "$OSTREE_FEATURES" | grep --quiet --no-messages "experimental"; then
experimental_sym="${G_TEST_SRCDIR}/src/libostree/libostree-experimental.sym" experimental_sym="${G_TEST_SRCDIR}/src/libostree/libostree-experimental.sym"
experimental_sections="${G_TEST_SRCDIR}/apidoc/ostree-experimental-sections.txt" experimental_sections="${G_TEST_SRCDIR}/apidoc/ostree-experimental-sections.txt"
@ -30,7 +32,7 @@ else
fi fi
echo "Verifying all expected symbols are actually exported..." echo "Verifying all expected symbols are actually exported..."
grep --no-filename ' ostree_[A-Za-z0-9_]*;' ${G_TEST_SRCDIR}/src/libostree/libostree.sym $experimental_sym | sed -e 's,^ *\([A-Za-z0-9_]*\);,\1,' | sort -u > expected-symbols.txt grep --no-filename ' ostree_[A-Za-z0-9_]*;' ${released_syms} ${devel_syms} ${experimental_sym} | sed -e 's,^ *\([A-Za-z0-9_]*\);,\1,' | sort -u > expected-symbols.txt
eu-readelf -a ${G_TEST_BUILDDIR}/.libs/libostree-1.so | grep 'FUNC.*GLOBAL.*DEFAULT.*@@LIBOSTREE_' | sed -e 's,^.* \(ostree_[A-Za-z0-9_]*\)@@LIBOSTREE_[0-9A-Z_.]*,\1,' |sort -u > found-symbols.txt eu-readelf -a ${G_TEST_BUILDDIR}/.libs/libostree-1.so | grep 'FUNC.*GLOBAL.*DEFAULT.*@@LIBOSTREE_' | sed -e 's,^.* \(ostree_[A-Za-z0-9_]*\)@@LIBOSTREE_[0-9A-Z_.]*,\1,' |sort -u > found-symbols.txt
diff -u expected-symbols.txt found-symbols.txt diff -u expected-symbols.txt found-symbols.txt
echo "ok exports" echo "ok exports"
@ -43,3 +45,11 @@ grep --no-filename '^ostree_' ${G_TEST_SRCDIR}/apidoc/ostree-sections.txt $exper
diff -u expected-documented.txt found-documented.txt diff -u expected-documented.txt found-documented.txt
echo 'ok documented symbols' echo 'ok documented symbols'
# ONLY update this checksum in release commits!
cat > released-sha256.txt <<EOF
1cacda8ca5f9622da8c36565f58f76d3437f86b276e266a0d4cb531449153404 ${released_syms}
EOF
sha256sum -c released-sha256.txt
echo "ok someone didn't add a symbol to a released version"