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
d31f136f
Commit
d31f136f
authored
4 years ago
by
Eric Vidal
Browse files
Options
Downloads
Patches
Plain Diff
rebuild the dependencies to include @optsdepends and @extdepends on it if any
parent
b974c32f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/include/66/parser.h
+1
-1
1 addition, 1 deletion
src/include/66/parser.h
src/lib66/parser_enabled.c
+52
-20
52 additions, 20 deletions
src/lib66/parser_enabled.c
with
53 additions
and
21 deletions
src/include/66/parser.h
+
1
−
1
View file @
d31f136f
...
...
@@ -288,7 +288,7 @@ extern int parser(sv_alltype *service,stralloc *src,char const *svname,int svtyp
extern
int
parse_service_check_enabled
(
char
const
*
tree_directory
,
char
const
*
svname
,
uint8_t
force
,
uint8_t
*
exist
)
;
extern
int
parse_service_before
(
ssexec_t
*
info
,
stralloc
*
parsed_list
,
stralloc
*
opts_deps_list
,
char
const
*
sv
,
unsigned
int
*
nbsv
,
stralloc
*
sasv
,
uint8_t
force
,
uint8_t
conf
)
;
extern
int
parse_service_deps
(
ssexec_t
*
info
,
stralloc
*
parsed_list
,
stralloc
*
opts_deps_list
,
sv_alltype
*
sv_before
,
char
const
*
sv
,
unsigned
int
*
nbsv
,
stralloc
*
sasv
,
uint8_t
force
,
uint8_t
conf
)
;
extern
int
parse_service_opts_deps
(
ssexec_t
*
info
,
stralloc
*
parsed_list
,
stralloc
*
opts_deps_list
,
sv_alltype
*
sv_before
,
char
const
*
sv
,
unsigned
int
*
nbsv
,
stralloc
*
sasv
,
uint8_t
force
,
uint8_t
conf
,
uint8_t
mandatory
)
;
extern
int
parse_service_opts_deps
(
stralloc
*
rebuild
,
ssexec_t
*
info
,
stralloc
*
parsed_list
,
stralloc
*
opts_deps_list
,
sv_alltype
*
sv_before
,
char
const
*
sv
,
unsigned
int
*
nbsv
,
stralloc
*
sasv
,
uint8_t
force
,
uint8_t
conf
,
uint8_t
mandatory
)
;
extern
int
parse_add_service
(
stralloc
*
parsed_list
,
sv_alltype
*
sv_before
,
char
const
*
service
,
unsigned
int
*
nbsv
,
uid_t
owner
)
;
extern
int
get_svtype
(
sv_alltype
*
sv_before
,
char
const
*
contents
)
;
extern
int
get_svtype_from_file
(
char
const
*
file
)
;
...
...
This diff is collapsed.
Click to expand it.
src/lib66/parser_enabled.c
+
52
−
20
View file @
d31f136f
...
...
@@ -15,30 +15,23 @@
#include
<66/parser.h>
#include
<string.h>
#include
<stdio.h>
//rename
#include
<unistd.h>
//chdir
#include
<oblibs/string.h>
#include
<oblibs/types.h>
#include
<oblibs/directory.h>
#include
<oblibs/log.h>
#include
<oblibs/sastr.h>
#include
<oblibs/environ.h>
#include
<oblibs/files.h>
#include
<skalibs/stralloc.h>
#include
<skalibs/direntry.h>
#include
<skalibs/djbunix.h>
#include
<skalibs/env.h>
#include
<skalibs/bytestr.h>
//byte_count
#include
<skalibs/djbunix.h>
//environ
#include
<66/resolve.h>
#include
<66/utils.h>
#include
<66/constants.h>
#include
<66/environ.h>
/* @sv -> name of the service to parse with
the path of the frontend file
* source */
/* @sv -> name of the service to parse with
*
the path of the frontend file
source */
int
parse_service_before
(
ssexec_t
*
info
,
stralloc
*
parsed_list
,
stralloc
*
tree_list
,
char
const
*
sv
,
unsigned
int
*
nbsv
,
stralloc
*
sasv
,
uint8_t
force
,
uint8_t
conf
)
{
log_trace
(
"start parse process of service: "
,
sv
)
;
...
...
@@ -81,7 +74,7 @@ int parse_service_before(ssexec_t *info,stralloc *parsed_list,stralloc *tree_lis
if
(
!
get_svtype
(
&
sv_before
,
sasv
->
s
))
log_warn_return
(
LOG_EXIT_ZERO
,
"invalid value for key: "
,
get_key_by_enum
(
ENUM_KEY_SECTION_MAIN
,
KEY_MAIN_TYPE
),
" in service file: "
,
svsrc
,
svname
)
;
/** cont
ain
of directory should be listed by ss_resolve_src_path
/** cont
ents
of directory should be listed by ss_resolve_src_path
* execpt for module type */
if
(
scan_mode
(
sv
,
S_IFDIR
)
==
1
&&
sv_before
.
cname
.
itype
!=
TYPE_MODULE
)
return
1
;
...
...
@@ -163,13 +156,47 @@ int parse_service_before(ssexec_t *info,stralloc *parsed_list,stralloc *tree_lis
}
}
deps:
if
(
!
parse_add_service
(
parsed_list
,
&
sv_before
,
svpath
,
nbsv
,
info
->
owner
))
return
0
;
if
((
sv_before
.
cname
.
itype
>
TYPE_CLASSIC
&&
force
>
1
)
||
!
exist
)
{
if
(
!
parse_service_deps
(
info
,
parsed_list
,
tree_list
,
&
sv_before
,
sv
,
nbsv
,
sasv
,
force
,
conf
))
return
0
;
if
(
!
parse_service_opts_deps
(
info
,
parsed_list
,
tree_list
,
&
sv_before
,
sv
,
nbsv
,
sasv
,
force
,
conf
,
KEY_MAIN_EXTDEPS
))
return
0
;
if
(
!
parse_service_opts_deps
(
info
,
parsed_list
,
tree_list
,
&
sv_before
,
sv
,
nbsv
,
sasv
,
force
,
conf
,
KEY_MAIN_OPTSDEPS
))
return
0
;
if
((
sv_before
.
cname
.
itype
>
TYPE_CLASSIC
&&
force
>
1
)
||
!
exist
)
{
stralloc
rebuild
=
STRALLOC_ZERO
;
if
(
!
parse_service_deps
(
info
,
parsed_list
,
tree_list
,
&
sv_before
,
sv
,
nbsv
,
sasv
,
force
,
conf
))
return
0
;
if
(
!
parse_service_opts_deps
(
&
rebuild
,
info
,
parsed_list
,
tree_list
,
&
sv_before
,
sv
,
nbsv
,
sasv
,
force
,
conf
,
KEY_MAIN_EXTDEPS
))
return
0
;
if
(
!
parse_service_opts_deps
(
&
rebuild
,
info
,
parsed_list
,
tree_list
,
&
sv_before
,
sv
,
nbsv
,
sasv
,
force
,
conf
,
KEY_MAIN_OPTSDEPS
))
return
0
;
if
(
rebuild
.
len
)
{
size_t
pos
=
0
;
stralloc
old
=
STRALLOC_ZERO
;
//rebuild the dependencies list of the service
int
id
=
sv_before
.
cname
.
idga
;
unsigned
int
nid
=
sv_before
.
cname
.
nga
;
for
(;
nid
;
id
+=
strlen
(
deps
.
s
+
id
)
+
1
,
nid
--
)
{
if
(
!
stralloc_catb
(
&
old
,
deps
.
s
+
id
,
strlen
(
deps
.
s
+
id
)
+
1
))
log_warnsys_return
(
LOG_EXIT_ZERO
,
"stralloc"
)
;
}
for
(
pos
=
0
;
pos
<
rebuild
.
len
;
pos
+=
strlen
(
rebuild
.
s
+
pos
)
+
1
)
{
if
(
!
stralloc_catb
(
&
old
,
rebuild
.
s
+
pos
,
strlen
(
rebuild
.
s
+
pos
)
+
1
))
log_warnsys_return
(
LOG_EXIT_ZERO
,
"stralloc"
)
;
}
sv_before
.
cname
.
idga
=
deps
.
len
;
sv_before
.
cname
.
nga
=
0
;
for
(
pos
=
0
;
pos
<
old
.
len
;
pos
+=
strlen
(
old
.
s
+
pos
)
+
1
)
{
if
(
!
stralloc_catb
(
&
deps
,
old
.
s
+
pos
,
strlen
(
old
.
s
+
pos
)
+
1
))
log_warnsys_return
(
LOG_EXIT_ZERO
,
"stralloc"
)
;
sv_before
.
cname
.
nga
++
;
}
stralloc_free
(
&
old
)
;
}
stralloc_free
(
&
rebuild
)
;
}
if
(
!
parse_add_service
(
parsed_list
,
&
sv_before
,
svpath
,
nbsv
,
info
->
owner
))
return
0
;
}
end:
return
1
;
...
...
@@ -206,17 +233,17 @@ int parse_service_deps(ssexec_t *info,stralloc *parsed_list,stralloc *tree_list,
return
0
;
}
int
parse_service_opts_deps
(
ssexec_t
*
info
,
stralloc
*
parsed_list
,
stralloc
*
tree_list
,
sv_alltype
*
sv_before
,
char
const
*
sv
,
unsigned
int
*
nbsv
,
stralloc
*
sasv
,
uint8_t
force
,
uint8_t
conf
,
uint8_t
mandatory
)
int
parse_service_opts_deps
(
stralloc
*
rebuild
,
ssexec_t
*
info
,
stralloc
*
parsed_list
,
stralloc
*
tree_list
,
sv_alltype
*
sv_before
,
char
const
*
sv
,
unsigned
int
*
nbsv
,
stralloc
*
sasv
,
uint8_t
force
,
uint8_t
conf
,
uint8_t
mandatory
)
{
int
r
;
stralloc
newsv
=
STRALLOC_ZERO
;
size_t
pos
=
0
,
baselen
=
strlen
(
info
->
base
.
s
)
+
SS_SYSTEM_LEN
;
uint8_t
found
=
0
,
ext
=
mandatory
==
KEY_MAIN_EXTDEPS
?
1
:
0
;
char
*
optname
=
0
;
char
btmp
[
baselen
+
1
]
;
auto_strings
(
btmp
,
info
->
base
.
s
,
SS_SYSTEM
)
;
int
idref
=
sv_before
->
cname
.
idopts
;
unsigned
int
nref
=
sv_before
->
cname
.
nopts
;
if
(
ext
)
{
...
...
@@ -271,6 +298,11 @@ int parse_service_opts_deps(ssexec_t *info,stralloc *parsed_list,stralloc *tree_
else
if
(
r
==
1
)
{
if
(
!
parse_service_before
(
info
,
parsed_list
,
tree_list
,
newsv
.
s
,
nbsv
,
sasv
,
force
,
conf
))
goto
err
;
// add the new deps
if
(
!
stralloc_catb
(
rebuild
,
optname
,
strlen
(
optname
)
+
1
))
log_warnsys_return
(
LOG_EXIT_ZERO
,
"stralloc"
)
;
// we only keep the first found on optsdepends
if
(
!
ext
)
break
;
}
...
...
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