SCP: Provide commit id information when archived simh content is used

This commit is contained in:
Mark Pizzolato 2021-11-01 15:33:43 -07:00
parent 70af29ac0c
commit 6d9a55d351
2 changed files with 21 additions and 4 deletions

19
scp.c
View file

@ -6671,6 +6671,25 @@ if (flag) {
strlcpy (os_type, getenv ("OSTYPE"), sizeof (os_type)); strlcpy (os_type, getenv ("OSTYPE"), sizeof (os_type));
setenv ("SIM_OSTYPE", os_type, 1); setenv ("SIM_OSTYPE", os_type, 1);
} }
#if defined(SIM_ARCHIVE_GIT_COMMIT_ID)
#define S_xstr(a) S_str(a)
#define S_str(a) #a
if (NULL == strchr (S_xstr(SIM_ARCHIVE_GIT_COMMIT_ID), '$')) {
const char *extras = strchr (S_xstr(SIM_ARCHIVE_GIT_COMMIT_ID), '+');
fprintf (st, "%ssimh git commit id: %8.8s%s", flag ? "\n " : " ", S_xstr(SIM_ARCHIVE_GIT_COMMIT_ID), extras ? extras : "");
setenv ("SIM_ARCHIVE_GIT_COMMIT_ID", S_xstr(SIM_ARCHIVE_GIT_COMMIT_ID), 1);
}
#if defined(SIM_ARCHIVE_GIT_COMMIT_TIME)
if (NULL == strchr (S_xstr(SIM_ARCHIVE_GIT_COMMIT_TIME), '$')) {
setenv ("SIM_ARCHIVE_GIT_COMMIT_TIME", S_xstr(SIM_ARCHIVE_GIT_COMMIT_TIME), 1);
if (flag)
fprintf (st, "%ssimh git commit time: %s", "\n ", S_xstr(SIM_ARCHIVE_GIT_COMMIT_TIME));
}
#endif
#undef S_str
#undef S_xstr
#endif
#if defined(SIM_GIT_COMMIT_ID) #if defined(SIM_GIT_COMMIT_ID)
#define S_xstr(a) S_str(a) #define S_xstr(a) S_str(a)
#define S_str(a) #a #define S_str(a) #a

View file

@ -56,10 +56,8 @@
information as a consequence of the "sim_rev.h export-subst" information as a consequence of the "sim_rev.h export-subst"
line in the .gitattributes file. line in the .gitattributes file.
*/ */
#if !defined(SIM_GIT_COMMIT_ID) #define SIM_ARCHIVE_GIT_COMMIT_ID $Format:%H$
#define SIM_GIT_COMMIT_ID $Format:%H$ #define SIM_ARCHIVE_GIT_COMMIT_TIME $Format:%aI$
#define SIM_GIT_COMMIT_TIME $Format:%aI$
#endif
/* /*
The comment section below reflects the manual editing process which was in place The comment section below reflects the manual editing process which was in place