-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementation and API version information is added to the API documentation. The README now contains an API version-specific link. A script is added to the test suite, verifying the documentation and shared library version information to be correct. The library implementation now identifies itself as 1.0.0. The ABI is version 0.0. Signed-off-by: Mattias Rönnblom <[email protected]>
- Loading branch information
1 parent
ec5614a
commit 674c977
Showing
5 changed files
with
155 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,25 @@ | ||
-*- Autoconf -*- | ||
|
||
AC_INIT(libpaf, 0.1, [[email protected]]) | ||
m4_define([paf_major_version], [1]) | ||
m4_define([paf_minor_version], [0]) | ||
m4_define([paf_patch_version], [0]) | ||
m4_define([paf_version],[paf_major_version.paf_minor_version.paf_patch_version]) | ||
|
||
m4_define([paf_abi_major_version], [m4_eval(paf_major_version - 1)]) | ||
m4_define([paf_abi_minor_version], [paf_minor_version]) | ||
|
||
AC_INIT(libpaf, [paf_version], [[email protected]]) | ||
AM_INIT_AUTOMAKE([foreign subdir-objects]) | ||
AC_CONFIG_MACRO_DIR([m4]) | ||
AC_PREREQ([2.63]) | ||
AC_PROG_CC | ||
|
||
AC_SUBST([PAF_ABI_MAJOR_VERSION], [paf_abi_major_version]) | ||
AC_SUBST([PAF_ABI_MINOR_VERSION], [paf_abi_minor_version]) | ||
AC_SUBST([PAF_MAJOR_VERSION], [paf_major_version]) | ||
AC_SUBST([PAF_MINOR_VERSION], [paf_minor_version]) | ||
AC_SUBST([PAF_PATCH_VERSION], [paf_patch_version]) | ||
|
||
AC_USE_SYSTEM_EXTENSIONS | ||
|
||
LT_INIT | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
#!/usr/bin/python3 | ||
|
||
import sys | ||
import re | ||
import os | ||
import stat | ||
|
||
if len(sys.argv) != 9: | ||
print("Usage: %s <paf-hdr-file> <readme> <builddir> <expected-abi-major> " | ||
"<expected-abi-minor> <expected-impl-major>" | ||
"<exepected-impl-minor> <expected-impl-patch>" % sys.argv[0]) | ||
sys.exit(1) | ||
|
||
hdr_abi_version_re = \ | ||
re.compile(r'@version\s+([0-9]+)\.([0-9]+).*API.*') | ||
hdr_impl_version_re = \ | ||
re.compile(r'@version\s+([0-9]+)\.([0-9]+)\.([0-9]+).*Implementation.*') | ||
|
||
readme_link_re = re.compile(r'paf/api/([0-9]+)\.([0-9]+)/') | ||
|
||
def check_hdr(hdr_file, abi_major, abi_minor, impl_major, impl_minor, | ||
impl_patch): | ||
hdr = open(hdr_file).read() | ||
|
||
print("ABI version: %d.%d." % (abi_major, abi_minor)) | ||
print("Implementation version: %d.%d.%d" % | ||
(impl_major, impl_minor, impl_patch)) | ||
print("Header file: %s" % hdr_file) | ||
|
||
hdr_abi_m = hdr_abi_version_re.search(hdr) | ||
if not hdr_abi_m: | ||
print("Can't find ABI version info in %s." % hdr_file) | ||
sys.exit(1) | ||
hdr_abi_major, hdr_abi_minor = [int(ver) for ver in hdr_abi_m.groups()] | ||
|
||
print("Pathfinder ABI documented to be version %d.%d." % | ||
(hdr_abi_major, hdr_abi_minor)) | ||
|
||
if abi_major != hdr_abi_major: | ||
print("Incorrect ABI major version in header file.") | ||
sys.exit(1) | ||
|
||
if abi_minor != hdr_abi_minor: | ||
print("Incorrect ABI minor version in header file.") | ||
sys.exit(1) | ||
|
||
hdr_impl_m = hdr_impl_version_re.search(hdr) | ||
if not hdr_impl_m: | ||
print("Can't find Implementation version info in %s." % hdr_file) | ||
sys.exit(1) | ||
hdr_impl_major, hdr_impl_minor, hdr_impl_patch = \ | ||
[int(ver) for ver in hdr_impl_m.groups()] | ||
|
||
print("Pathfinder library implementation documented to be " | ||
"version %d.%d.%d." % (hdr_impl_major, hdr_impl_minor, | ||
hdr_impl_patch)) | ||
|
||
if impl_major != hdr_impl_major: | ||
print("Incorrect implementation major version in header file.") | ||
sys.exit(1) | ||
|
||
if impl_minor != hdr_impl_minor: | ||
print("Incorrect implementation minor version in header file.") | ||
sys.exit(1) | ||
|
||
if impl_patch != hdr_impl_patch: | ||
print("Incorrect implementation patch version in header file.") | ||
sys.exit(1) | ||
|
||
def check_readme(readme_file, abi_major, abi_minor): | ||
readme = open(readme_file).read() | ||
|
||
readme_m = readme_link_re.search(readme) | ||
|
||
if not readme_m: | ||
print("Can't find API documentation link in %s." % readme_file) | ||
sys.exit(1) | ||
|
||
readme_abi_major, readme_abi_minor = [int(ver) for ver in readme_m.groups()] | ||
|
||
print("README documentation link points towards version %d.%d." % | ||
(readme_abi_major, readme_abi_minor)) | ||
|
||
if abi_major != readme_abi_major: | ||
print("Incorrect ABI major version in link.") | ||
sys.exit(1) | ||
|
||
if abi_minor != readme_abi_minor: | ||
print("Incorrect ABI minor version in link.") | ||
sys.exit(1) | ||
|
||
def check_so(builddir, abi_major, abi_minor, patch): | ||
so_file = "%s/.libs/libpaf.so.%d.%d.%d" % \ | ||
(builddir, abi_major, abi_minor, patch) | ||
try: | ||
st = os.stat(so_file) | ||
if stat.S_ISREG(st.st_mode): | ||
print("Shared library file is at \"%s\", as expected." % so_file) | ||
else: | ||
print("\"%s\" is not a regular file." % so_file) | ||
sys.exit(1) | ||
except FileNotFoundError: | ||
print("Shared library file \"%s\" not found." % so_file) | ||
sys.exit(1) | ||
|
||
paf_hdr_file = sys.argv[1] | ||
readme = sys.argv[2] | ||
builddir = sys.argv[3] | ||
abi_major = int(sys.argv[4]) | ||
abi_minor = int(sys.argv[5]) | ||
impl_major = int(sys.argv[6]) | ||
impl_minor = int(sys.argv[7]) | ||
impl_patch = int(sys.argv[8]) | ||
|
||
check_hdr(paf_hdr_file, abi_major, abi_minor, impl_major, impl_minor, | ||
impl_patch) | ||
|
||
check_readme(readme, abi_major, abi_minor) | ||
|
||
check_so(builddir, abi_major, abi_minor, impl_patch) | ||
|
||
print("All good.") | ||
sys.exit(0) |