Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Timo Koch
dune-common
Commits
613e6d11
Commit
613e6d11
authored
12 years ago
by
Christian Engwer
Browse files
Options
Downloads
Patches
Plain Diff
[dunecontrol]
* smaller cleanups * remove unsused methods [[Imported from SVN: r6823]]
parent
f194b8b2
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
lib/dunemodules.lib
+28
-58
28 additions, 58 deletions
lib/dunemodules.lib
with
28 additions
and
58 deletions
lib/dunemodules.lib
+
28
−
58
View file @
613e6d11
...
...
@@ -45,10 +45,13 @@ BLANK="$space$tab"
#
parse_control
()
{
# check file existence
if
!
test
-f
"
$1
"
;
then
echo
"ERROR:
could not read
file
$1
"
>
&2
if
test
!
-f
"
$1
"
-o
"
$(
basename
$1
)
"
!=
"
$CONTROL
"
;
then
echo
"ERROR:
'
$1
' is no
$CONTROL
file"
>
&2
exit
1
fi
# reset information handling
local
module
=
""
local
module_inst
=
"no"
# read parameters from control file
local
name
=
"
$(
echo
$(
$GREP
Module:
"
$1
"
|
cut
-d
':'
-f2
))
"
if
test
"x
$name
"
=
"x"
;
then
...
...
@@ -56,8 +59,7 @@ parse_control() {
exit
1
fi
# create and check variable name from module name
export
module_inst
=
"no"
export
module
=
$(
fix_variable_name
$name
)
module
=
$(
fix_variable_name
$name
)
if
!
check_modname
"
$module
"
;
then
echo
"ERROR:
$CONTROL
files
$1
contains an invalid Module entry"
>
&2
exit
1
...
...
@@ -83,7 +85,7 @@ parse_control() {
local
pkgpath
=
$(
canonicalname
"
$prefix
/lib/dunecontrol/
${
name
}
"
)
if
test
x
"
$pkgpath
"
=
x
"
$path
"
;
then
path
=
"
$prefix
"
export
module_inst
=
"yes"
module_inst
=
"yes"
fi
fi
# avoid multiple definition of the same module
...
...
@@ -113,7 +115,7 @@ parse_control() {
echo
"
$path
/lib/dunecontrol/
${
name
}
/
$CONTROL
"
>
&2
echo
"using previously found locally built module"
>
&2
echo
"
$(
eval echo
\$
PATH_
$module
)
/
$CONTROL
"
>
&2
export
module_inst
=
"no"
module_inst
=
"no"
return
;;
# local modules supersede installed modules
...
...
@@ -143,6 +145,12 @@ parse_control() {
mod
=
$(
fix_variable_name
$name
)
export
NAME_
${
mod
}
=
"
$name
"
done
# update list of modules
if
test
"
$module_inst
"
=
"yes"
;
then
export
INSTMODULES
=
"
$MODULES$module
"
else
export
LOCALMODULES
=
"
$MODULES$module
"
fi
}
#
...
...
@@ -194,14 +202,14 @@ find_modules_in_path() {
while
read dir
;
do
if
test
-d
"
$dir
"
;
then
while
read
m
;
do
test
-n
"
$m
"
&&
find_modules
"
$m
"
TMPMODULES
=
"
$TMPMODULES$
FM_
MODULES$INSTMODULES
"
test
-n
"
$m
"
&&
parse_control
"
$m
"
TMPMODULES
=
"
$TMPMODULES$
LOCAL
MODULES$INSTMODULES
"
done
<<
EOFM
$(
find
-H
"
$dir
"
-name
$CONTROL
|
$GREP
-v
'dune-[-_a-zA-Z]/dune-[-a-zA-Z_]*-[0-9]\{1,\}.[0-9]\{1,\}/'
)
EOFM
else
find_modules
$dir
TMPMODULES
=
"
$TMPMODULES$
FM_
MODULES$INSTMODULES
"
parse_control
"
$dir
"
TMPMODULES
=
"
$TMPMODULES$
LOCAL
MODULES$INSTMODULES
"
fi
done
<<
EOF
$(
echo
$DUNE_CONTROL_PATH
|
sed
-e
's/:\+/:/g'
|
tr
':'
'\n'
)
...
...
@@ -211,29 +219,6 @@ EOF
fi
}
#
# search a directory recursively for $CONTROL files
#
# paramters:
# $1 directory to search for modules
#
find_modules
()
{
if
test
-f
"
$1
"
&&
test
"
$(
basename
$1
)
"
=
"
$CONTROL
"
;
then
export
module
=
""
export
module_inst
=
"no"
parse_control
"
$1
"
if
test
"
$module_inst
"
=
"yes"
;
then
export
INSTMODULES
=
"
$MODULES$module
"
else
export
FM_MODULES
=
"
$MODULES$module
"
fi
else
echo
"ERROR: '
$1
' is no
$CONTROL
file"
>
&2
false
fi
}
#
# sort $MODULES according to the dependencies
#
...
...
@@ -261,28 +246,6 @@ sort_modules() {
done
}
#
# sort $MODULES's dependencies according to the dependencies
# don't include $MODULE itself
#
sort_dependencies
()
{
# get dependencies
sort_modules
$1
# save result
export
MODULES
=
"
$SORTEDMODULES_DEPS
"
}
#
# sort $MODULES's dependencies according to the dependencies
# don't include $MODULE itself
#
sort_suggestions
()
{
# get suggestions
sort_modules
$1
# save result
export
MODULES
=
"
$SORTEDMODULES_SUGS
"
}
#
# recursive part of sort_modules
# evaluate dependencies of one module
...
...
@@ -419,11 +382,10 @@ eval_control() {
}
#
# fix a value such that it is suitable for a variable name
and assign it
# fix a value such that it is suitable for a variable name
#
# parameters:
# $1 name of variable
# $2 value
# $1 value
#
fix_variable_name
()
{
# The replacement sequence has to be extended explicitly to the length of
...
...
@@ -431,6 +393,13 @@ fix_variable_name() {
echo
-n
"
$@
"
|
tr
'[:punct:]'
'[_*]'
}
#
# fix a value such that it is suitable for a variable name and assign it
#
# parameters:
# $1 name of variable
# $2 value
#
fix_and_assign
()
{
local
name
=
"
$1
"
if
!
check_modname
$name
;
then
...
...
@@ -442,6 +411,7 @@ fix_and_assign() {
#
# make sure the module name fits the naming convention
# (we try to assign the name and report upon failure)
#
# parameters:
# $1 module name
...
...
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