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
186f025b
Commit
186f025b
authored
8 months ago
by
Eric Vidal
Browse files
Options
Downloads
Patches
Plain Diff
Make compute_wrapper_scripts and compute_wrapper_scripts_user as public function
parent
dd406ee2
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/lib66/parse/parse_compute_resolve.c
+1
-68
1 addition, 68 deletions
src/lib66/parse/parse_compute_resolve.c
src/lib66/parse/parse_compute_scripts.c
+98
-0
98 additions, 0 deletions
src/lib66/parse/parse_compute_scripts.c
with
99 additions
and
68 deletions
src/lib66/parse/parse_compute_resolve.c
+
1
−
68
View file @
186f025b
...
...
@@ -128,64 +128,6 @@ uint32_t compute_pipe_service(resolve_wrapper_t_ref wres, ssexec_t *info, char c
}
/**
* @!runorfinish -> finish, @runorfinish -> run
* */
static
void
compute_wrapper_scripts
(
resolve_service_t
*
res
,
uint8_t
runorfinish
)
{
log_flow
()
;
resolve_service_addon_scripts_t
*
script
=
runorfinish
?
&
res
->
execute
.
run
:
&
res
->
execute
.
finish
;
resolve_wrapper_t_ref
wres
=
resolve_set_struct
(
DATA_SERVICE
,
res
)
;
char
*
shebang
=
"#!"
SS_EXECLINE_SHEBANGPREFIX
"execlineb -"
;
/** TODO:
* -v${VERBOSITY} should use to correspond to the
* request of the user.
* */
char
*
exec
=
SS_EXTLIBEXECPREFIX
"66-execute"
;
char
run
[
strlen
(
shebang
)
+
3
+
strlen
(
exec
)
+
7
+
strlen
(
res
->
sa
.
s
+
res
->
name
)
+
4
+
1
]
;
auto_strings
(
run
,
\
shebang
,
(
!
runorfinish
)
?
((
res
->
type
==
TYPE_CLASSIC
)
?
"S0
\n
"
:
"P
\n
"
)
:
"P
\n
"
,
\
exec
,
\
!
runorfinish
?
" stop "
:
" start "
,
\
res
->
sa
.
s
+
res
->
name
,
(
!
runorfinish
)
?
" $@
\n
"
:
"
\n
"
)
;
script
->
run
=
resolve_add_string
(
wres
,
run
)
;
free
(
wres
)
;
}
/**
* @!runorfinish -> finish.user, @runofinish -> run.user
* */
static
void
compute_wrapper_scripts_user
(
resolve_service_t
*
res
,
uint8_t
runorfinish
)
{
log_flow
()
;
char
*
shebang
=
"#!"
SS_EXECLINE_SHEBANGPREFIX
"execlineb -P"
;
size_t
fakelen
=
0
,
shebanglen
=
strlen
(
shebang
)
;
resolve_service_addon_scripts_t
*
script
=
runorfinish
?
&
res
->
execute
.
run
:
&
res
->
execute
.
finish
;
size_t
scriptlen
=
strlen
(
res
->
sa
.
s
+
script
->
run_user
)
;
int
build
=
!
strcmp
(
res
->
sa
.
s
+
script
->
build
,
"custom"
)
?
BUILD_CUSTOM
:
BUILD_AUTO
;
resolve_wrapper_t_ref
wres
=
resolve_set_struct
(
DATA_SERVICE
,
res
)
;
char
run
[
shebanglen
+
1
+
scriptlen
+
1
+
1
]
;
if
(
!
build
)
{
auto_strings
(
run
,
shebang
,
"
\n
"
)
;
fakelen
=
FAKELEN
;
}
if
(
script
->
run_user
)
auto_strings
(
run
+
fakelen
,
res
->
sa
.
s
+
script
->
run_user
,
"
\n
"
)
;
script
->
run_user
=
resolve_add_string
(
wres
,
run
)
;
free
(
wres
)
;
}
void
parse_compute_resolve
(
resolve_service_t
*
res
,
ssexec_t
*
info
)
{
log_flow
()
;
...
...
@@ -242,16 +184,7 @@ void parse_compute_resolve(resolve_service_t *res, ssexec_t *info)
res
->
logger
.
execute
.
run
.
runas
=
res
->
logger
.
execute
.
run
.
runas
?
resolve_add_string
(
wres
,
res
->
sa
.
s
+
res
->
logger
.
execute
.
run
.
runas
)
:
resolve_add_string
(
wres
,
SS_LOGGER_RUNNER
)
;
}
if
(
res
->
type
==
TYPE_ONESHOT
||
res
->
type
==
TYPE_CLASSIC
)
{
compute_wrapper_scripts
(
res
,
1
)
;
// run
if
(
res
->
execute
.
finish
.
run
)
compute_wrapper_scripts
(
res
,
0
)
;
// finish
compute_wrapper_scripts_user
(
res
,
1
)
;
// run.user
if
(
res
->
execute
.
finish
.
run_user
)
compute_wrapper_scripts_user
(
res
,
0
)
;
// finish.user
}
parse_compute_scripts
(
res
)
;
free
(
wres
)
;
}
This diff is collapsed.
Click to expand it.
src/lib66/parse/parse_compute_scripts.c
0 → 100644
+
98
−
0
View file @
186f025b
/*
* parse_compute_scripts.c
*
* Copyright (c) 2018-2024 Eric Vidal <eric@obarun.org>
*
* All rights reserved.
*
* This file is part of Obarun. It is subject to the license terms in
* the LICENSE file found in the top-level directory of this
* distribution.
* This file may not be copied, modified, propagated, or distributed
* except according to the terms contained in the LICENSE file./
*/
#include
<stdint.h>
#include
<stdlib.h>
#include
<oblibs/string.h>
#include
<oblibs/log.h>
#include
<66/service.h>
#include
<66/resolve.h>
#include
<66/config.h>
#ifndef FAKELEN
#define FAKELEN strlen(run)
#endif
/**
* @!runorfinish -> finish, @runorfinish -> run
* */
static
void
compute_wrapper_scripts
(
resolve_service_t
*
res
,
uint8_t
runorfinish
)
{
log_flow
()
;
resolve_service_addon_scripts_t
*
script
=
runorfinish
?
&
res
->
execute
.
run
:
&
res
->
execute
.
finish
;
resolve_wrapper_t_ref
wres
=
resolve_set_struct
(
DATA_SERVICE
,
res
)
;
char
*
shebang
=
"#!"
SS_EXECLINE_SHEBANGPREFIX
"execlineb -"
;
/** TODO:
* -v${VERBOSITY} should use to correspond to the
* request of the user.
* */
char
*
exec
=
SS_EXTLIBEXECPREFIX
"66-execute"
;
char
run
[
strlen
(
shebang
)
+
3
+
strlen
(
exec
)
+
7
+
strlen
(
res
->
sa
.
s
+
res
->
name
)
+
4
+
1
]
;
auto_strings
(
run
,
\
shebang
,
(
!
runorfinish
)
?
((
res
->
type
==
TYPE_CLASSIC
)
?
"S0
\n
"
:
"P
\n
"
)
:
"P
\n
"
,
\
exec
,
\
!
runorfinish
?
" stop "
:
" start "
,
\
res
->
sa
.
s
+
res
->
name
,
(
!
runorfinish
)
?
" $@
\n
"
:
"
\n
"
)
;
script
->
run
=
resolve_add_string
(
wres
,
run
)
;
free
(
wres
)
;
}
/**
* @!runorfinish -> finish.user, @runofinish -> run.user
* */
static
void
compute_wrapper_scripts_user
(
resolve_service_t
*
res
,
uint8_t
runorfinish
)
{
log_flow
()
;
char
*
shebang
=
"#!"
SS_EXECLINE_SHEBANGPREFIX
"execlineb -P"
;
size_t
fakelen
=
0
,
shebanglen
=
strlen
(
shebang
)
;
resolve_service_addon_scripts_t
*
script
=
runorfinish
?
&
res
->
execute
.
run
:
&
res
->
execute
.
finish
;
size_t
scriptlen
=
strlen
(
res
->
sa
.
s
+
script
->
run_user
)
;
int
build
=
!
strcmp
(
res
->
sa
.
s
+
script
->
build
,
"custom"
)
?
BUILD_CUSTOM
:
BUILD_AUTO
;
resolve_wrapper_t_ref
wres
=
resolve_set_struct
(
DATA_SERVICE
,
res
)
;
char
run
[
shebanglen
+
1
+
scriptlen
+
1
+
1
]
;
if
(
!
build
)
{
auto_strings
(
run
,
shebang
,
"
\n
"
)
;
fakelen
=
FAKELEN
;
}
if
(
script
->
run_user
)
auto_strings
(
run
+
fakelen
,
res
->
sa
.
s
+
script
->
run_user
,
"
\n
"
)
;
script
->
run_user
=
resolve_add_string
(
wres
,
run
)
;
free
(
wres
)
;
}
void
parse_compute_scripts
(
resolve_service_t
*
res
)
{
if
(
res
->
type
!=
TYPE_MODULE
)
{
compute_wrapper_scripts
(
res
,
1
)
;
// run
compute_wrapper_scripts_user
(
res
,
1
)
;
// run.user
if
(
res
->
execute
.
finish
.
run_user
)
{
compute_wrapper_scripts
(
res
,
0
)
;
// finish
compute_wrapper_scripts_user
(
res
,
0
)
;
// finish.user
}
}
}
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