summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2024-04-29 09:48:40 +0200
committerGitHub <noreply@github.com>2024-04-29 09:48:40 +0200
commit5915fa1b459a44d0b0928f4895ccde6ccb3e7af0 (patch)
tree3d522d347612b37b5931e97f93e0a739c48f908e
parent23b79df8bf766e72b8eb697b4726d843664c46c3 (diff)
parentbd9a4fab9cf02a2aa2e33b5a4fba970308491ea0 (diff)
downloadvyatta-cfg-5915fa1b459a44d0b0928f4895ccde6ccb3e7af0.tar.gz
vyatta-cfg-5915fa1b459a44d0b0928f4895ccde6ccb3e7af0.zip
Merge pull request #78 from jestabro/sagitta-configdep-redundancymergify/bp/sagitta/pr-77
T5660: Remove redundant calls to config dependency scripts
-rw-r--r--src/cli_cstore.h2
-rw-r--r--src/cli_objects.c11
-rw-r--r--src/commit/commit-algorithm.cpp6
3 files changed, 19 insertions, 0 deletions
diff --git a/src/cli_cstore.h b/src/cli_cstore.h
index b77d69c..3ef7f72 100644
--- a/src/cli_cstore.h
+++ b/src/cli_cstore.h
@@ -142,6 +142,8 @@ int restore_output(void);
/* functions from cli_objects */
char *get_at_string(void);
void set_in_commit(boolean b);
+void set_if_last(int);
+void clear_last(void);
void set_at_string(char* s);
void set_in_delete_action(boolean b);
diff --git a/src/cli_objects.c b/src/cli_objects.c
index 190ff46..c09c368 100644
--- a/src/cli_objects.c
+++ b/src/cli_objects.c
@@ -34,6 +34,7 @@ static first_seg f_seg_m;
static char *in_commit_file = "/var/tmp/in_commit";
static char *initial_file = "/var/tmp/initial_in_commit";
+static char *last_in_queue_file = "/var/tmp/last_in_queue";
static int mark_by_file(char *p) {
int ret = mknod(p, S_IFREG|0664, 0);
@@ -96,6 +97,16 @@ void set_in_commit(boolean b) {
}
}
+void set_if_last(int n) {
+ if (n == 1) {
+ mark_by_file(last_in_queue_file);
+ }
+}
+
+void clear_last(void) {
+ remove_mark(last_in_queue_file);
+}
+
boolean is_in_exec(void) {
return in_exec;
}
diff --git a/src/commit/commit-algorithm.cpp b/src/commit/commit-algorithm.cpp
index f04b8c2..a84fdf5 100644
--- a/src/commit/commit-algorithm.cpp
+++ b/src/commit/commit-algorithm.cpp
@@ -1306,8 +1306,13 @@ commit::doCommit(Cstore& cs, CfgNode& cfg1, CfgNode& cfg2)
debug_on = !!getenv("VYOS_DEBUG");
TRACE_INIT("Processing the Priority Queue");
+ clear_last();
+ int num = pq.size();
+ // decrease by one because we have one root element
+ --num;
while (!dpq.empty()) {
PrioNode *p = dpq.top();
+ set_if_last(num+dpq.size());
if (!_commit_exec_prio_subtree(cs, p)) {
// prio subtree failed
OUTPUT_USER("delete [ %s ] failed\n",
@@ -1321,6 +1326,7 @@ commit::doCommit(Cstore& cs, CfgNode& cfg1, CfgNode& cfg2)
}
while (!pq.empty()) {
PrioNode *p = pq.top();
+ set_if_last(pq.size());
if (!_commit_exec_prio_subtree(cs, p)) {
// prio subtree failed
OUTPUT_USER("[[%s]] failed\n",