public inbox for location@lists.ipfire.org
 help / color / mirror / Atom feed
From: Valters Jansons <valter.jansons@gmail.com>
To: location@lists.ipfire.org
Subject: [PATCH] debian: Add dpkg's symbols file
Date: Fri, 11 Jun 2021 10:51:07 +0300	[thread overview]
Message-ID: <20210611075107.7727-1-valter.jansons@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 8909 bytes --]

There are muiltiple standards of listing symbols throughout the Linux
ecosystem. For `dpkg`, a d/package.symbols file tracks symbols, and in
which version they were added in. This is then used to allow dependency
checks/resolution.

See man:dpkg-gensymbols(1) for details about the generation,
and man:dpkg-shlibdeps(1) for how the symbols file ends up being used.

This commit adds a d/libloc1.symbols file, containing the current state
of the symbols. There is now also a d/gensymbols.sh script, which
generates this symbols file. The script tries to determine what Git
tags need to be checked for changes in symbols, by looking at current
maximum version referenced in symbols file.

After checking tags, the current revision is also processed, to allow
building symbols file for a yet unreleased version (prior to tagging it).
This is to allow symbols changes to be included in a tag.

Do keep in mind, that for the workflow above, when running the script,
the d/changelog file should contain information about what version the
current revision will be released at (potentially tagged as UNRELEASED
in the d/changelog file). Otherwise, if there is no version tagged,
the `dpkg-gensymbols` tool will use the old version information,
in turn incorrectly attributing new symbols to an old version.
---
 debian/gensymbols.sh   |  50 +++++++++++++++
 debian/libloc1.symbols | 134 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 184 insertions(+)
 create mode 100755 debian/gensymbols.sh
 create mode 100644 debian/libloc1.symbols

diff --git a/debian/gensymbols.sh b/debian/gensymbols.sh
new file mode 100755
index 0000000..8523556
--- /dev/null
+++ b/debian/gensymbols.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+SYMBOLS_PKG=libloc1
+LOCAL_FILE=debian/libloc1.symbols
+TEMP_FILE="$(mktemp --tmpdir libloc1.XXXXXX.symbols)"
+trap "rm -f ${TEMP_FILE}" EXIT
+
+generate () {
+  intltoolize --force --automake
+  autoreconf --install --symlink
+  ./configure CFLAGS='-g -O0' --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib
+
+  make
+
+  dpkg-gensymbols -p"$SYMBOLS_PKG" -O"$TEMP_FILE" -esrc/.libs/libloc.so.*
+  sed -i -E -e 's/( [0-9\.]+)-.+$/\1/' "$TEMP_FILE"
+
+  make clean
+}
+
+main () {
+  local maxver='0.0.0'
+  if [ -f "$LOCAL_FILE" ]; then
+    cp "$LOCAL_FILE" "$TEMP_FILE"
+    maxver="$(grep -E '^ ' "$LOCAL_FILE" | cut -d' ' -f3 | sort -Vru | head -n1)"
+    echo "Latest version checked: $maxver"
+  fi
+
+
+  local tag
+  for tag in $(git tag -l --sort=version:refname)
+  do
+    if [ "$(echo -e "${maxver}\n${tag}" | sort -Vr | head -n1)" == "$maxver" ]; then
+      echo "Tag $tag -- skip"
+      continue
+    fi
+
+    echo "Tag $tag -- checking"
+    git switch --quiet --detach "$tag" || return 1
+    generate || return 1
+    git switch --quiet - || return 1
+  done
+
+  echo "Current -- checking"
+  generate || return 1
+
+  mv "$TEMP_FILE" "$LOCAL_FILE"
+  chmod 644 "$LOCAL_FILE"
+}
+
+main "$@" || exit $?
diff --git a/debian/libloc1.symbols b/debian/libloc1.symbols
new file mode 100644
index 0000000..74b70b5
--- /dev/null
+++ b/debian/libloc1.symbols
@@ -0,0 +1,134 @@
+libloc.so.1 libloc1 #MINVER#
+* Build-Depends-Package: libloc-dev
+ LIBLOC_1(a)LIBLOC_1 0.9.4
+ LIBLOC_PRIVATE(a)LIBLOC_PRIVATE 0.9.4
+ loc_as_cmp(a)LIBLOC_1 0.9.4
+ loc_as_get_name(a)LIBLOC_1 0.9.4
+ loc_as_get_number(a)LIBLOC_1 0.9.4
+ loc_as_list_append(a)LIBLOC_1 0.9.5
+ loc_as_list_clear(a)LIBLOC_1 0.9.5
+ loc_as_list_contains(a)LIBLOC_1 0.9.5
+ loc_as_list_contains_number(a)LIBLOC_1 0.9.5
+ loc_as_list_empty(a)LIBLOC_1 0.9.5
+ loc_as_list_get(a)LIBLOC_1 0.9.5
+ loc_as_list_new(a)LIBLOC_1 0.9.5
+ loc_as_list_ref(a)LIBLOC_1 0.9.5
+ loc_as_list_size(a)LIBLOC_1 0.9.5
+ loc_as_list_unref(a)LIBLOC_1 0.9.5
+ loc_as_new(a)LIBLOC_1 0.9.4
+ loc_as_ref(a)LIBLOC_1 0.9.4
+ loc_as_set_name(a)LIBLOC_1 0.9.4
+ loc_as_unref(a)LIBLOC_1 0.9.4
+ loc_country_cmp(a)LIBLOC_1 0.9.4
+ loc_country_code_is_valid(a)LIBLOC_1 0.9.4
+ loc_country_get_code(a)LIBLOC_1 0.9.4
+ loc_country_get_continent_code(a)LIBLOC_1 0.9.4
+ loc_country_get_name(a)LIBLOC_1 0.9.4
+ loc_country_list_append(a)LIBLOC_1 0.9.5
+ loc_country_list_clear(a)LIBLOC_1 0.9.5
+ loc_country_list_contains(a)LIBLOC_1 0.9.5
+ loc_country_list_contains_code(a)LIBLOC_1 0.9.5
+ loc_country_list_empty(a)LIBLOC_1 0.9.5
+ loc_country_list_get(a)LIBLOC_1 0.9.5
+ loc_country_list_new(a)LIBLOC_1 0.9.5
+ loc_country_list_ref(a)LIBLOC_1 0.9.5
+ loc_country_list_size(a)LIBLOC_1 0.9.5
+ loc_country_list_unref(a)LIBLOC_1 0.9.5
+ loc_country_new(a)LIBLOC_1 0.9.4
+ loc_country_ref(a)LIBLOC_1 0.9.4
+ loc_country_set_continent_code(a)LIBLOC_1 0.9.4
+ loc_country_set_name(a)LIBLOC_1 0.9.4
+ loc_country_unref(a)LIBLOC_1 0.9.4
+ loc_database_count_as(a)LIBLOC_1 0.9.4
+ loc_database_created_at(a)LIBLOC_1 0.9.4
+ loc_database_enumerator_get_asns(a)LIBLOC_1 0.9.5
+ loc_database_enumerator_get_countries(a)LIBLOC_1 0.9.5
+ loc_database_enumerator_new(a)LIBLOC_1 0.9.4
+ loc_database_enumerator_next_as(a)LIBLOC_1 0.9.4
+ loc_database_enumerator_next_country(a)LIBLOC_1 0.9.4
+ loc_database_enumerator_next_network(a)LIBLOC_1 0.9.4
+ loc_database_enumerator_ref(a)LIBLOC_1 0.9.4
+ loc_database_enumerator_set_asns(a)LIBLOC_1 0.9.5
+ loc_database_enumerator_set_countries(a)LIBLOC_1 0.9.5
+ loc_database_enumerator_set_family(a)LIBLOC_1 0.9.4
+ loc_database_enumerator_set_flag(a)LIBLOC_1 0.9.4
+ loc_database_enumerator_set_string(a)LIBLOC_1 0.9.4
+ loc_database_enumerator_unref(a)LIBLOC_1 0.9.4
+ loc_database_get_as(a)LIBLOC_1 0.9.4
+ loc_database_get_country(a)LIBLOC_1 0.9.4
+ loc_database_get_description(a)LIBLOC_1 0.9.4
+ loc_database_get_license(a)LIBLOC_1 0.9.4
+ loc_database_get_vendor(a)LIBLOC_1 0.9.4
+ loc_database_lookup(a)LIBLOC_1 0.9.4
+ loc_database_lookup_from_string(a)LIBLOC_1 0.9.4
+ loc_database_new(a)LIBLOC_1 0.9.4
+ loc_database_ref(a)LIBLOC_1 0.9.4
+ loc_database_unref(a)LIBLOC_1 0.9.4
+ loc_database_verify(a)LIBLOC_1 0.9.4
+ loc_discover_latest_version(a)LIBLOC_1 0.9.4
+ loc_get_log_priority(a)LIBLOC_1 0.9.4
+ loc_network_address_family(a)LIBLOC_1 0.9.4
+ loc_network_cmp(a)LIBLOC_1 0.9.5
+ loc_network_exclude(a)LIBLOC_1 0.9.5
+ loc_network_exclude_list(a)LIBLOC_1 0.9.5
+ loc_network_format_first_address(a)LIBLOC_1 0.9.4
+ loc_network_format_last_address(a)LIBLOC_1 0.9.4
+ loc_network_get_asn(a)LIBLOC_1 0.9.4
+ loc_network_get_country_code(a)LIBLOC_1 0.9.4
+ loc_network_get_first_address(a)LIBLOC_1 0.9.5
+ loc_network_get_last_address(a)LIBLOC_1 0.9.5
+ loc_network_has_flag(a)LIBLOC_1 0.9.4
+ loc_network_is_subnet(a)LIBLOC_1 0.9.5
+ loc_network_list_clear(a)LIBLOC_1 0.9.5
+ loc_network_list_contains(a)LIBLOC_1 0.9.5
+ loc_network_list_dump(a)LIBLOC_1 0.9.5
+ loc_network_list_empty(a)LIBLOC_1 0.9.5
+ loc_network_list_get(a)LIBLOC_1 0.9.5
+ loc_network_list_merge(a)LIBLOC_1 0.9.5
+ loc_network_list_new(a)LIBLOC_1 0.9.5
+ loc_network_list_pop(a)LIBLOC_1 0.9.5
+ loc_network_list_pop_first(a)LIBLOC_1 0.9.5
+ loc_network_list_push(a)LIBLOC_1 0.9.5
+ loc_network_list_ref(a)LIBLOC_1 0.9.5
+ loc_network_list_size(a)LIBLOC_1 0.9.5
+ loc_network_list_unref(a)LIBLOC_1 0.9.5
+ loc_network_match_address(a)LIBLOC_1 0.9.5
+ loc_network_match_asn(a)LIBLOC_1 0.9.4
+ loc_network_match_country_code(a)LIBLOC_1 0.9.4
+ loc_network_match_flag(a)LIBLOC_1 0.9.4
+ loc_network_new(a)LIBLOC_1 0.9.4
+ loc_network_new_from_string(a)LIBLOC_1 0.9.4
+ loc_network_overlaps(a)LIBLOC_1 0.9.5
+ loc_network_prefix(a)LIBLOC_1 0.9.5
+ loc_network_ref(a)LIBLOC_1 0.9.4
+ loc_network_set_asn(a)LIBLOC_1 0.9.4
+ loc_network_set_country_code(a)LIBLOC_1 0.9.4
+ loc_network_set_flag(a)LIBLOC_1 0.9.4
+ loc_network_str(a)LIBLOC_1 0.9.4
+ loc_network_subnets(a)LIBLOC_1 0.9.5
+ loc_network_unref(a)LIBLOC_1 0.9.4
+ loc_new(a)LIBLOC_1 0.9.4
+ loc_ref(a)LIBLOC_1 0.9.4
+ loc_set_log_fn(a)LIBLOC_1 0.9.4
+ loc_set_log_priority(a)LIBLOC_1 0.9.4
+ loc_stringpool_add(a)LIBLOC_PRIVATE 0.9.4
+ loc_stringpool_dump(a)LIBLOC_PRIVATE 0.9.4
+ loc_stringpool_get(a)LIBLOC_PRIVATE 0.9.4
+ loc_stringpool_get_size(a)LIBLOC_PRIVATE 0.9.4
+ loc_stringpool_new(a)LIBLOC_PRIVATE 0.9.4
+ loc_stringpool_ref(a)LIBLOC_PRIVATE 0.9.4
+ loc_stringpool_unref(a)LIBLOC_PRIVATE 0.9.4
+ loc_unref(a)LIBLOC_1 0.9.4
+ loc_writer_add_as(a)LIBLOC_1 0.9.4
+ loc_writer_add_country(a)LIBLOC_1 0.9.4
+ loc_writer_add_network(a)LIBLOC_1 0.9.4
+ loc_writer_get_description(a)LIBLOC_1 0.9.4
+ loc_writer_get_license(a)LIBLOC_1 0.9.4
+ loc_writer_get_vendor(a)LIBLOC_1 0.9.4
+ loc_writer_new(a)LIBLOC_1 0.9.4
+ loc_writer_ref(a)LIBLOC_1 0.9.4
+ loc_writer_set_description(a)LIBLOC_1 0.9.4
+ loc_writer_set_license(a)LIBLOC_1 0.9.4
+ loc_writer_set_vendor(a)LIBLOC_1 0.9.4
+ loc_writer_unref(a)LIBLOC_1 0.9.4
+ loc_writer_write(a)LIBLOC_1 0.9.4
-- 
2.32.0


             reply	other threads:[~2021-06-11  7:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-11  7:51 Valters Jansons [this message]
2021-06-11  9:16 ` Michael Tremer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210611075107.7727-1-valter.jansons@gmail.com \
    --to=valter.jansons@gmail.com \
    --cc=location@lists.ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox