Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SCDDS-core
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor 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
SPC
SCDDS
SCDDS-core
Commits
cdb380c9
Commit
cdb380c9
authored
4 years ago
by
Cristian Galperti
Browse files
Options
Downloads
Patches
Plain Diff
SCDconf_setCODEconf allows for an empty codeverstring
parent
5b001c94
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
build/simulink_codegen/writegitinfoheader.m
+90
-86
90 additions, 86 deletions
build/simulink_codegen/writegitinfoheader.m
code/functions/SCDconf_setCODEconf.m
+5
-5
5 additions, 5 deletions
code/functions/SCDconf_setCODEconf.m
with
95 additions
and
91 deletions
build/simulink_codegen/writegitinfoheader.m
+
90
−
86
View file @
cdb380c9
function
writegitinfoheader
()
function
writegitinfoheader
(
empty
)
% max code description string length
maxdesclen
=
1024
;
% scd expcode info retrieval
try
scd
=
Simulink
.
data
.
evalinGlobal
(
'tcv'
,
'scd'
);
expcode
=
scd
.
expcode
;
expcodeset
=
true
;
catch
ME
warning
(
'No configured expcode found, code description string will not have this info.'
);
expcodeset
=
false
;
end
% Git checks
% 1) check repo cleanlyness
% TODO: check that the output of 'git status -procelain' is empty
[
~
,
result
]
=
system
(
'git status --porcelain'
);
if
~
isempty
(
result
)
error
(
'the working copy is not clean, please commit changes first.'
);
end
% 2) check local and remote hash are matching (in synch working copy)
[
~
,
localhash
]
=
system
(
'git rev-parse @'
);
[
~
,
remotehash
]
=
system
(
'git rev-parse @{u}'
);
if
~
strcmp
(
localhash
,
remotehash
)
error
(
'the working copy is not in sync with its origin, please push first.'
);
end
% first we get TCV current shot number, to be used for tagging
mdsconnect
(
'tcvdata'
);
curshot
=
mdsvalue
(
'current_shot("tcv_shot")'
);
% then we try to tag the current rtccode repo
tagname
=
[
'builds/TCV'
num2str
(
curshot
)];
str
=
sprintf
(
'Going to try this git tag: %s [(Y)es/(N)o/A(p)pend]?'
,
tagname
);
answ
=
input
(
str
,
's'
);
switch
upper
(
answ
)
case
'P'
nameapp
=
input
(
'Type what to append to tag name: '
,
's'
);
tagname
=
[
tagname
nameapp
];
case
'Y'
otherwise
if
empty
==
false
% scd expcode info retrieval
try
scd
=
Simulink
.
data
.
evalinGlobal
(
'tcv'
,
'scd'
);
expcode
=
scd
.
expcode
;
expcodeset
=
true
;
catch
ME
warning
(
'No configured expcode found, code description string will not have this info.'
);
expcodeset
=
false
;
end
% Git checks
% 1) check repo cleanlyness
% TODO: check that the output of 'git status -procelain' is empty
[
~
,
result
]
=
system
(
'git status --porcelain'
);
if
~
isempty
(
result
)
error
(
'the working copy is not clean, please commit changes first.'
);
end
% 2) check local and remote hash are matching (in synch working copy)
[
~
,
localhash
]
=
system
(
'git rev-parse @'
);
[
~
,
remotehash
]
=
system
(
'git rev-parse @{u}'
);
if
~
strcmp
(
localhash
,
remotehash
)
error
(
'the working copy is not in sync with its origin, please push first.'
);
end
% first we get TCV current shot number, to be used for tagging
mdsconnect
(
'tcvdata'
);
curshot
=
mdsvalue
(
'current_shot("tcv_shot")'
);
% then we try to tag the current rtccode repo
tagname
=
[
'builds/TCV'
num2str
(
curshot
)];
str
=
sprintf
(
'Going to try this git tag: %s [(Y)es/(N)o/A(p)pend]?'
,
tagname
);
answ
=
input
(
str
,
's'
);
switch
upper
(
answ
)
case
'P'
nameapp
=
input
(
'Type what to append to tag name: '
,
's'
);
tagname
=
[
tagname
nameapp
];
case
'Y'
otherwise
return
end
tagmsg
=
input
(
'Type git tag message here: '
,
's'
);
tagmsg
=
strrep
(
tagmsg
,
','
,
';'
);
tagcmd
=
[
'git tag -f '
tagname
' -m "'
tagmsg
'"'
];
answ
=
input
(
'Ok to tag [(Y)es/(N)o]?'
,
's'
);
switch
upper
(
answ
)
case
'Y'
otherwise
return
end
[
status
,
result
]
=
system
(
tagcmd
);
if
status
~=
0
fprintf
(
'could not tag, git error: \n%s\n'
,
result
);
return
end
tagmsg
=
input
(
'Type git tag message here: '
,
's'
);
tagmsg
=
strrep
(
tagmsg
,
','
,
';'
);
tagcmd
=
[
'git tag -f '
tagname
' -m "'
tagmsg
'"'
];
answ
=
input
(
'Ok to tag [(Y)es/(N)o]?'
,
's'
);
switch
upper
(
answ
)
case
'Y'
otherwise
return
end
[
status
,
result
]
=
system
(
tagcmd
);
if
status
~=
0
fprintf
(
'could not tag, git error: \n%s\n'
,
result
);
return
end
taginfocmd
=
[
'git for-each-ref refs/tags/'
tagname
' --format="RTCCODE TAG NAME,%(refname),HASH,%(objectname:short),CONTENTS,%(contents:subject),TAGGER,%(taggername),%(taggerdate),FULL OBJECT INFO,%(objecttype),%(objectname)"'
];
[
status
,
result
]
=
system
(
taginfocmd
);
if
status
~=
0
fprintf
(
'could not retrieve tag info, git error: \n%s\n'
,
result
);
return
end
descstr
=
result
;
answ
=
input
(
'Include expcode [(Y)es/(N)o]?'
,
's'
);
switch
upper
(
answ
)
case
'Y'
if
expcodeset
descstr
=
[
'EXPCODE,'
num2str
(
expcode
)
','
descstr
];
else
end
taginfocmd
=
[
'git for-each-ref refs/tags/'
tagname
' --format="RTCCODE TAG NAME,%(refname),HASH,%(objectname:short),CONTENTS,%(contents:subject),TAGGER,%(taggername),%(taggerdate),FULL OBJECT INFO,%(objecttype),%(objectname)"'
];
[
status
,
result
]
=
system
(
taginfocmd
);
if
status
~=
0
fprintf
(
'could not retrieve tag info, git error: \n%s\n'
,
result
);
return
end
descstr
=
result
;
answ
=
input
(
'Include expcode [(Y)es/(N)o]?'
,
's'
);
switch
upper
(
answ
)
case
'Y'
if
expcodeset
descstr
=
[
'EXPCODE,'
num2str
(
expcode
)
','
descstr
];
else
descstr
=
[
'EXPCODE,n/a,'
descstr
];
end
otherwise
descstr
=
[
'EXPCODE,n/a,'
descstr
];
end
otherwise
descstr
=
[
'EXPCODE,n/a,'
descstr
];
end
if
numel
(
descstr
)
>
maxdesclen
descstr
=
descstr
(
1
:
numel
(
descstr
));
fprintf
(
'WARNING: code description string truncated!\n'
);
end
if
numel
(
descstr
)
>
maxdesclen
descstr
=
descstr
(
1
:
numel
(
descstr
));
fprintf
(
'WARNING: code description string truncated!\n'
);
end
end
descstr
=
'n/a'
;
fprintf
(
'Code decription string will be set to:\n%s\n'
,
descstr
);
[
path
,
~
,
~
]
=
fileparts
(
mfilename
(
'fullpath'
));
...
...
This diff is collapsed.
Click to expand it.
code/functions/SCDconf_setCODEconf.m
+
5
−
5
View file @
cdb380c9
...
...
@@ -4,7 +4,7 @@
% otherwise it takes the first argument as the name of the
% configuration settings to be copied into configurationSettings
function
[]
=
SCDconf_setCODEconf
(
varargin
)
function
[]
=
SCDconf_setCODEconf
(
varargin
)
if
nargin
==
0
codeconfname
=
'configurationSettingsCODEicc'
;
else
...
...
@@ -22,10 +22,10 @@ function [] = SCDconf_setCODEconf(varargin)
answ
=
input
(
'Perform git tag operations [(Y)es/(N)o]?'
,
's'
);
switch
upper
(
answ
)
case
'Y'
otherwise
return
case
'Y'
writegitinfoheader
(
false
)
otherwise
writegitinfoheader
(
true
)
end
writegitinfoheader
end
\ No newline at end of file
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