Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Méso-NH code
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RODIER Quentin
Méso-NH code
Commits
84def7f6
Commit
84def7f6
authored
2 years ago
by
RIETTE Sébastien
Browse files
Options
Downloads
Patches
Plain Diff
S. Riette 8 Dec 2022: add PHYEX2IAL tool
parent
6d117cfa
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/PHYEX2IAL.sh
+96
-0
96 additions, 0 deletions
tools/PHYEX2IAL.sh
with
96 additions
and
0 deletions
tools/PHYEX2IAL.sh
0 → 100755
+
96
−
0
View file @
84def7f6
#!/bin/bash
set
-e
set
-x
################################
#Command line arguments and help
full_command
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
/
$(
basename
"
${
BASH_SOURCE
[0]
}
"
)
$@
"
function
usage
{
echo
"Usage:
$0
[-h] [--phyex-repo-user PHYEXREPOuser] [--phyex-repo-protocol PHYEXREPOprotocol]"
echo
" IALDIRECTORY:IALVERSION PHYEXVERSION BRANCH"
echo
echo
"--phyex-repo-user PHYEXREPOuser user hosting the PHYEX repository on github,"
echo
" defaults to the env variable PHYEXREOuser (=
$PHYEXREPOuser
)"
echo
"--phyex-repo-protocol PHYEXREPOprotocol protocol (https or ssh) to reach the PHYEX repository on github,"
echo
" defaults to the env variable PHYEXREOprotocol (=
$PHYEXREPOprotocol
)"
echo
"IALDIRECTORY local directory containing the IAL repository"
echo
"IALVERSION version to checkout in the IAL repository"
echo
"PHYEXVERSION commit, tag (as tags/<tag>) of PHYEX to use"
echo
echo
"The scripts builds a pack using PHYEX (with the help of the check_commit_ial.sh script)"
echo
"and puts the content of the pack in the IAL repository."
echo
"It is important that the PHYEXVERSION is based on the same version as the selected IALVERSION."
}
IALDIRECTORY
=
''
IALVERSION
=
''
PHYEXVERSION
=
''
BRANCH
=
''
positional
=
0
while
[
-n
"
$1
"
]
;
do
case
"
$1
"
in
'-h'
)
usage
;
exit
;;
'--phyex-repo-user'
)
export
PHYEXREPOuser
=
"
$2
"
;
shift
;;
'--phyex-repo-protocol'
)
export
PHYEXREPOprotocol
=
"
$2
"
;
shift
;;
*
)
positional
=
$((
$positional
+
1
))
case
$positional
in
1
)
if
echo
"
$1
"
|
grep
':'
;
then
IALDIRECTORY
=
$(
echo
"
$1
"
|
cut
-d
:
-f1
)
IALVERSION
=
$(
echo
"
$1
"
|
cut
-d
:
-f2-
)
else
echo
"First mandatory argument must take the form IALDIRECTORY:IALVERSION with ':' as separator"
exit
1
fi
;;
2
)
PHYEXVERSION
=
"
$1
"
;;
3
)
BRANCH
=
"
$1
"
;;
*
)
echo
"Only three positional arguments are allowed"
exit
2
;;
esac
esac
shift
done
if
[
-z
"
${
BRANCH
-
}
"
]
;
then
echo
"This script needs positional arguments, you can use the -h option to get help"
exit
3
fi
##################################################
#Create a gmkpack's pack and filling it with PHYEX
# Create temporary directory and set up its automatic destruction
export
TMP_LOC
=
$(
mktemp
-d
--tmpdir
=
$TMP
XXXXXX
)
trap
"echo Removing now temporary directory
$TMP_LOC
;
\r
m -rf
$TMP_LOC
"
EXIT
# Creates a pack using check_commit_ial.sh script
echo
"Creating pack in
$TMP_LOC
using
$PHYEXVERSION
PHYEX version with"
echo
"PHYEXREPOuser=
$PHYEXREPOuser
and PHYEXREPOprotocol=
$PHYEXREPOprotocol
"
HOMEPACK
=
$TMP_LOC
check_commit_ial.sh
-p
-f
"
${
PHYEXVERSION
}
"
#########################################
#Create branch in IAL, fill it and commit
# Create the branch in the IAL repository
cd
"
${
IALDIRECTORY
}
"
if
[
!
-z
"
$(
git status
--porcelain
)
"
]
;
then
echo
"The IAL repository (
$IALDIRECTORY
) cannot be used as it is not clean"
exit
4
fi
git checkout
-b
"
${
BRANCH
}
"
"
${
IALVERSION
}
"
# copy the pack created with PHYEX into the IAL branch
cd
$TMP_LOC
/PHYEX/
*
/src/local/
for
rep
in
*
;
do
rsync
-r
--delete
$rep
/home/riette/IAL/
done
# commit
cd
"
${
IALDIRECTORY
}
"
git add
.
git commit
-m
"Integration of PHYEX version
$PHYEXVERSION
in IAL"
\
-m
"PHYEXREPOuser=
$PHYEXREPOuser
PHYEXREPOprotocol=
$PHYEXREPOprotocol
$full_command
"
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