diff options
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/frr-reload.py | 3 | ||||
| -rw-r--r-- | tools/gen_northbound_callbacks.c | 55 | ||||
| -rwxr-xr-x | tools/tarsource.sh | 9 |
3 files changed, 61 insertions, 6 deletions
diff --git a/tools/frr-reload.py b/tools/frr-reload.py index cc383e06d8..412cde0910 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -776,9 +776,10 @@ def ignore_delete_re_add_lines(lines_to_add, lines_to_del): if re_nbr_bfd_timers: nbr = re_nbr_bfd_timers.group(1) bfd_nbr = "neighbor %s" % nbr + bfd_search_string = bfd_nbr + r' bfd (\S+) (\S+) (\S+)' for (ctx_keys, add_line) in lines_to_add: - re_add_nbr_bfd_timers = re.search(r'neighbor (\S+) bfd (\S+) (\S+) (\S+)', add_line) + re_add_nbr_bfd_timers = re.search(bfd_search_string, add_line) if re_add_nbr_bfd_timers: found_add_bfd_nbr = line_exist(lines_to_add, ctx_keys, bfd_nbr, False) diff --git a/tools/gen_northbound_callbacks.c b/tools/gen_northbound_callbacks.c index 14f648e8da..cbdf01e7b8 100644 --- a/tools/gen_northbound_callbacks.c +++ b/tools/gen_northbound_callbacks.c @@ -26,10 +26,12 @@ #include "yang.h" #include "northbound.h" +static bool static_cbs; + static void __attribute__((noreturn)) usage(int status) { extern const char *__progname; - fprintf(stderr, "usage: %s [-h] [-p path] MODULE\n", __progname); + fprintf(stderr, "usage: %s [-h] [-s] [-p path] MODULE\n", __progname); exit(status); } @@ -153,10 +155,46 @@ static void generate_callback_name(struct lys_node *snode, replace_hyphens_by_underscores(buffer); } +static void generate_prototype(const struct nb_callback_info *ncinfo, + const char *cb_name) +{ + printf("%s%s(%s);\n", ncinfo->return_type, cb_name, ncinfo->arguments); +} + +static int generate_prototypes(const struct lys_node *snode, void *arg) +{ + switch (snode->nodetype) { + case LYS_CONTAINER: + case LYS_LEAF: + case LYS_LEAFLIST: + case LYS_LIST: + case LYS_NOTIF: + case LYS_RPC: + break; + default: + return YANG_ITER_CONTINUE; + } + + for (struct nb_callback_info *cb = &nb_callbacks[0]; + cb->operation != -1; cb++) { + char cb_name[BUFSIZ]; + + if (cb->optional + || !nb_operation_is_valid(cb->operation, snode)) + continue; + + generate_callback_name((struct lys_node *)snode, cb->operation, + cb_name, sizeof(cb_name)); + generate_prototype(cb, cb_name); + } + + return YANG_ITER_CONTINUE; +} + static void generate_callback(const struct nb_callback_info *ncinfo, const char *cb_name) { - printf("static %s%s(%s)\n{\n", + printf("%s%s%s(%s)\n{\n", static_cbs ? "static " : "", ncinfo->return_type, cb_name, ncinfo->arguments); switch (ncinfo->operation) { @@ -287,7 +325,7 @@ int main(int argc, char *argv[]) struct stat st; int opt; - while ((opt = getopt(argc, argv, "hp:")) != -1) { + while ((opt = getopt(argc, argv, "hp:s")) != -1) { switch (opt) { case 'h': usage(EXIT_SUCCESS); @@ -307,6 +345,9 @@ int main(int argc, char *argv[]) search_path = optarg; break; + case 's': + static_cbs = true; + break; default: usage(EXIT_FAILURE); /* NOTREACHED */ @@ -332,6 +373,14 @@ int main(int argc, char *argv[]) /* Create a nb_node for all YANG schema nodes. */ nb_nodes_create(); + /* Generate callback prototypes. */ + if (!static_cbs) { + printf("/* prototypes */\n"); + yang_snodes_iterate_module(module->info, generate_prototypes, 0, + NULL); + printf("\n"); + } + /* Generate callback functions. */ yang_snodes_iterate_module(module->info, generate_callbacks, 0, NULL); diff --git a/tools/tarsource.sh b/tools/tarsource.sh index eee2a9739b..4843fe88b0 100755 --- a/tools/tarsource.sh +++ b/tools/tarsource.sh @@ -301,6 +301,11 @@ if $debian; then --format='3.0 (custom)' --target-format='3.0 (quilt)' \ -b . frr_${PACKAGE_VERSION}.orig.tar.$zip frr_${DEBVER}.debian.tar.$zip + dpkg-genchanges -sa -S > ../frr_${DEBVER}_source.changes + + test -n "$keyid" && debsign ../frr_${DEBVER}_source.changes -k"$keyid" + + mv ../frr_${DEBVER}_source.changes "$outdir" || true mv ../frr_${DEBVER}.dsc "$outdir" || true mv ../frr_${DEBVER}.debian.tar.$zip "$outdir" || true if test -h ../frr_${PACKAGE_VERSION}.orig.tar.$zip; then @@ -309,12 +314,12 @@ if $debian; then ln -s frr-${PACKAGE_VERSION}.tar.$zip "$outdir/frr_${PACKAGE_VERSION}.orig.tar.$zip" || true cd "$outdir" - test -n "$keyid" && debsign -k "$keyid" "frr_${DEBVER}.dsc" lsfiles="$lsfiles \ frr_${DEBVER}.dsc \ frr_${DEBVER}.debian.tar.$zip \ - frr_${PACKAGE_VERSION}.orig.tar.$zip" + frr_${PACKAGE_VERSION}.orig.tar.$zip \ + frr_${DEBVER}_source.changes" fi cd "$outdir" |
