From 0c546b024fc02ebb5f4452f254cccb46e96418f2 Mon Sep 17 00:00:00 2001
From: Ben Avison <bavison@riscosopen.org>
Date: Mon, 2 May 2022 21:25:45 +0100
Subject: [PATCH] Enable GitLab CI/CD

Detail:
* Enable GitLab CI
* Address issues identified by CI jobs, excluding those related to cppcheck
* Enable GitLab CD for stubs (used implicitly when linker is invoked by cc)

Version 6.12. Tagged as 'RISC_OSLib-6_12'
---
 .gitlab-ci.yml | 26 ++++++++++++++++++++++++++
 VersionASM     | 12 ++++++------
 VersionNum     | 20 ++++++++++----------
 c/alloc        |  4 ++--
 c/stdio        |  2 +-
 5 files changed, 45 insertions(+), 19 deletions(-)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..8c79f34
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,26 @@
+variables:
+  COPYRIGHT_WHITELIST: "./rlib/h/README"
+  WHITESPACE_WHITELIST: "./Doc/fwrite ./test/!TboxCalc/Makefile ./BlackLog"
+  SUPPRESS_JOBS: "cppcheck softload_gnu"
+
+include:
+  - project: 'Support/CI'
+    file: '/RISC_OSLib.yml'
+
+deploy_to_runner:
+  stage: deploy
+  only:
+    refs: [ master ]
+  tags: [ cross ]
+  script:
+    # Depending on whether the pipeline is launched by the merge request or
+    # manually, VersionNum may or may not have been updated. Switch to the
+    # tip of master to ensure consistency.
+    - git checkout origin/master
+    - 'curl --location --output ~/cache/common/BuildHost.zip -z ~/cache/common/BuildHost.zip "https://gitlab.riscosopen.org/Products/BuildHost/-/jobs/artifacts/master/download?job=latest_package_tree"'
+    - unzip -q ~/cache/common/BuildHost.zip
+    - source RiscOS/Env/ROOL/BuildHost.sh
+    - COMPONENT=SharedCLibrary mk all_libs
+    # Upload binary
+    - chmod 400 $SSH_PRIVATE_KEY
+    - rsync -avc -e "ssh -i $SSH_PRIVATE_KEY" --chown rool:rool --chmod=644 objs/stubs.a root@localhost:/opt/rool/lib/
diff --git a/VersionASM b/VersionASM
index 6c2e915..ee7b1ed 100644
--- a/VersionASM
+++ b/VersionASM
@@ -9,12 +9,12 @@
                         GBLS    Module_ApplicationDate
                         GBLS    Module_HelpVersion
                         GBLS    Module_ComponentName
-Module_MajorVersion     SETS    "6.11"
-Module_Version          SETA    611
+Module_MajorVersion     SETS    "6.12"
+Module_Version          SETA    612
 Module_MinorVersion     SETS    ""
-Module_Date             SETS    "22 Nov 2021"
-Module_ApplicationDate  SETS    "22-Nov-21"
+Module_Date             SETS    "16 May 2022"
+Module_ApplicationDate  SETS    "16-May-22"
 Module_ComponentName    SETS    "RISC_OSLib"
-Module_FullVersion      SETS    "6.11"
-Module_HelpVersion      SETS    "6.11 (22 Nov 2021)"
+Module_FullVersion      SETS    "6.12"
+Module_HelpVersion      SETS    "6.12 (16 May 2022)"
                         END
diff --git a/VersionNum b/VersionNum
index 7166149..d4c6e93 100644
--- a/VersionNum
+++ b/VersionNum
@@ -1,21 +1,21 @@
-/* (6.11)
+/* (6.12)
  *
  * This file is automatically maintained by srccommit, do not edit manually.
  *
  */
-#define Module_MajorVersion_CMHG        6.11
+#define Module_MajorVersion_CMHG        6.12
 #define Module_MinorVersion_CMHG
-#define Module_Date_CMHG                22 Nov 2021
+#define Module_Date_CMHG                16 May 2022
 
-#define Module_MajorVersion             "6.11"
-#define Module_Version                  611
+#define Module_MajorVersion             "6.12"
+#define Module_Version                  612
 #define Module_MinorVersion             ""
-#define Module_Date                     "22 Nov 2021"
+#define Module_Date                     "16 May 2022"
 
-#define Module_ApplicationDate          "22-Nov-21"
+#define Module_ApplicationDate          "16-May-22"
 
 #define Module_ComponentName            "RISC_OSLib"
 
-#define Module_FullVersion              "6.11"
-#define Module_HelpVersion              "6.11 (22 Nov 2021)"
-#define Module_LibraryVersionInfo       "6:11"
+#define Module_FullVersion              "6.12"
+#define Module_HelpVersion              "6.12 (16 May 2022)"
+#define Module_LibraryVersionInfo       "6:12"
diff --git a/c/alloc b/c/alloc
index 9d51de2..b789a6c 100644
--- a/c/alloc
+++ b/c/alloc
@@ -1328,7 +1328,7 @@ extern void *aligned_alloc(size_t align, size_t size)
       return (e != NULL) ? NULL : ptr;
     } else { /* overallocate to ensure alignment, then return the subset */
       if (align < sizeof(RMABlock)) align = sizeof(RMABlock);
-      oversize = size + align - 1 + sizeof(RMABlock); 
+      oversize = size + align - 1 + sizeof(RMABlock);
       ptr = _kernel_RMAalloc(oversize);
       if (ptr != NULL) {
         RMABlock *bp;
@@ -1357,7 +1357,7 @@ extern void *aligned_alloc(size_t align, size_t size)
         _alloc_die(_kernel_getmessage("malloc failed", "C12"), CORRUPT);
       else return NULL;
     } else {
-      BlockP keepBlock, tempBlock; 
+      BlockP keepBlock, tempBlock;
       uintptr_t user = (uintptr_t)ptr;
       user  = (user + (align - 1)) & ~(align - 1); /* aligned as the user wished */
       user += excess; /* doubly aligned to ensure excess */
diff --git a/c/stdio b/c/stdio
index b39424d..0c8dc1b 100644
--- a/c/stdio
+++ b/c/stdio
@@ -727,7 +727,7 @@ static FILE *freopen_common(const char *name, const char *mode, FILE *iob, int f
     case 'b':   flag |= _IOBIN, openmode |= OPEN_B;
                 continue;
     case 'x':   if (*mode != '\0' ||   /* must be last and writing */
-                    !(openmode & OPEN_W)) return NULL;    
+                    !(openmode & OPEN_W)) return NULL;
                 openmode |= OPEN_X; break;
         }
         break;
-- 
GitLab