Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
6
66
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eric Vidal
66
Commits
3608756b
Commit
3608756b
authored
4 years ago
by
Eric Vidal
Browse files
Options
Downloads
Patches
Plain Diff
respect start order of the tree with 66-update tool
parent
205fd344
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/66/66-update.c
+29
-1
29 additions, 1 deletion
src/66/66-update.c
with
29 additions
and
1 deletion
src/66/66-update.c
+
29
−
1
View file @
3608756b
...
...
@@ -21,6 +21,7 @@
#include
<oblibs/sastr.h>
#include
<oblibs/types.h>
#include
<oblibs/directory.h>
#include
<oblibs/files.h>
#include
<skalibs/stralloc.h>
#include
<skalibs/buffer.h>
...
...
@@ -188,6 +189,7 @@ int main(int argc, char const *const *argv,char const *const *envp)
stralloc
satree
=
STRALLOC_ZERO
;
stralloc
allow
=
STRALLOC_ZERO
;
stralloc
contents
=
STRALLOC_ZERO
;
stralloc
tree_enabled
=
STRALLOC_ZERO
;
ssexec_t
info
=
SSEXEC_ZERO
;
PROG
=
"66-update"
;
...
...
@@ -257,7 +259,10 @@ int main(int argc, char const *const *argv,char const *const *envp)
log_die_nomem
(
"stralloc"
)
;
}
}
/** keep start order of trees */
if
(
!
file_readputsa
(
&
tree_enabled
,
system
,
"state"
))
log_dieusys
(
LOG_EXIT_SYS
,
"read contents of file: "
,
system
,
"state"
)
;
len
=
satree
.
len
;
for
(
pos
=
0
;
pos
<
len
;
pos
+=
strlen
(
satree
.
s
+
pos
)
+
1
)
{
...
...
@@ -358,6 +363,28 @@ int main(int argc, char const *const *argv,char const *const *envp)
log_dieu
(
LOG_EXIT_SYS
,
"create tree: "
,
info
.
treename
.
s
)
;
}
}
// reorganize the trees start order
if
(
tree_enabled
.
len
)
{
if
(
!
sastr_split_string_in_nline
(
&
tree_enabled
))
log_dieu
(
LOG_EXIT_SYS
,
"split elements"
)
;
unsigned
int
enabled
;
ssize_t
r
=
sastr_find_element_byname
(
&
tree_enabled
,
info
.
treename
.
s
,
&
enabled
)
;
if
(
r
>=
0
)
{
char
*
after_tree
=
tree_enabled
.
s
+
sastr_find_element_byid
(
&
tree_enabled
,
!
enabled
?
enabled
:
enabled
-
1
)
;
char
const
*
t
[]
=
{
"-S"
,
after_tree
,
info
.
treename
.
s
}
;
if
(
DRYRUN
)
{
log_info
(
drun
,
"66-tree -S "
,
after_tree
,
" "
,
info
.
treename
.
s
)
;
}
else
{
if
(
!
run_cmdline
(
SS_EXTBINPREFIX
"66-tree"
,
t
,
3
,
envp
))
log_dieu
(
LOG_EXIT_SYS
,
"orders the start order of tree: "
,
info
.
treename
.
s
)
;
}
}
}
/* we must reimplement the enable process instead of
* using directly 66-enable. The 66-enable program will use
* is own workdir with an empty tree. At call of db_update(),
...
...
@@ -447,6 +474,7 @@ int main(int argc, char const *const *argv,char const *const *envp)
stralloc_free
(
&
allow
)
;
stralloc_free
(
&
WORKDIR
)
;
stralloc_free
(
&
contents
)
;
stralloc_free
(
&
tree_enabled
)
;
ssexec_free
(
&
info
)
;
return
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment