From 6177ccaea21f1d27796fd889257fdfdef1cf1d8a Mon Sep 17 00:00:00 2001 From: "(Holloway) Chew, Kean Ho" Date: Tue, 18 Jun 2024 07:13:37 +0800 Subject: [PATCH] srcC: upgraded to match the latest automataCI implementations The C programming language is the hardest to deal with among all technology. However, we did it so we're upstreaming it back to this repository. There are a number of new enchancement features implemented here: 1. DEB can now be packaged and released as a flat repository format. 2. RPM can now be packaged and released as a flat repository format. 3. AutomataCI no longer rely on Reprepro external dependency to formulate the DEB repository. 4. Enhanced packaging registrations by adding known limitation filtration. This patch upgrades srcC/ directory to match the latest automataCI implementations. Co-authored-by: Shuralyov, Jean Co-authored-by: Galyna, Cory Co-authored-by: (Holloway) Chew, Kean Ho Signed-off-by: (Holloway) Chew, Kean Ho --- .github/workflows/git-push.yml | 2 +- CONFIG.toml | 924 +++++++++++++----- LICENSE.pdf | Bin 0 -> 49470 bytes LICENSE.txt | 201 ---- automataCI/_package-archive_unix-any.sh | 6 +- automataCI/_package-archive_windows-any.ps1 | 8 +- automataCI/_package-cargo_unix-any.sh | 2 +- automataCI/_package-cargo_windows-any.ps1 | 4 +- automataCI/_package-chocolatey_unix-any.sh | 4 +- .../_package-chocolatey_windows-any.ps1 | 2 +- automataCI/_package-citation_unix-any.sh | 2 +- automataCI/_package-citation_windows-any.ps1 | 4 +- automataCI/_package-deb_unix-any.sh | 2 +- automataCI/_package-deb_windows-any.ps1 | 4 +- automataCI/_package-docker_unix-any.sh | 2 +- automataCI/_package-docker_windows-any.ps1 | 4 +- automataCI/_package-flatpak_unix-any.sh | 2 +- automataCI/_package-flatpak_windows-any.ps1 | 2 +- automataCI/_package-homebrew_unix-any.sh | 79 +- automataCI/_package-homebrew_windows-any.ps1 | 76 +- automataCI/_package-ipk_unix-any.sh | 2 +- automataCI/_package-ipk_windows-any.ps1 | 2 +- automataCI/_package-msi_unix-any.sh | 2 +- automataCI/_package-msi_windows-any.ps1 | 4 +- automataCI/_package-npm_unix-any.sh | 80 -- automataCI/_package-npm_windows-any.ps1 | 73 -- automataCI/_package-pdf_windows-any.ps1 | 2 +- automataCI/_package-pypi_unix-any.sh | 2 +- automataCI/_package-pypi_windows-any.ps1 | 2 +- automataCI/_package-rpm_unix-any.sh | 4 +- automataCI/_package-rpm_windows-any.ps1 | 6 +- automataCI/_release-changelog_unix-any.sh | 20 +- automataCI/_release-changelog_windows-any.ps1 | 22 +- automataCI/_release-checksum_unix-any.sh | 86 +- automataCI/_release-checksum_windows-any.ps1 | 92 +- automataCI/_release-chocolatey_unix-any.sh | 143 --- .../_release-chocolatey_windows-any.ps1 | 155 --- automataCI/_release-citation_unix-any.sh | 24 +- automataCI/_release-citation_windows-any.ps1 | 24 +- automataCI/_release-deb_unix-any.sh | 251 ++++- automataCI/_release-deb_windows-any.ps1 | 258 ++++- automataCI/_release-docker_unix-any.sh | 25 +- automataCI/_release-docker_windows-any.ps1 | 25 +- automataCI/_release-docsrepo_unix-any.sh | 37 +- automataCI/_release-docsrepo_windows-any.ps1 | 35 +- automataCI/_release-flatpak_unix-any.sh | 145 +++ automataCI/_release-flatpak_windows-any.ps1 | 149 +++ automataCI/_release-homebrew_unix-any.sh | 152 ++- automataCI/_release-homebrew_windows-any.ps1 | 167 ++-- automataCI/_release-lib_unix-any.sh | 29 +- automataCI/_release-lib_windows-any.ps1 | 49 +- automataCI/_release-npm_unix-any.sh | 36 +- automataCI/_release-npm_windows-any.ps1 | 38 +- automataCI/_release-project_unix-any.sh | 95 ++ automataCI/_release-project_windows-any.ps1 | 97 ++ ...x-any.sh => _release-research_unix-any.sh} | 24 +- ....ps1 => _release-research_windows-any.ps1} | 26 +- automataCI/_release-rpm_unix-any.sh | 245 ++++- automataCI/_release-rpm_windows-any.ps1 | 247 ++++- automataCI/_release-staticrepo_unix-any.sh | 119 --- .../_release-staticrepo_windows-any.ps1 | 115 --- automataCI/common_unix-any.sh | 15 +- automataCI/common_windows-any.ps1 | 14 +- automataCI/env_unix-any.sh | 9 - automataCI/env_windows-any.ps1 | 8 - automataCI/package_unix-any.sh | 282 ++++-- automataCI/package_windows-any.ps1 | 280 ++++-- automataCI/release_unix-any.sh | 157 ++- automataCI/release_windows-any.ps1 | 225 +++-- automataCI/services/archive/ar.ps1 | 34 +- automataCI/services/archive/ar.sh | 32 +- automataCI/services/archive/tar.ps1 | 32 +- automataCI/services/archive/tar.sh | 32 +- automataCI/services/checksum/md5.ps1 | 2 +- automataCI/services/checksum/md5.sh | 15 +- automataCI/services/checksum/shasum.ps1 | 2 +- automataCI/services/compilers/changelog.ps1 | 9 +- automataCI/services/compilers/changelog.sh | 9 +- automataCI/services/compilers/deb.ps1 | 751 +++++++++++++- automataCI/services/compilers/deb.sh | 752 +++++++++++++- automataCI/services/compilers/ipk.ps1 | 8 +- automataCI/services/compilers/ipk.sh | 8 +- automataCI/services/compilers/node.ps1 | 9 +- automataCI/services/compilers/node.sh | 6 +- automataCI/services/compilers/rpm.ps1 | 197 +++- automataCI/services/compilers/rpm.sh | 198 +++- automataCI/services/crypto/gpg.ps1 | 67 +- automataCI/services/crypto/gpg.sh | 67 +- .../services/i18n/_check-disabled-skipped.ps1 | 29 + .../services/i18n/_check-disabled-skipped.sh | 29 + automataCI/services/i18n/_conclude.ps1 | 35 + automataCI/services/i18n/_conclude.sh | 31 + .../services/i18n/_simulate-conclusion.ps1 | 2 +- automataCI/services/i18n/translations.ps1 | 3 +- automataCI/services/i18n/translations.sh | 2 + automataCI/services/io/disk.ps1 | 39 +- automataCI/services/io/disk.sh | 36 +- automataCI/services/io/fs.ps1 | 252 ++++- automataCI/services/io/fs.sh | 259 ++++- automataCI/services/io/os.ps1 | 2 +- automataCI/services/io/os.sh | 2 +- automataCI/services/io/time.ps1 | 44 +- automataCI/services/io/time.sh | 66 +- automataCI/services/publishers/chocolatey.sh | 2 +- automataCI/services/publishers/createrepo.ps1 | 16 +- automataCI/services/publishers/createrepo.sh | 36 +- automataCI/services/publishers/homebrew.ps1 | 217 +++- automataCI/services/publishers/homebrew.sh | 210 +++- automataCI/services/publishers/unix.ps1 | 51 + automataCI/services/publishers/unix.sh | 58 ++ src/.ci/_package-archive_unix-any.sh | 79 +- src/.ci/_package-archive_windows-any.ps1 | 69 +- src/.ci/_package-chocolatey_unix-any.sh | 221 ++++- src/.ci/_package-chocolatey_windows-any.ps1 | 229 ++++- src/.ci/_package-deb_unix-any.sh | 85 +- src/.ci/_package-deb_windows-any.ps1 | 90 +- src/.ci/_package-docker_unix-any.sh | 60 +- src/.ci/_package-docker_windows-any.ps1 | 61 +- src/.ci/_package-homebrew_unix-any.sh | 95 +- src/.ci/_package-homebrew_windows-any.ps1 | 94 +- src/.ci/_package-ipk_unix-any.sh | 45 +- src/.ci/_package-ipk_windows-any.ps1 | 47 +- src/.ci/_package-lib_unix-any.sh | 127 ++- src/.ci/_package-lib_windows-any.ps1 | 141 ++- src/.ci/_package-pdf_unix-any.sh | 6 +- src/.ci/_package-pdf_windows-any.ps1 | 6 +- src/.ci/_package-rpm_unix-any.sh | 114 ++- src/.ci/_package-rpm_windows-any.ps1 | 121 ++- src/.ci/build_unix-any.sh | 13 +- src/.ci/build_windows-any.ps1 | 13 +- srcC/.ci/_package-archive_unix-any.sh | 130 --- srcC/.ci/_package-archive_windows-any.ps1 | 131 --- srcC/.ci/_package-chocolatey_unix-any.sh | 260 ----- srcC/.ci/_package-chocolatey_windows-any.ps1 | 260 ----- srcC/.ci/_package-docker_unix-any.sh | 151 --- srcC/.ci/_package-docker_windows-any.ps1 | 150 --- srcC/.ci/_package-homebrew_unix-any.sh | 150 --- srcC/.ci/_package-homebrew_windows-any.ps1 | 151 --- srcC/.ci/build_unix-any.sh | 325 +++--- srcC/.ci/build_windows-any.ps1 | 289 ++++-- srcC/.ci/materialize_unix-any.sh | 8 +- srcC/.ci/materialize_windows-any.ps1 | 8 +- srcC/.ci/package_unix-any.sh | 32 - srcC/.ci/package_windows-any.ps1 | 31 - srcC/executable.txt | 13 +- srcC/library.txt | 13 +- .../entity_any-any.h => entities/Vanilla.h} | 6 + .../greeter_any-any.c => greeters/Vanilla.c} | 0 .../greeter_any-any.h => greeters/Vanilla.h} | 7 +- .../Vanilla_test.c} | 29 +- .../Vanilla.h} | 6 + srcC/libs/testing/Vanilla.h | 28 + srcC/main.c | 7 +- 153 files changed, 8504 insertions(+), 4477 deletions(-) create mode 100644 LICENSE.pdf delete mode 100644 LICENSE.txt delete mode 100644 automataCI/_package-npm_unix-any.sh delete mode 100644 automataCI/_package-npm_windows-any.ps1 delete mode 100644 automataCI/_release-chocolatey_unix-any.sh delete mode 100644 automataCI/_release-chocolatey_windows-any.ps1 create mode 100644 automataCI/_release-flatpak_unix-any.sh create mode 100644 automataCI/_release-flatpak_windows-any.ps1 create mode 100644 automataCI/_release-project_unix-any.sh create mode 100644 automataCI/_release-project_windows-any.ps1 rename automataCI/{_release-pdf_unix-any.sh => _release-research_unix-any.sh} (66%) rename automataCI/{_release-pdf_windows-any.ps1 => _release-research_windows-any.ps1} (62%) delete mode 100644 automataCI/_release-staticrepo_unix-any.sh delete mode 100644 automataCI/_release-staticrepo_windows-any.ps1 create mode 100644 automataCI/services/i18n/_check-disabled-skipped.ps1 create mode 100644 automataCI/services/i18n/_check-disabled-skipped.sh create mode 100644 automataCI/services/i18n/_conclude.ps1 create mode 100644 automataCI/services/i18n/_conclude.sh create mode 100644 automataCI/services/publishers/unix.ps1 create mode 100644 automataCI/services/publishers/unix.sh delete mode 100644 srcC/.ci/_package-archive_unix-any.sh delete mode 100644 srcC/.ci/_package-archive_windows-any.ps1 delete mode 100644 srcC/.ci/_package-chocolatey_unix-any.sh delete mode 100644 srcC/.ci/_package-chocolatey_windows-any.ps1 delete mode 100644 srcC/.ci/_package-docker_unix-any.sh delete mode 100644 srcC/.ci/_package-docker_windows-any.ps1 delete mode 100644 srcC/.ci/_package-homebrew_unix-any.sh delete mode 100644 srcC/.ci/_package-homebrew_windows-any.ps1 delete mode 100644 srcC/.ci/package_unix-any.sh delete mode 100644 srcC/.ci/package_windows-any.ps1 rename srcC/libs/{sample/entity_any-any.h => entities/Vanilla.h} (95%) rename srcC/libs/{sample/greeter_any-any.c => greeters/Vanilla.c} (100%) rename srcC/libs/{sample/greeter_any-any.h => greeters/Vanilla.h} (98%) rename srcC/libs/{sample/greeter_any-any_test.c => greeters/Vanilla_test.c} (78%) rename srcC/libs/{sample/location_any-any.h => locations/Vanilla.h} (95%) create mode 100644 srcC/libs/testing/Vanilla.h diff --git a/.github/workflows/git-push.yml b/.github/workflows/git-push.yml index 0a86c720..b8f2960f 100644 --- a/.github/workflows/git-push.yml +++ b/.github/workflows/git-push.yml @@ -28,7 +28,7 @@ jobs: CONTAINER_PASSWORD: ${{ secrets.CONTAINER_PASSWORD }} TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} - PROJECT_SIMULATE_RELEASE_REPO: true + PROJECT_SIMULATE_RUN: true PROJECT_ROBOT_RUN: true PROJECT_ROBOT_GITHUB_TOKEN: "${{ github.token }}" steps: diff --git a/CONFIG.toml b/CONFIG.toml index 9ff440be..42775cb9 100644 --- a/CONFIG.toml +++ b/CONFIG.toml @@ -20,14 +20,14 @@ # This is the known product ID used as a command, marketing brand, etc. # It should be in lowercase and should not be using dash ('-'), # underscore ('_'), and space (' ') for maximum compatibility. -PROJECT_SKU = "automataci" +PROJECT_SKU = 'automataci' # PROJECT_SKU_TITLECASE # The titlecase version of PROJECT_SKU. Used in certain packager control scripts # like Homebrew. Conditions is the same as PROJECT_SKU except it is in the # TitleCase representation. -PROJECT_SKU_TITLECASE = "AutomataCI" +PROJECT_SKU_TITLECASE = 'AutomataCI' # PROJECT_APP_ID @@ -36,7 +36,11 @@ PROJECT_SKU_TITLECASE = "AutomataCI" # must be a reversed domain with no dash ('-') and underscore ('_'). For GitHub # projects, it's advisable to use 'io.github.[owner].[project]' format instead # to avoid naming conflict. -PROJECT_APP_ID = "com.github.chewkeanho.automataci" +# +# Some examples: +# 1. 'com.github.[USERNAME].[PROJECT]' (https://github.com/[USERNAME]/[PROJECT]) +# 2. 'com.example.app' (https://app.example.com) +PROJECT_APP_ID = 'com.github.chewkeanho.automataci' # PRODUCT_APP_UUID @@ -60,7 +64,7 @@ PROJECT_APP_ID = "com.github.chewkeanho.automataci" # This is commonly used in product ID like MSI packaging where it is used as the # UPGRADE_CODE designating a possible upgrade installation against the same # product line or PRODUCT ID. -PRODUCT_APP_UUID = "76C7A54E-7360-CB70-1A5E-44D8A00CCB30" +PRODUCT_APP_UUID = '76C7A54E-7360-CB70-1A5E-44D8A00CCB30' # PROJECT_NAME @@ -72,7 +76,7 @@ PROJECT_NAME = "Chew Kean Ho's AutomataCI" # PROJECT_PITCH # A short elevator pitch about the project used as a short description. Max # Max: 60 characters. -PROJECT_PITCH = "A redistributable & semi-autonomous CI infrastructure." +PROJECT_PITCH = 'One Peaceful Frontend+Backend Software Library Suite.' # PROJECT_VERSION @@ -85,57 +89,62 @@ PROJECT_PITCH = "A redistributable & semi-autonomous CI infrastructure." # like '0.0.1~rc1' instead of dashes (-). Some distribution ecosystem have # strict and reserved rules for version sorting using dashes so tlide will be # the best choice. -PROJECT_VERSION = "2.2.0" +PROJECT_VERSION = '3.0.0' # PROJECT_CADENCE # The build cadence number usually to indicate the multiple builds of the same -# version like '12312' where some packager will generate the final version -# number as: '0.0.1-rc1-12312' or '0.0.1-12312'. +# version like '12312' where some packager (e.g. RPM) will generate the final +# version number as: '0.0.1-rc1-12312' or '0.0.1-12312'. # -# When it doubt or unused, set to 1 and use numerical increment only. -PROJECT_CADENCE = "1" +# When it doubt or unused, set/reset to 1 and only increment when there is an +# actual need. +PROJECT_CADENCE = '1' # PROJECT_LICENSE # The SPDX license tag. Refer https://spdx.org/licenses/ for finding or # constructing your license identifier. -PROJECT_LICENSE = "Apache-2.0" +PROJECT_LICENSE = 'Apache-2.0' # PROJECT_SCOPE -# The scope of the project being housed in (e.g. +# The ownership of the project being housed working as a scoping domain. (e.g. # GitHub Username|Organization Name, NPMJS scope, etc). This is required for -# certain packages' ecosystems such as but not limited to NPM. -PROJECT_SCOPE = "chewkeanho" +# certain packages' ecosystems such as but not limited to NPM. In certain cases, +# this field is commonly combined with PROJECT_SKU to form the full ID complying +# to '${PROJECT_SCOPE}-${PROJECT_SKU}' pattern. +# +# This field shall not be left empty. +PROJECT_SCOPE = 'chewkeanho' # PROJECT_CONTACT_BRAND # Contact Entity's short brand name. It should be in lowercase and should not be # using dash ('-'), underscore ('_'), and space (' ') for maximum compatibility. -PROJECT_CONTACT_BRAND = "chewkeanho" +PROJECT_CONTACT_BRAND = 'chewkeanho' # PROJECT_CONTACT_BRAND_TITLECASE # The titlecase version of PROJECT_CONTACT_BRAND. Used in certain packager # control scripts like MSI. Conditions is the same as PROJECT_CONTACT_BRAND # except it is in the TitleCase representation. -PROJECT_CONTACT_BRAND_TITLECASE = "ChewKeanHo" +PROJECT_CONTACT_BRAND_TITLECASE = 'ChewKeanHo' # PROJECT_CONTACT_NAME # Entity's full name for inquiries. -PROJECT_CONTACT_NAME = "(Holloway) Chew, Kean Ho" +PROJECT_CONTACT_NAME = '(Holloway) Chew, Kean Ho' # PROJECT_CONTACT_EMAIL # Entity's email channel for email communications. -PROJECT_CONTACT_EMAIL = "hello@hollowaykeanho.com" +PROJECT_CONTACT_EMAIL = 'hello@hollowaykeanho.com' # PROJECT_CONTACT_WEBSITE # Entity's website channel for sourcing information. -PROJECT_CONTACT_WEBSITE = "https://github.com/ChewKeanHo/AutomataCI" +PROJECT_CONTACT_WEBSITE = 'https://github.com/ChewKeanHo/AutomataCI' # PROJECT_SOURCE_URL @@ -147,7 +156,7 @@ PROJECT_CONTACT_WEBSITE = "https://github.com/ChewKeanHo/AutomataCI" # # Example: # 1. GitHub Packages : https://github.com/OWNER/REPO -PROJECT_SOURCE_URL = "https://github.com/ChewKeanHo/AutomataCI" +PROJECT_SOURCE_URL = 'https://github.com/ChewKeanHo/AutomataCI' # PROJECT_SOURCE_GIT_REMOTE @@ -181,8 +190,8 @@ PROJECT_README = 'README.md' # The relative location of the project license file from $PROJECT_PATH_ROOT # (repository root directory). # -# Default is 'LICENSE.txt' -PROJECT_LICENSE_FILE = 'LICENSE.txt' +# Default is 'LICENSE.pdf' +PROJECT_LICENSE_FILE = 'LICENSE.pdf' # PROJECT_LICENSE_ACCEPTANCE_REQUIRED @@ -202,11 +211,11 @@ PROJECT_LICENSE_ACCEPTANCE_REQUIRED = 'true' # to this format: # {iso639-1}[-{iso15954}] # Examples: -# en – International English. (Default & Fallback) -# fr – International French. -# zh-hans – International Simplified Chinese. -# zh-hant – International Traditional Chinese. -AUTOMATACI_LANG = "" +# 'en' – International English. (Default & Fallback) +# 'fr' – International French. +# 'zh-hans' – International Simplified Chinese. +# 'zh-hant' – International Traditional Chinese. +AUTOMATACI_LANG = '' @@ -239,7 +248,7 @@ PROJECT_ANGULAR = '' # # To enable it: simply supply the path (e.g. default is 'srcBOOK'). # To disable it: simply supply an empty path (e.g. default is ''). -PROJECT_BOOK = 'srcBOOK' +PROJECT_BOOK = '' @@ -259,6 +268,16 @@ PROJECT_BOOK = 'srcBOOK' PROJECT_C = '' +# PROJECT_C_BRANCH_TAG +# This is for technology tagging purposes such as but not limited to release +# branches identification. The value shall always be lowercase, short, and +# directly identify it is C technology. +# +# Default is: 'c' +# To disable: set it empty '' +PROJECT_C_BRANCH_TAG = 'c' + + ###################### @@ -270,14 +289,14 @@ PROJECT_C = '' # # To enable it, simply simply the supported version. Default is '1.2.0'. # To dsiable it, simply leave it empty. -PROJECT_CITATION="1.2.0" +PROJECT_CITATION='1.2.0' # PROJECT_CITATION_TYPE # The type's field value of the repository representing the content of it. # # Can only accept 'software' or 'dataset'. Default is 'software'. -PROJECT_CITATION_TYPE="software" +PROJECT_CITATION_TYPE='software' @@ -306,7 +325,7 @@ PROJECT_DOTNET = '' # PROJECT_PATH_DOTNET_ENGINE # This is a relative pathing to PROJECT_PATH_ROOT + PROJECT_PATH_TOOLS for # setting up .NET localized directory. -PROJECT_PATH_DOTNET_ENGINE = "dotnet-engine" +PROJECT_PATH_DOTNET_ENGINE = 'dotnet-engine' # PROJECT_DOTNET_CHANNEL @@ -317,7 +336,7 @@ PROJECT_PATH_DOTNET_ENGINE = "dotnet-engine" # https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script # # When in doubt, use "LTS" -PROJECT_DOTNET_CHANNEL = "LTS" +PROJECT_DOTNET_CHANNEL = 'LTS' # DOTNET_CLI_TELEMETRY_OPTOUT @@ -329,7 +348,7 @@ PROJECT_DOTNET_CHANNEL = "LTS" # # To enable: "1" # To disable: commit it out. -DOTNET_CLI_TELEMETRY_OPTOUT = "1" +DOTNET_CLI_TELEMETRY_OPTOUT = '1' # PROJECT_PATH_NUPKG @@ -337,7 +356,7 @@ DOTNET_CLI_TELEMETRY_OPTOUT = "1" # PROJECT_PATH_DOTNET_ENGINE for for housing .NET nupkg packages. At AutomataCI, # .nupkg (a zip file) can be downloaded without depending on downloading the # entire .Net framework. -PROJECT_PATH_NUPKG = "nupkg" +PROJECT_PATH_NUPKG = 'nupkg' @@ -468,6 +487,7 @@ GOOGLEAI_BLOCK_HARASSMENT = 'BLOCK_NONE' # Do note that should the following technologies are enabled, LibreOffice shall # be installed regardless of this control variable: # (1) PROJECT_RESEARCH - using Libreoffice by default. +# (2) PROJECT_BOOK - using Libreoffice by default. # # To enable it: simply supply the path (e.g. default is 'srcLIBREOFFICE'). # To disable it: simply supply an empty path (e.g. default is ''). @@ -482,7 +502,7 @@ PROJECT_LIBREOFFICE = '' # # Refer to the following mirror list for value selection: # (1) https://download.documentfoundation.org/mirmon/allmirrors.html -PROJECT_LIBREOFFICE_MIRROR = "https://download.documentfoundation.org/libreoffice" +PROJECT_LIBREOFFICE_MIRROR = 'https://download.documentfoundation.org/libreoffice' # PROJECT_LIBREOFFICE_VERSION # This is for defining the LibreOffice version to install into the local OS. @@ -491,13 +511,13 @@ PROJECT_LIBREOFFICE_MIRROR = "https://download.documentfoundation.org/libreoffic # (1) https://www.libreoffice.org/download/download-libreoffice/ # # Example: '24.4.3' for 'LibreOffice 24.4.3' -PROJECT_LIBREOFFICE_VERSION = "24.2.3" +PROJECT_LIBREOFFICE_VERSION = '24.2.3' # PROJECT_PATH_LIBREOFFICE_ENGINE # This is a relative pathing to PROJECT_PATH_ROOT + PROJECT_PATH_TOOLS for # setting up localized environment. -PROJECT_PATH_LIBREOFFICE_ENGINE = "libreoffice-engine" +PROJECT_PATH_LIBREOFFICE_ENGINE = 'libreoffice-engine' @@ -520,7 +540,7 @@ PROJECT_GO = '' # PROJECT_PATH_GO_ENGINE # This is a relative pathing to PROJECT_PATH_ROOT + PROJECT_PATH_TOOLS for # setting up localized environment. -PROJECT_PATH_GO_ENGINE = "go-engine" +PROJECT_PATH_GO_ENGINE = 'go-engine' @@ -543,7 +563,7 @@ PROJECT_NIM = '' # PROJECT_PATH_NIM_ENGINE # This is a relative pathing to PROJECT_PATH_ROOT + PROJECT_PATH_TOOLS for # setting up localized environment. -PROJECT_PATH_NIM_ENGINE = "nim-engine" +PROJECT_PATH_NIM_ENGINE = 'nim-engine' @@ -560,13 +580,13 @@ PROJECT_PATH_NIM_ENGINE = "nim-engine" # # To enable it: simply supply the path (e.g. default is 'srcNODE'). # To disable it: simply supply an empty path (e.g. default is ''). -PROJECT_NODE = 'srcNODE' +PROJECT_NODE = '' # PROJECT_PATH_NODE_ENGINE # This is a relative pathing to PROJECT_PATH_ROOT + PROJECT_PATH_TOOLS for # setting up localized virtual environment. -PROJECT_PATH_NODE_ENGINE = "node-engine" +PROJECT_PATH_NODE_ENGINE = 'node-engine' # PROJECT_NODE_VERSION @@ -637,25 +657,25 @@ PROJECT_PYTHON = '' # PROJECT_PATH_PYTHON_ENGINE # This is a relative pathing to PROJECT_PATH_ROOT + PROJECT_PATH_TOOLS for # setting up venv location. -PROJECT_PATH_PYTHON_ENGINE = "python-engine" +PROJECT_PATH_PYTHON_ENGINE = 'python-engine' # PROJECT_PYPI_REPO_URL # The PyPi upstream repo to push the PyPi package. The defualt PyPi values are: # Test Zone : https://test.pypi.org/legacy/ # Actual : https://upload.pypi.org/legacy/ -PROJECT_PYPI_REPO_URL = "https://test.pypi.org/legacy/" +PROJECT_PYPI_REPO_URL = 'https://test.pypi.org/legacy/' # PROJECT_PYPI_README # The PyPi README file relative to PROJECT_PATH_ROOT directory. Default is the # the common README.md. It **MUST** be a file. -PROJECT_PYPI_README = "README.md" +PROJECT_PYPI_README = 'README.md' # PROJECT_PYPI_README_MIME # The PyPi README file's MIME type data. Default is 'text/markdown'. -PROJECT_PYPI_README_MIME = "text/markdown" +PROJECT_PYPI_README_MIME = 'text/markdown' @@ -713,37 +733,37 @@ PROJECT_RUST_EDITION = '2021' # PROJECT_PATH_RUST_ENGINE # This is a relative pathing to PROJECT_PATH_ROOT + PROJECT_PATH_TOOLS for # setting up localized environment. -PROJECT_PATH_RUST_ENGINE = "rust-engine" +PROJECT_PATH_RUST_ENGINE = 'rust-engine' # PROJECT_CARGO_README # The Cargo README file relative to PROJECT_PATH_ROOT directory. Default is the # the common README.md. It **MUST** be a file. -PROJECT_CARGO_README = "README.md" +PROJECT_CARGO_README = 'README.md' # CARGO_REGISTRY # The Cargo registry. # # Default is: crates-io -CARGO_REGISTRY = "crates-io" +CARGO_REGISTRY = 'crates-io' ########################## -# DISTRIBUTION ECOSYSTEM # +# DISTRIBUTION - ALL # ########################## # PROJECT_CHANGELOG_TITLE # The title of the changelog file. -PROJECT_CHANGELOG_TITLE = "Changelog | 更新日志 | Endringslogg | Cacatan Perubahan | Ändringslogg | 変更履歴" +PROJECT_CHANGELOG_TITLE = 'Changelog | 更新日志 | Endringslogg | Cacatan Perubahan | Ändringslogg | 変更履歴' # PROJECT_RELEASE_SHA256 # Perform SHA256 checksum file generation in Release job. To disable it, simply # let it empty. # # Otherwise, as long as it's not empty, it is enabled. -PROJECT_RELEASE_SHA256 = "enabled" +PROJECT_RELEASE_SHA256 = 'enabled' # PROJECT_RELEASE_SHA512 @@ -751,19 +771,312 @@ PROJECT_RELEASE_SHA256 = "enabled" # empty. # # Otherwise, as long as it's not empty, it is enabled. -PROJECT_RELEASE_SHA512 = "enabled" +PROJECT_RELEASE_SHA512 = 'enabled' + + +# PROJECT_SIMULATE_RUN +# A flag to indicate this CI job run is to be simulated (or 'dry run'). +# Depending on job, this disables certain non-resersible, critical, or high +# stake tasks (e.g. gpg-signing, release conclusion etc) and replace it with a +# simple simulation run. +# +# It is made primarily for local CI job run testing and for full automated run +# like GitHub Actions or GitLab CI. +# +# To enable, simply declare the environment variable non-empty value (e.g. 'true'). +# To disable: leave it empty. +# +# PROJECT_SIMULATE_RUN = '' # Reserved - provided externally via environment variable. + + +# PROJECT_ROBOT_RUN +# A flag to indicate the run is operating inside a CI service by its +# autonomous robot. +# +# It is made primarily for local CI job run testing and for full automated run +# like GitHub Actions or GitLab CI. +# +# To enable, simply declare the environment variable non-empty value (e.g. 'true'). +# To disable: leave it empty. +# +# PROJECT_ROBOT_RUN = '' # Reserved - provided externally via environment variable. + + +# PROJECT_RELEASE_REPO_TYPE +# The type of release repository. Available options are: +# +# 1. 'git' - git repository +# 2. 'local' - a localized directory (for manual export elsewhere). +# +# Default is 'git'. +# Leaving it empty shall fallback to git repository. +PROJECT_RELEASE_REPO_TYPE = 'git' + + +# PROJECT_RELEASE_REPO +# The URL for setting the ${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE} directory +# as a single unified repository rather than manage each of the release repos +# individually. This is designed for Git-based publishing service providers like +# GitHub/GitLab Pages and etc. +# +# Setting this field shall overrides all the distributions' git url fields +# (e.g. PROJECT_RPM_REPO, PROJECT_DEB_REPO, etc) and will only push to this +# repo at the end of the release job conclusion. +# +# Default is empty '' (favoring flat-mode repositories) +PROJECT_RELEASE_REPO = '' + + +# PROJECT_RELEASE_REPO_KEY +# The git upstream key for PROJECT_RELEASE_REPO. This field cannot be left +# empty. +# +# Default is 'origin'. +PROJECT_RELEASE_REPO_KEY = 'origin' + + +# PROJECT_RELEASE_REPO_BRANCH +# The git upstream branch for PROJECT_RELEASE_REPO. This field cannot be left +# empty. +# +# Default is 'master' or 'main'. +PROJECT_RELEASE_REPO_BRANCH = 'master' + + +# PROJECT_RELEASE_ARCHIVE +# The flag to package archive (.tar.gz | .zip) files as output. +# +# To enable : fill in some string (e.g. 'enabled') +# To disable: leave it empty ('') +PROJECT_RELEASE_ARCHIVE = 'enabled' + + +# PROJECT_RELEASE_IPK +# The flag to package ipk pipeline. +# +# To enable : fill in some string (e.g. 'enabled') +# To disable: leave it empty ('') +PROJECT_RELEASE_IPK = 'enabled' + + +# PROJECT_RELEASE_MSI +# The flag to package msi pipeline. +# +# To enable : fill in some string (e.g. 'enabled') +# To disable: leave it empty ('') +PROJECT_RELEASE_IPK = 'enabled' + + + + +############################# +# DISTRIBUTION - CHOCOLATEY # +############################# +# PROJECT_CHOCOLATEY_URL +# The base URL for Chocolatey & end-users to source the .nupkg packages. This +# variable is also acting as a switch to enable/disable Chocolatey distribution +# pipeline. +# +# End user may track your upstream using this URL (as in the command: +# '$ choco source add -n name -s location'). More info: +# (1) https://docs.chocolatey.org/en-us/choco/commands/sources/ +# (2) https://docs.chocolatey.org/en-us/features/host-packages/ +# +# Some examples are: +# (1) GitHub Release: +# value: 'https://github.com/[USERNAME]/[PROJECT]/releases/latest/download' +# actual URL: 'https://github.com/[USERNAME]/[PROJECT]/releases/latest/download/[FILE]' +# +# To enable it: set the URL without the ending slash. +# To disable it: set it empty. +# +# !! IMPORTANT !! - Please avoid ending with the URL slash. +PROJECT_CHOCOLATEY_URL = 'https://github.com/ChewKeanHo/AutomataCI/releases/latest/download' + + + + +# PROJECT_CHOCOLATEY_VERSION +# The Chocolatey version as a dependency. This field SHALL NOT BE EMPTY. +# +# Default value is: '0.9.8.21' +PROJECT_CHOCOLATEY_VERSION = '0.9.8.21' + + + + +############################# +# DISTRIBUTION - CONTAINERS # +############################# +# PROJECT_CONTAINER_REGISTRY +# The container registry URI value without ending slash. This variable is also +# acting as a switch to enable/disable container distribution pipeline. +# +# Some examples: +# 1. DockerHub : registry.hub.docker.com/[ NAMESPACE ] +# 2. GitHub Package: ghcr.io/[ NAMESPACE ] +# 2. Local : localhost:5000/[ NAMESPACE ] +# +# To enable it: set the URI without the ending slash. +# To disable it: set it empty. +# +# !! IMPORTANT !! - Please avoid ending with the URL slash. +PROJECT_CONTAINER_REGISTRY = 'ghcr.io/chewkeanho' + + +# PROJECT_CONTAINER_BASE_WINDOWS +# The base Windows image of the container. If you wish to use bare scratch, set +# the value to 'scratch'. +# +# Default is: 'mcr.microsoft.com/windows/nanoserver:ltsc2022' +PROJECT_CONTAINER_BASE_WINDOWS = 'mcr.microsoft.com/windows/nanoserver:ltsc2022' + + +# PROJECT_CONTAINER_BASE_WINDOWS_ARCH +# The list of archiectures to be containerized and supported by the Windows base +# image. Leaving this field empty means accepts all which is usable for +# 'scratch' type base images. +# +# Each image is separated by a '|'. +# +# Default is: 'amd64' (mcr.microsoft.com/windows/nanoserver:ltsc2022) +PROJECT_CONTAINER_BASE_WINDOWS_ARCH = 'amd64' + + +# PROJECT_CONTAINER_BASE_LINUX +# The base Linux image of the container. If you wish to use bare scratch, set +# the value to 'scratch'. +# +# Default is: 'linuxcontainers/debian-slim:latest' +PROJECT_CONTAINER_BASE_LINUX = 'linuxcontainers/debian-slim:latest' + + +# PROJECT_CONTAINER_BASE_LINUX_ARCH +# The list of archiectures to be containerized and supported by the Linux base +# image. Leaving this field empty means accepts all which is usable for +# 'scratch' type base images. +# +# Each image is separated by a '|'. +# +# Default is: '386|amd64|arm64|ppc64le|s390x' (linuxcontainers/debian-slim:latest) +PROJECT_CONTAINER_BASE_LINUX_ARCH = '386|amd64|arm64|ppc64le|s390x' + + +# DOCKER_CLI_EXPERIMENTAL +# Enable the Docker's experimental CLI features for using buildx. If disabled, +# is shall break many of the CI job. +DOCKER_CLI_EXPERIMENTAL = 'enabled' + + + + +########################## +# DISTRIBUTION - DEB # +########################## +# PROJECT_DEB_URL +# The .debs' downloadable apt URL used for generating the +# /etc/apt/source.list.d/ source file. More info: +# (1) https://wiki.debian.org/DebianRepository/Format +# +# For flat repository mode (e.g. GitHub Release / GitLab Release), +# simply supply the URL without the last section of the pathing. For example: +# (1) GitHub Release: +# value: 'https://github.com/[USERNAME]/[PROJECT]/releases/latest' +# actual URL: 'https://github.com/[USERNAME]/[PROJECT]/releases/latest/download/[FILE]' +# +# This field also acts as the flag for enabling or disabling the deb pipeline. +# +# To enable : fill in the end-user downloadable URL without ending slash. +# To disable: leave this field empty (''). +# +# !! IMPORTANT !! - Please avoid ending with the URL slash. +PROJECT_DEB_URL = 'https://github.com/ChewKeanHo/AutomataCI/releases/latest' + + +# PROJECT_DEB_DISTRIBUTION +# The 'Suite' ('Suite: ' field) distribution series for grouping .deb pakages +# by major release. The value is used for generating changelog and for +# the .deb package repository processes. More info: +# https://www.debian.org/doc/debian-policy/ch-controlfields.html#id25 +# https://www.debian.org/doc/debian-policy/ch-source.html#debian-changelog-debian-changelog +# https://wiki.debian.org/DebianRepository/Format +# +# By default, the repository is operating in the conventional pool repository +# mode (with 'dist' and 'pool' sub-directories). To enable the flat repository +# mode (e.g. GitHub Release / GitLab Release), simply ends with a slash to +# indicate it is a directory. For example: +# (1) GitHub Release: +# value: 'download/' +# actual URL: 'https://github.com/[USERNAME]/[PROJECT]/releases/latest/download/[FILE]' +# +# Otherwise, the default pool repository mode is implemented. In this case, when +# in doubt, the following values are recommended for the highest compatibilities +# with all Debian-based OSes: +# (1) 'stable' = for stable branch (e.g. 'main') +# (2) 'unstable' OR 'testing' = for next release branch (e.g 'staging', or +# 'next'). +# (3) 'experimental' = for latest branch (e.g 'experimental' or +# 'edge'). +PROJECT_DEB_DISTRIBUTION = 'download/' + + +# PROJECT_DEB_COMPONENT +# The value used by deb package repository for grouping packages by +# categorization. In any case, the value **MUST** match any one of the +# 'Component:' field understood by the apt package manager. +# +# This is mainly used to group the packages by categories (e.g. 'firmware', +# 'gui', 'models', etc). Some recommended values would be your repository +# functioning name (e.g. 'main', 'next', 'dev', etc.). +# +# When in doubt or usually unused, set the value to 'main'. +PROJECT_DEB_COMPONENT = 'main' + + +# PROJECT_DEB_CODENAME +# The value used by deb package repository for tagging a release series. In any +# case, the value **MUST** match any one of the 'Codename:' field understood by +# the apt package manager. Generally, Codename is used to symlink against +# Suite for unique identification or specific release version freezes. +# +# Example values from Debian are: 'experimental', 'sid', 'bookworm', 'wheeze', +# etc (toy story characters). +# +# When in doubt or unused, It is advisble to set the following values: +# (1) In flat repository: 'stable'. +# (2) In pool repository: 'stable' or same as PROJECT_DEB_DISTRIBUTION. +PROJECT_DEB_CODENAME = 'stable' -# PROJECT_DEBIAN_IS_NATIVE +# PROJECT_DEB_ARCH +# The list of overriding system architectures values for the deb package +# repository. It accepts a list of values separated by space (' ') based on +# dpkg supported architectures. The command: +# "$ dpkg-architecture --list-known" +# will print out a list of supported architectures' value based on the host +# system. +# +# Please keep in mind that the values are not used for gatekeeping purposes. +# When left empty, AutomataCI shall generate a full list from the existing +# published packages autonomously. +# +# By default and recommended, the value is empty '' for automation purposes. +PROJECT_DEB_ARCH = '' + + +# PROJECT_DEB_IS_NATIVE # Flag to determine the project is Debian natively sponsored package. Usually # is false. +# # Only accept: "true/false" -PROJECT_DEBIAN_IS_NATIVE = "false" +# +# Default is 'false'. +PROJECT_DEB_IS_NATIVE = 'false' -# PROJECT_DEBIAN_PRIORITY +# PROJECT_DEB_PRIORITY # Indicate the current package's distribution priority. Strictly the following -# values +# values arranged from highest priority to the lowest: # (1) required # (2) important # (3) standard @@ -771,245 +1084,404 @@ PROJECT_DEBIAN_IS_NATIVE = "false" # (5) extra # see https://www.debian.org/doc/debian-policy/ch-archive.html#s-priorities for # more info. -PROJECT_DEBIAN_PRIORITY = "optional" - - -# PROJECT_DEBIAN_DISTRIBUTION -# The distribution series for compiling the .deb pakage changelog. See this page -# for more info: -# https://www.debian.org/doc/debian-policy/ch-controlfields.html#id25 -# https://www.debian.org/doc/debian-policy/ch-source.html#debian-changelog-debian-changelog # -# Strictly of the following values: -# (1) stable = for stable branches (e.g. 'main') -# (2) unstable OR testing = for next release branches (e.g 'staging', or 'next'). -# (3) experimental = for latest branches (e.g 'experimental' or 'edge'). -PROJECT_DEBIAN_DISTRIBUTION = "stable" +# Default is 'optional'. +PROJECT_DEB_PRIORITY = 'optional' -# PROJECT_DEBIAN_URGENCY -# The urgency value for compiling the .deb pakage changelog. See this page +# PROJECT_DEB_URGENCY +# The urgency value used for compiling the .deb pakage changelog. See this page # for more info: # https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-urgency # https://www.debian.org/doc/debian-policy/ch-source.html#debian-changelog-debian-changelog # -# Strictly of the following values: -# (1) low -# (2) medium +# Strictly of the following values from highest attention to the lowest: +# (1) critical +# (2) emergency # (3) high = for user diversions -# (4) emergency -# (5) critical -PROJECT_DEBIAN_URGENCY = "low" +# (4) medium +# (5) low +# +# Default is 'low'. +PROJECT_DEB_URGENCY = 'low' -# PROJECT_DEBIAN_SECTION +# PROJECT_DEB_SECTION # The categories the project belongs to in the Debian .deb package ecosystem. # Contains restricted values. Refer: # https://www.debian.org/doc/debian-policy/ch-archive.html#sections # For maximum compliances -PROJECT_DEBIAN_SECTION = "devel" +PROJECT_DEB_SECTION = 'devel' -# PROJECT_FLATPAK_RUNTIME -# The runtime module where the Flatpak is operating on. -PROJECT_FLATPAK_RUNTIME = "org.freedesktop.Platform" +# PROJECT_DEB_REPO +# The git repository for publishing all .deb packages using a static file +# sharing service (e.g NGINX file hosting, GitHub/GitLab Pages, etc). When +# enabled, this repository URL shall be git clone into +# '$PROJECT_PATH_ROOT/$PROJECT_PATH_RELEASE' directory named as 'deb'. +# +# Note that if PROJECT_RELEASE_REPO is set, this field is ignored regardless of +# its value. +PROJECT_DEB_REPO = 'git@github.com:ChewKeanHo/AutomataCI.wiki.git' -# PROJECT_FLATPAK_RUNTIME_VERSION -# The runtime module where the Flatpak is operating on. -PROJECT_FLATPAK_RUNTIME_VERSION = "22.08" +# PROJECT_DEB_REPO_KEY +# The git upstream key. Value CANNOT be empty. +# +# Default is 'origin'. +PROJECT_DEB_REPO_KEY = 'origin' -# PROJECT_FLATPAK_SDK -# The runtime module where the Flatpak is operating on. -PROJECT_FLATPAK_SDK = "org.freedesktop.Sdk" +# PROJECT_DEB_REPO_BRANCH +# The git upstream branch. Value CANNOT be empty. +# +# Default is 'master' or 'main'. +PROJECT_DEB_REPO_BRANCH = 'master' -# PROJECT_REPREPRO_CODENAME -# The codename used by .deb's Reprepro for publishing any detected .deb package -# file. In any cases, the value **MUST** match any one of the 'Codename:' field -# understood by the reprepro. +# PROJECT_DEB_PATH +# The relative pathing for organizing within the debian repository directory. +# The path is always relative to +# '${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}/deb' directory which is the +# PROJECT_DEB_REPO debian repository. This is useful for cases where specific +# directory is required (e.g. 'GitHub Pages using "docs/" directory for +# publications). +# +# If left empty, AutomataCI shall use 'deb' as its value. # -# When in doubt or unused, set the value to 'main'. -PROJECT_REPREPRO_CODENAME = "main" +# Default is 'deb'. +PROJECT_DEB_PATH = 'deb' -# PROJECT_REPREPRO_COMPONENT -# The component used by .deb's Reprepro for publishing any detected .deb package -# file. In any case, the value **MUST** match any one of the 'Component:' field -# understood by the reprepro. +# PROJECT_DEB_PATH_DATA +# The deb repository noDB database directory. This houses all the packages data +# for recursive compilations. When set, the pathing is strictly relative to +# '${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/data/deb' directory. # -# This is mainly used to group the packages by categories (e.g. 'firmware', -# 'gui', 'models', etc). +# Leaving it empty shall use a disposable database directory located in: +# '${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/releaser-deb-repoDB' pathing. # -# When in doubt or unused, set the value matching PROJECT_DEBIAN_DISTRIBUTION. -PROJECT_REPREPRO_COMPONENT = "stable" +# Default is 'repoDB' ('${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/data/deb/repoDB') +PROJECT_DEB_PATH_DATA = 'repoDB' -# PROJECT_REPREPRO_ARCH -# The list of accepted reprepro architecture used by .deb's Reprepro for -# gatekeeping a given .deb package. It accepts a list of values separated by -# space (' ') based on dpkg supported architectures. The command: -# "$ dpkg-architecture --list-known" -# will print out a list of supported architectures' value based on the host -# syste. + + +########################## +# DISTRIBUTION - DOCS # +########################## +# PROJECT_DOCS_URL +# The base URL for viewing the published documentation (e.g. website address). +# It is made available in-case of publication needs. # -# When left empty, AutomataCI shall generate a full list of arch-only hard-coded -# arch values. -PROJECT_REPREPRO_ARCH = "" +# This field also acts as the flag for enabling or disabling the documentation +# pipeline. +# +# To enable : fill in the end-user downloadable URL without ending slash. +# To disable: leave this field empty (''). +# +# !! IMPORTANT !! - Please avoid ending with the URL slash. +PROJECT_DOCS_URL = 'https://github.io/ChewKeanHo/AutomataCI' -# PROJECT_STATIC_REPO -# The git repository for publishing all the packages using static file sharing -# (e.g. .deb repo, .rpm repo, flatpak repo, etc). This URL shall be git cloned -# as the PROJECT_PATH_RELEASE directory. -PROJECT_STATIC_REPO = "git@github.com:ChewKeanHo/AutomataCI.wiki.git" +# PROJECT_DOCS_REPO +# The git repository for publishing all the docs web artifacts using a static +# file sharing service (e.g NGINX file hosting, GitHub/GitLab Pages, etc). +# This repository URL shall be git clone into +# '$PROJECT_PATH_ROOT/$PROJECT_PATH_RELEASE' directory internally named as +# 'x_docsrepo'. +# +# Note that regardless of PROJECT_RELEASE_REPO is set or otherwise, this repo +# shall be deleted automatically at the end of its operation, successful or +# otherwise to prevent output distortion. +PROJECT_DOCS_REPO = 'git@github.com:ChewKeanHo/AutomataCI.git' -# PROJECT_STATIC_REPO_KEY -# The git upstream key. Default is 'origin'. -PROJECT_STATIC_REPO_KEY = "origin" +# PROJECT_DOCS_REPO_KEY +# The git upstream key. Value CANNOT be empty. +# +# Default is 'origin'. +PROJECT_DOCS_REPO_KEY = 'origin' -# PROJECT_STATIC_REPO_BRANCH -# The git upstream branch. Default is 'master' or 'main'. -PROJECT_STATIC_REPO_BRANCH = "master" +# PROJECT_DOCS_REPO_BRANCH +# The git upstream branch. Value CANNOT be empty. +# +# For Website service provider using git version control system such as but not +# limited to GitHub/GitLab Pages, it is always advisable to implement 'gh-pages' +# (default settings) instead of other means. Otherwise, if the repository is +# a standalone one (e.g. [USERNAME].github.io repository as root profile) +# website, then standard branch name is used. +# +# Default is 'gh-pages'. +PROJECT_DOCS_REPO_BRANCH = 'gh-pages' -# PROJECT_STATIC_REPO_DIRECTORY -# The directory name housing the static repo. Value CANNOT be empty. -# Default is 'static'. -PROJECT_STATIC_REPO_DIRECTORY = "static" -# PROJECT_SIMULATE_RELEASE_REPO -# A flag to disable PROJECT_STATIC_REPO supplied from an external automated -# ecosystem to construct a simulated blank repository instead of sourcing. This -# is made primarily created for situation where release repository has complex -# security access or the ecosystem is not using Release Job at all (e.g. GitHub -# Actions). +########################## +# DISTRIBUTION - FLATPAK # +########################## +# PROJECT_FLATPAK_URL +# The base URL for Flatpak to download its associated .flatpak package payload. +# This variable is also acting as a switch to enable/disable Flatpak +# distribution pipeline. +# +# AutomataCI will always compile "Single File Bundles" distribution channel by +# default. Should PROJECT_FLATPAK_REPO is set, then AutomataCI shall also +# compile and update the "Repository" distribution channel. More info: +# 1. https://docs.flatpak.org/en/latest/repositories.html +# +# In the event where "Repository" distribution channel is set +# (PROJECT_FLATPAK_REPO), then the URL shall be pointing to the repository URL +# instead of the "Single File Bundles" downlodable portal version. The value +# shall be used for creating .flakpakrepo and .flatpakref files respectively. +# +# Some examples are: +# (1) GitHub Release (Single Bundle channel only): +# value: 'https://github.com/[USERNAME]/[PROJECT]/releases/latest/download' +# actual URL: 'https://github.com/[USERNAME]/[PROJECT]/releases/latest/download/[FILE]' +# +# (2) GitHub Pages (Single Bundle channel + Repository): +# value: 'https://[USERNAME]github.io/flatpak/[PROJECT].flatpakrepo' +# actual URL: 'https://[USERNAME]github.io/flatpak/[PROJECT].flatpakrepo' +# +# (3) Other static file hosting services (Single Bundle channel + Repository): +# value: 'https://www.example.com/flatpak/[PROJECT].flatpakrepo' +# actual URL: 'https://www.example.com/flatpak/[PROJECT].flatpakrepo' +# +# This field also acts as the flag for enabling or disabling the flatpak +# pipeline. # -# PROJECT_SIMULATE_RELEASE_REPO = "" # Reserved - provided externally. +# To enable it: set the URL without the ending slash. +# To disable it: set it empty. +# +# !! IMPORTANT !! - Please avoid ending with the URL slash. +PROJECT_FLATPAK_URL = 'https://github.com/ChewKeanHo/AutomataCI/releases/latest/download' -# PROJECT_ROBOT_RUN -# A flag to indicate the run is operating inside a CI service by its -# autonomous robot. +# PROJECT_FLATPAK_REPO +# The Flatpak publication git repository for updating and publishing +# Flatpak packages repository. AutomataCI will always use the temporary +# directory for all flatpak packaging operations at: +# $PROJECT_PATH_ROOT/$PROJECT_PATH_TEMP/flatpak-repo +# until it is being moved to the release job when set. # -# PROJECT_ROBOT_RUN = "" # Reserved - provided externally. +# This field also acts as a flag for enabling "Repository" distribution channel +# when PROJECT_FLATPAK_URL is set. +# +# To enable it: set the URL without the ending slash. +# To disable it: set it empty. +# +# In the event where PROJECT_RELEASE_REPO is set, this repo shall be ignored. +# However, to maintain enabling the "Repository" distribution channel packaging +# decision, this field shall have the same value as PROJECT_RELEASE_REPO. +PROJECT_FLATPAK_REPO = 'git@github.com:ChewKeanHo/AutomataCI.wiki.git' -# PROJECT_STATIC_URL -# The public facing base URL for accessing the published static repo. This URL -# shall be used to construct the final user instructions across various -# distribution ecosystems. -PROJECT_STATIC_URL = "https://github.com/ChewKeanHo/AutomataCI/wiki/" +# PROJECT_FLATPAK_PATH +# The relative pathing for organizing within the flatpak repository directory. +# when "Repository" distribution channel is set. +# The path is always relative to +# '${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}/flatpak' directory which is the +# PROJECT_FLATPAK_REPO debian repository. This is useful for cases where +# specific directory is required (e.g. 'GitHub Pages using "docs/" directory +# for publications). +# +# If left empty, AutomataCI shall use 'flatpak' as its value. +# +# Default is 'flatpak'. +PROJECT_FLATPAK_PATH = 'flatpak' -# PROJECT_CONTAINER_REGISTRY -# The container registry URI value. DO NOT end with a slash. Example: -# 1. DockerHub : registry.hub.docker.com/[ NAMESPACE ] -# 2. GitHub Package: ghcr.io/[ NAMESPACE ] -# 2. Local : localhost:5000/[ NAMESPACE ] -PROJECT_CONTAINER_REGISTRY = "ghcr.io/chewkeanho" +# PROJECT_FLATPAK_REPO_KEY +# The git upstream key. Value CANNOT be empty. +# +# Default is 'origin'. +PROJECT_FLATPAK_REPO_KEY = 'origin' -# DOCKER_CLI_EXPERIMENTAL -# Enable the Docker's experimental CLI features for using buildx. If disabled, -# is shall break many of the CI job. -DOCKER_CLI_EXPERIMENTAL = "enabled" +# PROJECT_FLATPAK_REPO_BRANCH +# The git upstream branch. Value CANNOT be empty. +# +# Default is 'main' or 'master'. +PROJECT_FLATPAK_REPO_BRANCH = 'master' -# PROJECT_HOMEBREW_REPO -# The Homebrew formula publication git repository for updating and publishing -# Homebrew's formula. This is used in release job. -PROJECT_HOMEBREW_REPO = "git@github.com:ChewKeanHo/Testbed.git" +# PROJECT_FLATPAK_RUNTIME +# The runtime module where the Flatpak is operating on. +PROJECT_FLATPAK_RUNTIME = 'org.freedesktop.Platform' -# PROJECT_HOMEBREW_REPO_KEY -# The git upstream key. Default is 'origin'. -PROJECT_HOMEBREW_REPO_KEY = "origin" +# PROJECT_FLATPAK_RUNTIME_VERSION +# The runtime module where the Flatpak is operating on. +PROJECT_FLATPAK_RUNTIME_VERSION = '22.08' -# PROJECT_HOMEBREW_REPO_BRANCH -# The git upstream branch. Default is 'main' or 'master'. -PROJECT_HOMEBREW_REPO_BRANCH = "main" +# PROJECT_FLATPAK_SDK +# The runtime module where the Flatpak is operating on. +PROJECT_FLATPAK_SDK = 'org.freedesktop.Sdk' -# PROJECT_HOMEBREW_DIRECTORY -# The directory name housing the Homebrew repo. Value CANNOT be empty. -# Default is 'homebrew'. -PROJECT_HOMEBREW_DIRECTORY = "homebrew" -# PROJECT_HOMEBREW_SOURCE_URL -# The base URL for Homebrew to source its tar.*z archive file. It is made -# available for maintaining consistency purposes and is only meant for Homebrew -# use for constructing the 'url' value. +########################### +# DISTRIBUTION - HOMEBREW # +########################### +# PROJECT_HOMEBREW_URL +# The base URL for Homebrew formula to download its associated tar.*z archive +# payload. This variable is also acting as a switch to enable/disable Homebrew +# distribution pipeline. +# +# Some examples are: +# (1) GitHub Release: +# value: 'https://github.com/[USERNAME]/[PROJECT]/releases/latest/download' +# actual URL: 'https://github.com/[USERNAME]/[PROJECT]/releases/latest/download/[FILE]' # -# NOTE: Please avoid ending with the URL slash. -PROJECT_HOMEBREW_SOURCE_URL = "https://github.com/ChewKeanHo/AutomataCI/releases/download" +# This field also acts as the flag for enabling or disabling the homebrew +# pipeline. +# +# To enable it: set the URL without the ending slash. +# To disable it: set it empty. +# +# !! IMPORTANT !! - Please avoid ending with the URL slash. +PROJECT_HOMEBREW_URL = 'https://github.com/ChewKeanHo/AutomataCI/releases/latest/download' -# PROJECT_CHOCOLATEY_REPO -# The Chocolatey package publication git repository for updating and publishing -# Chocolatey's usable nupkg packages. This is used in release job. -PROJECT_CHOCOLATEY_REPO = "git@github.com:ChewKeanHo/Testbed.git" +# PROJECT_HOMEBREW_REPO +# The Homebrew formula publication git repository for updating and publishing +# Homebrew's formula. This repository is ENTIRELY DIFFERENT from your project +# version (as in a tap repo: '$ brew tap [username]/[collections] [URL]'). +# More info: +# 1. https://docs.brew.sh/Taps +# +# Value CANNOT BE EMPTY. When in doubt, you can create a publishing +# 'Collections' git repository which is great for branding. For example: +# 1. (Holloway) Chew, Kean Ho: 'git@github.com:ChewKeanHo/Collections.git' +# +# Note that regardless of PROJECT_RELEASE_REPO is set or otherwise, this repo +# shall be deleted automatically at the end of its operation, successful or +# otherwise to prevent output distortion. +PROJECT_HOMEBREW_REPO = 'git@github.com:ChewKeanHo/Collections.git' -# PROJECT_CHOCOLATEY_REPO_KEY -# The git upstream key. Default is 'origin'. -PROJECT_CHOCOLATEY_REPO_KEY = "origin" +# PROJECT_HOMEBREW_REPO_KEY +# The git upstream key. Value CANNOT be empty. +# +# Default is 'origin'. +PROJECT_HOMEBREW_REPO_KEY = 'origin' -# PROJECT_CHOCOLATEY_REPO_BRANCH -# The git upstream branch. Default is 'main' or 'master'. -PROJECT_CHOCOLATEY_REPO_BRANCH = "main" +# PROJECT_HOMEBREW_REPO_BRANCH +# The git upstream branch. Value CANNOT be empty. +# +# Default is 'main' or 'master'. +PROJECT_HOMEBREW_REPO_BRANCH = 'main' -# PROJECT_CHOCOLATEY_DIRECTORY -# The directory name housing the Chocolatey repo. Value CANNOT be empty. -# Default is 'chocolatey'. -PROJECT_CHOCOLATEY_DIRECTORY = "chocolatey" -# PROJECT_CHOCOLATEY_SOURCE_URL -# The base URL for Chocolatey to source its .nupkg packages. It is made -# available for maintaining consistency purposes and is only meant for -# Chocolatey use for constructing the 'url' value. +########################## +# DISTRIBUTION - RPM # +########################## +# PROJECT_RPM_URL +# The .rpm' downloadable yum URL used for generating .repo source file inside +# /etc/yum.repos.d directory. More info: +# (1) https://developers.redhat.com/articles/2022/10/07/whats-inside-rpm-repo-file +# +# Some examples: +# (1) GitHub Release: +# value: 'https://github.com/[USERNAME]/[PROJECT]/releases/latest/download' +# actual URL: 'https://github.com/[USERNAME]/[PROJECT]/releases/latest/download/[FILE]' +# +# This field also acts as the flag for enabling or disabling the rpm pipeline. # -# NOTE: Please avoid ending with the URL slash. -PROJECT_CHOCOLATEY_SOURCE_URL = "https://github.com/ChewKeanHo/AutomataCI/releases/download" +# To enable : fill in the end-user downloadable URL without ending slash. +# To disable: leave this field empty (''). +# +# !! IMPORTANT !! - Please avoid ending with the URL slash. +PROJECT_RPM_URL = 'https://github.com/ChewKeanHo/AutomataCI/releases/latest/download' -# PROJECT_DOCS_REPO -# The git repository for publishing all the docs web artifacts. This URL shall -# be git cloned into the PROJECT_PATH_RELEASE directory. -PROJECT_DOCS_REPO = "git@github.com:ChewKeanHo/AutomataCI.git" +# PROJECT_RPM_FLAT_MODE +# The flag to create a flat .rpm repository directory rather than using the +# conventional mode with repodata/ sub-directory. This is especially useful +# for filesystem without sub-directories such as but not limited to +# GitHub/GitLab Release page. +# +# To enable : leave the non-empty (e.g. 'enabled') +# To disable: leave it empty ('') +PROJECT_RPM_FLAT_MODE = 'enabled' -# PROJECT_DOCS_REPO_KEY -# The git upstream key. Default is 'origin'. -PROJECT_DOCS_REPO_KEY = "origin" +# PROJECT_RPM_REPOXML_NAME +# The filename of the repomd.xml file after the directory is flattened. This +# field SHALL NOT be left empty or it will cause catastrophic, irreversible +# effect to the release repo. +# +# Default is: 'repomd.xml' +PROJECT_RPM_REPOXML_NAME = 'repomd.xml' -# PROJECT_DOCS_REPO_BRANCH -# The git upstream branch. Default is 'gh-pages'. -PROJECT_DOCS_REPO_BRANCH = "gh-pages" +# PROJECT_RPM_METALINK +# The filename of the METALINK file after the directory is flattened. This +# field SHALL NOT be left empty or it will cause catastrophic, irreversible +# effect to the release repo. +# +# Default is: 'METALINK_RPM' +PROJECT_RPM_METALINK = 'METALINK_RPM' -# PROJECT_DOCS_REPO_DIRECTORY -# The directory name housing the docs repo. Value CANNOT be empty. -# Default is 'docs'. -PROJECT_DOCS_REPO_DIRECTORY = "docs" +# PROJECT_RPM_IS_NATIVE +# Flag to determine the project is Red Hat natively sponsored package. Usually +# is false. +# +# Only accept: "true/false" +# +# Default is 'false'. +PROJECT_RPM_IS_NATIVE = 'false' -# PROJECT_DOCS_SOURCE_URL -# The base URL for viewing the published documentation (e.g. website address). -# It is made available in-case of publication needs. +# PROJECT_RPM_REPO +# The git repository for publishing all .rpm packages using a static file +# sharing service (e.g NGINX file hosting, GitHub/GitLab Pages, etc). When .rpm +# is operating in the conventional mode, this repository URL shall be git clone +# into '$PROJECT_PATH_ROOT/$PROJECT_PATH_RELEASE' directory named as 'rpm'. # -# NOTE: Please avoid ending with the URL slash. -PROJECT_DOCS_SOURCE_URL = "https://github.io/ChewKeanHo/AutomataCI" +# If PROJECT_RPM_REPO_TYPE is not set to git type, then this variable shall be +# ignored. +# +# Note that if PROJECT_RELEASE_REPO is set, this field is ignored regardless of +# its value. +PROJECT_RPM_REPO = 'git@github.com:ChewKeanHo/AutomataCI.wiki.git' + + +# PROJECT_RPM_REPO_KEY +# The git upstream key. Value CANNOT be empty. +# +# Default is 'origin'. +PROJECT_DEB_REPO_KEY = 'origin' + + +# PROJECT_RPM_REPO_BRANCH +# The git upstream branch. Value CANNOT be empty. +# +# Default is 'master' or 'main'. +PROJECT_RPM_REPO_BRANCH = 'master' + + +# PROJECT_RPM_PATH +# The relative pathing for organizing within the rpm repository directory. +# The path is always relative to +# '${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}/rpm' directory which is the +# PROJECT_RPM_REPO rpm repository. This is useful for cases where specific +# directory is required (e.g. 'GitHub Pages using "docs/" directory for +# publications). +# +# If left empty, AutomataCI shall use 'rpm' as its value. +# +# Default is 'rpm'. +PROJECT_RPM_PATH = 'rpm' @@ -1029,79 +1501,79 @@ PROJECT_DOCS_SOURCE_URL = "https://github.io/ChewKeanHo/AutomataCI" # # WARNING: DO NOT attempt to change/override this naming convention. It will # break AutomataCI. -# PROJECT_PATH_AUTOMATA = "automataCI" # Reserved - determined by ci.cmd automatically. +# PROJECT_PATH_AUTOMATA = 'automataCI' # Reserved - determined by ci.cmd automatically. # LIBS_AUTOMATACI # This is the reserved pathing containing: # ${PROJECT_PATH_ROOT}/${PROJECT_PATH_AUTOMATA} # for easy service libraries import. -# WARNING: DO NOT attempt to change/override this naming convention. It will -# break AutomataCI. +# !! WARNING !! DO NOT attempt to change/override this naming convention. It +# will break AutomataCI. # PROJECT_PATH_SOURCE # This is the relative pathing to PROJECT_PATH_ROOT where it locates the # baseline source directory independent of technological section and acts as an # overall controls. -PROJECT_PATH_SOURCE = "src" +PROJECT_PATH_SOURCE = 'src' # PROJECT_PATH_TOOLS # This is the relative pathing to PROJECT_PATH_ROOT where it locates the # project's tooling directory like programming languages' engine or executables. -PROJECT_PATH_TOOLS = "tools" +PROJECT_PATH_TOOLS = 'tools' # PROJECT_PATH_BUILD # This is the relative pathing to PROJECT_PATH_ROOT where it locates the # project's build output directory. -PROJECT_PATH_BUILD = "build" +PROJECT_PATH_BUILD = 'build' # PROJECT_PATH_BIN # This is the relative pathing to PROJECT_PATH_ROOT where it locates the # project's shippable executable binraries. -PROJECT_PATH_BIN = "bin" +PROJECT_PATH_BIN = 'bin' # PROJECT_PATH_LIB # This is the relative pathing to PROJECT_PATH_ROOT where it locates the # project's shippable importable libraries. -PROJECT_PATH_LIB = "lib" +PROJECT_PATH_LIB = 'lib' # PROJECT_PATH_TEMP # This is the relative pathing to PROJECT_PATH_ROOT where it locates the # project's temporary workspace directory. -PROJECT_PATH_TEMP = "tmp" +PROJECT_PATH_TEMP = 'tmp' # PROJECT_PATH_LOG # This is the relative pathing to PROJECT_PATH_ROOT where it locates the # project's log output directory. -PROJECT_PATH_LOG = "log" +PROJECT_PATH_LOG = 'log' # PROJECT_PATH_CI # This is the relative pathing to PROJECT_PATH_ROOT + PROJECT_PATH_SOURCE where # it locates the project's tech-specific CI job directory. -PROJECT_PATH_CI = ".ci" +PROJECT_PATH_CI = '.ci' # PROJECT_PATH_PKG # This is the relative pathing to PROJECT_PATH_ROOT where it locates the # project's releasable packages output directory. -PROJECT_PATH_PKG = "pkg" +PROJECT_PATH_PKG = 'pkg' # PROJECT_PATH_RELEASE # This is the relative pathing to PROJECT_PATH_ROOT where it locates the # project's publication output directory. -PROJECT_PATH_RELEASE = "releases" +PROJECT_PATH_RELEASE = 'releases' # PROJECT_PATH_DOCS # This is the relative pathing to PROJECT_PATH_ROOT where it locates the # project's documentation directory. -PROJECT_PATH_DOCS = "public" +PROJECT_PATH_DOCS = 'public' diff --git a/LICENSE.pdf b/LICENSE.pdf new file mode 100644 index 0000000000000000000000000000000000000000..4be6683f10f7ebcb6057eaf470c9b797bd20b758 GIT binary patch literal 49470 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 -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -. "${LIBS_AUTOMATACI}/services/io/os.sh" -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run me from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - - - - -PACKAGE_Run_NPM() { - #__line="$1" - - - # parse input - __line="$1" - - _dest="${__line%%|*}" - __line="${__line#*|}" - - _target="${__line%%|*}" - __line="${__line#*|}" - - _target_filename="${__line%%|*}" - __line="${__line#*|}" - - _target_os="${__line%%|*}" - __line="${__line#*|}" - - _target_arch="${__line%%|*}" - __line="${__line#*|}" - - - # copy all complimentary files to the workspace - cmd="PACKAGE_Assemble_NPM_Content" - I18N_Check_Function "$cmd" - OS_Is_Command_Available "$cmd" - if [ $? -ne 0 ]; then - I18N_Check_Failed - return 1 - fi - - I18N_Assemble_Package - "$cmd" "$_target" "$_dest" "$_target_filename" "$_target_os" "$_target_arch" - case $? in - 10) - I18N_Assemble_Skipped - return 0 - ;; - 0) - # accepted - ;; - *) - I18N_Assemble_Failed - return 1 - ;; - esac - - - # report status - return 0 -} diff --git a/automataCI/_package-npm_windows-any.ps1 b/automataCI/_package-npm_windows-any.ps1 deleted file mode 100644 index 8a84999c..00000000 --- a/automataCI/_package-npm_windows-any.ps1 +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright 2024 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -. "${env:LIBS_AUTOMATACI}\services\io\os.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - return -} - - - - -function PACKAGE-Run-NPM { - param ( - [string]$__line - ) - - - # parse input - $__list = $__line -split "\|" - $_dest = $__list[0] - $_target = $__list[1] - $_target_filename = $__list[2] - $_target_os = $__list[3] - $_target_arch = $__list[4] - - - # copy all complimentary files to the workspace - $cmd = "PACKAGE-Assemble-NPM-Content" - $null = I18N-Check-Function "$cmd" - $___process = OS-Is-Command-Available "$cmd" - if ($___process -ne 0) { - $null = I18N-Check-Failed - return 1 - } - - $null = I18N-Assemble-Package - $___process = PACKAGE-Assemble-NPM-Content ` - "${_target}" ` - "${_dest}" ` - "${_target_filename}" ` - "${_target_os}" ` - "${_target_arch}" - switch ($___process) { - 10 { - $null = I18N-Assemble-Skipped - return 0 - } 0 { - # accepted - } Default { - $null = I18N-Assemble-Failed - return 1 - }} - - - # report status - return 0 -} diff --git a/automataCI/_package-pdf_windows-any.ps1 b/automataCI/_package-pdf_windows-any.ps1 index bd94f190..fd78da09 100644 --- a/automataCI/_package-pdf_windows-any.ps1 +++ b/automataCI/_package-pdf_windows-any.ps1 @@ -18,7 +18,7 @@ # initialize if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!`n" + Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" return } diff --git a/automataCI/_package-pypi_unix-any.sh b/automataCI/_package-pypi_unix-any.sh index 6f89f8ff..7399772a 100644 --- a/automataCI/_package-pypi_unix-any.sh +++ b/automataCI/_package-pypi_unix-any.sh @@ -80,7 +80,7 @@ PACKAGE_Run_PYPI() { I18N_Create "PYPI" _src="${_target_filename}_${PROJECT_VERSION}_${_target_os}-${_target_arch}" _target_path="${_dest}/pypi_${_src}" - _src="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/pypi_${_src}" + _src="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/packagers-pypi-${_src}" I18N_Remake "$_src" FS_Remake_Directory "$_src" if [ $? -ne 0 ]; then diff --git a/automataCI/_package-pypi_windows-any.ps1 b/automataCI/_package-pypi_windows-any.ps1 index 200e835a..62ee7b59 100644 --- a/automataCI/_package-pypi_windows-any.ps1 +++ b/automataCI/_package-pypi_windows-any.ps1 @@ -70,7 +70,7 @@ function PACKAGE-Run-PYPI { $null = I18N-Create "PYPI" $_src = "${_target_filename}_${env:PROJECT_VERSION}_${_target_os}-${_target_arch}" $_target_path = "${_dest}\pypi_${_src}" - $_src = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\pypi_${_src}" + $_src = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\packagers-pypi-${_src}" $null = I18N-Remake "${_src}" $___process = FS-Remake-Directory "${_src}" if ($___process -ne 0) { diff --git a/automataCI/_package-rpm_unix-any.sh b/automataCI/_package-rpm_unix-any.sh index cdf8b6f3..c5b4a596 100644 --- a/automataCI/_package-rpm_unix-any.sh +++ b/automataCI/_package-rpm_unix-any.sh @@ -69,7 +69,7 @@ PACKAGE_Run_RPM() { ;; esac - I18N_Check_Availability "MANUAL DOCS" + I18N_Check_Availability "MANUAL" MANUAL_Is_Available if [ $? -ne 0 ]; then I18N_Check_Failed @@ -80,7 +80,7 @@ PACKAGE_Run_RPM() { # prepare workspace and required values I18N_Create_Package "RPM" _src="${_target_filename}_${_target_os}-${_target_arch}" - _src="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/rpm_${_src}" + _src="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/packagers-rpm-${_src}" I18N_Remake "$_src" FS_Remake_Directory "$_src" if [ $? -ne 0 ]; then diff --git a/automataCI/_package-rpm_windows-any.ps1 b/automataCI/_package-rpm_windows-any.ps1 index fd39f62e..f531a296 100644 --- a/automataCI/_package-rpm_windows-any.ps1 +++ b/automataCI/_package-rpm_windows-any.ps1 @@ -57,10 +57,10 @@ function PACKAGE-Run-RPM { return 0 }} - $null = I18N-Check-Availability "MANUAL DOCS" + $null = I18N-Check-Availability "MANUAL" $___process = MANUAL-Is-Available if ($___process -ne 0) { - $null = I18N-Check-Failed "MANUAL DOCS" + $null = I18N-Check-Failed "MANUAL" return 1 } @@ -68,7 +68,7 @@ function PACKAGE-Run-RPM { # prepare workspace and required values $null = I18N-Create-Package "RPM" $_src = "${_target_filename}_${_target_os}-${_target_arch}" - $_src = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\rpm_${_src}" + $_src = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\packagers-rpm-${_src}" $null = I18N-Remake "${_src}" $___process = FS-Remake-Directory "${_src}" if ($___process -ne 0) { diff --git a/automataCI/_release-changelog_unix-any.sh b/automataCI/_release-changelog_unix-any.sh index fa282890..dfe08796 100644 --- a/automataCI/_release-changelog_unix-any.sh +++ b/automataCI/_release-changelog_unix-any.sh @@ -10,6 +10,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations under # the License. +. "${LIBS_AUTOMATACI}/services/io/os.sh" . "${LIBS_AUTOMATACI}/services/i18n/translations.sh" . "${LIBS_AUTOMATACI}/services/compilers/changelog.sh" @@ -27,13 +28,18 @@ fi RELEASE_Conclude_CHANGELOG() { # execute - I18N_Export "${PROJECT_VERSION} CHANGELOG" - CHANGELOG_Seal \ - "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/changelog" \ - "$PROJECT_VERSION" - if [ $? -ne 0 ]; then - I18N_Export_Failed - return 1 + I18N_Conclude "${PROJECT_VERSION} CHANGELOG" + if [ $(OS_Is_Run_Simulated) -ne 0 ]; then + CHANGELOG_Seal \ + "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/changelog" \ + "$PROJECT_VERSION" + if [ $? -ne 0 ]; then + I18N_Conclude_Failed + return 1 + fi + else + # always simulate in case of error or mishaps before any point of no return + I18N_Simulate_Conclude "${PROJECT_VERSION} CHANGELOG" fi diff --git a/automataCI/_release-changelog_windows-any.ps1 b/automataCI/_release-changelog_windows-any.ps1 index 7aa330ef..5d6d76eb 100644 --- a/automataCI/_release-changelog_windows-any.ps1 +++ b/automataCI/_release-changelog_windows-any.ps1 @@ -9,6 +9,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +. "${env:LIBS_AUTOMATACI}\services\io\os.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" . "${env:LIBS_AUTOMATACI}\services\compilers\changelog.ps1" @@ -26,16 +27,21 @@ if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { function RELEASE-Conclude-CHANGELOG { # execute - $null = I18N-Export "${env:PROJECT_VERSION} CHANGELOG" - $___process = CHANGELOG-Seal ` - "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\changelog" ` - "${env:PROJECT_VERSION}" - if ($___process -ne 0) { - $null = I18N-Export-Failed - return 1 + $null = I18N-Conclude "${env:PROJECT_VERSION} CHANGELOG" + if ($(OS-Is-Run-Simulated) -ne 0) { + $___process = CHANGELOG-Seal ` + "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\changelog" ` + "${env:PROJECT_VERSION}" + if ($___process -ne 0) { + $null = I18N-Conclude-Failed + return 1 + } + } else { + # always simulate in case of error or mishaps before any point of no return + $null = I18N-Simulate-Conclude "${env:PROJECT_VERSION} CHANGELOG" } - # report status + # return status return 0 } diff --git a/automataCI/_release-checksum_unix-any.sh b/automataCI/_release-checksum_unix-any.sh index 799db642..22291274 100644 --- a/automataCI/_release-checksum_unix-any.sh +++ b/automataCI/_release-checksum_unix-any.sh @@ -10,8 +10,9 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations under # the License. -. "${LIBS_AUTOMATACI}/services/io/fs.sh" . "${LIBS_AUTOMATACI}/services/io/os.sh" +. "${LIBS_AUTOMATACI}/services/io/fs.sh" +. "${LIBS_AUTOMATACI}/services/io/strings.sh" . "${LIBS_AUTOMATACI}/services/i18n/translations.sh" . "${LIBS_AUTOMATACI}/services/crypto/gpg.sh" . "${LIBS_AUTOMATACI}/services/checksum/shasum.sh" @@ -28,23 +29,23 @@ fi -RELEASE_Run_CHECKSUM() { - #__static_repo="$1" +RELEASE_Conclude_CHECKSUM() { + #__repo_directory="$1" # execute - __sha256_file="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/sha256.txt" + __sha256_file="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/releaser-sha256.txt" FS_Remove_Silently "$__sha256_file" + __sha512_file="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/releaser-sha512.txt" + FS_Remove_Silently "$__sha512_file" + __sha256_target="${PROJECT_SKU}-sha256_${PROJECT_VERSION}.txt" - __sha256_target="${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}/${__sha256_target}" + __sha256_target="${1}/${__sha256_target}" FS_Remove_Silently "$__sha256_target" - __sha512_file="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/sha512.txt" - FS_Remove_Silently "$__sha512_file" - __sha512_target="${PROJECT_SKU}-sha512_${PROJECT_VERSION}.txt" - __sha512_target="${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}/${__sha512_target}" + __sha512_target="${1}/${__sha512_target}" FS_Remove_Silently "$__sha512_target" @@ -52,31 +53,38 @@ RELEASE_Run_CHECKSUM() { GPG_Is_Available "$PROJECT_GPG_ID" if [ $? -eq 0 ]; then __keyfile="${PROJECT_SKU}-gpg_${PROJECT_VERSION}.keyfile" - I18N_Export "$__keyfile" - __keyfile="${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}/${__keyfile}" - FS_Remove_Silently "${__keyfile}" - - GPG_Export_Public_Key "$__keyfile" "$PROJECT_GPG_ID" - if [ $? -ne 0 ]; then - I18N_Export_Failed - return 1 - fi + __keyfile="${1}/${__keyfile}" - FS_Copy_File "$__keyfile" "${1}/${__keyfile##*/}" - if [ $? -ne 0 ]; then - I18N_Export_Failed - return 1 + I18N_Publish "$__keyfile" + FS_Remove_Silently "$__keyfile" + if [ $(OS_Is_Run_Simulated) -ne 0 ]; then + GPG_Export_Public_Key "$__keyfile" "$PROJECT_GPG_ID" + if [ $? -ne 0 ]; then + I18N_Publish_Failed + return 1 + fi + else + I18N_Simulate_Publish "$__keyfile" fi # gpg sign all packages - for TARGET in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}"/*; do - if [ ! "${TARGET%%.asc*}" = "${TARGET}" ]; then + for TARGET in "$1"/*; do + if [ ! "${TARGET%%.asc*}" = "$TARGET" ]; then continue # it's a gpg cert fi + if [ ! "${TARGET%%.gpg*}" = "$TARGET" ]; then + continue # it's a gpg keyfile or cert + fi + I18N_Sign "$TARGET" "GPG" + if [ $(OS_Is_Run_Simulated) -eq 0 ]; then + I18N_Simulate_Notarize "$TARGET" + continue + fi + FS_Remove_Silently "${TARGET}.asc" - GPG_Detach_Sign_File "$TARGET" "$PROJECT_GPG_ID" + GPG_Detach_Sign_File "${TARGET}.asc" "$TARGET" "$PROJECT_GPG_ID" if [ $? -ne 0 ]; then I18N_Sign_Failed return 1 @@ -86,7 +94,7 @@ RELEASE_Run_CHECKSUM() { # shasum all files - for TARGET in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}"/*; do + for TARGET in "$1"/*; do FS_Is_Directory "$TARGET" if [ $? -eq 0 ]; then I18N_Is_Directory_Skipped "$TARGET" @@ -101,9 +109,9 @@ RELEASE_Run_CHECKSUM() { return 1 fi - FS_Append_File "${__sha256_file}" "\ -${__value} ${TARGET##*/} -" + FS_Append_File \ + "$__sha256_file" \ + "${__value} $(FS_Get_File "$TARGET")\n" if [ $? -ne 0 ]; then I18N_Checksum_Failed return 1 @@ -114,14 +122,14 @@ ${__value} ${TARGET##*/} if [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_SHA512") -ne 0 ]; then I18N_Checksum "$TARGET" "SHA512" __value="$(SHASUM_Create_From_File "$TARGET" "512")" - if [ $(STRINGS_Is_Empty "${__value}") -eq 0 ]; then + if [ $(STRINGS_Is_Empty "$__value") -eq 0 ]; then I18N_Checksum_Failed return 1 fi - FS_Append_File "${__sha512_file}" "\ -${__value} ${TARGET##*/} -" + FS_Append_File \ + "$__sha512_file" \ + "${__value} $(FS_Get_File "$TARGET")\n" if [ $? -ne 0 ]; then I18N_Checksum_Failed return 1 @@ -132,10 +140,10 @@ ${__value} ${TARGET##*/} FS_Is_File "$__sha256_file" if [ $? -eq 0 ]; then - I18N_Export "$__sha256_target" - FS_Move "${__sha256_file}" "$__sha256_target" + I18N_Conclude "$__sha256_target" + FS_Move "$__sha256_file" "$__sha256_target" if [ $? -ne 0 ]; then - I18N_Export_Failed + I18N_Conclude_Failed return 1 fi fi @@ -143,10 +151,10 @@ ${__value} ${TARGET##*/} FS_Is_File "$__sha512_file" if [ $? -eq 0 ]; then - I18N_Export "$__sha512_target" - FS_Move "${__sha512_file}" "$__sha512_target" + I18N_Conclude "$__sha512_target" + FS_Move "$__sha512_file" "$__sha512_target" if [ $? -ne 0 ]; then - I18N_Export_Failed + I18N_Conclude_Failed return 1 fi fi diff --git a/automataCI/_release-checksum_windows-any.ps1 b/automataCI/_release-checksum_windows-any.ps1 index dc7c8a0d..74c2feec 100644 --- a/automataCI/_release-checksum_windows-any.ps1 +++ b/automataCI/_release-checksum_windows-any.ps1 @@ -11,6 +11,7 @@ # under the License. . "${env:LIBS_AUTOMATACI}\services\io\os.ps1" . "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" . "${env:LIBS_AUTOMATACI}\services\crypto\gpg.ps1" . "${env:LIBS_AUTOMATACI}\services\checksum\shasum.ps1" @@ -27,25 +28,25 @@ if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { -function RELEASE-Run-CHECKSUM { +function RELEASE-Conclude-CHECKSUM { param ( - [string]$__static_repo + [string]$__repo_directory ) # execute - $__sha256_file = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\sha256.txt" + $__sha256_file = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\releaser-sha256.txt" $null = FS-Remove-Silently "${__sha256_file}" + $__sha512_file = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\releaser-sha512.txt" + $null = FS-Remove-Silently "${__sha512_file}" + $__sha256_target = "${env:PROJECT_SKU}-sha256_${env:PROJECT_VERSION}.txt" - $__sha256_target = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_PKG}\${__sha256_target}" + $__sha256_target = "${__repo_directory}\${__sha256_target}" $null = FS-Remove-Silently "${__sha256_target}" - $__sha512_file = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\sha512.txt" - $null = FS-Remove-Silently "${__sha512_file}" - $__sha512_target = "${env:PROJECT_SKU}-sha512_${env:PROJECT_VERSION}.txt" - $__sha512_target = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_PKG}\${__sha512_target}" + $__sha512_target = "${__repo_directory}\${__sha512_target}" $null = FS-Remove-Silently "${__sha512_target}" @@ -53,33 +54,44 @@ function RELEASE-Run-CHECKSUM { $___process = GPG-Is-Available "${env:PROJECT_GPG_ID}" if ($___process -eq 0) { $__keyfile = "${env:PROJECT_SKU}-gpg_${env:PROJECT_VERSION}.keyfile" - $null = I18N-Export "${__keyfile}" - $__keyfile = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_PKG}\${__keyfile}" - $null = FS-Remove-Silently "${__keyfile}" + $__keyfile = "${__repo_directory}\${__keyfile}" - $___process = GPG-Export-Public-Key "${__keyfile}" "${env:PROJECT_GPG_ID}" - if ($___process -ne 0) { - $null = I18N-Export-Failed - return 1 + $null = I18N-Publish "${__keyfile}" + $null = FS-Remove-Silently "${__keyfile}" + if ($(OS-Is-Run-Simulated) -ne 0) { + $___process = GPG-Export-Public-Key ` + "${__keyfile}" ` + "${env:PROJECT_GPG_ID}" + if ($___process -ne 0) { + $null = I18N-Publish-Failed + return 1 + } + } else { + $null = I18N-Simulate-Publish "${__keyfile}" } - $___process = FS-Copy-File ` - "${__keyfile}" ` - "${__static_repo}\$(Split-Path -Leaf -Path "${__keyfile}")" - if ($___process -ne 0) { - $null = I18N-Export-Failed - return 1 - } + foreach ($TARGET in (Get-ChildItem -Path "${__repo_directory}")) { + $TARGET = $TARGET.FullName - foreach ($TARGET in (Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_PKG}")) { - $TARGET = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_PKG}\${TARGET}" if ($("${TARGET}" -replace '^.*.asc') -ne "${TARGET}") { continue # it's a gpg cert } + if ($("${TARGET}" -replace '^.*.gpg') -ne "${TARGET}") { + continue # it's a gpg keyfile or cert + } + $null = I18N-Sign "${TARGET}" "GPG" + if ($(OS-Is-Run-Simulated) -eq 0) { + $null = I18N-Simulate-Notarize "${TARGET}" + continue + } + FS-Remove-Silently "${TARGET}.asc" - $___process = GPG-Detach-Sign-File "${TARGET}" "${env:PROJECT_GPG_ID}" + $___process = GPG-Detach-Sign-File ` + "${TARGET}.asc" ` + "${TARGET}" ` + "${env:PROJECT_GPG_ID}" if ($___process -ne 0) { $null = I18N-Sign-Failed return 1 @@ -89,7 +101,9 @@ function RELEASE-Run-CHECKSUM { # shasum all files - foreach ($TARGET in (Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_PKG}")) { + foreach ($TARGET in (Get-ChildItem -Path "${__repo_directory}")) { + $TARGET = $TARGET.FullName + $___process = FS-Is-Directory "${TARGET}" if ($___process -eq 0) { $null = I18N-Is-Directory-Skipped "${TARGET}" @@ -97,14 +111,16 @@ function RELEASE-Run-CHECKSUM { } if ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_SHA256}") -ne 0) { - $null = I18N-Checksum "$TARGET" "SHA256" - $__value = SHASUM-Checksum-From-File $TARGET.FullName "256" + $null = I18N-Checksum $TARGET "SHA256" + $__value = SHASUM-Create-From-File $TARGET "256" if ($(STRINGS-Is-Empty "${__value}") -eq 0) { $null = I18N-Checksum-Failed return 1 } - $___process = FS-Append-File "${__sha256_file}" "${__value} $TARGET`n" + $___process = FS-Append-File ` + "${__sha256_file}" ` + "${__value} $(FS-Get-File "$TARGET")`n" if ($___process -ne 0) { $null = I18N-Checksum-Failed return 1 @@ -112,14 +128,16 @@ function RELEASE-Run-CHECKSUM { } if ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_SHA512}") -ne 0) { - $null = I18N-Checksum "$TARGET" "SHA512" - $__value = SHASUM-Checksum-From-File $TARGET.FullName "512" + $null = I18N-Checksum $TARGET "SHA512" + $__value = SHASUM-Create-From-File $TARGET "512" if ($(STRINGS-Is-Empty "${__value}") -eq 0) { $null = I18N-Checksum-Failed return 1 } - $___process = FS-Append-File "${__sha512_file}" "${__value} $TARGET`n" + $___process = FS-Append-File ` + "${__sha512_file}" ` + "${__value} $(FS-Get-File "$TARGET")`n" if ($___process -ne 0) { $null = I18N-Checksum-Failed return 1 @@ -130,10 +148,10 @@ function RELEASE-Run-CHECKSUM { $___process = FS-Is-File "${__sha256_file}" if ($___process -eq 0) { - $null = I18N-Export "${__sha256_target}" + $null = I18N-Conclude "${__sha256_target}" $___process = FS-Move "${__sha256_file}" "${__sha256_target}" if ($___process -ne 0) { - $null = I18N-Export-Failed + $null = I18N-Conclude-Failed return 1 } } @@ -141,10 +159,10 @@ function RELEASE-Run-CHECKSUM { $___process = FS-Is-File "${__sha512_file}" if ($___process -eq 0) { - $null = I18N-Export "${__sha512_target}" + $null = I18N-Conclude "${__sha512_target}" $___process = FS-Move "${__sha512_file}" "${__sha512_target}" if ($___process -ne 0) { - $null = I18N-Export-Failed + $null = I18N-Conclude-Failed return 1 } } @@ -170,7 +188,7 @@ function RELEASE-Initiate-CHECKSUM { if ($(OS-Is-Run-Simulated) -eq 0) { $null = I18N-Simulate-Available "GPG" } else { - $___process = GPG-Is-Available + $___process = GPG-Is-Available "${env:PROJECT_GPG_ID}" if ($___process -ne 0) { $null = I18N-Check-Failed return 1 diff --git a/automataCI/_release-chocolatey_unix-any.sh b/automataCI/_release-chocolatey_unix-any.sh deleted file mode 100644 index b42534ae..00000000 --- a/automataCI/_release-chocolatey_unix-any.sh +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/io/strings.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" -. "${LIBS_AUTOMATACI}/services/versioners/git.sh" -. "${LIBS_AUTOMATACI}/services/publishers/chocolatey.sh" - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run me from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - - - - -RELEASE_Run_CHOCOLATEY() { - #___target="$1" - #___repo="$2" - - - # validate input - CHOCOLATEY_Is_Valid_Nupkg "$1" - if [ $? -ne 0 ]; then - return 0 - fi - - I18N_Export "$1" - if [ $(STRINGS_Is_Empty "$1") -eq 0 ] || [ $(STRINGS_Is_Empty "$2") -eq 0 ]; then - I18N_Export_Failed - return 1 - fi - - - # execute - CHOCOLATEY_Publish "$1" "${2}/${PROJECT_CHOCOLATEY_DIRECTORY}/" - if [ $? -ne 0 ]; then - I18N_Export_Failed - return 1 - fi - - - # report status - return 0 -} - - - - -RELEASE_Conclude_CHOCOLATEY() { - #___directory="$1" - - - # validate input - I18N_Commit "CHOCOLATEY" - if [ $(STRINGS_Is_Empty "$1") -eq 0 ]; then - I18N_Commit_Failed - return 1 - fi - - FS_Is_Directory "$1" - if [ $? -ne 0 ]; then - I18N_Commit_Failed - return 1 - fi - - - # execute - __current_path="$PWD" - cd "$1" - GIT_Autonomous_Commit "${PROJECT_SKU} ${PROJECT_VERSION}" - if [ $? -ne 0 ]; then - cd "$__current_path" && unset __current_path - I18N_Commit_Failed - return 1 - fi - - GIT_Pull_To_Latest - if [ $? -ne 0 ]; then - cd "$__current_path" && unset __current_path - I18N_Commit_Failed - return 1 - fi - - GIT_Push "$PROJECT_CHOCOLATEY_REPO_KEY" "$PROJECT_CHOCOLATEY_REPO_BRANCH" - ___process=$? - cd "$__current_path" && unset __current_path - if [ $___process -ne 0 ]; then - I18N_Commit_Failed - return 1 - fi - - - # report status - return 0 -} - - - - -RELEASE_Setup_CHOCOLATEY() { - # clean up base directory - I18N_Check "CHOCOLATEY" - FS_Is_File "${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}" - if [ $? -eq 0 ]; then - I18N_Check_Failed - return 1 - fi - FS_Make_Directory "${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}" - - - # execute - I18N_Setup "CHOCOLATEY" - GIT_Clone_Repo \ - "$PROJECT_PATH_ROOT" \ - "$PROJECT_PATH_RELEASE" \ - "$PWD" \ - "$PROJECT_CHOCOLATEY_REPO" \ - "$PROJECT_SIMULATE_RELEASE_REPO" \ - "$PROJECT_CHOCOLATEY_DIRECTORY" - if [ $? -ne 0 ]; then - I18N_Setup_Failed - return 1 - fi - - - # report status - return 0 -} diff --git a/automataCI/_release-chocolatey_windows-any.ps1 b/automataCI/_release-chocolatey_windows-any.ps1 deleted file mode 100644 index c35f6c74..00000000 --- a/automataCI/_release-chocolatey_windows-any.ps1 +++ /dev/null @@ -1,155 +0,0 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" -. "${env:LIBS_AUTOMATACI}\services\versioners\git.ps1" -. "${env:LIBS_AUTOMATACI}\services\publishers\chocolatey.ps1" - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - return -} - - - - -function RELEASE-Run-CHOCOLATEY { - param( - [string]$___target, - [string]$___repo - ) - - - # validate input - $___process = CHOCOLATEY-Is-Valid-Nupkg "${___target}" - if ($___process -ne 0) { - return 0 - } - - $null = I18N-Export "${___target}" - if (($(STRINGS-Is-Empty "${___target}") -eq 0) -or - ($(STRINGS-Is-Empty "${___repo}") -eq 0)) { - $null = I18N-Export-Failed - return 1 - } - - - # execute - $___process = CHOCOLATEY-Publish ` - "${___target}" ` - "${___repo}\${env:PROJECT_CHOCOLATEY_DIRECTORY}" - if ($___process -ne 0) { - $null = I18N-Export-Failed - return 1 - } - - - # report status - return 0 -} - - - - -function RELEASE-Conclude-CHOCOLATEY { - param( - [string]$___directory - ) - - - # validate input - $null = I18N-Commit "CHOCOLATEY" - if ($(STRINGS-Is-Empty "${___directory}") -eq 0) { - $null = I18N-Commit-Failed - return 1 - } - - $___process = FS-Is-Directory "${___directory}" - if ($___process -ne 0) { - $null = I18N-Commit-Failed - return 1 - } - - - # execute - $__current_path = Get-Location - $null = Set-Location "${___directory}" - $___process = GIT-Autonomous-Commit "${env:PROJECT_SKU} ${env:PROJECT_VERSION}" - if ($___process -ne 0) { - $null = Set-Location "${__curent_path}" - $null = Remove-Variable __current_path - $null = I18N-Commit-Failed - return 1 - } - - - $___process = GIT-Pull-To-Latest - if ($___process -ne 0) { - $null = Set-Location "${__curent_path}" - $null = Remove-Variable __current_path - $null = I18N-Commit-Failed - return 1 - } - - - $___process = GIT-Push ` - "${env:PROJECT_CHOCOLATEY_REPO_KEY}" ` - "${env:PROJECT_CHOCOLATEY_REPO_BRANCH}" - $null = Set-Location "${__curent_path}" - $null = Remove-Variable __current_path - if ($___process -ne 0) { - $null = I18N-Commit-Failed - return 1 - } - - - # return status - return 0 -} - - - - -function RELEASE-Setup-CHOCOLATEY { - # clean up base directory - $null = I18N-Check "CHOCOLATEY" - $___process = FS-Is-File "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}" - if ($___process -eq 0) { - $null = I18N-Check-Failed - return 1 - } - $null = FS-Make-Directory "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}" - - - # execute - $null = I18N-Setup "CHOCOLATEY" - $___process = GIT-Clone-Repo ` - "${env:PROJECT_PATH_ROOT}" ` - "${env:PROJECT_PATH_RELEASE}" ` - "$(Get-Location)" ` - "${env:PROJECT_CHOCOLATEY_REPO}" ` - "${env:PROJECT_SIMULATE_RELEASE_REPO}" ` - "${env:PROJECT_CHOCOLATEY_DIRECTORY}" - if ($___process -ne 0) { - $null = I18N-Setup-Failed - return 1 - } - - - # report status - return 0 -} diff --git a/automataCI/_release-citation_unix-any.sh b/automataCI/_release-citation_unix-any.sh index 8a758bb8..2b950d23 100644 --- a/automataCI/_release-citation_unix-any.sh +++ b/automataCI/_release-citation_unix-any.sh @@ -11,6 +11,7 @@ # License for the specific language governing permissions and limitations under # the License. . "${LIBS_AUTOMATACI}/services/io/fs.sh" +. "${LIBS_AUTOMATACI}/services/io/strings.sh" . "${LIBS_AUTOMATACI}/services/i18n/translations.sh" @@ -26,21 +27,30 @@ fi RELEASE_Run_CITATION_CFF() { - _target="$1" + #__target="$1" # validate - if [ $(FS_Is_Target_A_Citation_CFF "$_target") -ne 0 ]; then + if [ $(FS_Is_Target_A_Citation_CFF "$1") -ne 0 ]; then return 0 fi + if [ $(STRINGS_Is_Empty "$PROJECT_CITATION") -eq 0 ]; then + return 0 # disabled explicitly + fi + # execute - I18N_Export "CITATION.cff" - FS_Copy_File "$_target" "${PROJECT_PATH_ROOT}/CITATION.cff" - if [ $? -ne 0 ]; then - I18N_Export_Failed - return 1 + I18N_Publish "CITATION.cff" + if [ $(OS_Is_Run_Simulated) -ne 0 ]; then + FS_Copy_File "$1" "${PROJECT_PATH_ROOT}/CITATION.cff" + if [ $? -ne 0 ]; then + I18N_Publish_Failed + return 1 + fi + else + # always simulate in case of error or mishaps before any point of no return + I18N_Simulate_Publish "CITATION.cff" fi diff --git a/automataCI/_release-citation_windows-any.ps1 b/automataCI/_release-citation_windows-any.ps1 index 4b0fc0ea..261a7f43 100644 --- a/automataCI/_release-citation_windows-any.ps1 +++ b/automataCI/_release-citation_windows-any.ps1 @@ -10,6 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. . "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" @@ -26,23 +27,32 @@ if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { function RELEASE-Run-CITATION-CFF { param( - [string]$_target + [string]$__target ) # validate input - $___process = FS-Is-Target-A-Citation-CFF "${_target}" + $___process = FS-Is-Target-A-Citation-CFF "${__target}" if ($___process -ne 0) { return 0 } + if ($(STRINGS-Is-Empty "${env:PROJECT_CITATION}") -eq 0) { + return 0 # disabled explicitly + } + # execute - $null = I18N-Export "CITATION.cff" - $___process = FS-Copy-File "${_target}" "${env:PROJECT_PATH_ROOT}\CITATION.cff" - if ($___process -ne 0) { - $null = I18N-Export-Failed - return 1 + $null = I18N-Publish "CITATION.cff" + if ($(OS-Is-Run-Simulated) -ne 0) { + $___process = FS-Copy-File "${__target}" "${env:PROJECT_PATH_ROOT}\CITATION.cff" + if ($___process -ne 0) { + $null = I18N-Publish-Failed + return 1 + } + } else { + # always simulate in case of error or mishaps before any point of no return + $null = I18N-Simulate-Publish "CITATION.cff" } diff --git a/automataCI/_release-deb_unix-any.sh b/automataCI/_release-deb_unix-any.sh index 751c7522..05cc8307 100644 --- a/automataCI/_release-deb_unix-any.sh +++ b/automataCI/_release-deb_unix-any.sh @@ -12,9 +12,10 @@ # the License. . "${LIBS_AUTOMATACI}/services/io/fs.sh" . "${LIBS_AUTOMATACI}/services/io/os.sh" +. "${LIBS_AUTOMATACI}/services/io/strings.sh" . "${LIBS_AUTOMATACI}/services/i18n/translations.sh" . "${LIBS_AUTOMATACI}/services/compilers/deb.sh" -. "${LIBS_AUTOMATACI}/services/publishers/reprepro.sh" +. "${LIBS_AUTOMATACI}/services/versioners/git.sh" @@ -28,9 +29,95 @@ fi +# define operating variables +DEB_REPO_DATA="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/releaser-deb-repoDB" +if [ $(STRINGS_Is_Empty "$PROJECT_DEB_PATH_DATA") -ne 0 ]; then + DEB_REPO_DATA="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/data/deb/${PROJECT_DEB_PATH_DATA}" +fi + +DEB_REPO="${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}" # default: flat mode +if [ "${PROJECT_DEB_DISTRIBUTION%%/*}" = "$PROJECT_DEB_DISTRIBUTION" ]; then + ## conventional mode + DEB_REPO="${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}/deb" + case "$(STRINGS_To_Lowercase "$PROJECT_RELEASE_REPO_TYPE")" in + local) + ;; + *) + # fallback to git mode + if [ $(STRINGS_Is_Empty "$PROJECT_DEB_PATH") -ne 0 ]; then + DEB_REPO="${DEB_REPO}/${PROJECT_DEB_PATH}" + fi + ;; + esac + + ## overrides if PROJECT_RELEASE_REPO is set + if [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_REPO") -ne 0 ]; then + DEB_REPO="${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}/deb" + fi +fi + + + + +RELEASE_Conclude_DEB() { + #__repo_directory="$1" + + + # validate input + if [ $(STRINGS_Is_Empty "$PROJECT_DEB_URL") -eq 0 ]; then + return 0 # disabled explicitly + fi + + + # execute + I18N_Conclude "DEB" + if [ $(OS_Is_Run_Simulated) -eq 0 ]; then + I18N_Simulate_Conclude "DEB" + return 0 + elif [ ! "${PROJECT_DEB_DISTRIBUTION%%/*}" = "$PROJECT_DEB_DISTRIBUTION" ]; then + # nothing to do in flat mode - report status + return 0 + elif [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_REPO") -ne 0 ]; then + # do nothing - single unified repository will take over later + return 0 + fi + + case "$(STRINGS_To_Lowercase "$PROJECT_RELEASE_REPO_TYPE")" in + local) + # nothing to do for local directory type - report status + return 0 + ;; + *) + # repository is an independent git repository so proceed as follows. + ;; + esac + + + # commit release + __current_path="$PWD" && cd "$1" + GIT_Autonomous_Force_Commit \ + "$PROJECT_VERSION" \ + "$PROJECT_DEB_REPO_KEY" \ + "$PROJECT_DEB_REPO_BRANCH" + ___process=$? + cd "$__current_path" && unset __current_path + if [ $___process -ne 0 ]; then + I18N_Conclude_Failed + return 1 + fi + + + # report status + return 0 +} + + + + RELEASE_Run_DEB() { __target="$1" - __directory="$2" + __repo_directory="$2" + __data_directory="$3" # validate input @@ -39,55 +126,145 @@ RELEASE_Run_DEB() { return 0 fi - I18N_Check_Availability "REPREPRO" - REPREPRO_Is_Available - if [ $? -ne 0 ]; then - I18N_Check_Failed_Skipped - return 0 + if [ $(STRINGS_Is_Empty "$PROJECT_DEB_URL") -eq 0 ]; then + return 0 # disabled explicitly fi # execute - __conf="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/deb" - __file="${__conf}/conf/distributions" - FS_Is_File "$__file" - if [ $? -ne 0 ]; then - I18N_Create "$__file" - REPREPRO_Create_Conf \ - "$__conf" \ - "$PROJECT_REPREPRO_CODENAME" \ - "$PROJECT_DEBIAN_DISTRIBUTION" \ - "$PROJECT_REPREPRO_COMPONENT" \ - "$PROJECT_REPREPRO_ARCH" \ - "$PROJECT_GPG_ID" + I18N_Publish "DEB" + if [ $(OS_Is_Run_Simulated) -ne 0 ]; then + DEB_Publish \ + "$__repo_directory" \ + "$__data_directory" \ + "${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/releaser-deb" \ + "$__target" \ + "$PROJECT_DEB_DISTRIBUTION" \ + "$PROJECT_DEB_COMPONENT" if [ $? -ne 0 ]; then - I18N_Create_Failed + I18N_Publish_Failed return 1 fi + else + # always simulate in case of error or mishaps before any point of no return + I18N_Simulate_Publish "DEB" fi - __dest="${2}/deb" - I18N_Create "$__dest" - FS_Make_Directory "${__dest}" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 + + # report status + return 0 +} + + + + +RELEASE_Setup_DEB() { + #__repo_directory="$1" + + + # validate input + I18N_Check "DEB" + if [ $(STRINGS_Is_Empty "$PROJECT_DEB_URL") -eq 0 ]; then + I18N_Check_Disabled_Skipped + return 0 # disabled explicitly fi - I18N_Publish "REPREPRO" - if [ $(OS_Is_Run_Simulated) -eq 0 ]; then - I18N_Simulate_Publish "REPREPRO" - else - REPREPRO_Publish \ - "$__target" \ - "$__dest" \ - "$__conf" \ - "${__conf}/db" \ - "$PROJECT_REPREPRO_CODENAME" + + # execute + I18N_Setup "DEB" + if [ "${PROJECT_DEB_DISTRIBUTION%%/*}" = "$PROJECT_DEB_DISTRIBUTION" ]; then + # conventional mode + if [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_REPO") -ne 0 ]; then + ## overridden by single unified repository + FS_Remake_Directory "$1" + return 0 + fi + + case "$(STRINGS_To_Lowercase "$PROJECT_RELEASE_REPO_TYPE")" in + local) + ## local file directory type + FS_Remake_Directory "$1" + return 0 + ;; + *) + ## fallback to git repository source + ;; + esac + + FS_Make_Housing_Directory "$1" + GIT_Clone_Repo \ + "$PROJECT_PATH_ROOT" \ + "$PROJECT_PATH_RELEASE" \ + "$PWD" \ + "$PROJECT_DEB_REPO" \ + "$PROJECT_SIMULATE_RUN" \ + "deb" if [ $? -ne 0 ]; then - I18N_Publish_Failed + I18N_Setup_Failed return 1 fi + + FS_Make_Directory "$1" + fi + + + # report status + return 0 +} + + + + +RELEASE_Update_DEB() { + #__repo_directory="$1" + #__data_directory="$2" + + + # validate input + if [ $(STRINGS_Is_Empty "$PROJECT_DEB_URL") -eq 0 ]; then + return 0 # disabled explicitly + fi + + + # execute + I18N_Publish "DEB" + if [ $(OS_Is_Run_Simulated) -eq 0 ]; then + I18N_Simulate_Publish "DEB" + return 0 + fi + + DEB_Publish_Conclude \ + "$1" \ + "$2" \ + "$PROJECT_DEB_DISTRIBUTION" \ + "$PROJECT_DEB_ARCH" \ + "$PROJECT_DEB_COMPONENT" \ + "$PROJECT_DEB_CODENAME" \ + "$PROJECT_GPG_ID" + if [ $? -ne 0 ]; then + I18N_Publish_Failed + return 1 + fi + + + # create the README.md + if [ ! "${PROJECT_DEB_DISTRIBUTION%%/*}" = "$PROJECT_DEB_DISTRIBUTION" ]; then + # it's flat repo so stop here - no README.md is required + return 0 + fi + + __dest="${1}/DEB_Repository.md" + I18N_Create "$__dest" + FS_Make_Housing_Directory "$__dest" + FS_Remove_Silently "$__dest" + FS_Write_File "$__dest" "\ +# DEB Distribution Repository + +This directory is now re-purposed to host DEB packages repository. +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 fi diff --git a/automataCI/_release-deb_windows-any.ps1 b/automataCI/_release-deb_windows-any.ps1 index f7ad6b84..134c38fc 100644 --- a/automataCI/_release-deb_windows-any.ps1 +++ b/automataCI/_release-deb_windows-any.ps1 @@ -3,7 +3,7 @@ # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy # of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the @@ -11,9 +11,10 @@ # under the License. . "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" . "${env:LIBS_AUTOMATACI}\services\io\os.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" . "${env:LIBS_AUTOMATACI}\services\compilers\deb.ps1" -. "${env:LIBS_AUTOMATACI}\services\publishers\reprepro.ps1" +. "${env:LIBS_AUTOMATACI}\services\versioners\git.ps1" @@ -27,10 +28,96 @@ if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { +# define operating variables +$DEB_REPO_DATA = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\releaser-deb-repoDB" +if ($(STRINGS-Is-Empty "${env:PROJECT_DEB_PATH_DATA}") -ne 0) { + $DEB_REPO_DATA = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\data\deb\${env:PROJECT_DEB_PATH_DATA}" +} + +$DEB_REPO = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_PKG}" # default: flat mode +if ("$(${env:PROJECT_DEB_DISTRIBUTION} -replace "\/.*$", '')" -eq "${env:PROJECT_DEB_DISTRIBUTION}") { + ## conventional mode + $DEB_REPO = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}\deb" + switch ("$(STRINGS-To-Lowercase "${env:PROJECT_RELEASE_REPO_TYPE}")") { + "local" { + # retain existing path + } default { + # fallback to git mode + if ($(STRINGS-Is-Empty "${env:PROJECT_DEB_PATH}") -ne 0) { + $DEB_REPO = "${DEB_REPO}\${PROJECT_DEB_PATH}" + } + }} + + ## overrides if PROJECT_RELEASE_REPO is set + if ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_REPO}") -ne 0) { + $DEB_REPO = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}\deb" + } +} + + + + +function RELEASE-Conclude-DEB { + param( + [string]$__repo_directory + ) + + + # validate input + if ($(STRINGS-Is-Empty "${env:PROJECT_DEB_URL}") -eq 0) { + return 0 # disabled explictly + } + + + # execute + $null = I18N-Conclude "DEB" + if ($(OS-Is-Run-Simulated) -eq 0) { + $null = I18N-Simulate-Conclude "DEB" + return 0 + } elseif ("$($___distribution -replace "\/.*$", '')" -ne $___distribution) { + # nothing to do in flat mode - report status + return 0 + } elseif ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_REPO}") -ne 0) { + # do nothing - single unified repository will take over later + return 0 + } + + switch ("$(STRINGS-To-Lowercase "${env:PROJECT_RELEASE_REPO_TYPE}")") { + "local" { + # nothing to do for local directory type - report status + return 0 + } default { + # repository is an independent git repository so proceed as follows. + }} + + + # commit release + $__current_path = Get-Location + $null = Set-Location "${__repo_directory}" + $___process = Git-Autonomous-Force-Commit ` + "${env:PROJECT_VERSION}" ` + "${env:PROJECT_DEB_REPO_KEY}" ` + "${env:PROJECT_DEB_REPO_BRANCH}" + $null = Set-Location "${__curent_path}" + $null = Remove-Variable __current_path + if ($___process -ne 0) { + $null = I18N-Conclude-Failed + return 1 + } + + + # return status + return 0 +} + + + + function RELEASE-Run-DEB { param( [string]$__target, - [string]$__directory + [string]$__repo_directory, + [string]$__data_directory ) @@ -40,55 +127,148 @@ function RELEASE-Run-DEB { return 0 } - $null = I18N-Check-Availability "REPREPRO" - $___process = REPREPRO-Is-Available - if ($___process -ne 0) { - $null = I18N-Check-Failed-Skipped - return 0 + if ($(STRINGS-Is-Empty "${env:PROJECT_DEB_URL}") -eq 0) { + return 0 # disabled explictly } # execute - $__conf = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\deb" - $__file = "${__conf}\conf\distributions" - $___process = FS-Is-File "${__file}" - if ($___process -ne 0) { - $null = I18N-Create "${__file}" - $___process = REPREPRO-Create-Conf ` - "${__conf}" ` - "${env:PROJECT_REPREPRO_CODENAME}" ` - "${env:PROJECT_DEBIAN_DISTRIBUTION}" ` - "${env:PROJECT_REPREPRO_COMPONENT}" ` - "${env:PROJECT_REPREPRO_ARCH}" ` - "${env:PROJECT_GPG_ID}" + $null = I18N-Publish "DEB" + if ($(OS-Is-Run-Simulated) -ne 0) { + $___process = DEB-Publish ` + "${__repo_directory}" ` + "${__data_directory}" ` + "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\releaser-deb" ` + "${__target}" ` + "${env:PROJECT_DEB_DISTRIBUTION}" ` + "${env:PROJECT_DEB_COMPONENT}" if ($___process -ne 0) { - $null = I18N-Create-Failed + $null = I18N-Publish-Failed return 1 } + } else { + # always simulate in case of error or mishaps before any point of no return + $null = I18N-Simulate-Publish "DEB" } - $__dest = "${__directory}/deb" - $null = I18N-Create "${__dest}" - $___process = FS-Make-Directory "${__dest}" + + # report status + return 0 +} + + + + +function RELEASE-Setup-DEB { + param( + [string]$__repo_directory + ) + + + # validate input + $null = I18N-Check "DEB" + if ($(STRINGS-Is-Empty "${env:PROJECT_DEB_URL}") -eq 0) { + $null = I18N-Check-Disabled-Skipped + return 0 # disabled explictly + } + + + # execute + $null = I18N-Setup "DEB" + if ("$($___distribution -replace "\/.*$", '')" -eq $___distribution) { + # conventional mode + if ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_REPO}") -eq 0) { + ## overridden by single unified repository + $null = FS-Remake-Directory "${__repo_directory}" + return 0 + } + + switch ("$(STRINGS-To-Lowercase "${env:PROJECT_RELEASE_REPO_TYPE}")") { + "local" { + ## local file directory type + $null = FS-Remake-Directory "${__repo_directory}" + return 0 + } default { + ## fallback to git repository source + }} + + $null = FS-Make-Housing-Directory "${__repo_directory}" + $___process = GIT-Clone-Repo ` + "${env:PROJECT_PATH_ROOT}" ` + "${env:PROJECT_PATH_RELEASE}" ` + "$(Get-Location)" ` + "${env:PROJECT_DEB_REPO}" ` + "${env:PROJECT_SIMULATE_RUN}" ` + "deb" + if ($___process -ne 0) { + $null = I18N-Setup-Failed + return 1 + } + + $null = FS-Make-Directory "${__repo_directory}" + } + + + # report status + return 0 +} + + + + +function RELEASE-Update-DEB { + param( + [string]$__repo_directory, + [string]$__data_directory + ) + + + # validate input + if ($(STRINGS-Is-Empty "${env:PROJECT_DEB_URL}") -eq 0) { + return 0 # disabled explictly + } + + + # execute + $null = I18N-Publish "DEB" + if ($(OS-Is-Run-Simulated) -eq 0) { + $null = I18N-Simulate-Publish "DEB" + return 0 + } + + $___process = DEB-Publish-Conclude ` + "${__repo_directory}" ` + "${__data_directory}" ` + "${env:PROJECT_DEB_DISTRIBUTION}" ` + "${env:PROJECT_DEB_ARCH}" ` + "${env:PROJECT_DEB_COMPONENT}" ` + "${env:PROJECT_DEB_CODENAME}" ` + "${env:PROJECT_GPG_ID}" if ($___process -ne 0) { - $null = I18N-Create-Failed + $null = I18N-Publish-Failed return 1 } - $null = I18N-Publish "REPREPRO" - if ($(OS-Is-Run-Simulated) -eq 0) { - $null = I18N-Simulate-Publish "REPREPRO" - } else { - $___process = REPREPRO-Publish ` - "${__target}" ` - "${__dest}" ` - "${__conf}" ` - "${__conf}\db" ` - "${env:PROJECT_REPREPRO_CODENAME}" - if ($___process -ne 0) { - $null = I18N-Publish-Failed - return 1 - } + + # create the README.md + if ("$($___distribution -replace "\/.*$", '')" -ne $___distribution) { + # it's flat repo so stop here - no README.md is required + return 0 + } + + $___dest = "${__repo_directory}\DEB_Repository.md" + $null = I18N-Create "${__dest}" + $null = FS-Make-Housing-Directory "${__dest}" + $null = FS-Remove-Silently "${__dest}" + $___process = FS-Write-File "${__dest}" @" +# DEB Distribution Repository + +This directory is now re-purposed to host DEB packages repository. + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 } diff --git a/automataCI/_release-docker_unix-any.sh b/automataCI/_release-docker_unix-any.sh index 55e1c1c6..218b11ed 100644 --- a/automataCI/_release-docker_unix-any.sh +++ b/automataCI/_release-docker_unix-any.sh @@ -10,8 +10,9 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations under # the License. -. "${LIBS_AUTOMATACI}/services/io/fs.sh" . "${LIBS_AUTOMATACI}/services/io/os.sh" +. "${LIBS_AUTOMATACI}/services/io/fs.sh" +. "${LIBS_AUTOMATACI}/services/io/strings.sh" . "${LIBS_AUTOMATACI}/services/i18n/translations.sh" . "${LIBS_AUTOMATACI}/services/compilers/docker.sh" @@ -28,16 +29,19 @@ fi RELEASE_Run_DOCKER() { - _target="$1" - _directory="$2" + __target="$1" # validate input - DOCKER_Is_Valid "$_target" + DOCKER_Is_Valid "$__target" if [ $? -ne 0 ]; then return 0 fi + if [ $(STRINGS_Is_Empty "$PROJECT_CONTAINER_REGISTRY") -eq 0 ]; then + return 0 # disabled explicitly + fi + I18N_Check_Availability "DOCKER" DOCKER_Is_Available if [ $? -ne 0 ]; then @@ -48,17 +52,18 @@ RELEASE_Run_DOCKER() { # execute I18N_Publish "DOCKER" - if [ $(OS_Is_Run_Simulated) -eq 0 ]; then - I18N_Simulate_Publish "DOCKER" - else - DOCKER_Release "$_target" "$PROJECT_VERSION" + if [ $(OS_Is_Run_Simulated) -ne 0 ]; then + DOCKER_Release "$__target" "$PROJECT_VERSION" if [ $? -ne 0 ]; then I18N_Publish_Failed return 1 fi - I18N_Clean "$_target" - FS_Remove_Silently "$_target" + I18N_Clean "$__target" + FS_Remove_Silently "$__target" + else + # always simulate in case of error or mishaps before any point of no return + I18N_Simulate_Publish "DOCKER" fi diff --git a/automataCI/_release-docker_windows-any.ps1 b/automataCI/_release-docker_windows-any.ps1 index 1ecb8a15..4435555c 100644 --- a/automataCI/_release-docker_windows-any.ps1 +++ b/automataCI/_release-docker_windows-any.ps1 @@ -9,8 +9,9 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" . "${env:LIBS_AUTOMATACI}\services\io\os.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" . "${env:LIBS_AUTOMATACI}\services\compilers\docker.ps1" @@ -28,17 +29,20 @@ if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { function RELEASE-Run-DOCKER { param( - [string]$_target, - [string]$_directory + [string]$__target ) # validate input - $___process = DOCKER-Is-Valid "${_target}" + $___process = DOCKER-Is-Valid "${__target}" if ($___process -ne 0) { return 0 } + if ($(STRINGS-Is-Empty "${env:PROJECT_CONTAINER_REGISTRY}") -eq 0) { + return 0 # disabled explicitly + } + $null = I18N-Check-Availability "DOCKER" $___process = DOCKER-Is-Available if ($___process -ne 0) { @@ -49,17 +53,18 @@ function RELEASE-Run-DOCKER { # execute $null = I18N-Publish "DOCKER" - if ($(OS-Is-Run-Simulated) -eq 0) { - $null = I18N-Simulate-Publish "DOCKER" - } else { - $___process = DOCKER-Release "${_target}" "${env:PROJECT_VERSION}" + if ($(OS-Is-Run-Simulated) -ne 0) { + $___process = DOCKER-Release "${__target}" "${env:PROJECT_VERSION}" if ($___process -ne 0) { $null = I18N-Publish-Failed return 1 } - $null = I18N-Clean "${_target}" - $null = FS-Remove-Silently "${_target}" + $null = I18N-Clean "${__target}" + $null = FS-Remove-Silently "${__target}" + } else { + # always simulate in case of error or mishaps before any point of no return + $null = I18N-Simulate-Publish "DOCKER" } diff --git a/automataCI/_release-docsrepo_unix-any.sh b/automataCI/_release-docsrepo_unix-any.sh index 4cbee009..770c3f37 100644 --- a/automataCI/_release-docsrepo_unix-any.sh +++ b/automataCI/_release-docsrepo_unix-any.sh @@ -10,6 +10,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations under # the License. +. "${LIBS_AUTOMATACI}/services/io/os.sh" . "${LIBS_AUTOMATACI}/services/io/fs.sh" . "${LIBS_AUTOMATACI}/services/i18n/translations.sh" . "${LIBS_AUTOMATACI}/services/versioners/git.sh" @@ -28,7 +29,18 @@ fi RELEASE_Conclude_DOCS() { # validate input - I18N_Check "DOCS" + if [ $(STRINGS_Is_Empty "$PROJECT_DOCS_URL") -eq 0 ]; then + return 0 # disabled explicitly + fi + + + # execute + I18N_Publish "DOCS" + if [ $(OS_Is_Run_Simulated) -eq 0 ]; then + I18N_Simulate_Conclude "DOCS" + return 0 + fi + FS_Is_Directory "${PROJECT_PATH_ROOT}/${PROJECT_PATH_DOCS}" if [ $? -ne 0 ]; then return 0 @@ -36,21 +48,21 @@ RELEASE_Conclude_DOCS() { FS_Is_File "${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}" if [ $? -eq 0 ]; then - I18N_Check_Failed + I18N_Publish_Failed return 1 fi - FS_Make_Directory "${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}" + FS_Make_Directory "${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}" - # execute I18N_Setup "DOCS" + __directory_name="x_docsrepo" GIT_Clone_Repo \ "$PROJECT_PATH_ROOT" \ "$PROJECT_PATH_RELEASE" \ "$PWD" \ "$PROJECT_DOCS_REPO" \ - "$PROJECT_SIMULATE_RELEASE_REPO" \ - "$PROJECT_DOCS_REPO_DIRECTORY" \ + "$PROJECT_SIMULATE_RUN" \ + "$__directory_name" \ "$PROJECT_DOCS_REPO_BRANCH" if [ $? -ne 0 ]; then I18N_Setup_Failed @@ -60,35 +72,40 @@ RELEASE_Conclude_DOCS() { # export contents __staging="${PROJECT_PATH_ROOT}/${PROJECT_PATH_DOCS}" - __dest="${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}/${PROJECT_DOCS_REPO_DIRECTORY}" + __dest="${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}/${__directory_name}" I18N_Export "$__staging" FS_Copy_All "${__staging}/" "$__dest" if [ $? -ne 0 ]; then I18N_Export_Failed + FS_Remove_Silently "$__dest" return 1 fi - I18N_Commit "DOCS" __tag="$(GIT_Get_Latest_Commit_ID)" + I18N_Commit "$__tag" if [ $(STRINGS_Is_Empty "$__tag") -eq 0 ]; then I18N_Commit_Failed + FS_Remove_Silently "$__dest" return 1 fi - ___current_path="$PWD" && cd "${__dest}" + __current_path="$PWD" && cd "$__dest" GIT_Autonomous_Force_Commit \ "$__tag" \ "$PROJECT_DOCS_REPO_KEY" \ "$PROJECT_DOCS_REPO_BRANCH" ___process=$? - cd "$___current_path" && unset ___current_path + cd "$__current_path" && unset __current_path if [ $___process -ne 0 ]; then I18N_Commit_Failed + FS_Remove_Silently "$__dest" return 1 fi + FS_Remove_Silently "$__dest" + # report status return 0 diff --git a/automataCI/_release-docsrepo_windows-any.ps1 b/automataCI/_release-docsrepo_windows-any.ps1 index 2730fdff..caccec59 100644 --- a/automataCI/_release-docsrepo_windows-any.ps1 +++ b/automataCI/_release-docsrepo_windows-any.ps1 @@ -9,6 +9,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +. "${env:LIBS_AUTOMATACI}\services\io\os.ps1" . "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" . "${env:LIBS_AUTOMATACI}\services\versioners\git.ps1" @@ -27,7 +28,18 @@ if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { function RELEASE-Conclude-DOCS { # validate input - $null = I18N-Check "DOCS" + if ($(STRINGS-Is-Empty "${env:PROJECT_DOCS_URL}") -eq 0) { + return 0 # disabled explicitly + } + + + # execute + $null = I18N-Publish "DOCS" + if ($(OS-Is-Run-Simulated) -eq 0) { + $null = I18N-Simulate-Conclude "DOCS" + return 0 + } + $___process = FS-Is-Directory "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_DOCS}" if ($___process -ne 0) { return 0 @@ -35,21 +47,21 @@ function RELEASE-Conclude-DOCS { $___process = FS-Is-File "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}" if ($___process -eq 0) { - $null = I18N-Check-Failed + $null = I18N-Publish-Failed return 1 } - $null = FS-Make-Directory "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}" + $null = FS-Make-Directory "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}" - # execute $null = I18N-Setup "DOCS" + $__directory_name = "x_docsrepo" $___process = GIT-Clone-Repo ` "${env:PROJECT_PATH_ROOT}" ` "${env:PROJECT_PATH_RELEASE}" ` "$(Get-Location)" ` "${env:PROJECT_DOCS_REPO}" ` - "${env:PROJECT_SIMULATE_RELEASE_REPO}" ` - "${env:PROJECT_DOCS_REPO_DIRECTORY}" ` + "${env:PROJECT_SIMULATE_RUN}" ` + "${__directory_name}" ` "${env:PROJECT_DOCS_REPO_BRANCH}" if ($___process -ne 0) { $null = I18N-Setup-Failed @@ -59,19 +71,21 @@ function RELEASE-Conclude-DOCS { # export contents $__staging = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_DOCS}" - $__dest = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}\${env:PROJECT_DOCS_REPO_DIRECTORY}" + $__dest = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}\${__directory_name}" $null = I18N-Export "${__staging}" $___process = FS-Copy-All "${__staging}\" "${__dest}" if ($___process -ne 0) { $null = I18N-Export-Failed + $null = FS-Remove-Silently "${__dest}" return 1 } - $null = I18N-Commit "DOCS" $__tag = GIT-Get-Latest-Commit-ID + $null = I18N-Commit "${__tag}" if ($(STRINGS-Is-Empty "${__tag}") -eq 0) { $null = I18N-Commit-Failed + $null = FS-Remove-Silently "${__dest}" return 1 } @@ -88,10 +102,13 @@ function RELEASE-Conclude-DOCS { if ($___process -ne 0) { $null = I18N-Commit-Failed + $null = FS-Remove-Silently "${__dest}" return 1 } + $null = FS-Remove-Silently "${__dest}" + - # report status + # return status return 0 } diff --git a/automataCI/_release-flatpak_unix-any.sh b/automataCI/_release-flatpak_unix-any.sh new file mode 100644 index 00000000..9a03dabf --- /dev/null +++ b/automataCI/_release-flatpak_unix-any.sh @@ -0,0 +1,145 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +. "${LIBS_AUTOMATACI}/services/io/os.sh" +. "${LIBS_AUTOMATACI}/services/io/fs.sh" +. "${LIBS_AUTOMATACI}/services/io/strings.sh" +. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" +. "${LIBS_AUTOMATACI}/services/versioners/git.sh" + + + + +# initialize +if [ "$PROJECT_PATH_ROOT" = "" ]; then + >&2 printf "[ ERROR ] - Please run me from automataCI/ci.sh.ps1 instead!\n" + return 1 +fi + + + + +# define operating variables +FLATPAK_REPO="${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}/flatpak" + + + + +RELEASE_Conclude_FLATPAK() { + #__repo_directory="$1" + + + # validate input + if [ $(STRINGS_Is_Empty "$PROJECT_FLATPAK_URL") -eq 0 ]; then + return 0 # disabled explicitly + elif [ $(STRINGS_Is_Empty "$PROJECT_FLATPAK_REPO") -eq 0 ] && + [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_REPO") -eq 0 ]; then + return 0 # single file bundles only + elif [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_REPO") -ne 0 ]; then + return 0 # do nothing - single unified repository will take over later + fi + + case "$(STRINGS_To_Lowercase "$PROJECT_RELEASE_REPO_TYPE")" in + local) + return 0 # do nothing + ;; + *) + # it's a git repository + ;; + esac + + + # execute + I18N_Conclude "FLATPAK" + FS_Is_Directory "$1" + if [ $? -ne 0 ]; then + return 0 # no repository setup during package job + fi + + if [ $(OS_Is_Run_Simulated) -eq 0 ]; then + I18N_Simulate_Conclude "FLATPAK" + return 0 + fi + + + # commit the git repository + __current_path="$PWD" && cd "$1" + GIT_Pull_To_Latest + if [ $? -ne 0 ]; then + cd "$__current_path" && unset __current_path + I18N_Conclude_Failed + return 1 + fi + + GIT_Autonomous_Commit "${PROJECT_SKU} ${PROJECT_VERSION}" + if [ $? -ne 0 ]; then + cd "$__current_path" && unset __current_path + I18N_Conclude_Failed + return 1 + fi + + GIT_Push "$PROJECT_FLATPAK_REPO_KEY" "$PROJECT_FLATPAK_REPO_BRANCH" + ___process=$? + cd "$__current_path" && unset __current_path + if [ $___process -ne 0 ]; then + I18N_Conclude_Failed + return 1 + fi + + + # report status + return 0 +} + + + + +RELEASE_Setup_FLATPAK() { + #__repo_directory="$1" + + + # validate input + I18N_Check "FLATPAK" + if [ $(STRINGS_Is_Empty "$PROJECT_FLATPAK_URL") -eq 0 ]; then + I18N_Check_Disabled_Skipped + return 0 # disabled explicitly + fi + + if [ $(STRINGS_Is_Empty "$PROJECT_FLATPAK_REPO") -eq 0 ] && + [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_REPO") -eq 0 ]; then + return 0 # single file bundles only + fi + + + # execute + __source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/flatpak-repo" + FS_Is_Directory "$__source" + if [ $? -ne 0 ]; then + return 0 # no repository setup during package job + fi + + I18N_Setup "FLATPAK" + FS_Remove_Silently "$1" + FS_Move "$__source" "$1" + if [ $? -ne 0 ]; then + I18N_Setup_Failed + return 1 + fi + + if [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_REPO") -ne 0 ]; then + FS_Remove_Silently "${1}/.git" + fi + + + # report status + return 0 +} diff --git a/automataCI/_release-flatpak_windows-any.ps1 b/automataCI/_release-flatpak_windows-any.ps1 new file mode 100644 index 00000000..010dadd5 --- /dev/null +++ b/automataCI/_release-flatpak_windows-any.ps1 @@ -0,0 +1,149 @@ +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +. "${env:LIBS_AUTOMATACI}\services\io\os.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" +. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" +. "${env:LIBS_AUTOMATACI}\services\versioners\git.ps1" + + + + +# initialize +if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { + Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" + return +} + + + + +# define operating variables +$FLATPAK_REPO = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}\flatpak" + + + + +function RELEASE-Conclude-FLATPAK { + param( + [string]$__repo_directory + ) + + + # validate input + if ($(STRINGS-Is-Empty "${env:PROJECT_FLATPAK_URL}") -eq 0) { + return 0 # disabled explictly + } elseif (($(STRINGS-Is-Empty "${env:PROJECT_FLATPAK_REPO}") -eq 0) -and + ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_REPO}") -eq 0)) { + return 0 # single file bundles only + } + + switch ("$(STRINGS-To-Lowercase "${env:PROJECT_RELEASE_REPO_TYPE}")") { + "local" { + return 0 # do nothing + } default { + # it's a git repository + }} + + + # execute + $null = I18N-Conclude "FLATPAK" + $___process = FS-Is-Directory "${__repo_directory}" + if ($___process -ne 0) { + return 0 # no repository setup during package job + } + + if ($(OS-Is-Run-Simulated) -eq 0) { + $null = I18N-Simulate-Conclude "FLATPAK" + return 0 + } + + + # commit the git repository + $__current_path = Get-Location + $null = Set-Location "${__repo_directory}" + $___process = GIT-Pull-To-Latest + if ($___process -ne 0) { + $null = Set-Location "${__curent_path}" + $null = Remove-Variable __current_path + $null = I18N-Conclude-Failed + return 1 + } + + $___process = GIT-Autonomous-Commit "${env:PROJECT_SKU} ${env:PROJECT_VERSION}" + if ($___process -ne 0) { + $null = Set-Location "${__curent_path}" + $null = Remove-Variable __current_path + $null = I18N-Conclude-Failed + return 1 + } + + $___process = GIT-Push ` + "${env:PROJECT_FLATPAK_REPO_KEY}" ` + "${env:PROJECT_FLATPAK_REPO_BRANCH}" + $null = Set-Location "${__curent_path}" + $null = Remove-Variable __current_path + if ($___process -ne 0) { + $null = I18N-Conclude-Failed + return 1 + } + + + # return status + return 0 +} + + + + +function RELEASE-Setup-FLATPAK { + param( + [string]$__repo_directory + ) + + + # validate input + $null = I18N-Check "FLATPAK" + if ($(STRINGS-Is-Empty "${env:PROJECT_FLATPAK_URL}") -eq 0) { + $null = I18N-Check-Disabled-Skipped + return 0 # disabled explictly + } + + if (($(STRINGS-Is-Empty "${env:PROJECT_FLATPAK_REPO}") -eq 0) -and + ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_REPO}") -eq 0)) { + return 0 # single file bundles only + } + + + # execute + $__source = "${PROJECT_PATH_ROOT}\${PROJECT_PATH_TEMP}\flatpak-repo" + $___process = FS-Is-Directory "${__source}" + if ($___process -ne 0) { + return 0 # no repository setup during package job + } + + $null = I18N-Setup "FLATPAK" + $null = FS-Remove-Silently "${__repo_directory}" + $___process = FS-Move "${__source}" "${__repo_directory}" + if ($___process -ne 0) { + $null = I18N-Setup-Failed + return 1 + } + + if ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_REPO}") -ne 0) { + $null = FS-Remove-Silently "${__repo_directory}\.git" + } + + + # report status + return 0 +} diff --git a/automataCI/_release-homebrew_unix-any.sh b/automataCI/_release-homebrew_unix-any.sh index 627210ac..1ab5d17d 100644 --- a/automataCI/_release-homebrew_unix-any.sh +++ b/automataCI/_release-homebrew_unix-any.sh @@ -4,17 +4,18 @@ # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of # the License at: -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations under # the License. +. "${LIBS_AUTOMATACI}/services/io/os.sh" . "${LIBS_AUTOMATACI}/services/io/fs.sh" . "${LIBS_AUTOMATACI}/services/io/strings.sh" . "${LIBS_AUTOMATACI}/services/i18n/translations.sh" -. "${LIBS_AUTOMATACI}/services/versioners/git.sh" . "${LIBS_AUTOMATACI}/services/publishers/homebrew.sh" +. "${LIBS_AUTOMATACI}/services/versioners/git.sh" @@ -28,28 +29,79 @@ fi -RELEASE_Run_HOMEBREW() { - #___target="$1" - #___repo="$2" +# define operating variables +HOMEBREW_REPO="${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}/homebrew" + + + + +RELEASE_Conclude_HOMEBREW() { + #__repo_directory="$1" # validate input - HOMEBREW_Is_Valid_Formula "$1" - if [ $? -ne 0 ]; then + if [ $(STRINGS_Is_Empty "$PROJECT_HOMEBREW_URL") -eq 0 ]; then + return 0 # disabled explicitly + fi + + + # execute + I18N_Conclude "HOMEBREW" + if [ $(OS_Is_Run_Simulated) -eq 0 ]; then + I18N_Simulate_Conclude "HOMEBREW" return 0 fi - I18N_Export "$1" - if [ $(STRINGS_Is_Empty "$1") -eq 0 ] || [ $(STRINGS_Is_Empty "$2") -eq 0 ]; then - I18N_Export_Failed + + # commit the formula first + __current_path="$PWD" && cd "$1" + GIT_Pull_To_Latest + if [ $? -ne 0 ]; then + cd "$__current_path" && unset __current_path + I18N_Conclude_Failed + return 1 + fi + + GIT_Autonomous_Commit "${PROJECT_SKU} ${PROJECT_VERSION}" + if [ $? -ne 0 ]; then + cd "$__current_path" && unset __current_path + I18N_Conclude_Failed + return 1 + fi + + GIT_Push "$PROJECT_HOMEBREW_REPO_KEY" "$PROJECT_HOMEBREW_REPO_BRANCH" + ___process=$? + cd "$__current_path" && unset __current_path + if [ $___process -ne 0 ]; then + I18N_Conclude_Failed return 1 fi - # execute - HOMEBREW_Publish "$1" "${2}/Formula/${PROJECT_SKU}.rb" + # clean up in case of other release configurations + if [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_REPO") -ne 0 ]; then + # remove traces - single unified repository will take over later + FS_Remove "$1" + if [ $? -ne 0 ]; then + I18N_Conclude_Failed + return 1 + fi + + return 0 + fi + + case "$(STRINGS_To_Lowercase "$PROJECT_RELEASE_REPO_TYPE")" in + local) + # remove traces - formula is never stray from its tap repository. + ;; + *) + return 0 + ;; + esac + + FS_Remove "$1" if [ $? -ne 0 ]; then - I18N_Export_Failed + I18N_Conclude_Failed return 1 fi @@ -61,47 +113,37 @@ RELEASE_Run_HOMEBREW() { -RELEASE_Conclude_HOMEBREW() { - #___directory="$1" +RELEASE_Run_HOMEBREW() { + #___target="$1" + #___repo_directory="$2" - # validate input - I18N_Commit "HOMEBREW" - if [ $(STRINGS_Is_Empty "$1") -eq 0 ]; then - I18N_Commit_Failed - return 1 - fi - FS_Is_Directory "$1" + # validate input + HOMEBREW_Is_Valid_Formula "$1" if [ $? -ne 0 ]; then - I18N_Commit_Failed - return 1 + return 0 fi - - # execute - ___current_path="$PWD" - cd "$1" - GIT_Autonomous_Commit "${PROJECT_SKU} ${PROJECT_VERSION}" - if [ $? -ne 0 ]; then - cd "$___current_path" && unset ___current_path - I18N_Commit_Failed - return 1 + if [ $(STRINGS_Is_Empty "$PROJECT_HOMEBREW_URL") -eq 0 ]; then + return 0 # disabled explicitly fi - GIT_Pull_To_Latest - if [ $? -ne 0 ]; then - cd "$___current_path" && unset ___current_path - I18N_Commit_Failed - return 1 - fi - GIT_Push "$PROJECT_CHOCOLATEY_REPO_KEY" "$PROJECT_CHOCOLATEY_REPO_BRANCH" - ___process=$? - cd "$___current_path" && unset ___current_path - if [ $___process -ne 0 ]; then - I18N_Commit_Failed - return 1 + # execute + I18N_Publish "HOMEBREW" + if [ $(OS_Is_Run_Simulated) -ne 0 ]; then + __dest="$(printf -- "%.1s" "$(FS_Get_File "$1")")" + __dest="${2}/Formula/${__dest}/$(FS_Get_File "$1")" + FS_Make_Housing_Directory "$__dest" + FS_Copy_File "$1" "$__dest" + if [ $? -ne 0 ]; then + I18N_Publish_Failed + return 1 + fi + else + # always simulate in case of error or mishaps before any point of no return + I18N_Simulate_Publish "HOMEBREW" fi @@ -113,30 +155,34 @@ RELEASE_Conclude_HOMEBREW() { RELEASE_Setup_HOMEBREW() { - # clean up base directory + #__repo_directory="$1" + + + # validate input I18N_Check "HOMEBREW" - FS_Is_File "${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}" - if [ $? -eq 0 ]; then - I18N_Check_Failed - return 1 + if [ $(STRINGS_Is_Empty "$PROJECT_HOMEBREW_URL") -eq 0 ]; then + I18N_Check_Disabled_Skipped + return 0 # disabled explicitly fi - FS_Make_Directory "${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}" # execute I18N_Setup "HOMEBREW" + FS_Make_Housing_Directory "$1" GIT_Clone_Repo \ "$PROJECT_PATH_ROOT" \ "$PROJECT_PATH_RELEASE" \ "$PWD" \ "$PROJECT_HOMEBREW_REPO" \ - "$PROJECT_SIMULATE_RELEASE_REPO" \ - "$PROJECT_HOMEBREW_DIRECTORY" + "$PROJECT_SIMULATE_RUN" \ + "homebrew" if [ $? -ne 0 ]; then I18N_Setup_Failed return 1 fi + FS_Make_Directory "$1" + # report status return 0 diff --git a/automataCI/_release-homebrew_windows-any.ps1 b/automataCI/_release-homebrew_windows-any.ps1 index 30c48713..a7402c54 100644 --- a/automataCI/_release-homebrew_windows-any.ps1 +++ b/automataCI/_release-homebrew_windows-any.ps1 @@ -9,11 +9,12 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +. "${env:LIBS_AUTOMATACI}\services\io\os.ps1" . "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" . "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" -. "${env:LIBS_AUTOMATACI}\services\versioners\git.ps1" . "${env:LIBS_AUTOMATACI}\services\publishers\homebrew.ps1" +. "${env:LIBS_AUTOMATACI}\services\versioners\git.ps1" @@ -27,90 +28,82 @@ if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { -function RELEASE-Run-HOMEBREW { - param( - [string]$___target, - [string]$___repo - ) - - - # validate input - $___process = HOMEBREW-Is-Valid-Formula "${___target}" - if ($___process -ne 0) { - return 0 - } - - $null = I18N-Export "${___target}" - if (($(STRINGS-Is-Empty "${___target}") -eq 0) -or - ($(STRINGS-Is-Empty "${___repo}") -eq 0)) { - $null = I18N-Export-Failed - return 1 - } - - - # execute - $___process = HOMEBREW-Publish "${___target}" "${___repo}/Formula/${env:PROJECT_SKU}.rb" - if ($___process -ne 0) { - $null = I18N-Export-Failed - return 1 - } - - - # report status - return 0 -} +# define operating variables +$HOMEBREW_REPO = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}\homebrew" function RELEASE-Conclude-HOMEBREW { param( - [string]$___directory + [string]$__repo_directory ) # validate input - $null = I18N-Commit "HOMEBREW" - if ($(STRINGS-Is-Empty "${___directory}") -eq 0) { - $null = I18N-Commit-Failed - return 1 + if ($(STRINGS-Is-Empty "${env:PROJECT_HOMEBREW_URL}") -eq 0) { + return 0 # disabled explictly } - $___process = FS-Is-Directory "${___directory}" - if ($___process -ne 0) { - $null = I18N-Commit-Failed - return 1 + + # execute + $null = I18N-Conclude "HOMEBREW" + if ($(OS-Is-Run-Simulated) -eq 0) { + $null = I18N-Simulate-Conclude "HOMEBREW" + return 0 } - # execute + # commit the formula first $__current_path = Get-Location - $null = Set-Location "${___directory}" - $___process = GIT-Autonomous-Commit "${env:PROJECT_SKU} ${env:PROJECT_VERSION}" + $null = Set-Location "${__repo_directory}" + $___process = GIT-Pull-To-Latest if ($___process -ne 0) { $null = Set-Location "${__curent_path}" $null = Remove-Variable __current_path - $null = I18N-Commit-Failed + $null = I18N-Conclude-Failed return 1 } - - $___process = GIT-Pull-To-Latest + $___process = GIT-Autonomous-Commit "${env:PROJECT_SKU} ${env:PROJECT_VERSION}" if ($___process -ne 0) { $null = Set-Location "${__curent_path}" $null = Remove-Variable __current_path - $null = I18N-Commit-Failed + $null = I18N-Conclude-Failed return 1 } - $___process = GIT-Push ` "${env:PROJECT_HOMEBREW_REPO_KEY}" ` "${env:PROJECT_HOMEBREW_REPO_BRANCH}" $null = Set-Location "${__curent_path}" $null = Remove-Variable __current_path if ($___process -ne 0) { - $null = I18N-Commit-Failed + $null = I18N-Conclude-Failed + return 1 + } + + + # clean up in case of other release configurations + if ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_REPO}") -ne 0) { + # remove traces - single unified repository will take over later + $___process = FS-Remove "${__repo_directory}" + if ($___process -ne 0) { + $null = I18N-Conclude-Failed + return 1 + } + } + + switch ("$(STRINGS-To-Lowercase "${env:PROJECT_RELEASE_REPO_TYPE}")") { + "local" { + # remove traces - formula is never stray from its tap repository. + } default { + return 0 + }} + + $___process = FS-Remove "${__repo_directory}" + if ($___process -ne 0) { + $null = I18N-Conclude-Failed return 1 } @@ -122,30 +115,78 @@ function RELEASE-Conclude-HOMEBREW { +function RELEASE-Run-HOMEBREW { + param( + [string]$__target, + [string]$__repo_directory + ) + + + # validate input + $___process = HOMEBREW-Is-Valid-Formula "${__target}" + if ($___process -ne 0) { + return 0 + } + + if ($(STRINGS-Is-Empty "${env:PROJECT_HOMEBREW_URL}") -eq 0) { + return 0 # disabled explictly + } + + + # execute + $null = I18N-Publish "HOMEBREW" + if ($(OS-Is-Run-Simulated) -ne 0) { + $__dest = $(FS-Get-File "${__target}").Substring(0,1) + $__dest = "${___repo_directory}\Formula\${__dest}\$(FS_Get_File "${__target}")" + $null = FS-Make-Housing-Directory "${__dest}" + $___process = FS-Copy-File "${__target}" "${__dest}" + if ($___process -ne 0) { + $null = I18N-Publish-Failed + return 1 + } + } else { + # always simulate in case of error or mishaps before any point of no return + $null = I18N-Simulate-Publish "HOMEBREW" + } + + + # report status + return 0 +} + + + + function RELEASE-Setup-HOMEBREW { - # clean up base directory + param( + [string]$__repo_directory + ) + + + # validate input $null = I18N-Check "HOMEBREW" - $___process = FS-Is-File "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}" - if ($___process -eq 0) { - $null = I18N-Check-Failed - return 1 + if ($(STRINGS-Is-Empty "${env:PROJECT_HOMEBREW_URL}") -eq 0) { + $null = I18N-Check-Disabled-Skipped + return 0 # disabled explictly } - $null = FS-Make-Directory "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}" # execute $null = I18N-Setup "HOMEBREW" + $null = FS-Make-Housing-Directory "${__repo_directory}" $___process = GIT-Clone-Repo ` "${env:PROJECT_PATH_ROOT}" ` "${env:PROJECT_PATH_RELEASE}" ` "$(Get-Location)" ` "${env:PROJECT_HOMEBREW_REPO}" ` - "${env:PROJECT_SIMULATE_RELEASE_REPO}" ` - "${env:PROJECT_HOMEBREW_DIRECTORY}" - if ($___process -ne 0) { - $null = I18N-Setup-Failed - return 1 - } + "${env:PROJECT_SIMULATE_RUN}" ` + "homebrew" + if ($___process -ne 0) { + $null = I18N-Setup-Failed + return 1 + } + + $null = FS-Make-Directory "${__repo_directory}" # report status diff --git a/automataCI/_release-lib_unix-any.sh b/automataCI/_release-lib_unix-any.sh index 2b6b4621..cd7f60e9 100644 --- a/automataCI/_release-lib_unix-any.sh +++ b/automataCI/_release-lib_unix-any.sh @@ -10,8 +10,8 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations under # the License. -. "${LIBS_AUTOMATACI}/services/io/fs.sh" . "${LIBS_AUTOMATACI}/services/io/os.sh" +. "${LIBS_AUTOMATACI}/services/io/fs.sh" . "${LIBS_AUTOMATACI}/services/io/strings.sh" . "${LIBS_AUTOMATACI}/services/archive/tar.sh" . "${LIBS_AUTOMATACI}/services/archive/zip.sh" @@ -31,15 +31,15 @@ fi RELEASE_Run_LIBS() { - #_target="$1" + #__target="$1" # validate input - if [ $(STRINGS_Is_Empty "$PROJECT_SOURCE_RELEASE_TAG_LATEST") -eq 0 ]; then + if [ $(FS_Is_Target_A_Library "$1") -ne 0 ]; then return 0 fi - if [ $(FS_Is_Target_A_Library "$1") -ne 0 ]; then + if [ $(STRINGS_Is_Empty "$PROJECT_SOURCE_RELEASE_TAG_LATEST") -eq 0 ]; then return 0 fi @@ -54,7 +54,6 @@ RELEASE_Run_LIBS() { # execute - ## identify tag __branch="v${PROJECT_VERSION}" if [ $(FS_Is_Target_A_NPM "$1") -eq 0 ]; then if [ $(STRINGS_Is_Empty "$PROJECT_NODE_BRANCH_TAG") -eq 0 ]; then @@ -62,17 +61,26 @@ RELEASE_Run_LIBS() { fi __branch="${__branch}_${PROJECT_NODE_BRANCH_TAG}" + elif [ $(FS_Is_Target_A_C "$1") -eq 0 ]; then + if [ $(STRINGS_Is_Empty "$PROJECT_C_BRANCH_TAG") -eq 0 ]; then + return 0 + fi + + __branch="${__branch}_${PROJECT_C_BRANCH_TAG}" else return 0 fi + + # begin publication I18N_Publish "git@$__branch" if [ $(OS_Is_Run_Simulated) -eq 0 ]; then I18N_Simulate_Publish "$__branch" return 0 fi - ## create workspace directory + + # create workspace directory __workspace="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/release-branch_${__branch}" GIT_Setup_Workspace_Bare "$PROJECT_SOURCE_GIT_REMOTE" "$__branch" "$__workspace" if [ $? -ne 0 ]; then @@ -80,7 +88,8 @@ RELEASE_Run_LIBS() { return 1 fi - ## unpack package into directory + + # unpack package into directory if [ $(FS_Is_Target_A_TARGZ "$1") -eq 0 ]; then TAR_Extract_GZ "$__workspace" "$1" elif [ $(FS_Is_Target_A_TARXZ "$1") -eq 0 ]; then @@ -96,7 +105,8 @@ RELEASE_Run_LIBS() { return 1 fi - ## commit release + + # commit release __current_path="$PWD" && cd "$__workspace" GIT_Autonomous_Commit "$__branch" ___process=$? @@ -106,7 +116,8 @@ RELEASE_Run_LIBS() { return 1 fi - ## push to upstream + + # push to upstream GIT_Push_Specific "$__workspace" \ "$PROJECT_SOURCE_GIT_REMOTE" \ "$__branch" \ diff --git a/automataCI/_release-lib_windows-any.ps1 b/automataCI/_release-lib_windows-any.ps1 index 56fe45f1..08017365 100644 --- a/automataCI/_release-lib_windows-any.ps1 +++ b/automataCI/_release-lib_windows-any.ps1 @@ -9,8 +9,8 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" . "${env:LIBS_AUTOMATACI}\services\io\os.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" . "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" . "${env:LIBS_AUTOMATACI}\services\archive\tar.ps1" . "${env:LIBS_AUTOMATACI}\services\archive\zip.ps1" @@ -31,17 +31,17 @@ if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { function RELEASE-Run-LIBS { param( - [string]$_target + [string]$__target ) # validate input - if ($(STRINGS-Is-Empty "${env:PROJECT_SOURCE_RELEASE_TAG_LATEST}") -eq 0) { + $___process = FS-Is-Target-A-Library "${__target}" + if ($___process -ne 0) { return 0 } - $___process = FS-Is-Target-A-Library "${_target}" - if ($___process -ne 0) { + if ($(STRINGS-Is-Empty "${env:PROJECT_SOURCE_RELEASE_TAG_LATEST}") -eq 0) { return 0 } @@ -56,26 +56,34 @@ function RELEASE-Run-LIBS { # execute - ## identify tag $__branch = "v${env:PROJECT_VERSION}" - if ($(FS-Is-Target-A-NPM "${_target}") -eq 0) { + if ($(FS-Is-Target-A-NPM "${__target}") -eq 0) { if ($(STRINGS-Is-Empty "${env:PROJECT_NODE_BRANCH_TAG}") -eq 0) { return 0 } $__branch = "${__branch}_${env:PROJECT_NODE_BRANCH_TAG}" + } elseif ($(FS-Is-Target-A-C "${__target}") -eq 0) { + if ($(STRINGS-Is-Empty "${env:PROJECT_C_BRANCH_TAG}") -eq 0) { + return 0 + } + + $__branch = "${__branch}_${env:PROJECT_C_BRANCH_TAG}" } else { return 0 } + + # begin publication $null = I18N-Publish "git@${__branch}" if ($(OS-Is-Run-Simulated) -eq 0) { $null = I18N-Simulate-Publish "${__branch}" return 0 } - ## create workspace directory - $__workspace = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\release-branch_${_branch}" + + # create workspace directory + $__workspace = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\release-branch_${__branch}" $___process = GIT-Setup-Workspace-Bare ` "${env:PROJECT_SOURCE_GIT_REMOTE}" ` "${__branch}" ` @@ -85,15 +93,16 @@ function RELEASE-Run-LIBS { return 1 } - ## unpack package into directory - if ($(FS-Is-Target-A-TARGZ "$1") -eq 0) { - $___process = TAR-Extract-GZ "${__workspace}" "${_target}" - } elseif ($(FS-Is-Target-A-TARXZ "$1") -eq 0) { - $___process = TAR-Extract-XZ "${__workspace}" "${_target}" - } elseif ($(FS-Is-Target-A-ZIP "$1") -eq 0) { - $___process = ZIP-Extract "${__workspace}" "${_target}" + + # unpack package into directory + if ($(FS-Is-Target-A-TARGZ "${__target}") -eq 0) { + $___process = TAR-Extract-GZ "${__workspace}" "${__target}" + } elseif ($(FS-Is-Target-A-TARXZ "${__target}") -eq 0) { + $___process = TAR-Extract-XZ "${__workspace}" "${__target}" + } elseif ($(FS-Is-Target-A-ZIP "${__target}") -eq 0) { + $___process = ZIP-Extract "${__workspace}" "${__target}" } else { - $___process = FS-Copy-File "${_target}" "${__workspace}" + $___process = FS-Copy-File "${__target}" "${__workspace}" } if ($___process -ne 0) { @@ -101,7 +110,8 @@ function RELEASE-Run-LIBS { return 1 } - ## commit release + + # commit release $__current_path = Get-Location $null = Set-Location -Path "${__workspace}" $___process = GIT-Autonomous-Commit "${__branch}" @@ -112,7 +122,8 @@ function RELEASE-Run-LIBS { return 1 } - ## push to upstream + + # push to upstream $___process = GIT-Push-Specific "${__workspace}" ` "${env:PROJECT_SOURCE_GIT_REMOTE}" ` "${__branch}" diff --git a/automataCI/_release-npm_unix-any.sh b/automataCI/_release-npm_unix-any.sh index d3090853..566815dc 100644 --- a/automataCI/_release-npm_unix-any.sh +++ b/automataCI/_release-npm_unix-any.sh @@ -10,8 +10,8 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations under # the License. -. "${LIBS_AUTOMATACI}/services/io/fs.sh" . "${LIBS_AUTOMATACI}/services/io/os.sh" +. "${LIBS_AUTOMATACI}/services/io/fs.sh" . "${LIBS_AUTOMATACI}/services/i18n/translations.sh" . "${LIBS_AUTOMATACI}/services/compilers/node.sh" @@ -28,7 +28,7 @@ fi RELEASE_Run_NPM() { - #_target="$1" + #__target="$1" # validate input @@ -37,6 +37,10 @@ RELEASE_Run_NPM() { return 0 fi + if [ $(STRINGS_Is_Empty "$PROJECT_NODE") -eq 0 ]; then + return 0 # disabled explicitly + fi + I18N_Activate_Environment NODE_Activate_Local_Environment if [ $? -ne 0 ]; then @@ -46,19 +50,23 @@ RELEASE_Run_NPM() { # execute - I18N_Check_Login "NPM" - NODE_NPM_Check_Login - if [ $? -eq 0 ]; then - I18N_Publish "NPM" - if [ $(OS_Is_Run_Simulated) -eq 0 ]; then - I18N_Simulate_Publish "$1" - else - NODE_NPM_Publish "$1" - if [ $? -ne 0 ]; then - I18N_Publish_Failed - return 1 - fi + I18N_Publish "NPM" + if [ $(OS_Is_Run_Simulated) -ne 0 ]; then + I18N_Check_Login "NPM" + NODE_NPM_Check_Login + if [ $? -ne 0 ]; then + I18N_Publish_Failed + return 1 + fi + + NODE_NPM_Publish "$1" + if [ $? -ne 0 ]; then + I18N_Publish_Failed + return 1 fi + else + # always simulate in case of error or mishaps before any point of no return + I18N_Simulate_Publish "NPM" fi diff --git a/automataCI/_release-npm_windows-any.ps1 b/automataCI/_release-npm_windows-any.ps1 index 0d620d8b..23e186f3 100644 --- a/automataCI/_release-npm_windows-any.ps1 +++ b/automataCI/_release-npm_windows-any.ps1 @@ -9,8 +9,8 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" . "${env:LIBS_AUTOMATACI}\services\io\os.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" . "${env:LIBS_AUTOMATACI}\services\compilers\node.ps1" @@ -28,16 +28,20 @@ if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { function RELEASE-Run-NPM { param( - [string]$_target + [string]$__target ) # validate input - $___process = NODE-NPM-Is-Valid "${_target}" + $___process = NODE-NPM-Is-Valid "${__target}" if ($___process -ne 0) { return 0 } + if ($(STRINGS-Is-Empty "${env:PROJECT_NODE}") -eq 0) { + return 0 # disabled explicitly + } + $null = I18N-Activate-Environment $___process = NODE-Activate-Local-Environment if ($___process -ne 0) { @@ -47,19 +51,23 @@ function RELEASE-Run-NPM { # execute - $null = I18N-Check-Login "NPM" - $___process = NODE-NPM-Check-Login - if ($___process -eq 0) { - $null = I18N-Publish "NPM" - if ($(OS-Is-Run-Simulated) -ne 0) { - $null = I18N-Simulate-Publish "${_target}" - } else { - $___process = NODE-NPM-Publish "${_target}" - if ($___process -ne 0) { - $null = I18N-Publish-Failed - return 1 - } + $null = I18N-Publish "NPM" + if ($(OS-Is-Run-Simulated) -ne 0) { + $null = I18N-Check-Login "NPM" + $___process = NODE-NPM-Check-Login + if ($___process -ne 0) { + $null = I18N-Publish-Failed + return 1 + } + + $___process = NODE-NPM-Publish "${__target}" + if ($___process -ne 0) { + $null = I18N-Publish-Failed + return 1 } + } else { + # always simulate in case of error or mishaps before any point of no return + $null = I18N-Simulate-Publish "NPM" } diff --git a/automataCI/_release-project_unix-any.sh b/automataCI/_release-project_unix-any.sh new file mode 100644 index 00000000..939fb18b --- /dev/null +++ b/automataCI/_release-project_unix-any.sh @@ -0,0 +1,95 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +. "${LIBS_AUTOMATACI}/services/io/os.sh" +. "${LIBS_AUTOMATACI}/services/io/fs.sh" +. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" +. "${LIBS_AUTOMATACI}/services/versioners/git.sh" + + + + +# initialize +if [ "$PROJECT_PATH_ROOT" = "" ]; then + >&2 printf "[ ERROR ] - Please run me from automataCI/ci.sh.ps1 instead!\n" + return 1 +fi + + + + +RELEASE_Conclude_PROJECT() { + # execute + I18N_Conclude "$PROJECT_VERSION" + if [ $(OS_Is_Run_Simulated) -eq 0 ]; then + I18N_Simulate_Conclude "$PROJECT_VERSION" + return 0 + fi + + + FS_Is_Directory "${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}" + if [ $? -eq 0 ] && [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_REPO") -ne 0 ]; then + # commit single unified repository + I18N_Commit "$PROJECT_RELEASE_REPO" + __current_path="$PWD" && cd "${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}" + GIT_Autonomous_Force_Commit \ + "$PROJECT_VERSION" \ + "$PROJECT_RELEASE_REPO_KEY" \ + "$PROJECT_RELEASE_REPO_BRANCH" + ___process=$? + cd "$__current_path" && unset __current_path + if [ $___process -ne 0 ]; then + I18N_Commit_Failed + return 1 + fi + fi + + + # report status + return 0 +} + + + + +RELEASE_Setup_PROJECT() { + # execute + I18N_Setup "${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}" + if [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_REPO") -ne 0 ]; then + I18N_Setup "$PROJECT_RELEASE_REPO" + GIT_Is_Available + if [ $? -ne 0 ]; then + I18N_Setup_Failed + return 1 + fi + + FS_Remove_Silently "${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}" + __current_path="$PWD" && cd "$PROJECT_PATH_ROOT" + git clone "$PROJECT_RELEASE_REPO" "$PROJECT_PATH_RELEASE" + ___process=$? + cd "$__current_path" && unset __current_path + if [ $___process -ne 0 ]; then + I18N_Setup_Failed + return 1 + fi + else + FS_Remake_Directory "${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}" + if [ $? -ne 0 ]; then + I18N_Setup_Failed + return 1 + fi + fi + + + # report status + return 0 +} diff --git a/automataCI/_release-project_windows-any.ps1 b/automataCI/_release-project_windows-any.ps1 new file mode 100644 index 00000000..c53744e0 --- /dev/null +++ b/automataCI/_release-project_windows-any.ps1 @@ -0,0 +1,97 @@ +# Copyright 2023 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +. "${env:LIBS_AUTOMATACI}\services\io\os.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" +. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" +. "${env:LIBS_AUTOMATACI}\services\compilers\changelog.ps1" +. "${env:LIBS_AUTOMATACI}\services\versioners\git.ps1" + + + + +# initialize +if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { + Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" + return +} + + + + +function RELEASE-Conclude-PROJECT { + # execute + $null = I18N-Conclude "${env:PROJECT_VERSION}" + if ($(OS-Is-Run-Simulated) -eq 0) { + $null = I18N-Simulate-Conclude "${env:PROJECT_VERSION}" + return 0 + } + + $___process = FS-Is-Directory "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}" + if (($___process -eq 0) -and ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_REPO}") -ne 0)) { + # commit single unified repository + $null = I18N-Commit "${env:PROJECT_RELEASE_REPO}" + $__current_path = Get-Location + $null = Set-Location "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}" + $___process = GIT-Autonomous-Force-Commit ` + "${env:PROJECT_VERSION}" ` + "${env:PROJECT_RELEASE_REPO_KEY}" ` + "${env:PROJECT_RELEASE_REPO_BRANCH}" + $null = Set-Location "${__current_path}" + $null = Remove-Variable __current_path + if ($___process -ne 0) { + $null = I18N-Commit-Failed + return 1 + } + } + + + # return status + return 0 +} + + + + +function RELEASE-Setup-PROJECT { + # execute + $null = I18N-Setup "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}" + if ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_REPO}") -ne 0) { + $null = I18N-Setup "${env:PROJECT_RELEASE_REPO}" + $___process = GIT-Is-Available + if ($___process -ne 0) { + $null = I18N-Setup-Failed + return 1 + } + + $null = FS-Remove-Silently "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}" + $__current_path = Get-Location + $null = Set-Location "${env:PROJECT_PATH_ROOT}" + $___process = OS-Exec "git" ` + "clone `"${env:PROJECT_RELEASE_REPO}`" `"${env:PROJECT_PATH_RELEASE}`"" + $null = Set-Location "${__current_path}" + $null = Remove-Variable __current_path + if ($___process -ne 0) { + $null = I18N-Setup-Failed + return 1 + } + } else { + $___process = FS-Remake-Directory "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}" + if ($___process -ne 0) { + $null = I18N-Setup-Failed + return 1 + } + } + + + # report status + return 0 +} diff --git a/automataCI/_release-pdf_unix-any.sh b/automataCI/_release-research_unix-any.sh similarity index 66% rename from automataCI/_release-pdf_unix-any.sh rename to automataCI/_release-research_unix-any.sh index 8482988a..77bc2c0c 100644 --- a/automataCI/_release-pdf_unix-any.sh +++ b/automataCI/_release-research_unix-any.sh @@ -10,6 +10,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations under # the License. +. "${LIBS_AUTOMATACI}/services/io/os.sh" . "${LIBS_AUTOMATACI}/services/io/fs.sh" . "${LIBS_AUTOMATACI}/services/i18n/translations.sh" @@ -25,8 +26,8 @@ fi -RELEASE_Run_PDF() { - #_target="$1" +RELEASE_Run_RESEARCH() { + #__target="$1" # validate input @@ -34,18 +35,25 @@ RELEASE_Run_PDF() { return 0 fi + if [ "${1##*${PROJECT_RESEARCH_IDENTIFIER}}" = "$1" ]; then + return 0 # not a research paper + fi + # execute - ___dest="PAPER.pdf" - I18N_Publish "$___dest" - ___dest="${PROJECT_PATH_ROOT}/${___dest}" - if [ "${1##*${PROJECT_RESEARCH_IDENTIFIER}}" != "$1" ]; then - ## it's a research paper - FS_Copy_File "$1" "$___dest" + I18N_Publish "RESEARCH" + if [ $(OS_Is_Run_Simulated) -ne 0 ]; then + __dest="PAPER.pdf" + __dest="${PROJECT_PATH_ROOT}/${__dest}" + I18N_Publish "$__dest" + FS_Copy_File "$1" "$__dest" if [ $? -ne 0 ]; then I18N_Publish_Failed return 1 fi + else + # always simulate in case of error or mishaps before any point of no return + I18N_Simulate_Publish "RESEARCH" fi diff --git a/automataCI/_release-pdf_windows-any.ps1 b/automataCI/_release-research_windows-any.ps1 similarity index 62% rename from automataCI/_release-pdf_windows-any.ps1 rename to automataCI/_release-research_windows-any.ps1 index 2c4ec0bc..405d0741 100644 --- a/automataCI/_release-pdf_windows-any.ps1 +++ b/automataCI/_release-research_windows-any.ps1 @@ -9,6 +9,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +. "${env:LIBS_AUTOMATACI}\services\io\os.ps1" . "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" @@ -24,30 +25,37 @@ if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { -function RELEASE-Run-PDF { +function RELEASE-Run-RESEARCH { param( - [string]$_target + [string]$__target ) # validate input - $___process = FS-Is-Target-A-PDF "${_target}" + $___process = FS-Is-Target-A-PDF "${__target}" if ($___process -ne 0) { return 0 } + if ($($__target -replace "^.*${env:PROJECT_RESEARCH_IDENTIFIER}") -eq "${__target}") { + return 0 # not a research paper + } + # execute - $___dest = "PAPER.pdf" - $null = I18N-Publish "${___dest}" - $___dest = "${env:PROJECT_PATH_ROOT}\${___dest}" - if ($($_target -replace "^.*${env:PROJECT_RESEARCH_IDENTIFIER}") -ne "${_target}") { - ## it's a research paper - $___process = FS-Copy-File "${_target}" "${___dest}" + $null = I18N-Publish "RESEARCH" + if ($(OS-Is-Run-Simulated) -ne 0) { + $__dest = "PAPER.pdf" + $null = I18N-Publish "${__dest}" + $__dest = "${env:PROJECT_PATH_ROOT}\${__dest}" + $___process = FS-Copy-File "${__target}" "${__dest}" if ($___process -ne 0) { $null = I18N-Publish-Failed return 1 } + } else { + # always simulate in case of error or mishaps before any point of no return + $null = I18N-Simulate-Publish "RESEARCH" } diff --git a/automataCI/_release-rpm_unix-any.sh b/automataCI/_release-rpm_unix-any.sh index e422fd3d..054b79e7 100644 --- a/automataCI/_release-rpm_unix-any.sh +++ b/automataCI/_release-rpm_unix-any.sh @@ -11,9 +11,12 @@ # License for the specific language governing permissions and limitations under # the License. . "${LIBS_AUTOMATACI}/services/io/fs.sh" +. "${LIBS_AUTOMATACI}/services/io/os.sh" +. "${LIBS_AUTOMATACI}/services/io/strings.sh" . "${LIBS_AUTOMATACI}/services/i18n/translations.sh" . "${LIBS_AUTOMATACI}/services/compilers/rpm.sh" . "${LIBS_AUTOMATACI}/services/publishers/createrepo.sh" +. "${LIBS_AUTOMATACI}/services/versioners/git.sh" @@ -27,41 +30,261 @@ fi +# define operating variables +RPM_REPO="${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}" # default: flat mode +if [ $(STRINGS_Is_Empty "$PROJECT_RPM_FLAT_MODE") -eq 0 ]; then + ## conventional mode + RPM_REPO="${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}/rpm" + case "$(STRINGS_To_Lowercase "$PROJECT_RELEASE_REPO_TYPE")" in + local) + # retain existing path + ;; + *) + # fallback to git mode + if [ $(STRINGS_Is_Empty "$PROJECT_RPM_PATH") -ne 0 ]; then + RPM_REPO="${RPM_REPO}/${PROJECT_RPM_PATH}" + fi + ;; + esac + + ## overrides if PROJECT_RELEASE_REPO is set + if [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_REPO") -ne 0 ]; then + RPM_REPO="${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}/rpm" + fi +fi + + + + +RELEASE_Conclude_RPM() { + #__repo_directory="$1" + + + # validate input + if [ $(STRINGS_Is_Empty "$PROJECT_RPM_URL") -eq 0 ]; then + return 0 # disabled explicitly + fi + + CREATEREPO_Is_Available + if [ $? -ne 0 ]; then + return 0 # nothing to execute without createrepo or createrepo_c. + fi + + + # execute + I18N_Conclude "RPM" + if [ $(OS_Is_Run_Simulated) -eq 0 ]; then + I18N_Simulate_Conclude "RPM" + return 0 + elif [ $(STRINGS_Is_Empty "$PROJECT_RPM_FLAT_MODE") -ne 0 ]; then + # nothing to do in flat mode - report status + return 0 + elif [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_REPO") -ne 0 ]; then + # do nothing - single unified repository will take over later + return 0 + fi + + case "$(STRINGS_To_Lowercase "$PROJECT_RELEASE_REPO_TYPE")" in + local) + # nothing to do for local directory type - report status + return 0 + ;; + *) + # repository is an independent git repository so proceed as follows. + ;; + esac + + + # commit release + __current_path="$PWD" && cd "$1" + GIT_Autonomous_Force_Commit \ + "$PROJECT_VERSION" \ + "$PROJECT_RPM_REPO_KEY" \ + "$PROJECT_RPM_REPO_BRANCH" + ___process=$? + cd "$__current_path" && unset __current_path + if [ $___process -ne 0 ]; then + I18N_Conclude_Failed + return 1 + fi + + + # report status + return 0 +} + + + + RELEASE_Run_RPM() { - __target="$1" - __directory="$2" + #__target="$1" + #__repo_directory="$2" # validate input - RPM_Is_Valid "$__target" + RPM_Is_Valid "$1" if [ $? -ne 0 ]; then return 0 fi + if [ $(STRINGS_Is_Empty "$PROJECT_RPM_URL") -eq 0 ]; then + return 0 # disabled explicitly + fi + + CREATEREPO_Is_Available + if [ $? -ne 0 ]; then + return 0 # can't execute without createrepo or createrepo_c. + fi + + + # execute + I18N_Publish "RPM" + if [ $(OS_Is_Run_Simulated) -ne 0 ]; then + if [ $(STRINGS_Is_Empty "$PROJECT_RPM_FLAT_MODE") -eq 0 ]; then + FS_Copy_File "$1" "${2}/$(FS_Get_File "$1")" + if [ $? -ne 0 ]; then + I18N_Publish_Failed + return 1 + fi + fi + else + # always simulate in case of error or mishaps before any point of no return + I18N_Simulate_Publish "RPM" + fi + + + # report status + return 0 +} + + + + +RELEASE_Setup_RPM() { + #__repo_directory="$1" + + + # validate input + I18N_Check "RPM" + if [ $(STRINGS_Is_Empty "$PROJECT_RPM_URL") -eq 0 ]; then + I18N_Check_Disabled_Skipped + return 0 # disabled explicitly + fi + I18N_Check_Availability "CREATEREPO" CREATEREPO_Is_Available if [ $? -ne 0 ]; then I18N_Check_Failed_Skipped - return 0 + return 0 # pipeline cannot run without createrepo or createrepo_c fi # execute - __dest="${__directory}/rpm" - I18N_Create "$__dest" - FS_Make_Directory "${__dest}" + I18N_Setup "RPM" + if [ $(STRINGS_Is_Empty "$PROJECT_RPM_FLAT_MODE") -eq 0 ]; then + # conventional mode + if [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_REPO") -ne 0 ]; then + ## overridden by single unified repository + FS_Remake_Directory "$1" + return 0 + fi + + case "$(STRINGS_To_Lowercase "$PROJECT_RELEASE_REPO_TYPE")" in + local) + ## local file directory type + FS_Remake_Directory "$1" + return 0 + ;; + *) + ## fallback to git repository source + ;; + esac + + FS_Make_Housing_Directory "$1" + GIT_Clone_Repo \ + "$PROJECT_PATH_ROOT" \ + "$PROJECT_PATH_RELEASE" \ + "$PWD" \ + "$PROJECT_RPM_REPO" \ + "$PROJECT_SIMULATE_RUN" \ + "rpm" + if [ $? -ne 0 ]; then + I18N_Setup_Failed + return 1 + fi + + FS_Make_Directory "$1" + fi + + + # report status + return 0 +} + + + + +RELEASE_Update_RPM() { + #__repo_directory="$1" + + + # validate input + if [ $(STRINGS_Is_Empty "$PROJECT_RPM_URL") -eq 0 ]; then + return 0 # disabled explicitly + fi + + CREATEREPO_Is_Available if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 + return 0 # can't execute without createrepo or createrepo_c. fi - I18N_Publish "CREATEREPO" - CREATEREPO_Publish "$__target" "${__dest}" + + # execute + I18N_Publish "RPM" + if [ $(OS_Is_Run_Simulated) -eq 0 ]; then + I18N_Simulate_Publish "RPM" + return 0 + fi + + CREATEREPO_Publish "$1" if [ $? -ne 0 ]; then I18N_Publish_Failed return 1 fi + if [ $(STRINGS_Is_Empty "$PROJECT_RPM_FLAT_MODE") -ne 0 ]; then + # flattening requested + RPM_Flatten_Repo "$1" \ + "$PROJECT_RPM_REPOXML_NAME" \ + "$PROJECT_RPM_METALINK" \ + "$PROJECT_RPM_URL" + if [ $? -ne 0 ]; then + I18N_Publish_Failed + return 1 + fi + fi + + + # create the README.md + if [ $(STRINGS_Is_Empty "$PROJECT_RPM_FLAT_MODE") -ne 0 ]; then + # stop here - report status + return 0 + fi + + __dest="${1}/RPM_Repository.md" + I18N_Create "$__dest" + FS_Make_Housing_Directory "$__dest" + FS_Remove_Silently "$__dest" + FS_Write_File "$__dest" "\ +# RPM Distribution Repository + +This directory is now re-purposed to host RPM packages repository. +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + # report status return 0 diff --git a/automataCI/_release-rpm_windows-any.ps1 b/automataCI/_release-rpm_windows-any.ps1 index 5780304b..4131c133 100644 --- a/automataCI/_release-rpm_windows-any.ps1 +++ b/automataCI/_release-rpm_windows-any.ps1 @@ -10,9 +10,12 @@ # License for the specific language governing permissions and limitations # under the License. . "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\os.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" . "${env:LIBS_AUTOMATACI}\services\compilers\rpm.ps1" . "${env:LIBS_AUTOMATACI}\services\publishers\createrepo.ps1" +. "${env:LIBS_AUTOMATACI}\services\versioners\git.ps1" @@ -26,10 +29,98 @@ if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { +# define operating variables +$RPM_REPO = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_PKG}" # default: flat mode +if ($(STRINGS-Is-Empty "${env:PROJECT_RPM_FLAT_MODE}") -eq 0) { + ## conventional mode + $RPM_REPO = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}\rpm" + switch ("$(STRINGS-To-Lowercase "${env:PROJECT_RELEASE_REPO_TYPE}")") { + "local" { + # retain existing path + } default { + # fallback to git mode + if ($(STRINGS-Is-Empty "${env:PROJECT_RPM_PATH}") -ne 0) { + $RPM_REPO = "${RPM_REPO}\${PROJECT_RPM_PATH}" + } + }} + + ## overrides if PROJECT_RELEASE_REPO is set + if ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_REPO}") -ne 0) { + $RPM_REPO = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}\rpm" + } +} + + + + +function RELEASE-Conclude-RPM { + param( + [string]$__repo_directory + ) + + + # validate input + if ($(STRINGS-Is-Empty "${env:PROJECT_RPM_URL}") -eq 0) { + return 0 # disabled explictly + } + + $___process = CREATEREPO-Is-Available + if ($___process -ne 0) { + return 0 # nothing to execute without createrepo or createrepo_c. + } + + + # execute + $null = I18N-Conclude "RPM" + if ($(OS-Is-Run-Simulated) -eq 0) { + $null = I18N-Simulate-Conclude "RPM" + return 0 + } + + + if ($(STRINGS-Is-Empty "${env:PROJECT_RPM_FLAT_MODE}") -ne 0) { + # nothing to do in flat mode - report status + return 0 + } elseif ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_REPO}") -ne 0) { + # do nothing - single unified repository will take over later + return 0 + } + + switch ("$(STRINGS-To-Lowercase "${env:PROJECT_RELEASE_REPO_TYPE}")") { + "local" { + # nothing to do for local directory type - report status + return 0 + } default { + # repository is an independent git repository so proceed as follows. + }} + + + # commit release + $__current_path = Get-Location + $null = Set-Location "${__repo_directory}" + $___process = Git-Autonomous-Force-Commit ` + "${env:PROJECT_VERSION}" ` + "${env:PROJECT_RPM_REPO_KEY}" ` + "${env:PROJECT_RPM_REPO_BRANCH}" + $null = Set-Location "${__curent_path}" + $null = Remove-Variable __current_path + if ($___process -ne 0) { + $null = I18N-Conclude-Failed + return 1 + } + + + # return status + return 0 +} + + + + function RELEASE-Run-RPM { param( [string]$__target, - [string]$__directory + [string]$__repo_directory ) @@ -39,30 +130,168 @@ function RELEASE-Run-RPM { return 0 } + if ($(STRINGS-Is-Empty "${env:PROJECT_RPM_URL}") -eq 0) { + return 0 # disabled explictly + } + + $___process = CREATEREPO-Is-Available + if ($___process -ne 0) { + return 0 # can't execute without createrepo or createrepo_c. + } + + + # execute + $null = I18N-Publish "RPM" + if ($(OS-Is-Run-Simulated) -ne 0) { + if ($(STRINGS-Is-Empty "${env:PROJECT_RPM_FLAT_MODE}") -eq 0) { + $___process = FS-Copy-File ` + "${__target}" ` + "${__repo_directory}/$(FS-Get-File "${__target}")" + if ($___process -ne 0) { + $null = I18N-Publish-Failed + return 1 + } + } + } else { + # always simulate in case of error or mishaps before any point of no return + $null = I18N-Simulate-Publish "RPM" + } + + + # report status + return 0 +} + + + + +function RELEASE-Setup-RPM { + param( + [string]$__repo_directory + ) + + + # validate input + $null = I18N-Check "RPM" + if ($(STRINGS-Is-Empty "${env:PROJECT_RPM_URL}") -eq 0) { + $null = I18N-Check-Disabled-Skipped + return 0 # disabled explictly + } + $null = I18N-Check-Availability "CREATEREPO" $___process = CREATEREPO-Is-Available if ($___process -ne 0) { $null = I18N-Check-Failed-Skipped - return 0 + return 0 # pipeline cannot run without createrepo or createrepo_c } # execute - $__dest = "${__directory}/rpm" - $null = I18N-Create "${__dest}" - $___process = FS-Make-Directory "${__dest}" + $null = I18N-Setup "RPM" + if ($(STRINGS-Is-Empty "${env:PROJECT_RPM_FLAT_MODE}") -eq 0) { + # conventional mode + if ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_REPO}") -eq 0) { + ## overridden by single unified repository + $null = FS-Remake-Directory "${__repo_directory}" + return 0 + } + + switch ("$(STRINGS-To-Lowercase "${env:PROJECT_RELEASE_REPO_TYPE}")") { + "local" { + ## local file directory type + $null = FS-Remake-Directory "${__repo_directory}" + return 0 + } default { + ## fallback to git repository source + }} + + $null = FS-Make-Housing-Directory "${__repo_directory}" + $___process = GIT-Clone-Repo ` + "${env:PROJECT_PATH_ROOT}" ` + "${env:PROJECT_PATH_RELEASE}" ` + "$(Get-Location)" ` + "${env:PROJECT_RPM_REPO}" ` + "${env:PROJECT_SIMULATE_RUN}" ` + "rpm" + if ($___process -ne 0) { + $null = I18N-Setup-Failed + return 1 + } + + $null = FS-Make-Directory "${__repo_directory}" + } + + + # report status + return 0 +} + + + + +function RELEASE-Update-RPM { + param( + [string]$__repo_directory + ) + + + # validate input + if ($(STRINGS-Is-Empty "${env:PROJECT_RPM_URL}") -eq 0) { + return 0 # disabled explictly + } + + $___process = CREATEREPO-Is-Available if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 + return 0 # can't execute without createrepo or createrepo_c. } - $null = I18N-Publish "CREATEREPO" - $___process = CREATEREPO-Publish "${__target}" "${__dest}" + + # execute + $null = I18N-Publish "RPM" + if ($(OS-Is-Run-Simulated) -eq 0) { + $null = I18N-Simulate-Publish "RPM" + return 0 + } + + $___process = CREATEREPO-Publish "${__repo_directory}" if ($___process -ne 0) { $null = I18N-Publish-Failed return 1 } + if ($(STRINGS-Is-Empty "$PROJECT_RPM_FLAT_MODE") -ne 0) { + $___process = RPM-Flatten-Repo "${__repo_directory}" ` + "${env:PROJECT_RPM_REPOXML_NAME}" ` + "${env:PROJECT_RPM_METALINK}" ` + "${env:PROJECT_RPM_URL}" + if ($___process -ne 0) { + $null = I18N-Publish-Failed + return 1 + } + } + + + # create the README.md + if ($(STRINGS-Is-Empty "${env:PROJECT_RPM_FLAT_MODE}") -eq 0) { + # stop here - report status + return 0 + } + + $___dest = "${__repo_directory}\RPM_Repository.md" + $null = I18N-Create "${__dest}" + $null = FS-Make-Housing-Directory "${__dest}" + $null = FS-Remove-Silently "${__dest}" + $___process = FS-Write-File "${__dest}" @" +# RPM Distribution Repository + +This directory is now re-purposed to host RPM packages repository. + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + # report status return 0 diff --git a/automataCI/_release-staticrepo_unix-any.sh b/automataCI/_release-staticrepo_unix-any.sh deleted file mode 100644 index fc7605b7..00000000 --- a/automataCI/_release-staticrepo_unix-any.sh +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/io/strings.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" -. "${LIBS_AUTOMATACI}/services/versioners/git.sh" - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run me from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - - - - -RELEASE_Conclude_STATIC_REPO() { - # validate input - I18N_Source "GIT COMMIT ID" - __tag="$(GIT_Get_Latest_Commit_ID)" - if [ $(STRINGS_Is_Empty "$__tag") -eq 0 ]; then - I18N_Source_Failed - return 1 - fi - - - # execute - __current_path="$PWD" - cd "${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}/${PROJECT_STATIC_REPO_DIRECTORY}" - - ___file="Home.md" - I18N_Create "$___file" - FS_Write_File "$___file" "\ -# ${PROJECT_NAME} Static Distribution Repository - -This is a re-purposed repository for housing various distribution ecosystem -such as but not limited to \`.deb\`, \`.rpm\`, \`.flatpak\`, and etc for folks -to \`apt-get install\`, \`yum install\`, or \`flatpak install\`. -" - - - I18N_Commit "STATIC REPO" - GIT_Autonomous_Force_Commit \ - "$__tag" \ - "$PROJECT_STATIC_REPO_KEY" \ - "$PROJECT_STATIC_REPO_BRANCH" - ___process=$? - - cd "$__current_path" && unset __current_path - - - # report status - if [ $___process -ne 0 ]; then - I18N_Commit_Failed - return 1 - fi - - return 0 -} - - - - -RELEASE_Setup_STATIC_REPO() { - # clean up base directory - I18N_Check "STATIC REPO" - FS_Is_File "${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}" - if [ $? -eq 0 ]; then - I18N_Check_Failed - return 1 - fi - FS_Make_Directory "${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}" - - - # execute - I18N_Setup "STATIC REPO" - GIT_Clone_Repo \ - "$PROJECT_PATH_ROOT" \ - "$PROJECT_PATH_RELEASE" \ - "$PWD" \ - "$PROJECT_STATIC_REPO" \ - "$PROJECT_SIMULATE_RELEASE_REPO" \ - "$PROJECT_STATIC_REPO_DIRECTORY" - if [ $? -ne 0 ]; then - I18N_Setup_Failed - return 1 - fi - - - # move existing items to static repo - __staging="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/${PROJECT_PATH_RELEASE}" - __dest="${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}/${PROJECT_STATIC_REPO_DIRECTORY}" - FS_Is_Directory "$__staging" - if [ $? -eq 0 ]; then - I18N_Export "STATIC REPO" - FS_Copy_All "${__staging}/" "$__dest" - if [ $? -ne 0 ]; then - I18N_Export_Failed - return 1 - fi - fi - - - # report status - return 0 -} diff --git a/automataCI/_release-staticrepo_windows-any.ps1 b/automataCI/_release-staticrepo_windows-any.ps1 deleted file mode 100644 index 2f60b82e..00000000 --- a/automataCI/_release-staticrepo_windows-any.ps1 +++ /dev/null @@ -1,115 +0,0 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" -. "${env:LIBS_AUTOMATACI}\services\versioners\git.ps1" - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - return -} - - - - - -function RELEASE-Conclude-STATIC-REPO { - # validate input - $null = I18N-Source "GIT COMMIT ID" - $__tag = GIT-Get-Latest-Commit-ID - if ($(STRINGS-Is-Empty "${__tag}") -eq 0) { - $null = I18N-Source-Failed - return 1 - } - - - # execute - $__current_path = Get-Location - $null = Set-Location "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}\${env:PROJECT_STATIC_REPO_DIRECTORY}" - - $__file = "Home.md" - $null = I18N-Create "${__file}" - $null = FS-Write-File "${__file}" @" -# ${env:PROJECT_NAME} Static Distribution Repository - -This is a re-purposed repository for housing various distribution ecosystem -such as but not limited to ``.deb``, ``.rpm``, ``.flatpak``, and etc for folks -to ``apt-get install``, ``yum install``, or ``flatpak install``. - -"@ - - $null = I18N-Commit "STATIC REPO" - $___process = Git-Autonomous-Force-Commit ` - "${__tag}" ` - "${env:PROJECT_STATIC_REPO_KEY}" ` - "${env:PROJECT_STATIC_REPO_BRANCH}" - - $null = Set-Location "${__curent_path}" - $null = Remove-Variable __current_path - - - # return status - if ($___process -ne 0) { - $null = I18N-Commit-Failed - return 1 - } - - return 0 -} - - - - -function RELEASE-Setup-STATIC-REPO { - # clean up base directory - $null = I18N-Check "STATIC REPO" - if ($(FS-Is-File "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}") -eq 0) { - $null = I18N-Check-Failed - return 1 - } - $null = FS-Make-Directory "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}" - - - # execute - $null = I18N-Setup "STATIC REPO" - $___process = GIT-Clone-Repo ` - "${env:PROJECT_PATH_ROOT}" ` - "${env:PROJECT_PATH_RELEASE}" ` - "$(Get-Location)" ` - "${env:PROJECT_STATIC_REPO}" ` - "${env:PROJECT_SIMULATE_RELEASE_REPO}" ` - "${env:PROJECT_STATIC_REPO_DIRECTORY}" - if ($___process -ne 0) { - $null = I18N-Setup-Failed - return 1 - } - - $__staging = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\${env:PROJECT_PATH_RELEASE}" - $__dest = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}\${env:PROJECT_STATIC_REPO_DIRECTORY}" - if ($(FS-Is-Directory "${__staging}") -eq 0) { - $null = I18N-Export "STATIC REPO" - $___process = FS-Copy-All "${__staging}/" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Export-Failed - return 1 - } - } - - - # report status - return 0 -} diff --git a/automataCI/common_unix-any.sh b/automataCI/common_unix-any.sh index ace249ef..c4fc41c8 100644 --- a/automataCI/common_unix-any.sh +++ b/automataCI/common_unix-any.sh @@ -92,12 +92,6 @@ if [ $? -ne 0 ]; then fi -Run_Subroutine_Exec "$PROJECT_C" "C" -if [ $? -ne 0 ]; then - return 1 -fi - - Run_Subroutine_Exec "$PROJECT_GO" "GO" if [ $? -ne 0 ]; then return 1 @@ -146,6 +140,15 @@ if [ $? -ne 0 ]; then fi +# IMPORTANT: C can set the terminal into a very strict mode after build causing +# other technological integrations to fail after run (e.g. flatpak). +# Therefore, it shall be placed as the last one to execute. +Run_Subroutine_Exec "$PROJECT_C" "C" +if [ $? -ne 0 ]; then + return 1 +fi + + # report status diff --git a/automataCI/common_windows-any.ps1 b/automataCI/common_windows-any.ps1 index d5bdb082..fb71873b 100644 --- a/automataCI/common_windows-any.ps1 +++ b/automataCI/common_windows-any.ps1 @@ -88,11 +88,6 @@ if ($___process -ne 0) { return 1 } -$___process = RUN-Subroutine-Exec "${env:PROJECT_C}" "C" -if ($___process -ne 0) { - return 1 -} - $___process = RUN-Subroutine-Exec "${env:PROJECT_GO}" "GO" if ($___process -ne 0) { return 1 @@ -133,6 +128,15 @@ if ($___process -ne 0) { return 1 } +# IMPORTANT: C on unix has some issue with setting the terminal into ultra +# strict mode after build causing other technological integrations +# to fail after run (e.g. flatpak). Therefore, it will be placed as +# the last one to execute. +$___process = RUN-Subroutine-Exec "${env:PROJECT_C}" "C" +if ($___process -ne 0) { + return 1 +} + diff --git a/automataCI/env_unix-any.sh b/automataCI/env_unix-any.sh index ddb64a28..42172966 100644 --- a/automataCI/env_unix-any.sh +++ b/automataCI/env_unix-any.sh @@ -37,7 +37,6 @@ fi . "${LIBS_AUTOMATACI}/services/publishers/dotnet.sh" . "${LIBS_AUTOMATACI}/services/publishers/github.sh" . "${LIBS_AUTOMATACI}/services/publishers/homebrew.sh" -. "${LIBS_AUTOMATACI}/services/publishers/reprepro.sh" @@ -91,14 +90,6 @@ if [ $? -ne 0 ]; then fi -I18N_Install "REPREPRO" -REPREPRO_Setup -if [ $? -ne 0 ]; then - I18N_Install_Failed - return 1 -fi - - I18N_Install "OSSLSIGNCODE" NOTARY_Setup_Microsoft if [ $? -ne 0 ]; then diff --git a/automataCI/env_windows-any.ps1 b/automataCI/env_windows-any.ps1 index e859436e..715f058b 100644 --- a/automataCI/env_windows-any.ps1 +++ b/automataCI/env_windows-any.ps1 @@ -35,7 +35,6 @@ if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { . "${env:LIBS_AUTOMATACI}\services\publishers\chocolatey.ps1" . "${env:LIBS_AUTOMATACI}\services\publishers\dotnet.ps1" . "${env:LIBS_AUTOMATACI}\services\publishers\github.ps1" -. "${env:LIBS_AUTOMATACI}\services\publishers\reprepro.ps1" @@ -90,13 +89,6 @@ if ($(MSI-Setup) -ne 0) { } -$null = I18N-Install "REPREPRO" -if ($(REPREPRO-Setup) -ne 0) { - $null = I18N-Install-Failed - return 1 -} - - if ($(STRINGS-Is-Empty "${env:PROJECT_PYTHON}") -ne 0) { $null = I18N-Install "PYTHON" if ($(PYTHON-Setup) -ne 0) { diff --git a/automataCI/package_unix-any.sh b/automataCI/package_unix-any.sh index 175d0e14..7e7a7c6e 100644 --- a/automataCI/package_unix-any.sh +++ b/automataCI/package_unix-any.sh @@ -24,6 +24,9 @@ fi . "${LIBS_AUTOMATACI}/services/io/strings.sh" . "${LIBS_AUTOMATACI}/services/io/sync.sh" . "${LIBS_AUTOMATACI}/services/i18n/translations.sh" +. "${LIBS_AUTOMATACI}/services/compilers/flatpak.sh" +. "${LIBS_AUTOMATACI}/services/publishers/homebrew.sh" +. "${LIBS_AUTOMATACI}/services/versioners/git.sh" . "${LIBS_AUTOMATACI}/_package-archive_unix-any.sh" . "${LIBS_AUTOMATACI}/_package-cargo_unix-any.sh" @@ -60,14 +63,64 @@ if [ $? -ne 0 ]; then fi +if [ "$(STRINGS_Is_Empty "$PROJECT_HOMEBREW_URL")" -ne 0 ]; then + HOMEBREW_WORKSPACE="packagers-homebrew-${PROJECT_SKU}" + I18N_Setup "$HOMEBREW_WORKSPACE" + HOMEBREW_WORKSPACE="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/${HOMEBREW_WORKSPACE}" + FS_Remake_Directory "${HOMEBREW_WORKSPACE}" + if [ $? -ne 0 ]; then + I18N_Setup_Failed + return 1 + fi +fi + + +if [ "$(STRINGS_Is_Empty "$PROJECT_FLATPAK_URL")" -ne 0 ]; then + FLATPAK_REPO="flatpak-repo" + I18N_Setup "$FLATPAK_REPO" + FLATPAK_REPO="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/${FLATPAK_REPO}" + FS_Remove_Silently "$FLATPAK_REPO" + + if [ $(STRINGS_Is_Empty "$PROJECT_FLATPAK_REPO") -ne 0 ] && + [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_REPO") -eq 0 ]; then + # version controlled repository supplied; AND + # single unified repository is not enabled + FS_Make_Housing_Directory "$FLATPAK_REPO" + GIT_Clone_Repo \ + "$PROJECT_PATH_ROOT" \ + "$PROJECT_PATH_TEMP" \ + "$PWD" \ + "$PROJECT_FLATPAK_REPO" \ + "$PROJECT_SIMULATE_RUN" \ + "$(FS_Get_File "$FLATPAK_REPO")" \ + "$PROJECT_FLATPAK_REPO_BRANCH" + if [ $? -ne 0 ]; then + I18N_Setup_Failed + return 1 + fi + + if [ $(STRINGS_Is_Empty "$PROJECT_FLATPAK_PATH") -ne 0 ]; then + FLATPAK_REPO="${FLATPAK_REPO}/${PROJECT_FLATPAK_PATH}" + fi + fi + + FS_Make_Directory "$FLATPAK_REPO" + if [ $? -ne 0 ]; then + I18N_Setup_Failed + return 1 + fi +fi + + FILE_CHANGELOG_MD="${PROJECT_SKU}-CHANGELOG_${PROJECT_VERSION}.md" FILE_CHANGELOG_MD="${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}/${FILE_CHANGELOG_MD}" -FILE_CHANGELOG_DEB="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/deb/changelog.gz" +FILE_CHANGELOG_DEB="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/packagers-changelog/deb.gz" PACKAGE_Run_CHANGELOG "$FILE_CHANGELOG_MD" "$FILE_CHANGELOG_DEB" if [ $? -ne 0 ]; then return 1 fi + FILE_CITATION_CFF="${PROJECT_SKU}-CITATION_${PROJECT_VERSION}.cff" FILE_CITATION_CFF="${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}/${FILE_CITATION_CFF}" PACKAGE_Run_CITATION "$FILE_CITATION_CFF" @@ -177,112 +230,205 @@ for i in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_BUILD}"/*; do fi fi - I18N_Sync_Register "$i" __common="${DEST}|${i}|${TARGET_FILENAME}|${TARGET_OS}|${TARGET_ARCH}" - __log="${__log_directory}/archive_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - FS_Append_File "$__parallel_control" "\ + + # begin registrations + I18N_Sync_Register "$i" + + if [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_ARCHIVE") -ne 0 ]; then + __log="archive_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + __log="${__log_directory}/${__log}" + FS_Append_File "$__parallel_control" "\ ${__common}|${__log}|PACKAGE_Run_ARCHIVE " - if [ $? -ne 0 ]; then - return 1 + if [ $? -ne 0 ]; then + return 1 + fi fi - __log="${__log_directory}/cargo_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - FS_Append_File "$__parallel_control" "\ + if [ $(STRINGS_Is_Empty "$PROJECT_RUST") -ne 0 ]; then + __log="cargo_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + __log="${__log_directory}/${__log}" + FS_Append_File "$__parallel_control" "\ ${__common}|${__log}|PACKAGE_Run_CARGO " - if [ $? -ne 0 ]; then - return 1 + if [ $? -ne 0 ]; then + return 1 + fi fi - __log="${__log_directory}/chocolatey_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - FS_Append_File "$__parallel_control" "\ + # NOTE: chocolatey only serve windows + if [ $(STRINGS_Is_Empty "$PROJECT_CHOCOLATEY_URL") -ne 0 ]; then + case "$TARGET_OS" in + any|windows) + __log="chocolatey_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + __log="${__log_directory}/${__log}" + FS_Append_File "$__parallel_control" "\ ${__common}|${__log}|PACKAGE_Run_CHOCOLATEY " - if [ $? -ne 0 ]; then - return 1 + if [ $? -ne 0 ]; then + return 1 + fi + ;; + *) + ;; + esac fi - __log="${__log_directory}/deb_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - FS_Append_File "$__parallel_control" "\ + # NOTE: deb does not work in windows or mac + if [ $(STRINGS_Is_Empty "$PROJECT_DEB_URL") -ne 0 ]; then + case "$TARGET_OS" in + windows|darwin) + ;; + *) + __log="deb_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + __log="${__log_directory}/${__log}" + FS_Append_File "$__parallel_control" "\ ${__common}|${FILE_CHANGELOG_DEB}|${__log}|PACKAGE_Run_DEB " - if [ $? -ne 0 ]; then - return 1 + if [ $? -ne 0 ]; then + return 1 + fi + ;; + esac fi - __log="${__log_directory}/docker_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - FS_Append_File "$__serial_control" "\ + # NOTE: container only serve windows and linux + if [ $(STRINGS_Is_Empty "$PROJECT_CONTAINER_REGISTRY") -ne 0 ]; then + case "$TARGET_OS" in + any|linux|windows) + __log="docker_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + __log="${__log_directory}/${__log}" + FS_Append_File "$__serial_control" "\ ${__common}|${__log}|PACKAGE_Run_DOCKER " - if [ $? -ne 0 ]; then - return 1 + if [ $? -ne 0 ]; then + return 1 + fi + ;; + *) + ;; + esac fi - __flatpak_path="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/${PROJECT_PATH_RELEASE}/flatpak" - __log="${__log_directory}/flatpak_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - FS_Append_File "$__serial_control" "\ -${__common}|${__flatpak_path}|${__log}|PACKAGE_Run_FLATPAK + # NOTE: flatpak only serve linux + FLATPAK_Is_Available + if [ $? -eq 0 ] && [ $(STRINGS_Is_Empty "$PROJECT_FLATPAK_URL") -ne 0 ]; then + case "$TARGET_OS" in + any|linux) + __log="flatpak_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + __log="${__log_directory}/${__log}" + FS_Append_File "$__serial_control" "\ +${__common}|${FLATPAK_REPO}|${__log}|PACKAGE_Run_FLATPAK " - if [ $? -ne 0 ]; then - return 1 + if [ $? -ne 0 ]; then + return 1 + fi + ;; + *) + ;; + esac fi - __log="${__log_directory}/homebrew_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - FS_Append_File "$__parallel_control" "\ -${__common}|${__log}|PACKAGE_Run_HOMEBREW + # NOTE: homebrew only serve linux and mac + if [ $(STRINGS_Is_Empty "$PROJECT_HOMEBREW_URL") -ne 0 ]; then + case "$TARGET_OS" in + any|darwin|linux) + __log="homebrew_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + __log="${__log_directory}/${__log}" + FS_Append_File "$__parallel_control" "\ +${__common}|${HOMEBREW_WORKSPACE}|${__log}|PACKAGE_Run_HOMEBREW " - if [ $? -ne 0 ]; then - return 1 + if [ $? -ne 0 ]; then + return 1 + fi + ;; + *) + ;; + esac fi - __log="${__log_directory}/ipk_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - FS_Append_File "$__parallel_control" "\ + if [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_IPK") -ne 0 ]; then + __log="ipk_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + __log="${__log_directory}/${__log}" + FS_Append_File "$__parallel_control" "\ ${__common}|${__log}|PACKAGE_Run_IPK " - if [ $? -ne 0 ]; then - return 1 + if [ $? -ne 0 ]; then + return 1 + fi fi - __log="${__log_directory}/lib_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - FS_Append_File "$__parallel_control" "\ + if [ $(FS_Is_Target_A_Library "$i") -eq 0 ] && + [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_ARCHIVE") -ne 0 ]; then + __log="lib_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + __log="${__log_directory}/${__log}" + FS_Append_File "$__parallel_control" "\ ${__common}|${__log}|PACKAGE_Run_LIB " - if [ $? -ne 0 ]; then - return 1 + if [ $? -ne 0 ]; then + return 1 + fi fi - __log="${__log_directory}/msi_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - FS_Append_File "$__serial_control" "\ + # NOTE: MSI only works in windows + if [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_MSI") -ne 0 ]; then + case "$TARGET_OS" in + any|windows) + __log="msi_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + __log="${__log_directory}/${__log}" + FS_Append_File "$__serial_control" "\ ${__common}|${__log}|PACKAGE_Run_MSI " - if [ $? -ne 0 ]; then - return 1 + if [ $? -ne 0 ]; then + return 1 + fi + ;; + *) + ;; + esac + fi - __log="${__log_directory}/pdf_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - FS_Append_File "$__parallel_control" "\ + if [ $(FS_Is_Target_A_PDF "$i") -eq 0 ]; then + __log="pdf_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + __log="${__log_directory}/${__log}" + FS_Append_File "$__parallel_control" "\ ${__common}|${__log}|PACKAGE_Run_PDF " - if [ $? -ne 0 ]; then - return 1 + if [ $? -ne 0 ]; then + return 1 + fi fi - __log="${__log_directory}/pypi_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - FS_Append_File "$__parallel_control" "\ + if [ $(STRINGS_Is_Empty "$PROJECT_PYTHON") -ne 0 ]; then + __log="pypi_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + __log="${__log_directory}/${__log}" + FS_Append_File "$__parallel_control" "\ ${__common}|${__log}|PACKAGE_Run_PYPI " - if [ $? -ne 0 ]; then - return 1 + if [ $? -ne 0 ]; then + return 1 + fi fi - __log="${__log_directory}/rpm_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - FS_Append_File "$__parallel_control" "\ + # NOTE: RPM only serve linux + if [ $(STRINGS_Is_Empty "$PROJECT_RPM_URL") -ne 0 ]; then + case "$TARGET_OS" in + any|linux) + __log="rpm_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + __log="${__log_directory}/${__log}" + FS_Append_File "$__parallel_control" "\ ${__common}|${__log}|PACKAGE_Run_RPM " - if [ $? -ne 0 ]; then - return 1 + if [ $? -ne 0 ]; then + return 1 + fi + ;; + *) + ;; + esac fi done fi @@ -299,6 +445,28 @@ if [ $? -eq 0 ]; then fi +if [ $(STRINGS_Is_Empty "$PROJECT_HOMEBREW_URL") -ne 0 ]; then + I18N_Newline + I18N_Newline + + __dest="${PROJECT_SKU}.rb" + I18N_Export "$__dest" + __dest="${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}/${__dest}" + HOMEBREW_Seal "$__dest" \ + "${PROJECT_SKU}-homebrew_${PROJECT_VERSION}_any-any.tar.xz" \ + "$HOMEBREW_WORKSPACE" \ + "$PROJECT_SKU" \ + "$PROJECT_PITCH" \ + "$PROJECT_CONTACT_WEBSITE" \ + "$PROJECT_LICENSE" \ + "$PROJECT_HOMEBREW_URL" + if [ $? -ne 0 ];then + I18N_Export_Failed + return 1 + fi +fi + + I18N_Sync_Run_Series FS_Is_File "$__serial_control" if [ $? -eq 0 ]; then diff --git a/automataCI/package_windows-any.ps1 b/automataCI/package_windows-any.ps1 index 2c5f18ce..05abb633 100644 --- a/automataCI/package_windows-any.ps1 +++ b/automataCI/package_windows-any.ps1 @@ -23,6 +23,9 @@ if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { . "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" . "${env:LIBS_AUTOMATACI}\services\io\sync.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" +. "${env:LIBS_AUTOMATACI}\services\compilers\flatpak.ps1" +. "${env:LIBS_AUTOMATACI}\services\publishers\homebrew.ps1" +. "${env:LIBS_AUTOMATACI}\services\versioners\git.ps1" . "${env:LIBS_AUTOMATACI}\_package-changelog_windows-any.ps1" . "${env:LIBS_AUTOMATACI}\_package-citation_windows-any.ps1" @@ -40,9 +43,58 @@ if ($___process -ne 0) { } +if ($(STRINGS-Is-Empty "${env:PROJECT_HOMEBREW_URL}") -ne 0) { + $HOMEBREW_WORKSPACE = "packagers-homebrew-${env:PROJECT_SKU}" + $null = I18N-Setup "${HOMEBREW_WORKSPACE}" + $HOMEBREW_WORKSPACE = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\${HOMEBREW_WORKSPACE}" + $___process = FS-Remake-Directory "${HOMEBREW_WORKSPACE}" + if ($___process -ne 0) { + $null = I18N-Setup-Failed + return 1 + } +} + + +if ($(STRINGS-Is-Empty "${env:PROJECT_FLATPAK_URL}") -ne 0) { + $FLATPAK_REPO = "flatpak-repo" + $null = I18N-Setup "${FLATPAK_REPO}" + $FLATPAK_REPO = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\${FLATPAK_REPO}" + $null = FS-Remove-Silently "$FLATPAK_REPO" + + if (($(STRINGS-Is-Empty "${env:PROJECT_FLATPAK_REPO}") -ne 0) -and + ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_REPO}") -ne 0)) { + # version controlled repository supplied; AND + # single unified repository is not enabled + $null = FS-Make-Housing-Directory "$FLATPAK_REPO" + $___process = GIT-Clone-Repo ` + "${env:PROJECT_PATH_ROOT}" ` + "${env:PROJECT_PATH_TEMP}" ` + "$(Get-Location)" ` + "${env:PROJECT_FLATPAK_REPO}" ` + "${env:PROJECT_SIMULATE_RUN}" ` + "$(FS-Get-File "${env:FLATPAK_REPO}")" ` + "${env:PROJECT_FLATPAK_REPO_BRANCH}" + if ($___process -ne 0) { + $null = I18N-Setup-Failed + return 1 + } + + if ($(STRINGS-Is-Empty "${env:PROJECT_FLATPAK_PATH}") -ne 0) { + $FLATPAK_REPO = "${FLATPAK_REPO}/${env:PROJECT_FLATPAK_PATH}" + } + } + + $___process = FS-Make-Directory "$FLATPAK_REPO" + if ($___process -ne 0) { + $null = I18N-Setup-Failed + return 1 + } +} + + $FILE_CHANGELOG_MD = "${env:PROJECT_SKU}-CHANGELOG_${env:PROJECT_VERSION}.md" $FILE_CHANGELOG_MD = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_PKG}\${FILE_CHANGELOG_MD}" -$FILE_CHANGELOG_DEB = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\deb\changelog.gz" +$FILE_CHANGELOG_DEB = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\packagers-changelog\deb.gz" $___process = Package-Run-CHANGELOG "$FILE_CHANGELOG_MD" "$FILE_CHANGELOG_DEB" if ($___process -ne 0) { return 1 @@ -157,17 +209,18 @@ function SUBROUTINE-Package { # begin registering packagers if ($(FS-Is-Directory "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_BUILD}") -eq 0) { -foreach ($file in (Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_BUILD}" ` - | Select-Object -ExpandProperty FullName)) { - $___process = FS-Is-File "$file" +foreach ($i in (Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_BUILD}")) { + $i = $i.FullName + + $___process = FS-Is-File "$i" if ($___process -ne 0) { continue } # parse build candidate - $null = I18N-Detected "${file}" - $TARGET_FILENAME = Split-Path -Leaf $file + $null = I18N-Detected "${i}" + $TARGET_FILENAME = Split-Path -Leaf $i $TARGET_FILENAME = $TARGET_FILENAME -replace "\..*$" $TARGET_OS = $TARGET_FILENAME -replace ".*_" $TARGET_FILENAME = $TARGET_FILENAME -replace "_.*" @@ -192,125 +245,204 @@ foreach ($file in (Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_P } } - $null = I18N-Sync-Register "$file" - $__common = "${DEST}|${file}|${TARGET_FILENAME}|${TARGET_OS}|${TARGET_ARCH}" + $__common = "${DEST}|${i}|${TARGET_FILENAME}|${TARGET_OS}|${TARGET_ARCH}" + + + # begin registrations + $null = I18N-Sync-Register "$i" - $__log = "${__log_directory}\archive_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $___process = FS-Append-File "${__parallel_control}" @" + if ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_ARCHIVE}") -ne 0) { + $__log = "archive_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + $__log = "${__log_directory}\${__log}" + $___process = FS-Append-File "${__parallel_control}" @" ${__common}|${__log}|PACKAGE-Run-ARCHIVE "@ - if ($___process -ne 0) { - return 1 + if ($___process -ne 0) { + return 1 + } } - $__log = "${__log_directory}\cargo_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $___process = FS-Append-File "${__parallel_control}" @" + if ($(STRINGS-Is-Empty "${env:PROJECT_RUST}") -ne 0) { + $__log = "cargo_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + $__log = "${__log_directory}\${__log}" + $___process = FS-Append-File "${__parallel_control}" @" ${__common}|${__log}|PACKAGE-Run-CARGO "@ - if ($___process -ne 0) { - return 1 + if ($___process -ne 0) { + return 1 + } } - $__log = "${__log_directory}\chocolatey_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $___process = FS-Append-File "${__parallel_control}" @" + # NOTE: chocolatey only serve windows + if ($(STRINGS-Is-Empty "${env:PROJECT_CHOCOLATEY_URL}") -ne 0) { + switch ("${TARGET_OS}") { + { $_ -in "any", "windows" } { + $__log = "chocolatey_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + $__log = "${__log_directory}\${__log}" + $___process = FS-Append-File "${__parallel_control}" @" ${__common}|${__log}|PACKAGE-Run-CHOCOLATEY "@ - if ($___process -ne 0) { - return 1 + if ($___process -ne 0) { + return 1 + } + } default { + }} } - $__log = "${__log_directory}\deb_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $___process = FS-Append-File "${__parallel_control}" @" + # NOTE: deb does not work in windows or mac + if ($(STRINGS-Is-Empty "${env:PROJECT_DEB_URL}") -ne 0) { + switch ("${TARGET_OS}") { + { $_ -in "windows", "darwin" } { + $__log = "deb_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + $__log = "${__log_directory}\${__log}" + $___process = FS-Append-File "${__parallel_control}" @" ${__common}|${FILE_CHANGELOG_DEB}|${__log}|PACKAGE-Run-DEB "@ - if ($___process -ne 0) { - return 1 + if ($___process -ne 0) { + return 1 + } + } default { + }} } - $__log = "${__log_directory}\docker_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $___process = FS-Append-File "${__serial_control}" @" + # NOTE: container only server windows and linux + if ($(STRINGS-Is-Empty "${env:PROJECT_CONTAINER_REGISTRY}") -ne 0) { + switch ("${TARGET_OS}") { + { $_ -in "any", "linux", "windows" } { + $__log = "docker_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + $__log = "${__log_directory}\${__log}" + $___process = FS-Append-File "${__serial_control}" @" ${__common}|${__log}|PACKAGE-Run-DOCKER "@ - if ($___process -ne 0) { - return 1 + if ($___process -ne 0) { + return 1 + } + } default { + }} } - $__flatpak_path = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\${env:PROJECT_PATH_RELEASE}\flatpak" - $__log = "${__log_directory}\flatpak_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $___process = FS-Append-File "${__serial_control}" @" -${__common}|${__flatpak_path}|${__log}|PACKAGE-Run-FLATPAK + # NOTE: flatpak only serve linux + $___process = FLATPAK-Is-Available + if (($___process -eq 0) -and + ($(STRINGS-Is-Empty "${env:PROJECT_FLATPAK_URL}") -ne 0)) { + switch ("${TARGET_OS}") { + { $_ -in "any", "linux" } { + $__log = "flatpak_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + $__log = "${__log_directory}\${__log}" + $___process = FS-Append-File "${__serial_control}" @" +${__common}|${FLATPAK_REPO}|${__log}|PACKAGE-Run-FLATPAK "@ - if ($___process -ne 0) { - return 1 + if ($___process -ne 0) { + return 1 + } + } default { + }} } - $__log = "${__log_directory}\homebrew_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $___process = FS-Append-File "${__parallel_control}" @" -${__common}|${__log}|PACKAGE-Run-HOMEBREW + # NOTE: homebrew only serve linux and mac + if ($(STRINGS-Is-Empty "${env:PROJECT_HOMEBREW_URL}") -ne 0) { + switch ("${TARGET_OS}") { + { $_ -in "any", "darwin", "linux" } { + $__log = "homebrew_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + $__log = "${__log_directory}\${__log}" + $___process = FS-Append-File "${__parallel_control}" @" +${__common}|${HOMEBREW_WORKSPACE}|${__log}|PACKAGE-Run-HOMEBREW "@ - if ($___process -ne 0) { - return 1 + if ($___process -ne 0) { + return 1 + } + } default { + }} } - $__log = "${__log_directory}\ipk_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $___process = FS-Append-File "${__parallel_control}" @" + if ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_IPK}") -ne 0) { + $__log = "ipk_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + $__log = "${__log_directory}\${__log}" + $___process = FS-Append-File "${__parallel_control}" @" ${__common}|${__log}|PACKAGE-Run-IPK "@ - if ($___process -ne 0) { - return 1 + if ($___process -ne 0) { + return 1 + } } - $__log = "${__log_directory}\lib_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $___process = FS-Append-File "${__parallel_control}" @" + if (($(FS-Is-Target-A-Library "${i}") -eq 0) -and + ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_ARCHIVE}") -ne 0)) { + $__log = "lib_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + $__log = "${__log_directory}\${__log}" + $___process = FS-Append-File "${__parallel_control}" @" ${__common}|${__log}|PACKAGE-Run-LIB "@ - if ($___process -ne 0) { - return 1 + if ($___process -ne 0) { + return 1 + } } - $__log = "${__log_directory}\msi_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $___process = FS-Append-File "${__serial_control}" @" + # NOTE: MSI only works in windows + if ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_MSI}") -ne 0) { + switch ("${TARGET_OS}") { + { $_ -in "any", "windows" } { + $__log = "msi_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + $__log = "${__log_directory}\${__log}" + $___process = FS-Append-File "${__serial_control}" @" ${__common}|${__log}|PACKAGE-Run-MSI "@ - if ($___process -ne 0) { - return 1 + if ($___process -ne 0) { + return 1 + } + } default { + }} } - $__log = "${__log_directory}\PDF_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $___process = FS-Append-File "${__parallel_control}" @" + if ($(FS-Is-Target-A-PDF "${i}") -eq 0) { + $__log = "PDF_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + $__log = "${__log_directory}\${__log}" + $___process = FS-Append-File "${__parallel_control}" @" ${__common}|${__log}|PACKAGE-Run-PDF "@ - if ($___process -ne 0) { - return 1 + if ($___process -ne 0) { + return 1 + } } - $__log = "${__log_directory}\pypi_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $___process = FS-Append-File "${__parallel_control}" @" + if ($(STRINGS-Is-Empty "${env:PROJECT_PYTHON}") -ne 0) { + $__log = "pypi_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + $__log = "${__log_directory}\${__log}" + $___process = FS-Append-File "${__parallel_control}" @" ${__common}|${__log}|PACKAGE-Run-PYPI "@ - if ($___process -ne 0) { - return 1 + if ($___process -ne 0) { + return 1 + } } - $__log = "${__log_directory}\rpm_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $___process = FS-Append-File "${__parallel_control}" @" + # NOTE: RPM only serve linux + if ($(STRINGS-Is-Empty "${env:PROJECT_RPM_URL}") -ne 0) { + switch ("${TARGET_OS}") { + { $_ -in "any", "linux" } { + $__log = "rpm_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + $__log = "${__log_directory}\${__log}" + $___process = FS-Append-File "${__parallel_control}" @" ${__common}|${__log}|PACKAGE-Run-RPM "@ - if ($___process -ne 0) { - return 1 + if ($___process -ne 0) { + return 1 + } + } default { + }} } } } @@ -330,6 +462,28 @@ if ($___process -eq 0) { } +if ($(STRINGS-Is-Empty "${env:PROJECT_HOMEBREW_URL}") -ne 0) { + $null = I18N-Newline + $null = I18N-Newline + + $__dest = "${env:PROJECT_SKU}.rb" + $null = I18N-Export "${__dest}" + $__dest = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_PKG}\${__dest}" + $___process = HOMEBREW-Seal "${__dest}" ` + "${env:PROJECT_SKU}-homebrew_${env:PROJECT_VERSION}_any-any.tar.xz" ` + "${HOMEBREW_WORKSPACE}" ` + "${env:PROJECT_SKU}" ` + "${env:PROJECT_PITCH}" ` + "${env:PROJECT_CONTACT_WEBSITE}" ` + "${env:PROJECT_LICENSE}" ` + "${env:PROJECT_HOMEBREW_URL}" + if ($___process -ne 0) { + $null = I18N-Export-Failed + return 1 + } +} + + $null = I18N-Sync-Run-Series $___process = FS-Is-File "${__serial_control}" if ($___process -eq 0) { diff --git a/automataCI/release_unix-any.sh b/automataCI/release_unix-any.sh index b1b196cf..3562d3ef 100644 --- a/automataCI/release_unix-any.sh +++ b/automataCI/release_unix-any.sh @@ -27,17 +27,17 @@ fi . "${LIBS_AUTOMATACI}/_release-cargo_unix-any.sh" . "${LIBS_AUTOMATACI}/_release-changelog_unix-any.sh" . "${LIBS_AUTOMATACI}/_release-checksum_unix-any.sh" -. "${LIBS_AUTOMATACI}/_release-chocolatey_unix-any.sh" . "${LIBS_AUTOMATACI}/_release-citation_unix-any.sh" . "${LIBS_AUTOMATACI}/_release-deb_unix-any.sh" . "${LIBS_AUTOMATACI}/_release-docker_unix-any.sh" +. "${LIBS_AUTOMATACI}/_release-flatpak_unix-any.sh" . "${LIBS_AUTOMATACI}/_release-homebrew_unix-any.sh" . "${LIBS_AUTOMATACI}/_release-lib_unix-any.sh" . "${LIBS_AUTOMATACI}/_release-npm_unix-any.sh" -. "${LIBS_AUTOMATACI}/_release-pdf_unix-any.sh" +. "${LIBS_AUTOMATACI}/_release-project_unix-any.sh" . "${LIBS_AUTOMATACI}/_release-pypi_unix-any.sh" +. "${LIBS_AUTOMATACI}/_release-research_unix-any.sh" . "${LIBS_AUTOMATACI}/_release-rpm_unix-any.sh" -. "${LIBS_AUTOMATACI}/_release-staticrepo_unix-any.sh" . "${LIBS_AUTOMATACI}/_release-docsrepo_unix-any.sh" @@ -54,8 +54,8 @@ __recipe="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${PROJECT_PATH_CI}" __recipe="${__recipe}/release_unix-any.sh" FS_Is_File "$__recipe" if [ $? -eq 0 ]; then - I18N_Detected "${__recipe}" - I18N_Parse "${__recipe}" + I18N_Detected "$__recipe" + I18N_Parse "$__recipe" . "$__recipe" if [ $? -ne 0 ]; then I18N_Parse_Failed @@ -64,6 +64,15 @@ if [ $? -eq 0 ]; then fi + + +# determine pathing variables +PACKAGE_DIRECTORY="${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}" + + + + +# initialize workspace and release job functions OS_Is_Command_Available "RELEASE_Run_Pre_Processor" if [ $? -eq 0 ]; then RELEASE_Run_Pre_Processor @@ -73,88 +82,111 @@ if [ $? -eq 0 ]; then fi -RELEASE_Setup_STATIC_REPO +RELEASE_Setup_PROJECT # !! IMPORTANT !! - always the first if [ $? -ne 0 ]; then return 1 fi -RELEASE_Setup_HOMEBREW +RELEASE_Setup_DEB "$DEB_REPO" if [ $? -ne 0 ]; then return 1 fi -RELEASE_Setup_CHOCOLATEY +RELEASE_Setup_FLATPAK "$FLATPAK_REPO" if [ $? -ne 0 ]; then return 1 fi -STATIC_REPO="${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}/${PROJECT_STATIC_REPO_DIRECTORY}" -HOMEBREW_REPO="${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}/${PROJECT_HOMEBREW_DIRECTORY}" -CHOCOLATEY_REPO="${PROJECT_PATH_ROOT}/${PROJECT_PATH_RELEASE}/${PROJECT_CHOCOLATEY_DIRECTORY}" -for TARGET in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}"/*; do +RELEASE_Setup_HOMEBREW "$HOMEBREW_REPO" +if [ $? -ne 0 ]; then + return 1 +fi + + +RELEASE_Setup_RPM "$RPM_REPO" +if [ $? -ne 0 ]; then + return 1 +fi + + + + +# scan through each product and run the release processing respectively +for TARGET in "$PACKAGE_DIRECTORY"/*; do if [ "${TARGET%.asc*}" != "$TARGET" ]; then - continue + continue # it's a gpg cert + fi + + if [ "${TARGET%.gpg*}" != "$TARGET" ]; then + continue # it's a gpg keyfile or cert fi + I18N_Processing "$TARGET" + RELEASE_Run_CARGO "$TARGET" if [ $? -ne 0 ]; then return 1 fi - RELEASE_Run_CHOCOLATEY "$TARGET" "$CHOCOLATEY_REPO" - if [ $? -ne 0 ]; then - return 1 - fi RELEASE_Run_CITATION_CFF "$TARGET" if [ $? -ne 0 ]; then return 1 fi - RELEASE_Run_DEB "$TARGET" "$STATIC_REPO" + + RELEASE_Run_DEB "$TARGET" "$DEB_REPO" "$DEB_REPO_DATA" if [ $? -ne 0 ]; then return 1 fi + RELEASE_Run_DOCKER "$TARGET" if [ $? -ne 0 ]; then return 1 fi - RELEASE_Run_LIBS "$TARGET" + + RELEASE_Run_HOMEBREW "$TARGET" "$HOMEBREW_REPO" if [ $? -ne 0 ]; then return 1 fi - RELEASE_Run_HOMEBREW "$TARGET" "$HOMEBREW_REPO" + + RELEASE_Run_LIBS "$TARGET" if [ $? -ne 0 ]; then return 1 fi + RELEASE_Run_NPM "$TARGET" if [ $? -ne 0 ]; then return 1 fi - RELEASE_Run_PDF "$TARGET" + + RELEASE_Run_PYPI "$TARGET" if [ $? -ne 0 ]; then return 1 fi - RELEASE_Run_PYPI "$TARGET" + + RELEASE_Run_RESEARCH "$TARGET" if [ $? -ne 0 ]; then return 1 fi - RELEASE_Run_RPM "$TARGET" "$STATIC_REPO" + + RELEASE_Run_RPM "$TARGET" "$RPM_REPO" if [ $? -ne 0 ]; then return 1 fi + OS_Is_Command_Available "RELEASE_Run_Package_Processor" if [ $? -eq 0 ]; then RELEASE_Run_Package_Processor "$TARGET" @@ -165,7 +197,16 @@ for TARGET in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}"/*; do done -RELEASE_Run_CHECKSUM "$STATIC_REPO" + + +# run one-time directory-wide release processing functions +RELEASE_Update_DEB "$DEB_REPO" "$DEB_REPO_DATA" +if [ $? -ne 0 ]; then + return 1 +fi + + +RELEASE_Update_RPM "$RPM_REPO" if [ $? -ne 0 ]; then return 1 fi @@ -180,34 +221,54 @@ if [ $? -eq 0 ]; then fi -if [ $(OS_Is_Run_Simulated) -eq 0 ]; then - I18N_Simulate_Conclude "STATIC REPO" - I18N_Simulate_Conclude "CHANGELOG" -else - RELEASE_Conclude_STATIC_REPO - if [ $? -ne 0 ]; then - return 1 - fi - RELEASE_Conclude_HOMEBREW "$HOMEBREW_REPO" - if [ $? -ne 0 ]; then - return 1 - fi - RELEASE_Conclude_CHOCOLATEY "$CHOCOLATEY_REPO" - if [ $? -ne 0 ]; then - return 1 - fi +# conclude the release +RELEASE_Conclude_CHECKSUM "$PACKAGE_DIRECTORY" ## !! IMPORTANT !! - always the first +if [ $? -ne 0 ]; then + return 1 +fi - RELEASE_Conclude_CHANGELOG - if [ $? -ne 0 ]; then - return 1 - fi - RELEASE_Conclude_DOCS - if [ $? -ne 0 ]; then - return 1 - fi +RELEASE_Conclude_DEB "$DEB_REPO" +if [ $? -ne 0 ]; then + return 1 +fi + + +RELEASE_Conclude_FLATPAK "$FLATPAK_REPO" +if [ $? -ne 0 ]; then + return 1 +fi + + +RELEASE_Conclude_HOMEBREW "$HOMEBREW_REPO" +if [ $? -ne 0 ]; then + return 1 +fi + + +RELEASE_Conclude_RPM "$RPM_REPO" +if [ $? -ne 0 ]; then + return 1 +fi + + +RELEASE_Conclude_DOCS +if [ $? -ne 0 ]; then + return 1 +fi + + +RELEASE_Conclude_CHANGELOG +if [ $? -ne 0 ]; then + return 1 +fi + + +RELEASE_Conclude_PROJECT # !! IMPORTANT !! - always the last +if [ $? -ne 0 ]; then + return 1 fi diff --git a/automataCI/release_windows-any.ps1 b/automataCI/release_windows-any.ps1 index 884883b6..69dd6980 100644 --- a/automataCI/release_windows-any.ps1 +++ b/automataCI/release_windows-any.ps1 @@ -26,17 +26,17 @@ if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { . "${env:LIBS_AUTOMATACI}\_release-cargo_windows-any.ps1" . "${env:LIBS_AUTOMATACI}\_release-changelog_windows-any.ps1" . "${env:LIBS_AUTOMATACI}\_release-checksum_windows-any.ps1" -. "${env:LIBS_AUTOMATACI}\_release-chocolatey_windows-any.ps1" . "${env:LIBS_AUTOMATACI}\_release-citation_windows-any.ps1" . "${env:LIBS_AUTOMATACI}\_release-deb_windows-any.ps1" +. "${env:LIBS_AUTOMATACI}\_release-flatpak_windows-any.ps1" . "${env:LIBS_AUTOMATACI}\_release-docker_windows-any.ps1" . "${env:LIBS_AUTOMATACI}\_release-homebrew_windows-any.ps1" . "${env:LIBS_AUTOMATACI}\_release-lib_windows-any.ps1" . "${env:LIBS_AUTOMATACI}\_release-npm_windows-any.ps1" -. "${env:LIBS_AUTOMATACI}\_release-pdf_windows-any.ps1" +. "${env:LIBS_AUTOMATACI}\_release-project_windows-any.ps1" . "${env:LIBS_AUTOMATACI}\_release-pypi_windows-any.ps1" +. "${env:LIBS_AUTOMATACI}\_release-research_windows-any.ps1" . "${env:LIBS_AUTOMATACI}\_release-rpm_windows-any.ps1" -. "${env:LIBS_AUTOMATACI}\_release-staticrepo_windows-any.ps1" . "${env:LIBS_AUTOMATACI}\_release-docsrepo_windows-any.ps1" @@ -63,6 +63,15 @@ if ($___process -eq 0) { } + + +# determine pathing variables +$PACKAGE_DIRECTORY = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_PKG}" + + + + +# initialize workspace and release job functions $___process = OS-Is-Command-Available "RELEASE-Run-Pre-Processor" if ($___process -eq 0) { $___process = RELEASE-Run-Pre-Processor @@ -72,143 +81,128 @@ if ($___process -eq 0) { } -$___process = RELEASE-Setup-STATIC-REPO +$___process = RELEASE-Setup-PROJECT # !! IMPORTANT !! - always the first if ($___process -ne 0) { return 1 } -$___process = RELEASE-Setup-HOMEBREW +$___process = RELEASE-Setup-DEB "${DEB_REPO}" if ($___process -ne 0) { return 1 } -$___process = RELEASE-Setup-CHOCOLATEY +$___process = RELEASE-Setup-FLATPAK "$FLATPAK_REPO" if ($___process -ne 0) { return 1 } -$STATIC_REPO = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}\${env:PROJECT_STATIC_REPO_DIRECTORY}" -$HOMEBREW_REPO = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}\${env:PROJECT_HOMEBREW_DIRECTORY}" -$CHOCOLATEY_REPO = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_RELEASE}\${env:PROJECT_CHOCOLATEY_DIRECTORY}" -$PACKAGE_DIRECTORY = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_PKG}" -if (Test-Path -PathType Container -Path "${PACKAGE_DIRECTORY}") { - foreach ($TARGET in (Get-ChildItem -Path "${PACKAGE_DIRECTORY}")) { - $TARGET = $TARGET.FullName - if ($TARGET -like "*.asc") { - continue - } - - $null = I18N-Processing "${TARGET}" - - $___process = RELEASE-Run-CARGO "$TARGET" - if ($___process -ne 0) { - return 1 - } +$___process = RELEASE-Setup-HOMEBREW "${HOMEBREW_REPO}" +if ($___process -ne 0) { + return 1 +} - $___process = RELEASE-Run-CITATION-CFF "$TARGET" - if ($___process -ne 0) { - return 1 - } - $___process = RELEASE-Run-CHOCOLATEY "$TARGET" "$CHOCOLATEY_REPO" - if ($___process -ne 0) { - return 1 - } +$___process = RELEASE-Setup-RPM "${RPM_REPO}" +if ($___process -ne 0) { + return 1 +} - $___process = RELEASE-Run-DEB "$TARGET" "$STATIC_REPO" - if ($___process -ne 0) { - return 1 - } - $___process = RELEASE-Run-DOCKER "$TARGET" - if ($___process -ne 0) { - return 1 - } - $___process = RELEASE-Run-HOMEBREW "$TARGET" "$HOMEBREW_REPO" - if ($___process -ne 0) { - return 1 - } - $___process = RELEASE-Run-LIBS "$TARGET" - if ($___process -ne 0) { - return 1 - } - - $___process = RELEASE-Run-NPM "$TARGET" - if ($___process -ne 0) { - return 1 - } - - $___process = RELEASE-Run-PDF "$TARGET" - if ($___process -ne 0) { - return 1 - } +# scan through each product and run the release processing respectively +foreach ($TARGET in (Get-ChildItem -Path "${PACKAGE_DIRECTORY}")) { $TARGET = $TARGET.FullName + if ($TARGET -like "*.asc") { + continue # it's a gpg cert + } - $___process = RELEASE-Run-PYPI "$TARGET" - if ($___process -ne 0) { - return 1 - } + if ($TARGET -like "*.gpg") { + continue # it's a gpg keyfile or cert + } - $___process = RELEASE-Run-RPM "$TARGET" "$STATIC_REPO" ` - if ($___process -ne 0) { - return 1 - } + $null = I18N-Processing "${TARGET}" - $___process = OS-Is-Command-Available "RELEASE-Run-Package-Processor" - if ($___process -eq 0) { - $___process = RELEASE-Run-Package-Processor "$TARGET" - if ($___process -ne 0) { - return 1 - } - } + $___process = RELEASE-Run-CARGO "$TARGET" + if ($___process -ne 0) { + return 1 } -} + $___process = RELEASE-Run-CITATION-CFF "$TARGET" + if ($___process -ne 0) { + return 1 + } -$___process = RELEASE-Run-CHECKSUM "$STATIC_REPO" -if ($___process -ne 0) { - return 1 -} + $___process = RELEASE-Run-DEB "$TARGET" "$DEB_REPO" "$DEB_REPO_DATA" + if ($___process -ne 0) { + return 1 + } + $___process = RELEASE-Run-DOCKER "$TARGET" + if ($___process -ne 0) { + return 1 + } -$___process = OS-Is-Command-Available "RELEASE-Run-Post-Processor" -if ($___process -eq 0) { - $___process = RELEASE-Run-Post-Processor + $___process = RELEASE-Run-HOMEBREW "$TARGET" "$HOMEBREW_REPO" if ($___process -ne 0) { return 1 } -} + $___process = RELEASE-Run-LIBS "$TARGET" + if ($___process -ne 0) { + return 1 + } -if ($(OS-Is-Run-Simulated) -eq 0) { - $null = I18N-Simulate-Conclusion "STATIC REPO" - $null = I18N-Simulate-Conclusion "CHANGELOG" -} else { - $___process = RELEASE-Conclude-STATIC-REPO + $___process = RELEASE-Run-NPM "$TARGET" if ($___process -ne 0) { return 1 } - $___process = RELEASE-Conclude-HOMEBREW "$HOMEBREW_REPO" + $___process = RELEASE-Run-PYPI "$TARGET" if ($___process -ne 0) { return 1 } - $___process = RELEASE-Conclude-CHOCOLATEY "$CHOCOLATEY_REPO" + $___process = RELEASE-Run-RESEARCH "$TARGET" if ($___process -ne 0) { return 1 } - $___process = RELEASE-Conclude-CHANGELOG + $___process = RELEASE-Run-RPM "$TARGET" "$RPM_REPO" if ($___process -ne 0) { return 1 } - $___process = RELEASE-Conclude-DOCS + $___process = OS-Is-Command-Available "RELEASE-Run-Package-Processor" + if ($___process -eq 0) { + $___process = RELEASE-Run-Package-Processor "$TARGET" + if ($___process -ne 0) { + return 1 + } + } +} + + + + +# run one-time directory-wide release processing functions +$___process = RELEASE-Update-DEB "$DEB_REPO" "$DEB_REPO_DATA" +if ($___process -ne 0) { + return 1 +} + + +$___process = RELEASE-Update-RPM "$RPM_REPO" +if ($___process -ne 0) { + return 1 +} + + +$___process = OS-Is-Command-Available "RELEASE-Run-Post-Processor" +if ($___process -eq 0) { + $___process = RELEASE-Run-Post-Processor if ($___process -ne 0) { return 1 } @@ -217,6 +211,57 @@ if ($(OS-Is-Run-Simulated) -eq 0) { +# conclude the release +$___process = RELEASE-Conclude-CHECKSUM "$PACKAGE_DIRECTORY" ## !! IMPORTANT !! - always the first +if ($___process -ne 0) { + return 1 +} + + +$___process = RELEASE-Conclude-DEB "$DEB_REPO" +if ($___process -ne 0) { + return 1 +} + + +$___process = RELEASE-Conclude-FLATPAK "$FLATPAK_REPO" +if ($___process -ne 0) { + return 1 +} + + +$___process = RELEASE-Conclude-HOMEBREW "$HOMEBREW_REPO" +if ($___process -ne 0) { + return 1 +} + + +$___process = RELEASE-Conclude-RPM "$RPM_REPO" +if ($___process -ne 0) { + return 1 +} + + +$___process = RELEASE-Conclude-DOCS +if ($___process -ne 0) { + return 1 +} + + +$___process = RELEASE-Conclude-CHANGELOG +if ($___process -ne 0) { + return 1 +} + + +$___process = RELEASE-Conclude-PROJECT # !! IMPORTANT !! - must always be the last +if ($___process -ne 0) { + return 1 +} + + + + # report status $null = I18N-Run-Successful return 0 diff --git a/automataCI/services/archive/ar.ps1 b/automataCI/services/archive/ar.ps1 index e68f238b..059ab777 100644 --- a/automataCI/services/archive/ar.ps1 +++ b/automataCI/services/archive/ar.ps1 @@ -1,4 +1,4 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho +# Copyright 2023 (Holloway) Chew, Kean Ho # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy @@ -11,6 +11,7 @@ # under the License. . "${env:LIBS_AUTOMATACI}\services\io\os.ps1" . "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" @@ -59,3 +60,34 @@ function AR-Create { # report status return 0 } + + + + +function AR-Extract { + param ( + [string]$___file + ) + + + # validate input + if ($(STRINGS-Is-Empty "${___file}") -eq 0) { + return 1 + } + + $___process = AR-Is-Available + if ($___process -ne 0) { + return 1 + } + + + # execute + $___process = OS-Exec "ar" "-x `"${___file}`"" + if ($___process -ne 0) { + return 1 + } + + + # report status + return 0 +} diff --git a/automataCI/services/archive/ar.sh b/automataCI/services/archive/ar.sh index 70a1bf72..dac8898a 100644 --- a/automataCI/services/archive/ar.sh +++ b/automataCI/services/archive/ar.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho +# Copyright 2023 (Holloway) Chew, Kean Ho # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of @@ -11,6 +11,7 @@ # License for the specific language governing permissions and limitations under # the License. . "${LIBS_AUTOMATACI}/services/io/os.sh" +. "${LIBS_AUTOMATACI}/services/io/fs.sh" . "${LIBS_AUTOMATACI}/services/io/strings.sh" @@ -58,3 +59,32 @@ AR_Create() { # report status return 0 } + + + + +AR_Extract() { + #___file="$1" + + + # validate input + if [ $(STRINGS_Is_Empty "$1") -eq 0 ]; then + return 1 + fi + + AR_Is_Available + if [ $? -ne 0 ]; then + return 1 + fi + + + # execute + ar -x "$1" + if [ $? -ne 0 ]; then + return 1 + fi + + + # report status + return 0 +} diff --git a/automataCI/services/archive/tar.ps1 b/automataCI/services/archive/tar.ps1 index 7a277b5b..316569e4 100644 --- a/automataCI/services/archive/tar.ps1 +++ b/automataCI/services/archive/tar.ps1 @@ -129,23 +129,25 @@ function TAR-Create-GZ { # create tar archive - $___process = TAR-Create "${___dest}" "${___source}" "${___owner}" "${___group}" + $___process = TAR-Create "${___dest}.tar" "${___source}" "${___owner}" "${___group}" if ($___process -ne 0) { return 1 } # compress archive - $___process = GZ-Create "${___dest}" + $___process = GZ-Create "${___dest}.tar" if ($___process -ne 0) { return 1 } # rename to target - $___process = FS-Move "${___dest}.gz" "${___destination}" - if ($___process -ne 0) { - return 1 + if ("${___destination}" -ne "${___dest}.tar.gz") { + $___process = FS-Move "${___dest}.tar.gz" "${___destination}" + if ($___process -ne 0) { + return 1 + } } @@ -194,23 +196,25 @@ function TAR-Create-XZ { # create tar archive - $___process = TAR-Create "${___dest}" "${___source}" "${___owner}" "${___group}" + $___process = TAR-Create "${___dest}.tar" "${___source}" "${___owner}" "${___group}" if ($___process -ne 0) { return 1 } # compress archive - $___process = XZ-Create "${___dest}" + $___process = XZ-Create "${___dest}.tar" if ($___process -ne 0) { return 1 } # rename to target - $___process = FS-Move "${___dest}.xz" "${___destination}" - if ($___process -ne 0) { - return 1 + if ("${___destination}" -ne "${___dest}.tar.xz") { + $___process = FS-Move "${___dest}.xz" "${___destination}" + if ($___process -ne 0) { + return 1 + } } @@ -251,7 +255,7 @@ function TAR-Extract-GZ { # unpack tar.gz - $___process = OS-Exec "tar" "-xzf `"${___destination}`" -C `"${___source}`"" + $___process = OS-Exec "tar" "-C `"${___destination}`" -xzf `"${___source}`"" if ($___process -ne 0) { return 1 } @@ -277,8 +281,8 @@ function TAR-Extract-XZ { return 1 } - $___process = FS-Is-File "${___destination}" - if ($___process -eq 0) { + $___process = FS-Is-Directory "${___destination}" + if ($___process -ne 0) { return 1 } @@ -294,7 +298,7 @@ function TAR-Extract-XZ { # unpack tar.xz - $___process = OS-Exec "tar" "-xf `"${___destination}`" -C `"${___source}`"" + $___process = OS-Exec "tar" "-C `"${___destination}`" -xf `"${___source}`"" if ($___process -ne 0) { return 1 } diff --git a/automataCI/services/archive/tar.sh b/automataCI/services/archive/tar.sh index fae30458..61638815 100644 --- a/automataCI/services/archive/tar.sh +++ b/automataCI/services/archive/tar.sh @@ -118,23 +118,25 @@ TAR_Create_GZ() { # create tar archive - TAR_Create "$___dest" "$2" "$3" "$4" + TAR_Create "${___dest}.tar" "$2" "$3" "$4" if [ $? -ne 0 ]; then return 1 fi # compress archive - GZ_Create "$___dest" + GZ_Create "${___dest}.tar" if [ $? -ne 0 ]; then return 1 fi # rename to destination target - FS_Move "${___dest}.gz" "$1" - if [ $? -ne 0 ]; then - return 1 + if [ ! "$1" = "${___dest}.tar.gz" ]; then + FS_Move "${___dest}.tar.gz" "$1" + if [ $? -ne 0 ]; then + return 1 + fi fi @@ -180,23 +182,25 @@ TAR_Create_XZ() { # create tar archive - TAR_Create "$___dest" "$2" "$3" "$4" + TAR_Create "${___dest}.tar" "$2" "$3" "$4" if [ $? -ne 0 ]; then return 1 fi # compress archive - XZ_Create "$___dest" + XZ_Create "${___dest}.tar" if [ $? -ne 0 ]; then return 1 fi # rename to target - FS_Move "${___dest}.xz" "$1" - if [ $? -ne 0 ]; then - return 1 + if [ ! "$1" = "${___dest}.tar.xz" ]; then + FS_Move "${___dest}.tar.xz" "$1" + if [ $? -ne 0 ]; then + return 1 + fi fi @@ -234,7 +238,7 @@ TAR_Extract_GZ() { # unpack tar.gz - tar -xzf "$2" -C "$1" + tar -C "$1" -xzf "$2" if [ $? -ne 0 ]; then return 1 fi @@ -257,8 +261,8 @@ TAR_Extract_XZ() { return 1 fi - FS_Is_File "$1" - if [ $? -eq 0 ]; then + FS_Is_Directory "$1" + if [ $? -ne 0 ]; then return 1 fi @@ -274,7 +278,7 @@ TAR_Extract_XZ() { # unpack tar.xz - tar -xf "$2" -C "$1" + tar -C "$1" -xf "$2" if [ $? -ne 0 ]; then return 1 fi diff --git a/automataCI/services/checksum/md5.ps1 b/automataCI/services/checksum/md5.ps1 index af80db24..c6254501 100644 --- a/automataCI/services/checksum/md5.ps1 +++ b/automataCI/services/checksum/md5.ps1 @@ -15,7 +15,7 @@ -function MD5-Checksum-From-File { +function MD5-Create-From-File { param ( [string]$___target ) diff --git a/automataCI/services/checksum/md5.sh b/automataCI/services/checksum/md5.sh index 1f742630..923a7a2c 100644 --- a/automataCI/services/checksum/md5.sh +++ b/automataCI/services/checksum/md5.sh @@ -17,7 +17,7 @@ -MD5_Checksum_From_File() { +MD5_Create_From_File() { #___target="$1" @@ -35,27 +35,28 @@ MD5_Checksum_From_File() { # execute OS_Is_Command_Available "md5sum" if [ $? -eq 0 ]; then - md5sum "$1" + ___value="$(md5sum "$1")" if [ $? -ne 0 ]; then return 1 fi - - return 0 fi OS_Is_Command_Available "md5" if [ $? -eq 0 ]; then - md5 "$1" + ___value="$(md5 "$1")" if [ $? -ne 0 ]; then return 1 fi + fi - return 0 + if [ $(STRINGS_Is_Empty "$___value") -eq 0 ]; then + return 1 fi # report status - return 1 + printf -- "%s" "${___value%% *}" + return 0 } diff --git a/automataCI/services/checksum/shasum.ps1 b/automataCI/services/checksum/shasum.ps1 index 2b7f795e..e0b6c9f7 100644 --- a/automataCI/services/checksum/shasum.ps1 +++ b/automataCI/services/checksum/shasum.ps1 @@ -15,7 +15,7 @@ -function SHASUM-Checksum-From-File { +function SHASUM-Create-From-File { param ( [string]$___target, [string]$___algo diff --git a/automataCI/services/compilers/changelog.ps1 b/automataCI/services/compilers/changelog.ps1 index e8b3211f..d4969e15 100644 --- a/automataCI/services/compilers/changelog.ps1 +++ b/automataCI/services/compilers/changelog.ps1 @@ -298,13 +298,7 @@ function CHANGELOG-Build-DEB-Entry { return 1 } - - switch ($___dist) { - { $_ -in "stable", "unstable", "testing", "experimental" } { - break - } default { - return 1 - }} + $___dest = $___dest -replace "\/.*$", "" # all good. Generate the log fragment @@ -312,6 +306,7 @@ function CHANGELOG-Build-DEB-Entry { # create the entry header + $null = FS-Remove-Silently "${___directory}\deb\.latest" $null = FS-Write-File "${___directory}\deb\.latest" @" ${___sku} (${___version}) ${___dist}; urgency=${___urgency} diff --git a/automataCI/services/compilers/changelog.sh b/automataCI/services/compilers/changelog.sh index f3e50e1f..efddc0d8 100644 --- a/automataCI/services/compilers/changelog.sh +++ b/automataCI/services/compilers/changelog.sh @@ -299,13 +299,7 @@ CHANGELOG_Build_DEB_Entry() { return 1 fi - case "$___dist" in - stable|unstable|testing|experimental) - ;; - *) - return 1 - ;; - esac + ___dist="${___dist%%/*}" # all good. Generate the log fragment @@ -313,6 +307,7 @@ CHANGELOG_Build_DEB_Entry() { # create the entry header + FS_Remove_Silently "${___directory}/deb/.latest" FS_Append_File "${___directory}/deb/.latest" "\ ${___sku} (${___version}) ${___dist}; urgency=${___urgency} diff --git a/automataCI/services/compilers/deb.ps1 b/automataCI/services/compilers/deb.ps1 index 50861dd9..faf5cecc 100644 --- a/automataCI/services/compilers/deb.ps1 +++ b/automataCI/services/compilers/deb.ps1 @@ -9,14 +9,16 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +. "${env:LIBS_AUTOMATACI}\services\io\disk.ps1" . "${env:LIBS_AUTOMATACI}\services\io\os.ps1" . "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" . "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\disk.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\time.ps1" . "${env:LIBS_AUTOMATACI}\services\archive\tar.ps1" . "${env:LIBS_AUTOMATACI}\services\archive\ar.ps1" . "${env:LIBS_AUTOMATACI}\services\crypto\gpg.ps1" . "${env:LIBS_AUTOMATACI}\services\checksum\md5.ps1" +. "${env:LIBS_AUTOMATACI}\services\publishers\unix.ps1" @@ -54,13 +56,13 @@ function DEB-Create-Archive { } - # change directory into workspace + # to workspace directory $___current_path = Get-Location # package control $null = Set-Location "${___directory}\control" - $___process = TAR-Create-XZ "..\control.tar.xz" "*" + $___process = TAR-Create-XZ "${___directory}\control.tar.xz" "*" if ($___process -ne 0) { $null = Set-Location $___current_path $null = Remove-Variable -Name ___current_path @@ -70,7 +72,7 @@ function DEB-Create-Archive { # package data $null = Set-Location "${___directory}\data" - $___process = TAR-Create-XZ "..\data.tar.xz" "*" + $___process = TAR-Create-XZ "${___directory}\data.tar.xz" "*" if ($___process -ne 0) { $null = Set-Location $___current_path $null = Remove-Variable -Name ___current_path @@ -184,10 +186,10 @@ function DEB-Create-Checksum { # checksum every items foreach ($___line in (Get-ChildItem -Path "${___directory}\data" -File -Recurse)) { - $___checksum = MD5-Checksum-From-File "${___line}" - $___path = "${___line}" -replace [regex]::Escape("${___directory}\data\"), "" + $___checksum = MD5-Create-From-File "${___line}" + $___path = "${___line}" -replace [regex]::Escape("${___directory}\data\"), '' $___path = $___path -replace "\\", "/" - $___checksum = $___checksum -replace "\ .*$", "" + $___checksum = $___checksum -replace "\ .*$", '' $___process = FS-Append-File "${___location}" "${___checksum} ${___path}`n" if ($___process -ne 0) { return 1 @@ -262,7 +264,7 @@ function DEB-Create-Control { # generate control file - $___size = DISK-Calculate-Size "${___directory}\data" + $___size = DISK-Calculate-Size-Directory-KB "${___directory}\data" if ($(STRINGS-Is-Empty "${___size}") -eq 0) { return 1 } @@ -289,11 +291,11 @@ Description: ${___pitch} foreach ($___line in (Get-Content -Path "${___description_filepath}")) { if (($(STRINGS-Is-Empty "${___line}") -ne 0) -and - ($(STRINGS-Is-Empty "$($___line -replace "#.*$")") -eq 0)) { + ($(STRINGS-Is-Empty "$($___line -replace "#.*$", '')") -eq 0)) { continue } - $___line = $___line -replace '#.*' + $___line = $___line -replace '#.*', '' if ($(STRINGS-Is-Empty "${___line}") -eq 0) { $___line = " ." } else { @@ -316,7 +318,7 @@ function DEB-Create-Source-List { [string]$___directory, [string]$___gpg_id, [string]$___url, - [string]$___codename, + [string]$___component, [string]$___distribution, [string]$___keyring ) @@ -325,7 +327,7 @@ function DEB-Create-Source-List { # validate input if (($(STRINGS-Is-Empty "${___directory}") -eq 0) -or ($(STRINGS-Is-Empty "${___url}") -eq 0) -or - ($(STRINGS-Is-Empty "${___codename}") -eq 0) -or + ($(STRINGS-Is-Empty "${___component}") -eq 0) -or ($(STRINGS-Is-Empty "${___distribution}") -eq 0) -or ($(STRINGS-Is-Empty "${___keyring}") -eq 0)) { return 1 @@ -342,8 +344,6 @@ function DEB-Create-Source-List { # execute - $___url = "${___url}/deb" - $___url = $___url -replace "//deb", "/deb" $___key = "usr\local\share\keyrings\${___keyring}-keyring.gpg" $___filename = "${___directory}\data\etc\apt\sources.list.d\${___keyring}.list" @@ -358,11 +358,21 @@ function DEB-Create-Source-List { } $null = FS-Make-Housing-Directory "${___filename}" - $___process = FS-Write-File "${___filename}" @" + if ("$($___distribution -replace "\/.*$", '')" -eq $___distribution) { + # it's a pool repository + $___process = FS-Write-File "${___filename}" @" +# WARNING: AUTO-GENERATED - DO NOT EDIT! +deb [signed-by=/${___key}] ${___url} ${___distribution} ${__component} + +"@ + } else { + # it's a flat repository + $___process = FS-Write-File "${___filename}" @" # WARNING: AUTO-GENERATED - DO NOT EDIT! -deb [signed-by=/${___key}] ${___url} ${___codename} ${___distribution} +deb [signed-by=/${___key}] ${___url} ${___distribution} "@ + } if ($___process -ne 0) { return 1 } @@ -401,40 +411,21 @@ function DEB-Get-Architecture { } - # process os + # execute switch ($___os) { - linux { + any { + $___output = "all-" + } linux { $___output = "" } dragonfly { $___output = "dragonflybsd-" } default { $___output = "${___os}-" }} - - - # process arch - switch ($___arch) { - { $_ -in "386", "i386", "486", "i486", "586", "i586", "686", "i686" } { - $___output = "${___output}i386" - } "mipsle" { - $___output = "${___output}mipsel" - } "mipsr6le" { - $___output = "${___output}mipsr6el" - } "mips32le" { - $___output = "${___output}mips32el" - } "mips32r6le" { - $___output = "${___output}mips32r6el" - } "mips64le" { - $___output = "${___output}mips64el" - } "mips64r6le" { - $___output = "${___output}mips64r6el" - } "powerpcle" { - $___output = "${___output}powerpcel" - } "ppc64le" { - $___output = "${___output}ppc64el" - } default { - $___output = "${___output}${___arch}" - }} + $___output = "${___output}$(UNIX-Get-Arch "${___arch}")" + if ($___output -eq "all-all") { + $___output = "all" + } # report status @@ -462,6 +453,11 @@ function DEB-Is-Available { return 1 } + $___process = SHASUM-Is-Available + if ($___process -ne 0) { + return 1 + } + $___process = TAR-Is-Available if ($___process -ne 0) { return 1 @@ -477,6 +473,11 @@ function DEB-Is-Available { return 1 } + $___process = GPG-Is-Available + if ($___process -ne 0) { + return 1 + } + # check compatible target os switch ($___os) { @@ -529,3 +530,667 @@ function DEB-Is-Valid { # report status return 1 } + + + + +function DEB-Publish { + param ( + [string]$___repo_directory, + [string]$___data_directory, + [string]$___workspace_directory, + [string]$___target, + [string]$___distribution, + [string]$___component + ) + + + # validate input + if (($(STRINGS-Is-Empty "${___repo_directory}") -eq 0) -or + ($(STRINGS-Is-Empty "${___data_directory}") -eq 0) -or + ($(STRINGS-Is-Empty "${___workspace_directory}") -eq 0) -or + ($(STRINGS-Is-Empty "${___target}") -eq 0) -or + ($(STRINGS-Is-Empty "${___distribution}") -eq 0) -or + ($(STRINGS-Is-Empty "${___component}") -eq 0)) { + return 1 + } + + $___process = FS-Is-Directory "${___repo_directory}" + if ($___process -ne 0) { + return 1 + } + + $___process = FS-Is-File "${___target}" + if ($___process -ne 0) { + return 1 + } + + + # execute + $___directory_unpack = "${___workspace_directory}\deb" + $___repo_is_pool = $false + if ("$($___distribution -replace "\/.*$", '')" -eq $___distribution) { + # it's a pool repository + $___repo_is_pool = $true + } else { + # it's a flat repository + $___distribution = $___distribution -replace "\/.*$", '' + } + + + # unpack package control section + $null = FS-Remake-Directory "${___directory_unpack}" + $___process = DEB-Unpack "${___directory_unpack}" "${___target}" "control" + if ($___process -ne 0) { + return 1 + } + + $___process = FS-Is-File "${___directory_unpack}\control\control" + if ($___process -ne 0) { + return 1 + } + + + # parse package control data + $___value_type = "binary" # currently support this for now + $___value_package = "" + $___value_version = "" + $___value_arch = "" + $___value_maintainer = "" + $___value_buffer = "" + $___value_size = "$(DISK-Calculate-Size-File-Byte "${___target}")" + $___value_sha256 = "$(SHASUM-Create-From-File "${___target}" "256")" + $___value_sha1 = "$(SHASUM-Create-From-File "${___target}" "1")" + $___value_md5 = "$(MD5-Create-From-File "${___target}")" + $___value_description = "" + + foreach ($___line in (Get-Content "${___directory_unpack}/control/control")) { + $___regex = "^.*Package:\ " + if ("$($___line -replace $___regex, '')" -ne $___line) { + if ($(STRINGS-Is-Empty "${___value_package}") -ne 0) { + ## invalid control file - multiple same fileds detected + return 1 + } + + $___value_package = $___line -replace $___regex, '' + continue + } + + $___regex = "^.*Version:\ " + if ("$($___line -replace $___regex, '')" -ne $___line) { + if ($(STRINGS-Is-Empty "${___value_version}") -ne 0) { + ## invalid control file - multiple same fileds detected + return 1 + } + + $___value_version = $___line -replace $___regex, '' + continue + } + + $___regex = "^.*Architecture:\ " + if ("$($___line -replace $___regex, '')" -ne $___line) { + if ($(STRINGS-Is-Empty "${___value_arch}") -ne 0) { + ## invalid control file - multiple same fileds detected + return 1 + } + + $___value_arch = $___line -replace $___regex, '' + continue + } + + $___regex = "^.*Maintainer:\ " + if ("$($___line -replace $___regex, '')" -ne $___line) { + if ($(STRINGS-Is-Empty "${___value_maintainer}") -ne 0) { + ## invalid control file - multiple same fileds detected + return 1 + } + + $___value_maintainer = $___line -replace $___regex, '' + continue + } + + $___regex = "^.*Description:\ " + if ("$($___line -replace $___regex, '')" -ne $___line) { + if ($(STRINGS-Is-Empty "${___value_description}") -ne 0) { + ## invalid control file - multiple same fileds detected + return 1 + } + + $___value_description = $___line + continue + } + + if ($(STRINGS-Is-Empty "${___value_description}") -eq 0) { + if ($(STRINGS-Is-Empty "${___value_buffer}") -ne 0) { + $___value_buffer = "${___value_buffer}`n" + } + + $___value_buffer = "${___value_buffer}${___line}" + } else { + if ($(STRINGS-Is-Empty "${___value_description}") -ne 0) { + $___value_description = "${___value_description}`n" + } + + $___value_description = "${___value_description}${___line}" + } + } + + + # sanitize package metadata + if (($(STRINGS-Is-Empty "${___value_type}") -eq 0) -or + ($(STRINGS-Is-Empty "${___value_package}") -eq 0) -or + ($(STRINGS-Is-Empty "${___value_version}") -eq 0) -or + ($(STRINGS-Is-Empty "${___value_arch}") -eq 0) -or + ($(STRINGS-Is-Empty "${___value_maintainer}") -eq 0) -or + ($(STRINGS-Is-Empty "${___value_size}") -eq 0) -or + ($(STRINGS-Is-Empty "${___value_sha256}") -eq 0) -or + ($(STRINGS-Is-Empty "${___value_sha1}") -eq 0) -or + ($(STRINGS-Is-Empty "${___value_md5}") -eq 0) -or + ($(STRINGS-Is-Empty "${___value_description}") -eq 0)) { + return 1 + } + + + # process filename + $___value_filename = "${___value_package}_${___value_version}_${___value_arch}.deb" + if ($___repo_is_pool) { + $___value_filename = "${___value_package}\${___value_filename}" + $___value_filename = "$($(FS-Get-File "${___value_package}").Substring(0, 1))\${___value_filename}" + $___value_filename = "pool\${___distribution}\${___value_filename}" + } + + + # write to package database + $___dest = "${___value_package}_${___value_version}_${___value_arch}" + if ($___repo_is_pool) { + $___dest = "${___value_type}-${___value_arch}/${___dest}" + $___dest = "${___component}\${___dest}" + $___dest = "${___distribution}\${___dest}" + } + $___dest = "${___data_directory}\packages\${___dest}" + $___process = FS-Is-File "${___dest}" + if ($___process -eq 0) { + return 1 # duplicated package - already registered + } + + $null = FS-Make-Housing-Directory "${___dest}" + $___process = FS-Write-File "${___dest}" @" +Package: ${___value_package} +Version: ${___value_version} +Architecture: ${___value_arch} +Maintainer: ${___value_maintainer} +${___value_buffer} +Filename: $($___value_filename -replace "\\", "/") +Size: ${___value_size} +SHA256: ${___value_sha256} +SHA1: ${___value_sha1} +MD5sum: ${___value_md5} +${___value_description} + +"@ + if ($___process -ne 0) { + return 1 + } + + + # write to arch database + $___dest = "${___data_directory}\arch\${___value_arch}" + $null = FS-Make-Housing-Directory "${___dest}" + $___process = FS-Append-File "${___dest}" "${___value_filename}`n" + if ($___process -ne 0) { + return 1 + } + + + # export deb payload to destination + $___dest = "${___repo_directory}\${___value_filename}" + $___process = FS-Is-File "${___dest}" + if ($___process -ne 0) { + $null = FS-Make-Housing-Directory "${___dest}" + $___process = FS-Move "${___target}" "${___dest}" + if ($___process -ne 0) { + return 1 + } + } else { + return 1 # duplicated package existence or corrupted run + } + + + # report status + return 0 +} + + + + +function DEB-Publish-Conclude { + param ( + [string]$___repo_directory, + [string]$___data_directory, + [string]$___distribution, + [string]$___arch_list, + [string]$___component, + [string]$___codename, + [string]$___gpg_id + ) + + + # validate input + if (($(STRINGS-Is-Empty "${___repo_directory}") -eq 0) -or + ($(STRINGS-Is-Empty "${___data_directory}") -eq 0) -or + ($(STRINGS-Is-Empty "${___arch_list}") -eq 0) -or + ($(STRINGS-Is-Empty "${___component}") -eq 0) -or + ($(STRINGS-Is-Empty "${___codename}") -eq 0) -or + ($(STRINGS-Is-Empty "${___gpg_id}") -eq 0)) { + return 1 + } + + $___process = FS-Is-Directory "${___repo_directory}" + if ($___process -ne 0) { + return 1 + } + + $___process = FS-Is-Directory "${___data_directory}" + if ($___process -ne 0) { + return 1 + } + + $___process = GPG-Is-Available "${___gpg_id}" + if ($___process -ne 0) { + return 1 + } + + + # execute + $___directory_package = "${___data_directory}\packages" + $___repo_is_pool = $false + if ("$($___distribution -replace "\/.*$", '')" -eq $___distribution) { + # it's a pool repository + $___repo_is_pool = $true + $___repo_directory = "${___repo_directory}\dists" + } else { + # it's a flat repository + $___distribution = $___distribution -replace "\/.*$", '' + } + + + # formulate arch list if empty + if ($(STRINGS-Is-Empty "${___arch_list}") -eq 0) { + Get-ChildItem -Path "${___data_directory}\arch" -File ` + | ForEach-Object { $___line = $_.FullName + if ($(STRINGS-Is-Empty "${___arch_list}") -ne 0) { + $___arch_list = "${___arch_list} " + } + + $___arch_list = "${___arch_list}$(FS-Get-File "${___line}")" + } + } + + if ($(STRINGS-Is-Empty "${___arch_list}") -eq 0) { + return 1 + } + + + # purge all Package and Release files from repository + if ($___repo_is_pool) { + $null = FS-Remove-Silently "${___repo_directory}" + } else { + Get-ChildItem -Path "${___repo_directory}" ` + | Where-Object { + ($_.Name -eq "Packages") -or + ($_.Name -eq "Packages.gz") -or + ($_.Name -eq "Releases") -or + ($_.Name -eq "Releases.gpg") -or + ($_.Name -eq "InRelease") + } | ForEach-Object { + $null = FS-Remove-Silently $_.FullName + } + } + + + # recreate Package files + Get-ChildItem -Path "${___directory_package}" -File ` + | ForEach-Object { $___line = $_.FullName + ## get relative path + $___dest = $___line -replace [regex]::Escape("${___directory_package}\"), '' + + ## determine destination path + $___dest = "$(FS-Get-Directory "${___line}")" + if ($___repo_is_pool) { + $___dest = "${___repo_directory}\${___dest}" + } else { + if ("${___dest}" -ne "${___line}") { + # skip - it is a pool mode package in flat mode operation + continue + } + + $___dest = "${___repo_directory}" + } + $null = FS-Make-Directory "${___dest}" + + ## append package entry + $___process = FS-Is-File "${___dest}\Packages" + if ($___process -eq 0) { + $___process = FS-Append-File "${___dest}\Packages" "`n" + if ($___process -ne 0) { + return 1 + } + } + + foreach ($___content in (Get-Content -Path "${___directory_package}\${___line}")) { + $___process = FS-Append-File "${___dest}\Packages" "${___content}`n" + if ($___process -ne 0) { + return 1 + } + } + + $null = FS-Append-File $___location "${___line}`n" + } + + Get-ChildItem -Path "${___repo_directory}" ` + | Where-Object { ($_.Name -eq "Packages") } ` + | ForEach-Object { $___line = $_.FullName + ## gunzip all Package files + $null = FS-Copy-File "${___line}" "${___line}.backup" + $null = FS-Remove-Silently "${___line}.gz" + $___process = GZ-Create "${___line}" + if ($___process -ne 0) { + return 1 + } + + $___process = FS-Move "${___line}.backup" "${___line}" + if ($___process -ne 0) { + return 1 + } + + ## create corresponding legacy Release file for pool mode + if ($___repo_is_pool) { + $___arch = $___line -replace [regex]::Escape("${___repo_directory}\"), '' + $___arch = "$(FS-Get-Directory "${___arch}")" + + $___arch = $___arch -split "\" + $___suite = $___arch[0] + + $___component = $___arch[1] + $___arch = $___arch[2] -split "-" + + $___package_type = $___arch[0] + $___arch = $___arch[1] + + $___process = FS-Write-File ` + "$(FS-Get-Directory "${___line}")\Release" ` @" +Archive: ${___suite} +Component: ${___component} +Architecture: ${___arch} + +"@ + if ($___process -ne 0) { + return 1 + } + } + } + + + # generate repository metadata + if ($___repo_is_pool) { + $___repo_directory = "${___repo_directory}\${___distribution}" + } + $___dest_release = "${___repo_directory}\Release" + $null = FS-Remove-Silently "${___dest_release}" + $___dest_inrelease = "${___repo_directory}\InRelease" + $null = FS-Remove-Silently "${___dest_inrelease}" + $___dest_md5 = "${___repo_directory}\ReleaseMD5" + $null = FS-Remove-Silently "${___dest_md5}" + $___dest_sha1 = "${___repo_directory}\ReleaseSHA1" + $null = FS-Remove-Silently "${___dest_sha1}" + $___dest_sha256 = "${___repo_directory}\ReleaseSHA256" + $null = FS-Remove-Silently "${___dest_sha256}" + + Get-ChildItem -Path "${___repo_directory}" ` + | Where-Object { + ($_.Name -eq "Packages") -or + ($_.Name -eq "Packages.gz") -or + ($_.Name -eq "Release") + } | ForEach-Object { $___line = $_.FullName + $___size = "$(DISK-Calculate-Size-File-Byte "${___line}")" + $___path = $___line -replace [regex]::Escape("${___repo_directory}\"), '' + + $___checksum = "$(MD5-Create-From-File "${___line}")" + $___process = FS-Append-File "${___dest_md5}" ` + " ${___checksum} ${___size} ${___path}`n" + if ($___process -ne 0) { + return 1 + } + + $___checksum = "$(SHASUM-Create-From-File "${___line}" "1")" + $___process = FS-Append-File "${___dest_sha1}" ` + " ${___checksum} ${___size} ${___path}`n" + if ($___process -ne 0) { + return 1 + } + + $___checksum = "$(SHASUM-Create-From-File "${___line}" "256")" + $___process = FS-Append-File "${___dest_sha256}" ` + " ${___checksum} ${___size} ${___path}`n" + if ($___process -ne 0) { + return 1 + } + } + + + # create root Release file + $___process = FS-Write-File "${___dest_release}" @" +Suite: ${___distribution} +Codename: ${___codename} +Date: $(TIME-Format-Datetime-RFC5322-UTC "$(TIME-Now)") +Architectures: ${___arch_list} +Components: ${___component} + +"@ + if ($___process -ne 0) { + return 1 + } + + $___process = FS-Append-File "${___dest_release}" "MD5Sum:`n" + if ($___process -ne 0) { + return 1 + } + foreach ($___line in (Get-Content -Path "${___dest_md5}")) { + $___process = FS-Append-File "${___dest_release}" "${___line}`n" + if ($___process -ne 0) { + return 1 + } + } + $___process = FS-Remove "${___dest_md5}" + if ($___process -ne 0) { + return 1 + } + + $___process = FS-Append-File "${___dest_release}" "SHA1:`n" + if ($___process -ne 0) { + return 1 + } + foreach ($___line in (Get-Content -Path "${___dest_sha1}")) { + $___process = FS-Append-File "${___dest_release}" "${___line}`n" + if ($___process -ne 0) { + return 1 + } + } + $___process = FS-Remove "${___dest_sha1}" + if ($___process -ne 0) { + return 1 + } + + $___process = FS-Append-File "${___dest_release}" "SHA256:`n" + if ($___process -ne 0) { + return 1 + } + foreach ($___line in (Get-Content -Path "${___dest_sha256}")) { + $___process = FS-Append-File "${___dest_release}" "${___line}`n" + if ($___process -ne 0) { + return 1 + } + } + $___process = FS-Remove "${___dest_sha256}" + if ($___process -ne 0) { + return 1 + } + + + # create InRelease file + $___process = GPG-Clear-Sign-File ` + "${___dest_inrelease}" ` + "${___dest_release}" ` + "${___gpg_id}" + if ($___process -ne 0) { + return 1 + } + + + # create Release.gpg file + $___process = GPG-Detach-Sign-File ` + "${___dest_release}.gpg" ` + "${___dest_release}" ` + "${___gpg_id}" + if ($___process -ne 0) { + return 1 + } + + + # report status + return 0 +} + + + + +function DEB-Unpack { + param( + [string]$___directory, + [string]$___target, + [string]$___unpack_type + ) + + # validate input + if ($(STRINGS-Is-Empty "${___directory}") -eq 0) { + return 1 + } + + $___process = FS-Is-Directory "${___directory}" + if ($___process -ne 0) { + return 1 + } + + $___process = FS-Is-File "${___target}" + if ($___process -ne 0) { + return 1 + } + + $___process = FS-Is-Target-Exist "${___directory}\control" + if ($___process -eq 0) { + return 1 + } + + $___process = FS-Is-Target-Exist "${___directory}\data" + if ($___process -eq 0) { + return 1 + } + + $___process = FS-Is-Target-Exist "${___directory}\debian-binary" + if ($___process -eq 0) { + return 1 + } + + + # execute + # copy target into directory + $___process = FS-Copy-File "${___target}" "${___directory}" + if ($___process -ne 0) { + return 1 + } + + + # to workspace directory + $___current_path = Get-Location + $null = Set-Location "${___directory}" + + + # ar extract outer layer + $___source = ".\$(FS-Get-File "${___target}")" + $___process = AR-Extract "${___source}" + if ($___process -ne 0) { + $null = Set-Location -Path $___current_path + $null = Remove-Variable -Name ___current_path + return 1 + } + $null = FS-Remove-Silently "${___source}" + + + # unpack control.tar.*z by request + if ($(STRINGS-To-Lowercase "${___unpack_type}") -ne "data") { + $___source=".\control.tar.xz" + $___dest=".\control" + $null = FS-Make-Directory "${___dest}" + $___process = FS-Is-File "${___source}" + if ($___process -eq 0) { + $___process = TAR-Extract-XZ "${___dest}" "${___source}" + } else { + $___source=".\control.tar.gz" + $___process = FS-Is-File "${___source}" + if ($___process -ne 0) { + $null = Set-Location -Path $___current_path + $null = Remove-Variable -Name ___current_path + return 1 + } + + $___process = TAR-Extract-GZ "${___dest}" "${___source}" + } + $null = FS-Remove-Silently "${___source}" + } + + if ($(STRINGS-To-Lowercase "${___unpack_type}") -eq "control") { + # stop as requested. + $null = Set-Location -Path $___current_path + $null = Remove-Variable -Name ___current_path + + + # report status + if ($___process -ne 0) { + return 1 + } + return 0 + } + + + # unpack data.tar.*z by request + $___source=".\data.tar.xz" + $___dest=".\data" + $null = FS-Make-Directory "${___dest}" + $___process = FS-Is-File "${___source}" + if ($___process -eq 0) { + $___process = TAR-Extract-XZ "${___dest}" "${___source}" + } else { + $___source=".\data.tar.gz" + $___process = FS-Is-File "${___source}" + if ($___process -ne 0) { + $null = Set-Location -Path $___current_path + $null = Remove-Variable -Name ___current_path + return 1 + } + + $___process = TAR-Extract-GZ "${___dest}" "${___source}" + } + $null = FS-Remove-Silently "${___source}" + + + # back to current directory + $null = Set-Location -Path $___current_path + $null = Remove-Variable -Name ___current_path + + + # report status + if ($___process -ne 0) { + return 1 + } + return 0 +} diff --git a/automataCI/services/compilers/deb.sh b/automataCI/services/compilers/deb.sh index 928e03d6..4642f017 100644 --- a/automataCI/services/compilers/deb.sh +++ b/automataCI/services/compilers/deb.sh @@ -10,14 +10,16 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations under # the License. +. "${LIBS_AUTOMATACI}/services/io/disk.sh" . "${LIBS_AUTOMATACI}/services/io/os.sh" . "${LIBS_AUTOMATACI}/services/io/fs.sh" . "${LIBS_AUTOMATACI}/services/io/strings.sh" -. "${LIBS_AUTOMATACI}/services/io/disk.sh" +. "${LIBS_AUTOMATACI}/services/io/time.sh" . "${LIBS_AUTOMATACI}/services/archive/tar.sh" . "${LIBS_AUTOMATACI}/services/archive/ar.sh" . "${LIBS_AUTOMATACI}/services/crypto/gpg.sh" . "${LIBS_AUTOMATACI}/services/checksum/md5.sh" +. "${LIBS_AUTOMATACI}/services/publishers/unix.sh" @@ -53,13 +55,13 @@ DEB_Create_Archive() { fi - # capture current directory + # to workspace directory ___current_path="$PWD" # package control cd "${___directory}/control" - TAR_Create_XZ "../control.tar.xz" "*" + TAR_Create_XZ "${___directory}/control.tar.xz" "." if [ $? -ne 0 ]; then cd "$___current_path" && unset ___current_path return 1 @@ -68,7 +70,7 @@ DEB_Create_Archive() { # package data cd "${___directory}/data" - TAR_Create_XZ "../data.tar.xz" "*" + TAR_Create_XZ "${___directory}/data.tar.xz" "*" if [ $? -ne 0 ]; then cd "$___current_path" && unset ___current_path return 1 @@ -175,7 +177,11 @@ DEB_Create_Checksum() { # checksum every items for ___line in $(find "${1}/data" -type f); do - ___checksum="$(MD5_Checksum_From_File "$___line")" + ___checksum="$(MD5_Create_From_File "$___line") ${___line}" + if [ $? -ne 0 ]; then + return 1 + fi + ___line="${___line##*${1}/data/}" ___checksum="${___checksum%% *}" FS_Append_File "$___location" "${___checksum} ${___line}\n" @@ -251,7 +257,7 @@ DEB_Create_Control() { # generate control file - ___size="$(DISK_Calculate_Size "${___directory}/data")" + ___size="$(DISK_Calculate_Size_Directory_KB "${___directory}/data")" if [ $(STRINGS_Is_Empty "$___size") -eq 0 ]; then return 1 fi @@ -270,7 +276,8 @@ Description: $___pitch # append description data file - if [ ! "$(FS_Is_File "$___description_filepath")" = "0" ]; then + FS_Is_File "$___description_filepath" + if [ $? -ne 0 ]; then return 0 # report status early fi @@ -303,7 +310,7 @@ DEB_Create_Source_List() { ___directory="$1" ___gpg_id="$2" ___url="$3" - ___codename="$4" + ___component="$4" ___distribution="$5" ___keyring="$6" @@ -311,7 +318,7 @@ DEB_Create_Source_List() { # validate input if [ $(STRINGS_Is_Empty "$___directory") -eq 0 ] || [ $(STRINGS_Is_Empty "$___url") -eq 0 ] || - [ $(STRINGS_Is_Empty "$___codename") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___component") -eq 0 ] || [ $(STRINGS_Is_Empty "$___distribution") -eq 0 ] || [ $(STRINGS_Is_Empty "$___keyring") -eq 0 ]; then return 1 @@ -328,8 +335,6 @@ DEB_Create_Source_List() { # execute - ___url="${___url}/deb" - ___url="${___url%//deb*}/deb" ___key="usr/local/share/keyrings/${___keyring}-keyring.gpg" ___filename="${___directory}/data/etc/apt/sources.list.d/${___keyring}.list" @@ -343,12 +348,20 @@ DEB_Create_Source_List() { return 1 fi - FS_Make_Housing_Directory "$___filename" - FS_Write_File "$___filename" "\ + if [ "${___distribution%%/*}" = "$___distribution" ]; then + # it's a pool repository + FS_Write_File "$___filename" "\ # WARNING: AUTO-GENERATED - DO NOT EDIT! -deb [signed-by=/${___key}] ${___url} ${___codename} ${___distribution} +deb [signed-by=/${___key}] ${___url} ${___distribution} ${__component} " + else + # it's a flat repository + FS_Write_File "$___filename" "\ +# WARNING: AUTO-GENERATED - DO NOT EDIT! +deb [signed-by=/${___key}] ${___url} ${___distribution} +" + fi if [ $? -ne 0 ]; then return 1 fi @@ -383,8 +396,11 @@ DEB_Get_Architecture() { fi - # process os + # execute case "$1" in + any) + ___output="all-" + ;; linux) ___output="" ;; @@ -395,41 +411,10 @@ DEB_Get_Architecture() { ___output="${1}-" ;; esac - - - # process arch - case "$2" in - 386|i386|486|i486|586|i586|686|i686) - ___output="${___output}i386" - ;; - mipsle) - ___output="${___output}mipsel" - ;; - mipsr6le) - ___output="${___output}mipsr6el" - ;; - mips32le) - ___output="${___output}mips32el" - ;; - mips32r6le) - ___output="${___output}mips32r6el" - ;; - mips64le) - ___output="${___output}mips64el" - ;; - mips64r6le) - ___output="${___output}mips64r6el" - ;; - powerpcle) - ___output="${___output}powerpcel" - ;; - ppc64le) - ___output="${___output}ppc64el" - ;; - *) - ___output="${___output}${2}" - ;; - esac + ___output="${___output}$(UNIX_Get_Arch "$2")" + if [ "$___output" = "all-all" ]; then + ___output="all" + fi # report status @@ -456,6 +441,11 @@ DEB_Is_Available() { return 1 fi + SHASUM_Is_Available + if [ $? -ne 0 ]; then + return 1 + fi + TAR_Is_Available if [ $? -ne 0 ]; then return 1 @@ -471,6 +461,11 @@ DEB_Is_Available() { return 1 fi + GPG_Is_Available + if [ $? -ne 0 ]; then + return 1 + fi + OS_Is_Command_Available "find" if [ $? -ne 0 ]; then return 1 @@ -488,7 +483,6 @@ DEB_Is_Available() { esac - # check compatible target cpu architecture case "$2" in any) @@ -531,3 +525,659 @@ DEB_Is_Valid() { # return status return 1 } + + + + +DEB_Publish() { + ___repo_directory="$1" + ___data_directory="$2" + ___workspace_directory="$3" + ___target="$4" + ___distribution="$5" + ___component="$6" + + + # validate input + if [ $(STRINGS_Is_Empty "$___repo_directory") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___data_directory") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___workspace_directory") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___target") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___distribution") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___component") -eq 0 ]; then + return 1 + fi + + FS_Is_Directory "$___repo_directory" + if [ $? -ne 0 ]; then + return 1 + fi + + FS_Is_File "$___target" + if [ $? -ne 0 ]; then + return 1 + fi + + + # execute + ___directory_unpack="${___workspace_directory}/deb" + ___repo_is_pool=1 + if [ "${___distribution%%/*}" = "$___distribution" ]; then + ## it's a pool repository + ___repo_is_pool=0 + else + ## it's a flat repository + ___distribution="${___distribution%%/*}" + fi + + + # unpack package control section + FS_Remake_Directory "$___directory_unpack" + DEB_Unpack "$___directory_unpack" "$___target" "control" + if [ $? -ne 0 ]; then + return 1 + fi + + FS_Is_File "${___directory_unpack}/control/control" + if [ $? -ne 0 ]; then + return 1 + fi + + + # parse package control data + ___value_type="binary" # currently support this for now + ___value_package="" + ___value_version="" + ___value_arch="" + ___value_maintainer="" + ___value_buffer="" + ___value_size="$(DISK_Calculate_Size_File_Byte "$___target")" + ___value_sha256="$(SHASUM_Create_From_File "$___target" "256")" + ___value_sha1="$(SHASUM_Create_From_File "$___target" "1")" + ___value_md5="$(MD5_Create_From_File "$___target")" + ___value_description="" + + ___old_IFS="$IFS" + while IFS= read -r ___line || [ -n "$___line" ]; do + if [ "${___line#*Package: }" != "${___line}" ]; then + if [ $(STRINGS_Is_Empty "$___value_package") -ne 0 ]; then + ## invalid control file - multiple same fields detected + return 1 + fi + + ___value_package="${___line#*Package: }" + continue + fi + + if [ "${___line#*Version: }" != "${___line}" ]; then + if [ $(STRINGS_Is_Empty "$___value_version") -ne 0 ]; then + ## invalid control file - multiple same fields detected + return 1 + fi + + ___value_version="${___line#*Version: }" + continue + fi + + if [ "${___line#*Architecture: }" != "${___line}" ]; then + if [ $(STRINGS_Is_Empty "$___value_arch") -ne 0 ]; then + ## invalid control file - multiple same fields detected + return 1 + fi + + ___value_arch="${___line#*Architecture: }" + continue + fi + + if [ "${___line#*Maintainer: }" != "${___line}" ]; then + if [ $(STRINGS_Is_Empty "$___value_maintainer") -ne 0 ]; then + ## invalid control file - multiple same fields detected + return 1 + fi + + ___value_maintainer="${___line#*Maintainer: }" + continue + fi + + if [ "${___line#*Description: }" != "${___line}" ]; then + if [ $(STRINGS_Is_Empty "$___value_description") -ne 0 ]; then + ## invalid control file - multiple same fields detected + return 1 + fi + + ___value_description="$___line" + continue + fi + + if [ $(STRINGS_Is_Empty "$___value_description") -eq 0 ]; then + if [ $(STRINGS_Is_Empty "$___value_buffer") -ne 0 ]; then + ___value_buffer="${___value_buffer}\n" + fi + + ___value_buffer="${___value_buffer}${___line}" + else + if [ $(STRINGS_Is_Empty "$___value_description") -ne 0 ]; then + ___value_description="${___value_description}\n" + fi + + ___value_description="${___value_description}${___line}" + fi + done < "${___directory_unpack}/control/control" + IFS="$___old_IFS" && unset ___old_IFS + + + # sanitize package metadata + if [ $(STRINGS_Is_Empty "$___value_type") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___value_package") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___value_version") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___value_arch") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___value_maintainer") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___value_size") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___value_sha256") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___value_sha1") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___value_md5") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___value_description") -eq 0 ]; then + return 1 + fi + + + # process filename + ___value_filename="${___value_package}_${___value_version}_${___value_arch}.deb" + if [ $___repo_is_pool -eq 0 ]; then + ___value_filename="${___value_package}/${___value_filename}" + ___value_filename="$(printf -- "%.1s" "$(FS_Get_File "$___value_package")")/${___value_filename}" + ___value_filename="pool/${___distribution}/${___value_filename}" + fi + + + # write to package database + ___dest="${___value_package}_${___value_version}_${___value_arch}" + if [ $___repo_is_pool -eq 0 ]; then + ___dest="${___value_type}-${___value_arch}/${___dest}" + ___dest="${___component}/${___dest}" + ___dest="${___distribution}/${___dest}" + fi + ___dest="${___data_directory}/packages/${___dest}" + FS_Is_File "$___dest" + if [ $? -eq 0 ]; then + return 1 # duplicated package - already registered + fi + + FS_Make_Housing_Directory "$___dest" + FS_Write_File "$___dest" "\ +Package: ${___value_package} +Version: ${___value_version} +Architecture: ${___value_arch} +Maintainer: ${___value_maintainer} +${___value_buffer} +Filename: ${___value_filename} +Size: ${___value_size} +SHA256: ${___value_sha256} +SHA1: ${___value_sha1} +MD5sum: ${___value_md5} +${___value_description} +" + if [ $? -ne 0 ]; then + return 1 + fi + + + # write to arch database + ___dest="${___data_directory}/arch/${___value_arch}" + FS_Make_Housing_Directory "$___dest" + FS_Append_File "$___dest" "${___value_filename}\n" + if [ $? -ne 0 ]; then + return 1 + fi + + + # export deb payload to destination + ___dest="${___repo_directory}/${___value_filename}" + FS_Is_File "$___dest" + if [ $? -ne 0 ]; then + FS_Make_Housing_Directory "$___dest" + if [ $___repo_is_pool -eq 0 ]; then + FS_Copy_File "$___target" "$___dest" + else + FS_Move "$___target" "$___dest" + fi + if [ $? -ne 0 ]; then + return 1 + fi + elif [ "$___target" != "$___dest" ]; then + return 1 # duplicated package existence or corrupted run + fi + + + # report status + return 0 +} + + + + +DEB_Publish_Conclude() { + ___repo_directory="$1" + ___data_directory="$2" + ___distribution="$3" + ___arch_list="$4" + ___component="$5" + ___codename="$6" + ___gpg_id="$7" + + + # validate input + if [ $(STRINGS_Is_Empty "$___repo_directory") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___data_directory") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___distribution") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___component") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___codename") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___gpg_id") -eq 0 ]; then + return 1 + fi + + FS_Is_Directory "$___repo_directory" + if [ $? -ne 0 ]; then + return 1 + fi + + FS_Is_Directory "$___data_directory" + if [ $? -ne 0 ]; then + return 1 + fi + + OS_Is_Command_Available "find" + if [ $? -ne 0 ]; then + return 1 + fi + + GPG_Is_Available "$___gpg_id" + if [ $? -ne 0 ]; then + return 1 + fi + + + # execute + ___directory_package="${___data_directory}/packages" + ___repo_is_pool=1 + if [ "${___distribution%%/*}" = "$___distribution" ]; then + # it's a pool repository + ___repo_is_pool=0 + ___repo_directory="${___repo_directory}/dists" + else + ## it's a flat repository + ___distribution="${___distribution%%/*}" + fi + + + # formulate arch list if empty + if [ $(STRINGS_Is_Empty "$___arch_list") -eq 0 ]; then + ___old_IFS="$IFS" + while IFS= read -r ___line || [ -n "$___line" ]; do + if [ $(STRINGS_Is_Empty "$___arch_list") -ne 0 ]; then + ___arch_list="${___arch_list} " + fi + + ___arch_list="${___arch_list}$(FS_Get_File "$___line")" + done < +# Copyright 2023 (Holloway) Chew, Kean Ho # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy @@ -58,7 +58,7 @@ function IPK-Create-Archive { # package control $null = Set-Location "${___directory}\control" - $___process = TAR-Create-GZ "..\control.tar.gz" "*" + $___process = TAR-Create-GZ "${___directory}\control.tar.gz" "." if ($___process -ne 0) { $null = Set-Location $___current_path $null = Remove-Variable -Name ___current_path @@ -68,7 +68,7 @@ function IPK-Create-Archive { # package data $null = Set-Location "${___directory}\data" - $___process = TAR-Create-GZ "..\data.tar.gz" "*" + $___process = TAR-Create-GZ "${___directory}\data.tar.gz" "." if ($___process -ne 0) { $null = Set-Location $___current_path $null = Remove-Variable -Name ___current_path @@ -98,7 +98,7 @@ function IPK-Create-Archive { # move to destination $null = FS-Remove-Silently "${___destination}" - $___process = FS-Move "${___file}.gz" "${___destination}" + $___process = FS-Move "${___file}" "${___destination}" # return to current directory diff --git a/automataCI/services/compilers/ipk.sh b/automataCI/services/compilers/ipk.sh index 8e7c2763..86dffe99 100644 --- a/automataCI/services/compilers/ipk.sh +++ b/automataCI/services/compilers/ipk.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho +# Copyright 2023 (Holloway) Chew, Kean Ho # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of @@ -57,7 +57,7 @@ IPK_Create_Archive() { # package control cd "${___directory}/control" - TAR_Create_GZ "../control.tar.gz" "*" + TAR_Create_GZ "${___directory}/control.tar.gz" "." if [ $? -ne 0 ]; then cd "$___current_path" && unset ___current_path return 1 @@ -66,7 +66,7 @@ IPK_Create_Archive() { # package data cd "${___directory}/data" - TAR_Create_GZ "../data.tar.gz" "*" + TAR_Create_GZ "${___directory}/data.tar.gz" "." if [ $? -ne 0 ]; then cd "$___current_path" && unset ___current_path return 1 @@ -93,7 +93,7 @@ IPK_Create_Archive() { # move to destination FS_Remove_Silently "$___destination" - FS_Move "${___file}.gz" "$___destination" + FS_Move "$___file" "$___destination" ___process=$? diff --git a/automataCI/services/compilers/node.ps1 b/automataCI/services/compilers/node.ps1 index fa926a7d..5c088a95 100644 --- a/automataCI/services/compilers/node.ps1 +++ b/automataCI/services/compilers/node.ps1 @@ -370,9 +370,11 @@ function NODE-Setup { } $___location = "$(NODE-Get-Activator-Path)" - $null = FS-Remove-Silently "$(FS-Get-Directory "${___location}")" + $___directory = "$(FS-Get-Directory "${___location}")" + $null = FS-Remove-Silently "${___directory}" $___target = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TOOLS}\" + $null = FS-Make-Directory "${___target}" switch ("${env:PROJECT_OS}") { "windows" { $___process = ZIP-Extract "${___target}" "${___filepath}" @@ -387,15 +389,14 @@ function NODE-Setup { return 1 } - $___process = FS-Move "${___target}" "$(FS-Get-Directory "${___location}")" + $___process = FS-Move "${___target}" "${___directory}" if ($___process -ne 0) { return 1 } - ## create activator script $___label = "(${env:PROJECT_PATH_NODE_ENGINE})" - $___target = "$(FS-Get-Directory "${___location}")" + $___target = "${___directory}" $null = FS-Write-File "${___location}" @" `$___target = `"${___target}`" diff --git a/automataCI/services/compilers/node.sh b/automataCI/services/compilers/node.sh index 29cbaece..b645f1ef 100644 --- a/automataCI/services/compilers/node.sh +++ b/automataCI/services/compilers/node.sh @@ -377,6 +377,7 @@ NODE_Setup() { FS_Remove_Silently "$(FS_Get_Directory "$___location")" ___target="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TOOLS}/" + FS_Make_Directory "$___target" case "$PROJECT_OS" in windows) ZIP_Extract "$___target" "$___filepath" @@ -395,7 +396,8 @@ NODE_Setup() { return 1 fi - FS_Move "$___target" "$(FS_Get_Directory "$___location")" + ___directory="$(FS_Get_Directory "$___location")" + FS_Move "$___target" "$___directory" if [ $? -ne 0 ]; then return 1 fi @@ -403,7 +405,7 @@ NODE_Setup() { ## create activator script ___label="($PROJECT_PATH_NODE_ENGINE)" - ___target="$(FS_Get_Directory "$___location")/bin" + ___target="${___directory}/bin" FS_Write_File "$___location" "\ #!/bin/sh ___target=\"${___target}\" diff --git a/automataCI/services/compilers/rpm.ps1 b/automataCI/services/compilers/rpm.ps1 index ef150674..0df151ce 100644 --- a/automataCI/services/compilers/rpm.ps1 +++ b/automataCI/services/compilers/rpm.ps1 @@ -11,8 +11,12 @@ # under the License. . "${env:LIBS_AUTOMATACI}\services\io\os.ps1" . "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\disk.ps1" . "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\time.ps1" . "${env:LIBS_AUTOMATACI}\services\compilers\changelog.ps1" +. "${env:LIBS_AUTOMATACI}\services\checksum\md5.ps1" +. "${env:LIBS_AUTOMATACI}\services\checksum\shasum.ps1" @@ -100,7 +104,9 @@ function RPM-Create-Source-Repo { [string]$___directory, [string]$___gpg_id, [string]$___url, + [string]$___metalink, [string]$___name, + [string]$___scope, [string]$___sku ) @@ -114,6 +120,7 @@ function RPM-Create-Source-Repo { ($(STRINGS-Is-Empty "${___gpg_id}") -eq 0) -or ($(STRINGS-Is-Empty "${___url}") -eq 0) -or ($(STRINGS-Is-Empty "${___name}") -eq 0) -or + ($(STRINGS-Is-Empty "${___scope}") -eq 0) -or ($(STRINGS-Is-Empty "${___sku}") -eq 0)) { return 1 } @@ -135,11 +142,23 @@ function RPM-Create-Source-Repo { # execute - $___url = "${___url}/rpm" - $___url = $___url -replace "//rpm", "/rpm" $___key = "usr\local\share\keyrings\${___sku}-keyring.gpg" $___filename = "etc\yum.repos.d\${___sku}.repo" + if ($(STRINGS-Is-Empty "${___metalink}") -ne 0) { + $___url = @" +#baseurl=${___url} # note: flat repository - base url is only for reference +metalink=${___metalink} + +"@ + } else { + $___url = @" +baseurl=${___url} + +"@ + +} + $___process = FS-Is-File "${___directory}\BUILD\$(FS-Get-File "${___filename}")" if ($___process -eq 0) { return 10 @@ -151,12 +170,11 @@ function RPM-Create-Source-Repo { } $null = FS-Make-Directory "${___directory}\BUILD" - $___process = FS-Write-File ` - "${___directory}\BUILD\$(FS-Get-File "${___filename}")" @" + $___process = FS-Write-File "${___directory}\BUILD\$(FS-Get-File "${___filename}")" @" # WARNING: AUTO-GENERATED - DO NOT EDIT! -[${___sku}] +[${___scope}-${___sku}] name=${___name} -baseurl=${___url} +${___url} gpgcheck=1 gpgkey=file:///${___key} @@ -445,6 +463,149 @@ URL: ${___website} +function RPM-Flatten-Repo { + param( + [string]$___repo_directory, + [string]$___filename_repomdxml, + [string]$___filename_metalink, + [string]$___base_url + ) + + + # validate input + if (($(STRINGS-Is-Empty "${___repo_directory}") -eq 0) -or + ($(STRINGS-Is-Empty "${___filename_repomdxml}") -eq 0) -or + ($(STRINGS-Is-Empty "${___filename_metalink}") -eq 0) -or + ($(STRINGS-Is-Empty "${___base_url}") -eq 0)) { + return 1 + } + + $___process = FS-Is-Directory "${___repo_directory}" + if ($___process -ne 0) { + return 1 + } + + $___process = FS-Is-Directory "${___repo_directory}\repodata" + if ($___process -ne 0) { + return 1 + } + + $___process = FS-Is-File "${___repo_directory}\repodata\repomd.xml" + if ($___process -ne 0) { + return 1 + } + + $___repomd = "${___repo_directory}\repomd.xml" + if ($(STRINGS-Is-Empty "${___filename_repomdxml}") -ne 0) { + $___repomd = "${___repo_directory}\${___filename_repomdxml}" + } + + $___metalink = "${___repo_directory}\METALINK_RPM" + if ($(STRINGS-Is-Empty "${___filename_metalink}") -ne 0) { + $___repomd = "${___repo_directory}\${___filename_metalink}" + } + + + # patch repomd.xml location fields and write to main directory + $null = FS-Remove-Silently "${___repomd}" + + foreach ($___line in (Get-Content -Path "${___repo_directory}/repodata/repomd.xml")) { + ## patch location fields + if ($($___line -replace "^\s* + + + + ${___time} + $(DISK-Calculate-Size-File-Byte "${___repomd}") + + $(MD5-Create-From-File "${___repomd}") + $(SHASUM-Create-From-File "${___repomd}" "1") + $(SHASUM-Create-From-File "${___repomd}" "256") + $(SHASUM-Create-From-File "${___repomd}" "512") + + + ${___url} + + + + + +"@ + if ($___process -ne 0) { + return 1 + } + + + # report status + return 0 +} + + + + function RPM-Is-Available { param( [string]$___os, @@ -550,22 +711,30 @@ function RPM-Register { # execute ## write into SPEC_INSTALL $___spec = "${___workspace}/SPEC_INSTALL" - $___dir = "$(FS-Get-Directory "${___target}")" - $___content = "`n" - if ($___dir -ne $___target) { - $___content = "${___content}`nmkdir -p %{buildroot}/${___dir}`n" + if ($(STRINGS-Is-Empty "${___is_directory}") -ne 0) { + $___content = @" +mkdir -p %{buildroot}/${___target} +cp -r $(FS_Get_Directory "${___source}") %{buildroot}/${___target}/. + +"@ + } else { + $___content = @" +mkdir -p %{buildroot}/$(FS-Get-Directory "${___target}") +cp -r ${___source} %{buildroot}/${___target}/. + +"@ } - $___content = "${___content}`ncp -r ${___source} %{buildroot}/${___target}`n" - $___process = FS-Append-File "${___spec}" "${___content}`n" + + $___process = FS-Append-File "${___spec}" "${___content}" if ($___process -ne 0) { return 1 } - ## write into SPEC_FILES + # write into SPEC_FILES $___spec = "${___workspace}/SPEC_FILES" $___content = "/${___content}" if ($(STRINGS-Is-Empty "${___is_directory}") -ne 0) { - $___content = "${___content}/*" + $___content = "${___content}/$(FS-Get-Directory "${___target}")" } $___content = "${___content}`n" $___process = FS-Append-File "${___spec}" "${___content}" diff --git a/automataCI/services/compilers/rpm.sh b/automataCI/services/compilers/rpm.sh index 3870e222..28afbf96 100644 --- a/automataCI/services/compilers/rpm.sh +++ b/automataCI/services/compilers/rpm.sh @@ -12,8 +12,12 @@ # the License. . "${LIBS_AUTOMATACI}/services/io/os.sh" . "${LIBS_AUTOMATACI}/services/io/fs.sh" +. "${LIBS_AUTOMATACI}/services/io/disk.sh" . "${LIBS_AUTOMATACI}/services/io/strings.sh" +. "${LIBS_AUTOMATACI}/services/io/time.sh" . "${LIBS_AUTOMATACI}/services/compilers/changelog.sh" +. "${LIBS_AUTOMATACI}/services/checksum/md5.sh" +. "${LIBS_AUTOMATACI}/services/checksum/shasum.sh" @@ -106,8 +110,10 @@ RPM_Create_Source_Repo() { ___directory="$2" ___gpg_id="$3" ___url="$4" - ___name="$5" - ___sku="$6" + ___metalink="$5" + ___name="$6" + ___scope="$7" + ___sku="$8" # validate input @@ -119,6 +125,7 @@ RPM_Create_Source_Repo() { [ $(STRINGS_Is_Empty "$___gpg_id") -eq 0 ] || [ $(STRINGS_Is_Empty "$___url") -eq 0 ] || [ $(STRINGS_Is_Empty "$___name") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___scope") -eq 0 ] || [ $(STRINGS_Is_Empty "$___sku") -eq 0 ]; then return 1 fi @@ -140,11 +147,20 @@ RPM_Create_Source_Repo() { # execute - ___url="${___url}/rpm" - ___url="${___url%//rpm*}/rpm" ___key="usr/local/share/keyrings/${___sku}-keyring.gpg" ___filename="etc/yum.repos.d/${___sku}.repo" + if [ $(STRINGS_Is_Empty "$___metalink") -ne 0 ]; then + ___url="\ +#baseurl=${___url} # note: flat repository - only for reference +metalink=${___metalink} +" + else + ___url="\ +baseurl=${___url} +" + fi + FS_Is_File "${___directory}/BUILD/$(FS_Get_File "$___filename")" if [ $? -eq 0 ]; then return 10 @@ -158,9 +174,9 @@ RPM_Create_Source_Repo() { FS_Make_Directory "${___directory}/BUILD" FS_Write_File "${___directory}/BUILD/$(FS_Get_File "$___filename")" "\ # WARNING: AUTO-GENERATED - DO NOT EDIT! -[${___sku}] +[${___scope}-${___sku}] name=${___name} -baseurl=${___url} +${___url} gpgcheck=1 gpgkey=file:///${___key} " @@ -456,6 +472,150 @@ URL: ${___website} +RPM_Flatten_Repo() { + ___repo_directory="$1" + ___filename_repomdxml="$2" + ___filename_metalink="$3" + ___base_url="$4" + + + # validate input + if [ $(STRINGS_Is_Empty "$___repo_directory") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___filename_repomdxml") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___filename_metalink") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___base_url") -eq 0 ]; then + return 1 + fi + + FS_Is_Directory "$___repo_directory" + if [ $? -ne 0 ]; then + return 1 + fi + + FS_Is_Directory "${___repo_directory}/repodata" + if [ $? -ne 0 ]; then + return 1 + fi + + FS_Is_File "${___repo_directory}/repodata/repomd.xml" + if [ $? -ne 0 ]; then + return 1 + fi + + ___repomd="${___repo_directory}/repomd.xml" + if [ $(STRINGS_Is_Empty "$___filename_repomdxml") -ne 0 ]; then + ___repomd="${___repo_directory}/${___filename_repomdxml}" + fi + + ___metalink="${___repo_directory}/METALINK_RPM" + if [ $(STRINGS_Is_Empty "$___filename_metalink") -ne 0 ]; then + ___metalink="${___repo_directory}/${___filename_metalink}" + fi + + + # patch repomd.xml location fields and write to main directory + FS_Remove_Silently "$___repomd" + + ___old_IFS="$IFS" + while IFS= read -r ___line || [ -n "$___line" ]; do + ## patch location fields + if [ ! "${___line##* + + + + ${___time} + $(DISK_Calculate_Size_File_Byte "$___repomd") + + $(MD5_Create_From_File "$___repomd") + $(SHASUM_Create_From_File "$___repomd" "1") + $(SHASUM_Create_From_File "$___repomd" "256") + $(SHASUM_Create_From_File "$___repomd" "512") + + + ${___url} + + + + +" + if [ $? -ne 0 ]; then + return 1 + fi + + + # report status + return 0 +} + + + + RPM_Is_Available() { ___os="$1" ___arch="$2" @@ -473,7 +633,7 @@ RPM_Is_Available() { fi - # check compatible target cpu architecture + # check compatible target os case "$___os" in linux|any) ;; @@ -555,24 +715,30 @@ RPM_Register() { # execute - ## write into SPEC_INSTALL + # write into SPEC_INSTALL ___spec="${1}/SPEC_INSTALL" - ___dir="$(FS_Get_Directory "$3")" - ___content="\n" - if [ "$___dir" != "$3" ]; then - ___content="${___content}\nmkdir -p %{buildroot}/${___dir}\n" + if [ $(STRINGS_Is_Empty "$4") -ne 0 ]; then + ___content="\ +mkdir -p %{buildroot}/${3} +cp -r $(FS_Get_Directory "$2") %{buildroot}/${3}/. +" + else + ___content="\ +mkdir -p %{buildroot}/$(FS_Get_Directory "$3") +cp -r ${2} %{buildroot}/${3} +" fi - ___content="${___content}\ncp -r ${2} %{buildroot}/${3}\n" + FS_Append_File "$___spec" "$___content" if [ $? -ne 0 ]; then return 1 fi - ## write into SPEC_FILES - ___spec="${___workspace}/SPEC_FILES" + # write into SPEC_FILES + ___spec="${1}/SPEC_FILES" ___content="/${3}" if [ $(STRINGS_Is_Empty "$4") -ne 0 ]; then - ___content="${___content}/*" + ___content="${___content}/$(FS_Get_Directory "$2")" fi ___content="${___content}\n" FS_Append_File "$___spec" "$___content" diff --git a/automataCI/services/crypto/gpg.ps1 b/automataCI/services/crypto/gpg.ps1 index 40543e8e..6739dd7d 100644 --- a/automataCI/services/crypto/gpg.ps1 +++ b/automataCI/services/crypto/gpg.ps1 @@ -16,24 +16,78 @@ -function GPG-Detach-Sign-File { +function GPG-Clear-Sign-File { param ( + [string]$___output, [string]$___target, [string]$___id ) # validate input - if (($(STRINGS-Is-Empty "${___target}") -eq 0) -or + if (($(STRINGS-Is-Empty "${___output}") -eq 0) -or + ($(STRINGS-Is-Empty "${___target}") -eq 0) -or ($(STRINGS-Is-Empty "${___id}") -eq 0)) { return 1 } + $___process = FS-Is-Target-Exist "${___output}" + if ($___process -eq 0) { + return 1 + } + $___process = FS-Is-File "${___target}" + if ($___process -ne 0) { + return 1 + } + + $___process = GPG-Is-Available "${___id}" + if ($___process -ne 0) { + return 1 + } + + + # execute + $___process = OS-Exec "gpg" @" +--armor --clear-sign --local-user `"${___id}`" --output `"${___output}`" `"${___target}`" +"@ + if ($___process -ne 0) { + return 1 + } + + + # report status + return 0 +} + + + + +function GPG-Detach-Sign-File { + param ( + [string]$___output, + [string]$___target, + [string]$___id + ) + + + # validate input + if (($(STRINGS-Is-Empty "${___output}") -eq 0) -or + ($(STRINGS-Is-Empty "${___target}") -eq 0) -or + ($(STRINGS-Is-Empty "${___id}") -eq 0)) { + return 1 + } + + $___process = FS-Is-Target-Exists "${___output}" if ($___process -eq 0) { return 1 } + $___process = FS-Is-File "${___target}" + if ($___process -ne 0) { + return 1 + } + $___process = GPG-Is-Available "${___id}" if ($___process -ne 0) { return 1 @@ -41,8 +95,9 @@ function GPG-Detach-Sign-File { # execute - $___process = OS-Exec ` - "gpg" "--armor --detach-sign --local-user `"${__id}`" `"${__target}`"" + $___process = OS-Exec "gpg" @" +--armor --detach-sign --local-user `"${___id}`" --output `"${___output}`" `"${___target}`" +"@ if ($___process -ne 0) { return 1 } @@ -135,6 +190,10 @@ function GPG-Is-Available { return 1 } + if ($(STRINGS-Is-Empty "${___id}") -eq 0) { + return 0 + } + $___process = OS-Exec "gpg" "--list-key `"${___id}`"" if ($___process -ne 0) { return 1 diff --git a/automataCI/services/crypto/gpg.sh b/automataCI/services/crypto/gpg.sh index c8d96e98..934ecd84 100644 --- a/automataCI/services/crypto/gpg.sh +++ b/automataCI/services/crypto/gpg.sh @@ -17,29 +17,80 @@ +GPG_Clear_Sign_File() { + #___output="$1" + #___target="$2" + #___id="$3" + + + # validate input + if [ $(STRINGS_Is_Empty "$1") -eq 0 ] || + [ $(STRINGS_Is_Empty "$2") -eq 0 ] || + [ $(STRINGS_Is_Empty "$3") -eq 0 ]; then + return 1 + fi + + FS_Is_Target_Exist "$1" + if [ $? -eq 0 ]; then + return 1 + fi + + FS_Is_File "$2" + if [ $? -ne 0 ]; then + return 1 + fi + + GPG_Is_Available "$3" + if [ $? -ne 0 ]; then + return 1 + fi + + + # execute + gpg --armor --clear-sign --local-user "$3" --output "$1" "$2" + if [ $? -ne 0 ]; then + return 1 + fi + + + # report status + return 0 +} + + + + GPG_Detach_Sign_File() { - #___target="$1" - #___id="$2" + #___output="$1" + #___target="$2" + #___id="$3" # validate input - if [ $(STRINGS_Is_Empty "$1") -eq 0 ] || [ $(STRINGS_Is_Empty "$2") -eq 0 ]; then + if [ $(STRINGS_Is_Empty "$1") -eq 0 ] || + [ $(STRINGS_Is_Empty "$2") -eq 0 ] || + [ $(STRINGS_Is_Empty "$3") -eq 0 ]; then return 1 fi - FS_Is_File "$1" + FS_Is_Target_Exist "$1" + if [ $? -eq 0 ]; then + return 1 + fi + + FS_Is_File "$2" if [ $? -ne 0 ]; then return 1 fi - GPG_Is_Available "$2" + GPG_Is_Available "$3" if [ $? -ne 0 ]; then return 1 fi # execute - gpg --armor --detach-sign --local-user "$2" "$1" + gpg --armor --detach-sign --local-user "$3" --output "$1" "$2" if [ $? -ne 0 ]; then return 1 fi @@ -124,6 +175,10 @@ GPG_Is_Available() { return 1 fi + if [ $(STRINGS_Is_Empty "$1") -eq 0 ]; then + return 0 + fi + gpg --list-key "$1" &> /dev/null if [ $? -ne 0 ]; then return 1 diff --git a/automataCI/services/i18n/_check-disabled-skipped.ps1 b/automataCI/services/i18n/_check-disabled-skipped.ps1 new file mode 100644 index 00000000..0b43c550 --- /dev/null +++ b/automataCI/services/i18n/_check-disabled-skipped.ps1 @@ -0,0 +1,29 @@ +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +. "${env:LIBS_AUTOMATACI}\services\i18n\__printer.ps1" + + + + +function I18N-Check-Disabled-Skipped { + # execute + switch (${env:AUTOMATACI_LANG}) { + default { + # fallback to default english + $null = I18N-Status-Print warning ` + "explicit disabled action detected. Skipping...`n`n" + }} + + + # report status + return 0 +} diff --git a/automataCI/services/i18n/_check-disabled-skipped.sh b/automataCI/services/i18n/_check-disabled-skipped.sh new file mode 100644 index 00000000..7cfd4417 --- /dev/null +++ b/automataCI/services/i18n/_check-disabled-skipped.sh @@ -0,0 +1,29 @@ +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +. "${LIBS_AUTOMATACI}/services/i18n/__printer.sh" + + + + +I18N_Check_Disabled_Skipped() { + # execute + case "$AUTOMATACI_LANG" in + *) + # fallback to default english + I18N_Status_Print warning "explicit disabled action detected. Skipping...\n\n" + ;; + esac + + + # report status + return 0 +} diff --git a/automataCI/services/i18n/_conclude.ps1 b/automataCI/services/i18n/_conclude.ps1 new file mode 100644 index 00000000..157f5dd9 --- /dev/null +++ b/automataCI/services/i18n/_conclude.ps1 @@ -0,0 +1,35 @@ +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +. "${env:LIBS_AUTOMATACI}\services\i18n\__printer.ps1" +. "${env:LIBS_AUTOMATACI}\services\i18n\__param.ps1" + + + + +function I18N-Conclude { + param( + [string]$___subject + ) + + + # execute + switch (${env:AUTOMATACI_LANG}) { + default { + # fallback to default english + $___subject = I18N-Param-Process "${___subject}" + $null = I18N-Status-Print info "concluding '${___subject}'...`n" + }} + + + # report status + return 0 +} diff --git a/automataCI/services/i18n/_conclude.sh b/automataCI/services/i18n/_conclude.sh new file mode 100644 index 00000000..f3f84164 --- /dev/null +++ b/automataCI/services/i18n/_conclude.sh @@ -0,0 +1,31 @@ +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +. "${LIBS_AUTOMATACI}/services/i18n/__printer.sh" +. "${LIBS_AUTOMATACI}/services/i18n/__param.sh" + + + + +I18N_Conclude() { + # execute + case "$AUTOMATACI_LANG" in + *) + # fallback to default english + ___subject="$(I18N_Param_Process "$1")" + I18N_Status_Print info "concluding '${___subject}'...\n" + ;; + esac + + + # report status + return 0 +} diff --git a/automataCI/services/i18n/_simulate-conclusion.ps1 b/automataCI/services/i18n/_simulate-conclusion.ps1 index 916705e2..2f65ba44 100644 --- a/automataCI/services/i18n/_simulate-conclusion.ps1 +++ b/automataCI/services/i18n/_simulate-conclusion.ps1 @@ -15,7 +15,7 @@ -function I18N-Simulate-Conclusion { +function I18N-Simulate-Conclude { param( [string]$___subject ) diff --git a/automataCI/services/i18n/translations.ps1 b/automataCI/services/i18n/translations.ps1 index 230275b2..69584ce4 100644 --- a/automataCI/services/i18n/translations.ps1 +++ b/automataCI/services/i18n/translations.ps1 @@ -25,6 +25,7 @@ . "${env:LIBS_AUTOMATACI}\services\i18n\_build-failed-parallel.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\_check.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\_check-availability.ps1" +. "${env:LIBS_AUTOMATACI}\services\i18n\_check-disabled-skipped.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\_check-failed.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\_check-failed-skipped.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\_check-function.ps1" @@ -33,9 +34,9 @@ . "${env:LIBS_AUTOMATACI}\services\i18n\_checksum.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\_checksum-failed.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\_clean.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\_clean-failed.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\_commit.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\_commit-failed.ps1" +. "${env:LIBS_AUTOMATACI}\services\i18n\_conclude.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\_configure-build-settings.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\_configure-failed.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\_copy.ps1" diff --git a/automataCI/services/i18n/translations.sh b/automataCI/services/i18n/translations.sh index ce29c3b1..075a698c 100644 --- a/automataCI/services/i18n/translations.sh +++ b/automataCI/services/i18n/translations.sh @@ -25,6 +25,7 @@ . "${LIBS_AUTOMATACI}/services/i18n/_build-failed-parallel.sh" . "${LIBS_AUTOMATACI}/services/i18n/_check.sh" . "${LIBS_AUTOMATACI}/services/i18n/_check-availability.sh" +. "${LIBS_AUTOMATACI}/services/i18n/_check-disabled-skipped.sh" . "${LIBS_AUTOMATACI}/services/i18n/_check-failed.sh" . "${LIBS_AUTOMATACI}/services/i18n/_check-failed-skipped.sh" . "${LIBS_AUTOMATACI}/services/i18n/_check-function.sh" @@ -36,6 +37,7 @@ . "${LIBS_AUTOMATACI}/services/i18n/_clean-failed.sh" . "${LIBS_AUTOMATACI}/services/i18n/_commit.sh" . "${LIBS_AUTOMATACI}/services/i18n/_commit-failed.sh" +. "${LIBS_AUTOMATACI}/services/i18n/_conclude.sh" . "${LIBS_AUTOMATACI}/services/i18n/_configure-build-settings.sh" . "${LIBS_AUTOMATACI}/services/i18n/_configure-failed.sh" . "${LIBS_AUTOMATACI}/services/i18n/_copy.sh" diff --git a/automataCI/services/io/disk.ps1 b/automataCI/services/io/disk.ps1 index 8a5f5f9a..9aa2a391 100644 --- a/automataCI/services/io/disk.ps1 +++ b/automataCI/services/io/disk.ps1 @@ -1,4 +1,4 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho +# Copyright 2023 (Holloway) Chew, Kean Ho # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy @@ -9,15 +9,15 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -function DISK-Calculate-Size { +function DISK-Calculate-Size-Directory-KB { param ( - [string]$___location + [string]$___directory ) # validate input - if ([string]::IsNullOrEmpty($___location) -or - (-not (Test-Path -Path "${___location}"))) { + if ([string]::IsNullOrEmpty($___directory) -or + (-not (Test-Path -Path "${___directory}"))) { return 1 } @@ -28,7 +28,7 @@ function DISK-Calculate-Size { # execute - $___value = Get-ChildItem "${___location}" -Recurse -Force ` + $___value = Get-ChildItem "${___directory}" -Recurse -Force ` -ErrorAction SilentlyContinue -Include * ` | Where-Object {$_.psiscontainer -eq $false} ` | Measure-Object -Property length -sum ` @@ -39,6 +39,33 @@ function DISK-Calculate-Size { +function DISK-Calculate-Size-File-Byte { + param ( + [string]$___file + ) + + + # validate input + if ([string]::IsNullOrEmpty($___file) -or (-not (Test-Path -Path "${___file}"))) { + return 1 + } + + $___process = DISK-Is-Available + if ($___process -ne 0) { + return 1 + } + + + # execute + $___value = Get-ChildItem $___file ` + | Measure-Object -Property length -Sum ` + | Select-Object sum + return [math]::Round($___value.sum / 1, 0) +} + + + + function DISK-Is-Available { return 0 } diff --git a/automataCI/services/io/disk.sh b/automataCI/services/io/disk.sh index 7bbe2a09..bc2cc559 100644 --- a/automataCI/services/io/disk.sh +++ b/automataCI/services/io/disk.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho +# Copyright 2023 (Holloway) Chew, Kean Ho # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of @@ -10,8 +10,8 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations under # the License. -DISK_Calculate_Size() { - #___location="$1" +DISK_Calculate_Size_Directory_KB() { + #___directory="$1" # validate input @@ -41,6 +41,36 @@ DISK_Calculate_Size() { +DISK_Calculate_Size_File_Byte() { + #___file="$1" + + + # validate input + if [ -z "$1" ] || [ -d "$1" ]; then + return 1 + fi + + DISK_Is_Available + if [ $? -ne 0 ]; then + return 1 + fi + + + # execute + ___size="$(du -b "$1")" + if [ $? -ne 0 ]; then + return 1 + fi + printf -- "%b" "${___size%%[!0-9]*}" + + + # report status + return 0 +} + + + + DISK_Is_Available() { # execute if [ ! -z "$(type -t du)" ]; then diff --git a/automataCI/services/io/fs.ps1 b/automataCI/services/io/fs.ps1 index b12736d0..af92f28a 100644 --- a/automataCI/services/io/fs.ps1 +++ b/automataCI/services/io/fs.ps1 @@ -48,6 +48,16 @@ function FS-Copy-All { return 1 } + $___process = FS-Is-Directory "${___source}" + if ($___process -ne 0) { + return 1 + } + + $___process = FS-Is-Directory "${___destination}" + if ($___process -ne 0) { + return 1 + } + # execute $null = Copy-Item -Path "${___source}\*" -Destination "${___destination}" -Recurse @@ -75,6 +85,16 @@ function FS-Copy-File { return 1 } + $___process = FS-Is-File "${___source}" + if ($___process -ne 0) { + return 1 + } + + $___process = FS-Is-Target-Exist "${___destination}" + if ($___process -eq 0) { + return 1 + } + # execute $null = Copy-Item -Path "${___source}" -Destination "${___destination}" @@ -309,6 +329,34 @@ function FS-Is-Directory { +function FS-Is-Directory-Empty { + param ( + [string]$___target + ) + + + # validate input + $___process = FS-Is-Directory "${___target}" + if ($___process -ne 0) { + return 0 + } + + + # execute + if((Get-ChildItem "${___target}" -force ` + | Select-Object -First 1 ` + | Measure-Object).Count -ne 0) { + return 1 + } + + + # report status + return 0 +} + + + + function FS-Is-File { param ( [string]$___target @@ -339,6 +387,40 @@ function FS-Is-File { +function FS-Is-Target-A-C { + param ( + [string]$___target + ) + + + # execute + if ([string]::IsNullOrEmpty("${___target}")) { + return 1 + } + + if ($(FS-Is-Target-A-Cargo "${___target}") -eq 0) { + return 1 + } + + if ($(FS-Is-Target-A-Chocolatey "${___target}") -eq 0) { + return 1 + } + + $___file_subject = FS-Get-File "${___target}" + if (($("${___file_subject}" -replace '.*-C.*', '') -ne "${___file_subject}") -or + ($("${___file_subject}" -replace '.*-c.*', '') -ne "${___file_subject}") -or + ($("${___file_subject}" -replace '.*\.c$', '') -ne "${___file_subject}")) { + return 0 + } + + + # report status + return 1 +} + + + + function FS-Is-Target-A-Cargo { param ( [string]$___target @@ -346,7 +428,12 @@ function FS-Is-Target-A-Cargo { # execute - if (($("${___target}" -replace '^.*-cargo') -ne "${___target}")) { + if ([string]::IsNullOrEmpty("${___target}")) { + return 1 + } + + $___file_subject = FS-Get-File "${___target}" + if ($("${___file_subject}" -replace '.*-cargo.*', '') -ne "${___file_subject}") { return 0 } @@ -365,8 +452,13 @@ function FS-Is-Target-A-Chocolatey { # execute - if (($("${___target}" -replace '^.*-chocolatey') -ne "${___target}") -or - ($("${___target}" -replace '^.*-choco') -ne "${___target}")) { + if ([string]::IsNullOrEmpty("${___target}")) { + return 1 + } + + $___file_subject = FS-Get-File "${___target}" + if (($("${___file_subject}" -replace '.*-chocolatey.*', '') -ne "${___file_subject}") -or + ($("${___file_subject}" -replace '.*-choco.*', '') -ne "${___file_subject}")) { return 0 } @@ -385,7 +477,12 @@ function FS-Is-Target-A-Citation-CFF { # execute - if ($("${___target}" -replace '^.*.cff') -ne "${___target}") { + if ([string]::IsNullOrEmpty("${___target}")) { + return 1 + } + + $___file_subject = FS-Get-File "${___target}" + if ($("${___file_subject}" -replace '.*\.cff$', '') -ne "${___file_subject}") { return 0 } @@ -404,8 +501,13 @@ function FS-Is-Target-A-Docs { # execute - if (($("${___target}" -replace '^.*-doc') -ne "${___target}") -or - ($("${___target}" -replace '^.*-docs') -ne "${___target}")) { + if ([string]::IsNullOrEmpty("${___target}")) { + return 1 + } + + $___file_subject = FS-Get-File "${___target}" + if (($("${___file_subject}" -replace '.*-doc.*', '') -ne "${___file_subject}") -or + ($("${___file_subject}" -replace '.*-docs.*', '') -ne "${___file_subject}")) { return 0 } @@ -424,8 +526,13 @@ function FS-Is-Target-A-Homebrew { # execute - if (($("${___target}" -replace '^.*-homebrew') -ne "${___target}") -or - ($("${___target}" -replace '^.*-brew') -ne "${___target}")) { + if ([string]::IsNullOrEmpty("${___target}")) { + return 1 + } + + $___file_subject = FS-Get-File "${___target}" + if (($("${___file_subject}" -replace '.*-homebrew.*', '') -ne "${___file_subject}") -or + ($("${___file_subject}" -replace '.*-brew.*', '') -ne "${___file_subject}")) { return 0 } @@ -439,18 +546,23 @@ function FS-Is-Target-A-Homebrew { function FS-Is-Target-A-Library { param ( - [string]$___subject + [string]$___target ) # execute - if (($("${___subject}" -replace '^lib.*') -ne "${___subject}") -or - ($("${___subject}" -replace '.*\.a$') -ne "${___subject}") -or - ($("${___subject}" -replace '.*\.dll$') -ne "${___subject}") -or - ($("${___subject}" -replace '^.*-lib') -ne "${___subject}") -or - ($("${___subject}" -replace '^.*-libs') -ne "${___subject}") -or - ($("${___subject}" -replace '^.*-library') -ne "${___subject}") -or - ($("${___subject}" -replace '^.*-libraries') -ne "${___subject}")) { + if ([string]::IsNullOrEmpty("${___target}")) { + return 1 + } + + $___file_subject = FS-Get-File "${___target}" + if (($("${___file_subject}" -replace '^lib.*', '') -ne "${___file_subject}") -or + ($("${___file_subject}" -replace '.*\.a$', '') -ne "${___file_subject}") -or + ($("${___file_subject}" -replace '.*\.dll$', '') -ne "${___file_subject}") -or + ($("${___file_subject}" -replace '.*-lib.*', '') -ne "${___file_subject}") -or + ($("${___file_subject}" -replace '.*-libs.*', '') -ne "${___file_subject}") -or + ($("${___file_subject}" -replace '.*-library.*', '') -ne "${___file_subject}") -or + ($("${___file_subject}" -replace '.*-libraries.*', '') -ne "${___file_subject}")) { return 0 } @@ -469,8 +581,13 @@ function FS-Is-Target-A-MSI { # execute - if (($("${___target}" -replace '^.*-msi') -ne "${___target}") -or - ($("${___target}" -replace '^.*.msi') -ne "${___target}")) { + if ([string]::IsNullOrEmpty("${___target}")) { + return 1 + } + + $___file_subject = FS-Get-File "${___target}" + if (($("${___file_subject}" -replace '.*\.msi$', '') -ne "${___file_subject}") -or + ($("${___file_subject}" -replace '.*-msi.*', '') -ne "${___file_subject}")) { return 0 } @@ -489,7 +606,12 @@ function FS-Is-Target-A-NPM { # execute - if ($("${___target}" -replace '^.*_js-js.tgz') -ne "${___target}") { + if ([string]::IsNullOrEmpty("${___target}")) { + return 1 + } + + $___file_subject = FS-Get-File "${___target}" + if ($("${___file_subject}" -replace '.*_js-js\.tgz$', '') -ne "${___file_subject}") { return 0 } @@ -508,7 +630,12 @@ function FS-Is-Target-A-Nupkg { # execute - if ($("${___target}" -replace '^.*.nupkg') -ne "${___target}") { + if ([string]::IsNullOrEmpty("${___target}")) { + return 1 + } + + $___file_subject = FS-Get-File "${___target}" + if ($("${___file_subject}" -replace '.*\.nupkg$', '') -ne "${___file_subject}") { return 0 } @@ -527,7 +654,12 @@ function FS-Is-Target-A-PDF { # execute - if ($("${___target}" -replace '^.*.pdf') -ne "${___target}") { + if ([string]::IsNullOrEmpty("${___target}")) { + return 1 + } + + $___file_subject = FS-Get-File "${___target}" + if ($("${___file_subject}" -replace '.*\.pdf$', '') -ne "${___file_subject}") { return 0 } @@ -546,7 +678,12 @@ function FS-Is-Target-A-PYPI { # execute - if ($("${___target}" -replace '^.*-pypi') -ne "${___target}") { + if ([string]::IsNullOrEmpty("${___target}")) { + return 1 + } + + $___file_subject = FS-Get-File "${___target}" + if ($("${___file_subject}" -replace '.*-pypi.*', '') -ne "${___file_subject}") { return 0 } @@ -565,8 +702,13 @@ function FS-Is-Target-A-Source { # execute - if (($("${___target}" -replace '^.*-src') -ne "${___target}") -or - ($("${___target}" -replace '^.*-source') -ne "${___target}")) { + if ([string]::IsNullOrEmpty("${___target}")) { + return 1 + } + + $___file_subject = FS-Get-File "${___target}" + if (($("${___file_subject}" -replace '.*-src.*', '') -ne "${___file_subject}") -or + ($("${___file_subject}" -replace '.*-source.*', '') -ne "${___file_subject}")) { return 0 } @@ -585,8 +727,13 @@ function FS-Is-Target-A-TARGZ { # execute - if (($("${___target}" -replace '^.*.tar.gz') -ne "${___target}") -or - ($("${___target}" -replace '^.*.tgz') -ne "${___target}")) { + if ([string]::IsNullOrEmpty("${___target}")) { + return 1 + } + + $___file_subject = FS-Get-File "${___target}" + if (($("${___file_subject}" -replace '.*\.tar\.gz$', '') -ne "${___file_subject}") -or + ($("${___file_subject}" -replace '.*\.tgz$', '') -ne "${___file_subject}")) { return 0 } @@ -605,8 +752,13 @@ function FS-Is-Target-A-TARXZ { # execute - if (($("${___target}" -replace '^.*.tar.xz') -ne "${___target}") -or - ($("${___target}" -replace '^.*.txz') -ne "${___target}")) { + if ([string]::IsNullOrEmpty("${___target}")) { + return 1 + } + + $___file_subject = FS-Get-File "${___target}" + if (($("${___file_subject}" -replace '.*\.tar\.xz$', '') -ne "${___file_subject}") -or + ($("${___file_subject}" -replace '.*\.txz$', '') -ne "${___file_subject}")) { return 0 } @@ -625,7 +777,12 @@ function FS-Is-Target-A-WASM { # execute - if ($("${___target}" -replace '^.*-wasm') -ne "${___target}") { + if ([string]::IsNullOrEmpty("${___target}")) { + return 1 + } + + $___file_subject = FS-Get-File "${___target}" + if ($("${___file_subject}" -replace '.*-wasm.*', '') -ne "${___file_subject}") { return 0 } @@ -644,11 +801,16 @@ function FS-Is-Target-A-WASM-JS { # execute - if ($("${___target}" -replace '^.*-wasm') -eq "${___target}") { + if ([string]::IsNullOrEmpty("${___target}")) { return 1 } - if ($("${___target}" -replace '^.*.js') -eq "${___target}") { + if ($(FS-Is-Target-A-WASM "${___target}") -ne 0) { + return 1 + } + + $___file_subject = FS-Get-File "${___target}" + if ($("${___file_subject}" -replace '.*\.js$', '') -eq "${___file_subject}") { return 1 } @@ -660,21 +822,19 @@ function FS-Is-Target-A-WASM-JS { -function FS-Is-Target-Exist { +function FS-Is-Target-A-ZIP { param ( [string]$___target ) - # validate input + # execute if ([string]::IsNullOrEmpty("${___target}")) { return 1 } - - # perform checking - $___process = Test-Path -Path "${___target}" -PathType Any -ErrorAction SilentlyContinue - if ($___process) { + $___file_subject = FS-Get-File "${___target}" + if ($("${___file_subject}" -replace '^.*\.zip$', '') -ne "${___file_subject}") { return 0 } @@ -686,14 +846,21 @@ function FS-Is-Target-Exist { -function FS-Is-Target-A-ZIP { +function FS-Is-Target-Exist { param ( [string]$___target ) - # execute - if ($("${___target}" -replace '^.*.zip') -ne "${___target}") { + # validate input + if ([string]::IsNullOrEmpty("${___target}")) { + return 1 + } + + + # perform checking + $___process = Test-Path -Path "${___target}" -PathType Any -ErrorAction SilentlyContinue + if ($___process) { return 0 } @@ -812,6 +979,11 @@ function FS-Move { return 1 } + $___process = FS-Is-Target-Exist $___source + if ($___process -ne 0) { + return 1 + } + # execute try { diff --git a/automataCI/services/io/fs.sh b/automataCI/services/io/fs.sh index d043cc3c..aaaf22fe 100644 --- a/automataCI/services/io/fs.sh +++ b/automataCI/services/io/fs.sh @@ -45,6 +45,16 @@ FS_Copy_All() { return 1 fi + FS_Is_Directory "$1" + if [ $? -ne 0 ]; then + return 1 + fi + + FS_Is_Directory "$2" + if [ $? -ne 0 ]; then + return 1 + fi + # execute cp -r "${1}"* "${2}/." @@ -70,6 +80,16 @@ FS_Copy_File() { return 1 fi + FS_Is_File "$1" + if [ $? -ne 0 ]; then + return 1 + fi + + FS_Is_Target_Exist "$2" + if [ $? -eq 0 ]; then + return 1 + fi + # execute cp "$1" "$2" @@ -272,6 +292,32 @@ FS_Is_Directory() { +FS_Is_Directory_Empty() { + #___target="$1" + + + # validate input + FS_Is_Directory "$1" + if [ $? -ne 0 ]; then + return 0 + fi + + + # execute + for ___item in "$1"/*; do + if [ -e "$___item" ]; then + return 1 + fi + done + + + # report status + return 0 +} + + + + FS_Is_File() { #___target="$1" @@ -300,12 +346,53 @@ FS_Is_File() { +FS_Is_Target_A_C() { + #___target="$1" + + + # execute + if [ "$1" = "" ]; then + printf -- "1" + return 1 + fi + + if [ $(FS_Is_Target_A_Cargo "$1") -eq 0 ]; then + return 1 + fi + + if [ $(FS_Is_Target_A_Chocolatey "$1") -eq 0 ]; then + return 1 + fi + + ___file_subject="$(FS_Get_File "$1")" + if [ "${___file_subject#*-C}" != "$___file_subject" ] || + [ "${___file_subject#*-c}" != "$___file_subject" ] || + [ "${___file_subject#*.c}" != "$___file_subject" ]; then + printf -- "0" + return 0 + fi + + + # report status + printf -- "1" + return 1 +} + + + + FS_Is_Target_A_Cargo() { #___target="$1" # execute - if [ "${1#*-cargo}" != "$1" ]; then + if [ "$1" = "" ]; then + printf -- "1" + return 1 + fi + + ___file_subject="$(FS_Get_File "$1")" + if [ "${___file_subject#*-cargo}" != "$___file_subject" ]; then printf -- "0" return 0 fi @@ -324,7 +411,14 @@ FS_Is_Target_A_Chocolatey() { # execute - if [ "${1#*-chocolatey}" != "$1" ] || [ "${1#*-choco}" != "$1" ]; then + if [ "$1" = "" ]; then + printf -- "1" + return 1 + fi + + ___file_subject="$(FS_Get_File "$1")" + if [ "${___file_subject#*-chocolatey}" != "$___file_subject" ] || + [ "${___file_subject#*-choco}" != "$___file_subject" ]; then printf -- "0" return 0 fi @@ -343,7 +437,13 @@ FS_Is_Target_A_Citation_CFF() { # execute - if [ "${1#*.cff}" != "$1" ]; then + if [ "$1" = "" ]; then + printf -- "1" + return 1 + fi + + ___file_subject="$(FS_Get_File "$1")" + if [ "${___file_subject#*.cff}" != "$___file_subject" ]; then printf -- "0" return 0 fi @@ -362,7 +462,14 @@ FS_Is_Target_A_Docs() { # execute - if [ "${1#*-doc}" != "$1" ] || [ "${1#*-docs}" != "$1" ]; then + if [ "$1" = "" ]; then + printf -- "1" + return 1 + fi + + ___file_subject="$(FS_Get_File "$1")" + if [ "${___file_subject#*-doc}" != "$___file_subject" ] || + [ "${___file_subject#*-docs}" != "$___file_subject" ]; then printf -- "0" return 0 fi @@ -381,7 +488,14 @@ FS_Is_Target_A_Homebrew() { # execute - if [ "${1#*-homebrew}" != "$1" ] || [ "${1#*-brew}" != "$1" ]; then + if [ "$1" = "" ]; then + printf -- "1" + return 1 + fi + + ___file_subject="$(FS_Get_File "$1")" + if [ "${___file_subject#*-homebrew}" != "$___file_subject" ] || + [ "${___file_subject#*-brew}" != "$___file_subject" ]; then printf -- "0" return 0 fi @@ -400,13 +514,19 @@ FS_Is_Target_A_Library() { # execute - if [ "${1%%lib*}" != "$1" ] || - [ "${1##*.a}" != "$1" ] || - [ "${1##*.dll}" != "$1" ] || - [ "${1#*-lib}" != "$1" ] || - [ "${1#*-libs}" != "$1" ] || - [ "${1#*-library}" != "$1" ] || - [ "${1#*-libraries}" != "$1" ]; then + if [ "$1" = "" ]; then + printf -- "1" + return 1 + fi + + ___file_subject="$(FS_Get_File "$1")" + if [ "${___file_subject#lib*}" != "$___file_subject" ] || + [ "${___file_subject#*.a}" != "$___file_subject" ] || + [ "${___file_subject#*.dll}" != "$___file_subject" ] || + [ "${___file_subject#*-lib}" != "$___file_subject" ] || + [ "${___file_subject#*-libs}" != "$___file_subject" ] || + [ "${___file_subject#*-library}" != "$___file_subject" ] || + [ "${___file_subject#*-libraries}" != "$___file_subject" ]; then printf -- "0" return 0 fi @@ -425,7 +545,14 @@ FS_Is_Target_A_MSI() { # execute - if [ "${1#*-msi}" != "$1" ] || [ "${1#*.msi}" != "$1" ]; then + if [ "$1" = "" ]; then + printf -- "1" + return 1 + fi + + ___file_subject="$(FS_Get_File "$1")" + if [ "${___file_subject#*-msi}" != "$___file_subject" ] || + [ "${___file_subject#*.msi}" != "$___file_subject" ]; then printf -- "0" return 0 fi @@ -444,7 +571,13 @@ FS_Is_Target_A_NPM() { # execute - if [ "${1#*_js-js.tgz}" != "$1" ]; then + if [ "$1" = "" ]; then + printf -- "1" + return 1 + fi + + ___file_subject="$(FS_Get_File "$1")" + if [ "${___file_subject#*_js-js.tgz}" != "$___file_subject" ]; then printf -- "0" return 0 fi @@ -463,7 +596,13 @@ FS_Is_Target_A_Nupkg() { # execute - if [ "${1#*.nupkg}" != "$1" ]; then + if [ "$1" = "" ]; then + printf -- "1" + return 1 + fi + + ___file_subject="$(FS_Get_File "$1")" + if [ "${___file_subject#*.nupkg}" != "$___file_subject" ]; then printf -- "0" return 0 fi @@ -482,7 +621,13 @@ FS_Is_Target_A_PDF() { # execute - if [ "${1#*.pdf}" != "$1" ]; then + if [ "$1" = "" ]; then + printf -- "1" + return 1 + fi + + ___file_subject="$(FS_Get_File "$1")" + if [ "${___file_subject#*.pdf}" != "$___file_subject" ]; then printf -- "0" return 0 fi @@ -501,7 +646,13 @@ FS_Is_Target_A_PYPI() { # execute - if [ "${1#*-pypi}" != "$1" ]; then + if [ "$1" = "" ]; then + printf -- "1" + return 1 + fi + + ___file_subject="$(FS_Get_File "$1")" + if [ "${___file_subject#*-pypi}" != "$___file_subject" ]; then printf -- "0" return 0 fi @@ -520,7 +671,14 @@ FS_Is_Target_A_Source() { # execute - if [ "${1#*-src}" != "$1" ] || [ "${1#*-source}" != "$1" ]; then + if [ "$1" = "" ]; then + printf -- "1" + return 1 + fi + + ___file_subject="$(FS_Get_File "$1")" + if [ "${___file_subject#*-src}" != "$___file_subject" ] || + [ "${___file_subject#*-source}" != "$___file_subject" ]; then printf -- "0" return 0 fi @@ -539,7 +697,14 @@ FS_Is_Target_A_TARGZ() { # execute - if [ "${1#*.tar.gz}" != "$1" ] || [ "${1#*.tgz}" != "$1" ]; then + if [ "$1" = "" ]; then + printf -- "1" + return 1 + fi + + ___file_subject="$(FS_Get_File "$1")" + if [ "${___file_subject#*.tar.gz}" != "$___file_subject" ] || + [ "${___file_subject#*.tgz}" != "$___file_subject" ]; then printf -- "0" return 0 fi @@ -558,7 +723,14 @@ FS_Is_Target_A_TARXZ() { # execute - if [ "${1#*.tar.xz}" != "$1" ] || [ "${1#*.txz}" != "$1" ]; then + if [ "$1" = "" ]; then + printf -- "1" + return 1 + fi + + ___file_subject="$(FS_Get_File "$1")" + if [ "${___file_subject#*.tar.xz}" != "$___file_subject" ] || + [ "${___file_subject#*.txz}" != "$___file_subject" ]; then printf -- "0" return 0 fi @@ -577,7 +749,13 @@ FS_Is_Target_A_WASM() { # execute - if [ "${1#*-wasm}" != "$1" ]; then + if [ "$1" = "" ]; then + printf -- "1" + return 1 + fi + + ___file_subject="$(FS_Get_File "$1")" + if [ "${___file_subject#*-wasm}" != "$___file_subject" ]; then printf -- "0" return 0 fi @@ -596,12 +774,18 @@ FS_Is_Target_A_WASM_JS() { # execute - if [ "${1#*-wasm}" == "$1" ]; then + if [ "$1" = "" ]; then printf -- "1" return 1 fi - if [ "${1#*.js}" == "$1" ]; then + if [ $(FS_Is_Target_A_WASM "$1") -ne 0 ]; then + printf -- "1" + return 1 + fi + + ___file_subject="$(FS_Get_File "$1")" + if [ "${___file_subject#*.js}" == "$___file_subject" ]; then printf -- "1" return 1 fi @@ -620,7 +804,13 @@ FS_Is_Target_A_ZIP() { # execute - if [ "${1#*.zip}" != "$1" ]; then + if [ "$1" = "" ]; then + printf -- "1" + return 1 + fi + + ___file_subject="$(FS_Get_File "$1")" + if [ "${___file_subject#*.zip}" != "${___file_subject}" ]; then printf -- "0" return 0 fi @@ -753,6 +943,11 @@ FS_Move() { return 1 fi + FS_Is_Target_Exist "$1" + if [ $? -ne 0 ]; then + return 1 + fi + # execute mv "$1" "$2" @@ -837,6 +1032,22 @@ FS_Rename() { #___target="$2" + # validate input + if [ -z "$1" ] || [ -z "$2" ]; then + return 1 + fi + + FS_Is_Target_Exist "$1" + if [ $? -ne 0 ]; then + return 1 + fi + + FS_Is_Target_Exist "$2" + if [ $? -eq 0 ]; then + return 1 + fi + + # execute FS_Move "$1" "$2" return $? diff --git a/automataCI/services/io/os.ps1 b/automataCI/services/io/os.ps1 index e9df5602..45ea61e8 100644 --- a/automataCI/services/io/os.ps1 +++ b/automataCI/services/io/os.ps1 @@ -200,7 +200,7 @@ function OS-Exec { function OS-Is-Run-Simulated { # execute - if (-not ([string]::IsNullOrEmpty("${env:PROJECT_SIMULATE_RELEASE_REPO}"))) { + if (-not ([string]::IsNullOrEmpty("${env:PROJECT_SIMULATE_RUN}"))) { return 0 } diff --git a/automataCI/services/io/os.sh b/automataCI/services/io/os.sh index e5f4ba14..cd9572ff 100644 --- a/automataCI/services/io/os.sh +++ b/automataCI/services/io/os.sh @@ -133,7 +133,7 @@ OS_Is_Command_Available() { OS_Is_Run_Simulated() { # execute - if [ ! -z "$PROJECT_SIMULATE_RELEASE_REPO" ]; then + if [ ! -z "$PROJECT_SIMULATE_RUN" ]; then printf -- "0" return 0 fi diff --git a/automataCI/services/io/time.ps1 b/automataCI/services/io/time.ps1 index 22d58c47..5eedd9b1 100644 --- a/automataCI/services/io/time.ps1 +++ b/automataCI/services/io/time.ps1 @@ -1,4 +1,4 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho +# Copyright 2023 (Holloway) Chew, Kean Ho # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy @@ -9,7 +9,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -function TIME-Format-ISO8601-Date { +function TIME-Format-Date-ISO8601 { param( [string]$___epoch ) @@ -29,6 +29,46 @@ function TIME-Format-ISO8601-Date { +function TIME-Format-Datetime-RFC5322 { + param( + [string]$___epoch + ) + + + # validate input + if ([string]::IsNullOrEmpty($___epoch)) { + return 1 + } + + + # execute + $___t = (Get-Date "1970-01-01 00:00:00.000Z") + ([TimeSpan]::FromSeconds($___epoch)) + return $___t.ToString("ddd, dd MMM YYYY HH:mm:ss zzz") +} + + + + +function TIME-Format-Datetime-RFC5322-UTC { + param( + [string]$___epoch + ) + + + # validate input + if ([string]::IsNullOrEmpty($___epoch)) { + return 1 + } + + + # execute + $___t = (Get-Date "1970-01-01 00:00:00.000Z") + ([TimeSpan]::FromSeconds($___epoch)) + return $___t.ToUniversalTime().ToString("ddd, dd MMM YYYY HH:mm:ss zzz") +} + + + + function TIME-Is-Available { return 0 } diff --git a/automataCI/services/io/time.sh b/automataCI/services/io/time.sh index 57be53f6..dc2cbbd9 100644 --- a/automataCI/services/io/time.sh +++ b/automataCI/services/io/time.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho +# Copyright 2023 (Holloway) Chew, Kean Ho # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of @@ -10,7 +10,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations under # the License. -TIME_Format_ISO8601_Date() { +TIME_Format_Date_ISO8601() { #___epoch="$1" @@ -41,6 +41,68 @@ TIME_Format_ISO8601_Date() { +TIME_Format_Datetime_RFC5322() { + #___epoch="$1" + + + # validate input + if [ -z "$1" ]; then + printf -- "" + return 1 + fi + + TIME_Is_Available + if [ $? -ne 0 ]; then + return 1 + fi + + + # execute + if [ "$(echo "$(uname)" | tr '[:upper:]' '[:lower:]')" = "darwin" ]; then + printf -- "%b" "$(date -j -f "%s" "${1}" +"%a, %d %b %Y %H:%M:%S %z")" + else + printf -- "%b" "$(date --date="@${1}" +"%a, %d %b %Y %H:%M:%S %z")" + fi + + + # report status + return 0 +} + + + + +TIME_Format_Datetime_RFC5322_UTC() { + #___epoch="$1" + + + # validate input + if [ -z "$1" ]; then + printf -- "" + return 1 + fi + + TIME_Is_Available + if [ $? -ne 0 ]; then + return 1 + fi + + + # execute + if [ "$(echo "$(uname)" | tr '[:upper:]' '[:lower:]')" = "darwin" ]; then + printf -- "%b" "$(date -u -j -f "%s" "${1}" +"%a, %d %b %Y %H:%M:%S %z")" + else + printf -- "%b" "$(date -u --date="@${1}" +"%a, %d %b %Y %H:%M:%S %z")" + fi + + + # report status + return 0 +} + + + + TIME_Is_Available() { # execute if [ -z "$(type -t date)" ]; then diff --git a/automataCI/services/publishers/chocolatey.sh b/automataCI/services/publishers/chocolatey.sh index 3b6bcc94..1e1fe7af 100644 --- a/automataCI/services/publishers/chocolatey.sh +++ b/automataCI/services/publishers/chocolatey.sh @@ -83,7 +83,7 @@ CHOCOLATEY_Archive() { # execute ___current_path="$PWD" && cd "$2" - ZIP_Create "$1" "*" + ZIP_Create "$1" "." ___process=$? cd "$___current_path" && unset ___current_path if [ $___process -ne 0 ]; then diff --git a/automataCI/services/publishers/createrepo.ps1 b/automataCI/services/publishers/createrepo.ps1 index 95ca6d4e..f21a2f44 100644 --- a/automataCI/services/publishers/createrepo.ps1 +++ b/automataCI/services/publishers/createrepo.ps1 @@ -1,4 +1,4 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho +# Copyright 2023 (Holloway) Chew, Kean Ho # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy @@ -38,14 +38,12 @@ function CREATEREPO-Is-Available { function CREATEREPO-Publish { param ( - [string]$___target, [string]$___directory ) # validate input - if (($(STRINGS-Is-Empty "${___target}") -eq 0) -or - ($(STRINGS-Is-Empty "${___directory}") -eq 0)) { + if ($(STRINGS-Is-Empty "${___target}") -eq 0) { return 1 } @@ -54,18 +52,8 @@ function CREATEREPO-Publish { return 1 } - $___process = FS-Is-Directory "${___directory}" - if ($___process -ne 0) { - return 1 - } - # execute - $___process = FS-Copy-File "${___target}" "${___directory}" - if ($___process -ne 0) { - return 1 - } - $___process = OS-Is-Command-Available "createrepo" if ($___process -eq 0) { $___process = OS-Exec "createrepo" "--update ${___directory}" diff --git a/automataCI/services/publishers/createrepo.sh b/automataCI/services/publishers/createrepo.sh index bd8e3896..b7cdb844 100644 --- a/automataCI/services/publishers/createrepo.sh +++ b/automataCI/services/publishers/createrepo.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho +# Copyright 2023 (Holloway) Chew, Kean Ho # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of @@ -38,50 +38,40 @@ CREATEREPO_Is_Available() { CREATEREPO_Publish() { - ___target="$1" - ___directory="$2" + #___repo_directory="$1" # validate input - if [ $(STRINGS_Is_Empty "$___target") -eq 0 ] || - [ $(STRINGS_Is_Empty "$__directory") -eq 0 ]; then + if [ $(STRINGS_Is_Empty "$1") -eq 0 ]; then return 1 fi - FS_Is_Directory "$___target" - if [ $? -eq 0 ]; then - return 1 - fi - - FS_Is_Directory "$___directory" + FS_Is_Directory "$1" if [ $? -ne 0 ]; then return 1 fi # execute - FS_Copy_File "$__target" "$__directory" - if [ $? -ne 0 ]; then - return 1 - fi - OS_Is_Command_Available "createrepo" if [ $? -eq 0 ]; then - createrepo --update "$__directory" - if [ $? -eq 0 ]; then - return 0 + createrepo --update "$1" + if [ $? -ne 0 ]; then + return 1 fi + + return 0 fi OS_Is_Command_Available "createrepo_c" if [ $? -eq 0 ]; then - createrepo_c --update "$__directory" - if [ $? -eq 0 ]; then - return 0 + createrepo_c --update "$1" + if [ $? -ne 0 ]; then + return 1 fi fi # report status - return 1 + return 0 } diff --git a/automataCI/services/publishers/homebrew.ps1 b/automataCI/services/publishers/homebrew.ps1 index 8a44dab2..0ef1f0f0 100644 --- a/automataCI/services/publishers/homebrew.ps1 +++ b/automataCI/services/publishers/homebrew.ps1 @@ -1,4 +1,4 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho +# Copyright 2023 (Holloway) Chew, Kean Ho # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy @@ -11,6 +11,8 @@ # under the License. . "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" . "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" +. "${env:LIBS_AUTOMATACI}\services\archive\tar.ps1" +. "${env:LIBS_AUTOMATACI}\services\checksum\shasum.ps1" @@ -26,11 +28,6 @@ function HOMEBREW-Is-Valid-Formula { return 1 } - $___process = FS-Is-Target-A-Homebrew "${___target}" - if ($___process -ne 0) { - return 1 - } - if ($___target -like "*.asc") { return 1 } @@ -49,25 +46,215 @@ function HOMEBREW-Is-Valid-Formula { -function HOMEBREW-Publish { +function HOMEBREW-Seal { param ( - [string]$___target, - [string]$___destination + [string]$___formula, + [string]$___archive_name, + [string]$___workspace, + [string]$___sku, + [string]$___description, + [string]$___website, + [string]$___license, + [string]$___base_url ) # validate input - if (($(STRINGS-Is-Empty "${___target}") -eq 0) -or - ($(STRINGS-Is-Empty "${___destination}") -eq 0)) { + if (($(STRINGS-Is-Empty "${___formula}") -eq 0) -or + ($(STRINGS-Is-Empty "${___archive_name}") -eq 0) -or + ($(STRINGS-Is-Empty "${___workspace}") -eq 0) -or + ($(STRINGS-Is-Empty "${___sku}") -eq 0) -or + ($(STRINGS-Is-Empty "${___description}") -eq 0) -or + ($(STRINGS-Is-Empty "${___website}") -eq 0) -or + ($(STRINGS-Is-Empty "${___license}") -eq 0) -or + ($(STRINGS-Is-Empty "${___base_url}") -eq 0)) { + return 1 + } + + $___process = FS-Is-Directory "${___workspace}" + if ($___process -ne 0) { + return 1 + } + + $___export_directory = "$(FS-Get-Directory "${___formula}")" + if ($___export_directory -eq $___formula) { return 1 } + $null = FS-Make-Directory "${___export_directory}" # execute - $null = FS-Make-Directory "${___destination}" - $___process = FS-Copy-File ` - "${___target}" ` - "${___destination}\$(Split-Path -Leaf -Path "${___target}")" + ## generate the init script + $___dest = "${___workspace}/init.sh" + $___process = FS-Write-File "${___dest}" @" +#!/bin/sh +OS_Get_Arch() { + ___output="`$(uname -m)" + ___output="`$(printf -- "%b" "`$___output" | tr '[:upper:]' '[:lower:]')" + case "`$___output" in + i686-64) + export ___output='ia64' # Intel Itanium. + ;; + i386|i486|i586|i686) + export ___output='i386' + ;; + x86_64) + export ___output='amd64' + ;; + sun4u) + export ___output='sparc' + ;; + 'power macintosh') + export ___output='powerpc' + ;; + ip*) + export ___output='mips' + ;; + *) + ;; + esac + + + # report status + printf -- "%b" "`$___output" + return 0 +} + + +OS_Get() { + # execute + ___output="`$(uname)" + ___output="`$(printf -- "%b" "`${___output}" | tr '[:upper:]' '[:lower:]')" + case "`$___output" in + windows*|ms-dos*) + ___output='windows' + ;; + cygwin*|mingw*|mingw32*|msys*) + ___output='windows' + ;; + *freebsd) + ___output='freebsd' + ;; + dragonfly*) + ___output='dragonfly' + ;; + *) + ;; + esac + + + # report status + printf -- "%b" "`$___output" + return 0 +} + + +main() { + host_os="`$(OS_Get)" + host_arch="`$(OS_Get_Arch)" + for ___file in './bin/'*; do + if [ ! -e "`$___file" ]; then + continue + fi + + ___system="`${___file##*/}" + ___system="`${___system%%.*}" + ___system="`${___system##*_}" + ___os="`${___system%%-*}" + ___arch="`${___system##*-}" + + case "`$___os" in + any|"`$host_os") + ;; + *) + rm -f "`$___file" &> /dev/null + continue + ;; + esac + + case "`$___arch" in + any|"`$host_arch") + mv "`$___file" "`${___file%%_*}" + ;; + *) + rm -f "`$___file" &> /dev/null + ;; + esac + done + + return 0 +} +main `$* +return `$? + +"@ + if ($___process -ne 0) { + return 1 + } + + ## seal the workspace + $___current_path = Get-Location + $null = Set-Location -Path "${___workspace}" + $___process = TAR-Create-XZ "${___export_directory}\${___archive_name}" "." + $null = Set-Location -Path "${___current_path}" + $null = Remove-Variable -Name ___current_path + if ($___process -ne 0) { + return 1 + } + + ## create the formula + $___shasum = SHASUM-Create-From-File "${___export_directory}/${___archive_name}" "256" + if ($(STRINGS-Is-Empty "${___shasum}") -eq 0) { + return 1 + } + + $null = FS-Make-Housing-Directory "${___formula}" + $___process = FS-Write-File "${___formula}" @" +class $(STRINGS-To-Titlecase "${___sku}") < Formula + desc '${___description}' + homepage '${___website}' + license '${___license}' + url '${___base_url}/${___archive_name}' + sha256 '${___shasum}' + + def install + if File.file?('init.sh.ps1') + chmod 755, './init.sh.ps1' + system './init.sh.ps1' + else + chmod 755, './init.sh' + system './init.sh' + end + + if File.directory?('bin') + Dir.foreach('bin') do |filename| + next if filename == '.' or filename == '..' + chmod 0755, filename + libexec.install 'bin/' + filename + bin.install_symlink 'libexec/bin/' + filename => filename + end + end + + if File.directory?('lib') + Dir.foreach('lib') do |filename| + next if filename == '.' or filename == '..' + chmod 0544, filename + libexec.install 'lib/' + filename + lib.install_symlink 'libexec/lib/' + filename => filename + end + end + end + + test do + if File.file?('init.sh.ps1') + assert_predicate 'init.sh.ps1', :exist? + else + assert_predicate 'init.sh', :exist? + end + end +end + +"@ if ($___process -ne 0) { return 1 } diff --git a/automataCI/services/publishers/homebrew.sh b/automataCI/services/publishers/homebrew.sh index ba34251e..f2c9bba8 100644 --- a/automataCI/services/publishers/homebrew.sh +++ b/automataCI/services/publishers/homebrew.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho +# Copyright 2023 (Holloway) Chew, Kean Ho # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of @@ -13,6 +13,8 @@ . "${LIBS_AUTOMATACI}/services/io/os.sh" . "${LIBS_AUTOMATACI}/services/io/fs.sh" . "${LIBS_AUTOMATACI}/services/io/strings.sh" +. "${LIBS_AUTOMATACI}/services/archive/tar.sh" +. "${LIBS_AUTOMATACI}/services/checksum/shasum.sh" @@ -26,10 +28,6 @@ HOMEBREW_Is_Valid_Formula() { return 1 fi - if [ $(FS_Is_Target_A_Homebrew "$1") -ne 0 ]; then - return 1 - fi - if [ ! "${1%.asc*}" = "$1" ]; then return 1 fi @@ -48,20 +46,210 @@ HOMEBREW_Is_Valid_Formula() { -HOMEBREW_Publish() { - #___target="$1" - #___destination="$2" +HOMEBREW_Seal() { + ___formula="$1" + ___archive_name="$2" + ___workspace="$3" + ___sku="$4" + ___description="$5" + ___website="$6" + ___license="$7" + ___base_url="$8" # validate input - if [ $(STRINGS_Is_Empty "$1") -eq 0 ] || [ $(STRINGS_Is_Empty "$2") -eq 0 ]; then + if [ $(STRINGS_Is_Empty "$___formula") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___archive_name") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___workspace") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___sku") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___description") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___website") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___license") -eq 0 ] || + [ $(STRINGS_Is_Empty "$___base_url") -eq 0 ]; then + return 1 + fi + + FS_Is_Directory "$___workspace" + if [ $? -ne 0 ]; then return 1 fi + ___export_directory="$(FS_Get_Directory "$___formula")" + if [ "$___export_directory" = "$___formula" ]; then + return 1 + fi + FS_Make_Directory "$___export_directory" + + + # execute + ## generate the init script + ___dest="${___workspace}/init.sh" + FS_Write_File "$___dest" "\ +#!/bin/sh +OS_Get_Arch() { + ___output=\"\$(uname -m)\" + ___output=\"\$(printf -- \"%b\" \"\$___output\" | tr '[:upper:]' '[:lower:]')\" + case \"\$___output\" in + i686-64) + export ___output='ia64' # Intel Itanium. + ;; + i386|i486|i586|i686) + export ___output='i386' + ;; + x86_64) + export ___output='amd64' + ;; + sun4u) + export ___output='sparc' + ;; + 'power macintosh') + export ___output='powerpc' + ;; + ip*) + export ___output='mips' + ;; + *) + ;; + esac + + + # report status + printf -- \"%b\" \"\$___output\" + return 0 +} + +OS_Get() { # execute - FS_Make_Housing_Directory "$2" - FS_Copy_File "$1" "$2" + ___output=\"\$(uname)\" + ___output=\"\$(printf -- \"%b\" \"\${___output}\" | tr '[:upper:]' '[:lower:]')\" + case \"\$___output\" in + windows*|ms-dos*) + ___output='windows' + ;; + cygwin*|mingw*|mingw32*|msys*) + ___output='windows' + ;; + *freebsd) + ___output='freebsd' + ;; + dragonfly*) + ___output='dragonfly' + ;; + *) + ;; + esac + + + # report status + printf -- \"%b\" \"\$___output\" + return 0 +} + + +main() { + host_os=\"\$(OS_Get)\" + host_arch=\"\$(OS_Get_Arch)\" + for ___file in './bin/'*; do + if [ ! -e \"\$___file\" ]; then + continue + fi + + ___system=\"\${___file##*/}\" + ___system=\"\${___system%%.*}\" + ___system=\"\${___system##*_}\" + ___os=\"\${___system%%-*}\" + ___arch=\"\${___system##*-}\" + + case \"\$___os\" in + any|\"\$host_os\") + ;; + *) + rm -f \"\$___file\" &> /dev/null + continue + ;; + esac + + case \"\$___arch\" in + any|\"\$host_arch\") + mv \"\$___file\" \"\${___file%%_*}\" + ;; + *) + rm -f \"\$___file\" &> /dev/null + ;; + esac + done + + return 0 +} +main \$* +return \$? +" + if [ $? -ne 0 ]; then + return 1 + fi + + ## seal the workspace + ___current_path="$PWD" && cd "$___workspace" + TAR_Create_XZ "${___export_directory}/${___archive_name}" "." + ___process=$? + cd "$___current_path" && unset ___current_path + if [ $___process -ne 0 ]; then + return 1 + fi + + ## create the formula + ___shasum="$(SHASUM_Create_From_File "${___export_directory}/${___archive_name}" "256")" + if [ $(STRINGS_Is_Empty "$___shasum") -eq 0 ]; then + return 1 + fi + + FS_Make_Housing_Directory "$___formula" + FS_Write_File "$___formula" "\ +class $(STRINGS_To_Titlecase "$___sku") < Formula + desc '${___description}' + homepage '${___website}' + license '${___license}' + url '${___base_url}/${___archive_name}' + sha256 '${___shasum}' + + def install + if File.file?('init.sh.ps1') + chmod 755, './init.sh.ps1' + system './init.sh.ps1' + else + chmod 755, './init.sh' + system './init.sh' + end + + if File.directory?('bin') + Dir.foreach('bin') do |filename| + next if filename == '.' or filename == '..' + chmod 0755, filename + libexec.install 'bin/' + filename + bin.install_symlink 'libexec/bin/' + filename => filename + end + end + + if File.directory?('lib') + Dir.foreach('lib') do |filename| + next if filename == '.' or filename == '..' + chmod 0544, filename + libexec.install 'lib/' + filename + lib.install_symlink 'libexec/lib/' + filename => filename + end + end + end + + test do + if File.file?('init.sh.ps1') + assert_predicate 'init.sh.ps1', :exist? + else + assert_predicate 'init.sh', :exist? + end + end +end +" if [ $? -ne 0 ]; then return 1 fi diff --git a/automataCI/services/publishers/unix.ps1 b/automataCI/services/publishers/unix.ps1 new file mode 100644 index 00000000..961c5906 --- /dev/null +++ b/automataCI/services/publishers/unix.ps1 @@ -0,0 +1,51 @@ +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +. "${env:LIBS_AUTOMATACI}\services\io\os.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" + + + + +function UNIX-Get-Arch { + param( + [string]$___arch + ) + + + # execute + switch ($___arch) { + "any" { + return "all" + } { $_ -in "386", "i386", "486", "i486", "586", "i586", "686", "i686" } { + return "i386" + } "armle" { + return "armel" + } "mipsle" { + return "mipsel" + } "mipsr6le" { + return "mips64r6el" + } "mipsn32le" { + return "mipsn32el" + } "mipsn32r6le" { + return "mipsn32r6el" + } "mips64le" { + return "mips64el" + } "mipsn64r6le" { + return "mipsn64r6el" + } "powerpcle" { + return "powerpcel" + } "ppc64le" { + return "ppc64el" + } default { + return $___arch + }} +} diff --git a/automataCI/services/publishers/unix.sh b/automataCI/services/publishers/unix.sh new file mode 100644 index 00000000..a6b0e608 --- /dev/null +++ b/automataCI/services/publishers/unix.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +UNIX_Get_Arch() { + # execute + case "$1" in + any) + ___value="all" + ;; + 386|i386|486|i486|586|i586|686|i686) + ___value="i386" + ;; + armle) + ___value="armel" + ;; + mipsle) + ___value="mipsel" + ;; + mipsr6le) + ___value="mipsr6el" + ;; + mipsn32le) + ___value="mipsn32el" + ;; + mipsn32r6le) + ___value="mipsn32r6el" + ;; + mips64le) + ___value="mips64el" + ;; + mips64r6le) + ___value="mips64r6el" + ;; + powerpcle) + ___value="powerpcel" + ;; + ppc64le) + ___value="ppc64el" + ;; + *) + ___value="$1" + ;; + esac + printf -- "%s" "$___value" + + + # report status + return 0 +} diff --git a/src/.ci/_package-archive_unix-any.sh b/src/.ci/_package-archive_unix-any.sh index 04b4fee1..066772ce 100644 --- a/src/.ci/_package-archive_unix-any.sh +++ b/src/.ci/_package-archive_unix-any.sh @@ -38,14 +38,17 @@ PACKAGE_Assemble_ARCHIVE_Content() { if [ $(FS_Is_Target_A_Source "$_target") -eq 0 ]; then return 10 # not applicable elif [ $(FS_Is_Target_A_Docs "$_target") -eq 0 ]; then - ___source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_DOCS}/" - FS_Is_Directory "$___source" + __source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_DOCS}" + __dest="${_directory}/docs" + + FS_Is_Directory "$__source" if [ $? -ne 0 ]; then return 10 # not applicable fi - I18N_Assemble "$___source" "$_directory" - FS_Copy_All "$___source" "$_directory" + I18N_Assemble "$__source" "$__dest" + FS_Make_Directory "$__dest" + FS_Copy_All "$__source" "$__dest" if [ $? -ne 0 ]; then I18N_Assemble_Failed return 1 @@ -55,18 +58,22 @@ PACKAGE_Assemble_ARCHIVE_Content() { elif [ $(FS_Is_Target_A_WASM_JS "$_target") -eq 0 ]; then return 10 # handled by wasm instead elif [ $(FS_Is_Target_A_WASM "$_target") -eq 0 ]; then - I18N_Assemble "$_target" "$_directory" - FS_Copy_File "$_target" "$_directory" + __dest="${_directory}/assets/$(FS_Get_File "$_target")" + + I18N_Assemble "$_target" "$__dest" + FS_Make_Housing_Directory "$__dest" + FS_Copy_File "$_target" "$__dest" if [ $? -ne 0 ]; then I18N_Assemble_Failed return 1 fi - ___source="$(FS_Extension_Remove "$_target" ".wasm").js" - FS_Is_File "$___source" + __source="$(FS_Extension_Remove "$_target" ".wasm").js" + FS_Is_File "$__source" if [ $? -eq 0 ]; then - I18N_Assemble "$___source" "$_directory" - FS_Copy_File "$___source" "$_directory" + __dest="${__dest}/$(FS_Get_File "$__source")" + I18N_Assemble "$__source" "$__dest" + FS_Copy_File "$__source" "$__dest" if [ $? -ne 0 ]; then I18N_Assemble_Failed return 1 @@ -83,8 +90,14 @@ PACKAGE_Assemble_ARCHIVE_Content() { elif [ $(FS_Is_Target_A_PDF "$_target") -eq 0 ]; then return 10 # not applicable else - I18N_Assemble "$_target" "$_directory" - FS_Copy_File "$_target" "$_directory" + __dest="${_directory}/bin/${PROJECT_SKU}" + if [ "$_target_os" = "windows" ]; then + __dest="${__dest}.exe" + fi + + I18N_Assemble "$_target" "$__dest" + FS_Make_Housing_Directory "$__dest" + FS_Copy_File "$_target" "$__dest" if [ $? -ne 0 ]; then I18N_Assemble_Failed return 1 @@ -93,23 +106,37 @@ PACKAGE_Assemble_ARCHIVE_Content() { # copy user guide - ___source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/docs/USER-GUIDES_en.pdf" - I18N_Assemble "$___source" "$_directory" - FS_Copy_File "$___source" "${_directory}/." - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi + for __source in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/docs/USER-GUIDES"*.pdf; do + FS_Is_Target_Exist "$__source" + if [ $? -ne 0 ]; then + continue + fi + + __dest="${_directory}/$(FS_Get_File "$__source")" + I18N_Assemble "$__source" "$__dest" + FS_Copy_File "$__source" "$__dest" + if [ $? -ne 0 ]; then + I18N_Assemble_Failed + return 1 + fi + done # copy license file - ___source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/licenses/LICENSE_en.pdf" - I18N_Assemble "$___source" "$_directory" - FS_Copy_File "$___source" "${_directory}/." - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi + for __source in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/licenses/LICENSE"*.pdf; do + FS_Is_Target_Exist "$__source" + if [ $? -ne 0 ]; then + continue + fi + + __dest="${_directory}/$(FS_Get_File "$__source")" + I18N_Assemble "$__source" "$__dest" + FS_Copy_File "$__source" "$__dest" + if [ $? -ne 0 ]; then + I18N_Assemble_Failed + return 1 + fi + done # report status diff --git a/src/.ci/_package-archive_windows-any.ps1 b/src/.ci/_package-archive_windows-any.ps1 index 479ef837..0d28260f 100644 --- a/src/.ci/_package-archive_windows-any.ps1 +++ b/src/.ci/_package-archive_windows-any.ps1 @@ -39,14 +39,17 @@ function PACKAGE-Assemble-ARCHIVE-Content { if ($(FS-Is-Target-A-Source "${_target}") -eq 0) { return 10 # not applicable } elseif ($(FS-Is-Target-A-Docs "${_target}") -eq 0) { - $___source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_DOCS}\" - $___process = FS-Is-Directory "${___source}" + $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_DOCS}" + $__dest = "${_directory}\docs" + + $___process = FS-Is-Directory "${__source}" if ($___process -ne 0) { return 10 # not applicable } - $null = I18N-Assemble "${___source}" "${_directory}" - $___process = FS-Copy-All "${___source}" "${_directory}" + $null = I18N-Assemble "${__source}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = FS-Copy-All "${__source}" "${__dest}" if ($___process -ne 0) { $null = I18N-Assemble-Failed return 1 @@ -56,18 +59,22 @@ function PACKAGE-Assemble-ARCHIVE-Content { } elseif ($(FS-Is-Target-A-WASM-JS "${_target}") -eq 0) { return 10 # handled by wasm instead } elseif ($(FS-Is-Target-A-WASM "${_target}") -eq 0) { - $null = I18N-Assemble "${_target}" "${_directory}" - $___process = FS-Copy-File "${_target}" "${_directory}" + $__dest = "${_directory}\assets\$(FS-Get-File "${_target}")" + + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = FS-Copy-File "${_target}" "${__dest}" if ($___process -ne 0) { $null = I18N-Assemble-Failed return 1 } - $___source = "$(FS-Extension-Remove "${_target}" ".wasm").js" - $___process = FS-Is-File "${___source}" + $__source = "$(FS-Extension-Remove "${_target}" ".wasm").js" + $___process = FS-Is-File "${__source}" if ($___process -eq 0) { - $null = I18N-Assemble "${___source}" "${_directory}" - $___process = FS-Copy-File "${___source}" "${_directory}" + $__dest = "${__dest}\$(FS-Get-File "${__source}")" + $null = I18N-Assemble "${__source}" "${__dest}" + $___process = FS-Copy-File "${__source}" "${__dest}" if ($___process -ne 0) { $null = I18N-Assemble-Failed return 1 @@ -84,8 +91,14 @@ function PACKAGE-Assemble-ARCHIVE-Content { } elseif ($(FS-Is-Target-A-PDF "${_target}") -eq 0) { return 10 # not applicable } else { - $null = I18N-Assemble "${_target}" "${_directory}" - $___process = FS-Copy-File "${_target}" "${_directory}" + $__dest = "${_directory}\bin\${env:PROJECT_SKU}" + if ($_target_os -eq "windows") { + $__dest = "${__dest}.exe" + } + + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Housing-Directory "${__dest}" + $___process = FS-Copy-File "${_target}" "${__dest}" if ($___process -ne 0) { $null = I18N-Assemble-Failed return 1 @@ -94,22 +107,30 @@ function PACKAGE-Assemble-ARCHIVE-Content { # copy user guide - $___source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\docs\USER-GUIDES_en.pdf" - $null = I18N-Assemble "${___source}" "${_directory}" - $___process = FS-Copy-File "${___source}" "${_directory}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 + Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\docs" ` + | Where-Object { ($_.Name -like "USER-GUIDES*.pdf") } ` + | ForEach-Object { $__source = $_.FullName + $__dest = "${_directory}\$(FS-Get-File "${__source}")" + $null = I18N-Assemble "${__source}" "${__dest}" + $___process = FS-Copy-File "${__source}" "${__dest}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } } # copy license file - $___source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\licenses\LICENSE_en.pdf" - $null = I18N-Assemble "${___source}" "${_directory}" - $___process = FS-Copy-File "${___source}" "${_directory}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 + Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\licenses" ` + | Where-Object { ($_.Name -like "LICENSE*.pdf") } ` + | ForEach-Object { $__source = $_.FullName + $__dest = "${_directory}\$(FS-Get-File "${__source}")" + $null = I18N-Assemble "${__source}" "${__dest}" + $___process = FS-Copy-File "${__source}" "${__dest}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } } diff --git a/src/.ci/_package-chocolatey_unix-any.sh b/src/.ci/_package-chocolatey_unix-any.sh index 57b5cbce..5bafcd8c 100644 --- a/src/.ci/_package-chocolatey_unix-any.sh +++ b/src/.ci/_package-chocolatey_unix-any.sh @@ -20,6 +20,9 @@ if [ "$PROJECT_PATH_ROOT" == "" ]; then return 1 fi +. "${LIBS_AUTOMATACI}/services/io/fs.sh" +. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" + @@ -31,6 +34,222 @@ PACKAGE_Assemble_CHOCOLATEY_Content() { _target_arch="$5" + # validate input + case "$_target_os" in + any|windows) + ;; + *) + return 10 # not supported + ;; + esac + + if [ $(FS_Is_Target_A_Source "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_Docs "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_Library "$_target") -eq 0 ]; then + __dest="${_directory}/lib" + + if [ $(FS_Is_Target_A_NPM "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_TARGZ "$_target") -eq 0 ]; then + # unpack library + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + TAR_Extract_GZ "$__dest" "$_target" + if [ $? -ne 0 ]; then + I18N_Assemble_Failed + return 1 + fi + elif [ $(FS_Is_Target_A_TARXZ "$_target") -eq 0 ]; then + # unpack library + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + TAR_Extract_XZ "$__dest" "$_target" + if [ $? -ne 0 ]; then + I18N_Assemble_Failed + return 1 + fi + elif [ $(FS_Is_Target_A_ZIP "$_target") -eq 0 ]; then + # unpack library + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + ZIP_Extract "$__dest" "$_target" + if [ $? -ne 0 ]; then + I18N_Assemble_Failed + return 1 + fi + else + # copy library file + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + FS_Copy_File "$_target" "$__dest" + if [ $? -ne 0 ]; then + I18N_Assemble_Failed + return 1 + fi + fi + + _package="lib${PROJECT_SKU}" + elif [ $(FS_Is_Target_A_WASM_JS "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_WASM "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_Chocolatey "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_Homebrew "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_Cargo "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_MSI "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_PDF "$_target") -eq 0 ]; then + return 10 # not applicable + else + # copy main program + __dest="${_directory}/bin/${PROJECT_SKU}.exe" + + I18N_Assemble "$_target" "$__dest" + FS_Make_Housing_Directory "$__dest" + FS_Copy_File "$_target" "$__dest" + if [ $? -ne 0 ]; then + I18N_Assemble_Failed + return 1 + fi + + _package="${PROJECT_SKU}" + fi + + __source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/icons/icon-128x128.png" + __dest="${_directory}/icon.png" + I18N_Assemble "$__source" "$__dest" + FS_Copy_File "$__source" "$__dest" + if [ $? -ne 0 ]; then + I18N_Assemble_Failed + return 1 + fi + + __source="${PROJECT_PATH_ROOT}/${PROJECT_README}" + __dest="${_directory}/${PROJECT_README}" + I18N_Assemble "$__source" "$__dest" + FS_Copy_File "$__source" "$__dest" + if [ $? -ne 0 ]; then + I18N_Assemble_Failed + return 1 + fi + + + # REQUIRED: chocolatey required tools\ directory + __dest="${_directory}/tools" + I18N_Create "$__dest" + FS_Make_Directory "$__dest" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + + + # OPTIONAL: chocolatey tools\chocolateyBeforeModify.ps1 + __dest="${_directory}/tools/chocolateyBeforeModify.ps1" + I18N_Create "$__dest" + FS_Write_File "$__dest" "\ +# REQUIRED - BEGIN EXECUTION +Write-Host \"Performing pre-configurations...\" +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + + + # REQUIRED: chocolatey tools\chocolateyinstall.ps1 + __dest="${_directory}/tools/chocolateyinstall.ps1" + I18N_Create "$__dest" + FS_Write_File "$__dest" "\ +# REQUIRED - PREPARING INSTALLATION +Write-Host \"Installing ${PROJECT_SKU} (${PROJECT_VERSION})...\" +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + + + # REQUIRED: chocolatey tools\chocolateyuninstall.ps1 + __dest="${_directory}/tools/chocolateyuninstall.ps1" + I18N_Create "$__dest" + FS_Write_File "$__dest" "\ +# REQUIRED - PREPARING UNINSTALLATION +Write-Host \"Uninstalling ${PROJECT_SKU} (${PROJECT_VERSION})...\" +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + + + # REQUIRED: chocolatey xml.nuspec file + __dest="${_directory}/${_package}.nuspec" + I18N_Create "$__dest" + FS_Write_File "$__dest" "\ + + + + ${PROJECT_SKU} + ${PROJECT_NAME} + ${PROJECT_VERSION} + ${PROJECT_CONTACT_NAME} + ${PROJECT_CONTACT_NAME} + ${PROJECT_CONTACT_WEBSITE} + ${PROJECT_LICENSE} + ${PROJECT_PITCH} + ${PROJECT_README} + icon.png + + + + + + + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + + FS_Is_Directory_Empty "${_directory}/bin" + if [ $? -ne 0 ]; then + FS_Append_File "$__dest" "\ + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + fi + + FS_Is_Directory_Empty "${_directory}/lib" + if [ $? -ne 0 ]; then + FS_Append_File "$__dest" "\ + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + fi + + FS_Append_File "$__dest" "\ + + +" + if [ $? -ne 0 ]; then + I18N_Create_Failed + return 1 + fi + + # execute - return 10 # not applicable - should be tech-oriented. + return 0 } diff --git a/src/.ci/_package-chocolatey_windows-any.ps1 b/src/.ci/_package-chocolatey_windows-any.ps1 index 933639bb..2bb2a8bf 100644 --- a/src/.ci/_package-chocolatey_windows-any.ps1 +++ b/src/.ci/_package-chocolatey_windows-any.ps1 @@ -19,6 +19,9 @@ if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { exit 1 } +. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" +. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" + @@ -32,6 +35,228 @@ function PACKAGE-Assemble-CHOCOLATEY-Content { ) - # execute - return 10 # not applicable - should be tech-oriented. + # validate project + switch ("${_target_os}") { + { $_ -in "any", "windows" } { + # accepted + } default { + return 10 # not supported + }} + + if ($(FS-Is-Target-A-Source "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-Docs "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-Library "${_target}") -eq 0) { + $__dest = "${_directory}\lib" + + if ($(FS-Is-Target-A-NPM "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-TARGZ "${_target}") -eq 0) { + # unpack library + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = TAR-Extract-GZ "${__dest}" "${_target}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } + } elseif ($(FS-Is-Target-A-TARXZ "${_target}") -eq 0) { + # unpack library + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = TAR-Extract-XZ "${__dest}" "${_target}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } + } elseif ($(FS-Is-Target-A-ZIP "${_target}") -eq 0) { + # unpack library + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = ZIP-Extract "${__dest}" "${_target}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } + } else { + # copy library file + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = FS-Copy-File "${_target}" "${__dest}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } + } + + $_package = "lib${env:PROJECT_SKU}" + } elseif ($(FS-Is-Target-A-WASM-JS "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-WASM "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-Chocolatey "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-Homebrew "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-Cargo "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-MSI "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-PDF "${_target}") -eq 0) { + return 10 # not applicable + } else { + # copy main program + $__dest = "${_directory}\bin\${env:PROJECT_SKU}.exe" + + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Housing-Directory "${__dest}" + $___process = FS-Copy-File "${_target}" "${__dest}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } + + $_package = "${env:PROJECT_SKU}" + } + + + $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\icons\icon-128x128.png" + $__dest = "${_directory}\icon.png" + $null = I18N-Assemble "${__source}" "${__dest}" + $___process = FS-Copy-File "${__source}" "${__dest}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } + + $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_README}" + $__dest = "${_directory}\${env:PROJECT_README}" + $null = I18N-Assemble "${__source}" "${__dest}" + $___process = FS-Copy-File "${__source}" "${__dest}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } + + + # REQUIRED: chocolatey required tools\ directory + $__dest = "${_directory}\tools" + $null = I18N-Create "${__dest}" + $___process = FS-Make-Directory "${__dest}" + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + + + # OPTIONAL: chocolatey tools\chocolateyBeforeModify.ps1 + $__dest = "${_directory}\tools\chocolateyBeforeModify.ps1" + $null = I18N-Create "${__dest}" + $___process = FS-Write-File "${__dest}" @" +# REQUIRED - BEGIN EXECUTION +Write-Host "Performing pre-configurations..." +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + + + # REQUIRED: chocolatey tools\chocolateyinstall.ps1 + $__dest = "${_directory}\tools\chocolateyinstall.ps1" + $null = I18N-Create "${__dest}" + $___process = FS-Write-File "${__dest}" @" +# REQUIRED - PREPARING INSTALLATION +Write-Host "Installing ${env:PROJECT_SKU} (${env:PROJECT_VERSION})..." + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + + + # REQUIRED: chocolatey tools\chocolateyuninstall.ps1 + $__dest = "${_directory}\tools\chocolateyuninstall.ps1" + $null = I18N-Create "${__dest}" + $___process = FS-Write-File "${__dest}" @" +# REQUIRED - PREPARING UNINSTALLATION +Write-Host "Uninstalling ${env:PROJECT_SKU} (${env:PROJECT_VERSION})..." + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + + + # REQUIRED: chocolatey xml.nuspec file + $__dest = "${_directory}\${env:PROJECT_SKU}.nuspec" + $null = I18N-Create "${__dest}" + $___process = FS-Write-File "${__dest}" @" + + + + ${env:PROJECT_SKU} + ${env:PROJECT_NAME} + ${env:PROJECT_VERSION} + ${env:PROJECT_CONTACT_NAME} + ${env:PROJECT_CONTACT_NAME} + ${env:PROJECT_CONTACT_WEBSITE} + ${env:PROJECT_LICENSE} + ${env:PROJECT_PITCH} + ${env:PROJECT_README} + icon.png + + + + + + + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + + $___process = FS-Is-Directory-Empty "${_directory}\bin" + if ($___process -ne 0) { + $___process = FS-Append-File "${__dest}" @" + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + } + + $___process = FS-Is-Directory-Empty "${_directory}\lib" + if ($___process -ne 0) { + $___process = FS-Append-File "${__dest}" @" + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + } + + $___process = FS-Append-File "${__dest}" @" + + + +"@ + if ($___process -ne 0) { + $null = I18N-Create-Failed + return 1 + } + + + # report status + return 0 } diff --git a/src/.ci/_package-deb_unix-any.sh b/src/.ci/_package-deb_unix-any.sh index 7cde15c7..da5a640a 100644 --- a/src/.ci/_package-deb_unix-any.sh +++ b/src/.ci/_package-deb_unix-any.sh @@ -67,8 +67,8 @@ PACKAGE_Assemble_DEB_Content() { ## (2) please avoid: usr/, usr/{TYPE}/, usr/bin/, & usr/lib{TYPE}/ ## whenever possible for avoiding conflicts with your OS native ## system packages. - _chroot="${_directory}/data/usr/" - if [ ! "$(STRINGS_To_Lowercase "$PROJECT_DEBIAN_IS_NATIVE")" = "true" ]; then + _chroot="${_directory}/data/usr" + if [ ! "$(STRINGS_To_Lowercase "$PROJECT_DEB_IS_NATIVE")" = "true" ]; then _chroot="${_chroot}/local" fi @@ -79,42 +79,42 @@ PACKAGE_Assemble_DEB_Content() { elif [ $(FS_Is_Target_A_Docs "$_target") -eq 0 ]; then return 10 # not applicable elif [ $(FS_Is_Target_A_Library "$_target") -eq 0 ]; then - ___dest="${_chroot}/lib/${PROJECT_SCOPE}/${PROJECT_SKU}" + __dest="${_chroot}/lib/${PROJECT_SCOPE}/${PROJECT_SKU}" if [ $(FS_Is_Target_A_NPM "$_target") -eq 0 ]; then return 10 # not applicable elif [ $(FS_Is_Target_A_TARGZ "$_target") -eq 0 ]; then # unpack library - I18N_Assemble "$_target" "$___dest" - FS_Make_Directory "$___dest" - TAR_Extract_GZ "$___dest" "$_target" + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + TAR_Extract_GZ "$__dest" "$_target" if [ $? -ne 0 ]; then I18N_Assemble_Failed return 1 fi elif [ $(FS_Is_Target_A_TARXZ "$_target") -eq 0 ]; then # unpack library - I18N_Assemble "$_target" "$___dest" - FS_Make_Directory "$___dest" - TAR_Extract_XZ "$___dest" "$_target" + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + TAR_Extract_XZ "$__dest" "$_target" if [ $? -ne 0 ]; then I18N_Assemble_Failed return 1 fi elif [ $(FS_Is_Target_A_ZIP "$_target") -eq 0 ]; then # unpack library - I18N_Assemble "$_target" "$___dest" - FS_Make_Directory "$___dest" - ZIP_Extract "$___dest" "$_target" + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + ZIP_Extract "$__dest" "$_target" if [ $? -ne 0 ]; then I18N_Assemble_Failed return 1 fi else # copy library file - I18N_Assemble "$_target" "$___dest" - FS_Make_Directory "$___dest" - FS_Copy_File "$_target" "$___dest" + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + FS_Copy_File "$_target" "$__dest" if [ $? -ne 0 ]; then I18N_Assemble_Failed return 1 @@ -139,11 +139,11 @@ PACKAGE_Assemble_DEB_Content() { return 10 # not applicable else # copy main program - ___dest="${_chroot}/bin/" + __dest="${_chroot}/bin/${PROJECT_SKU}" - I18N_Assemble "$_target" "$___dest" - FS_Make_Directory "$___dest" - FS_Copy_File "$_target" "$___dest" + I18N_Assemble "$_target" "$__dest" + FS_Make_Housing_Directory "$__dest" + FS_Copy_File "$_target" "$__dest" if [ $? -ne 0 ]; then I18N_Assemble_Failed return 1 @@ -152,9 +152,9 @@ PACKAGE_Assemble_DEB_Content() { # NOTE: REQUIRED file - ___dest="${_chroot}/share/doc/${PROJECT_SCOPE}/${PROJECT_SKU}/changelog.gz" - I18N_Create "$___dest" - DEB_Create_Changelog "$___dest" "$_changelog" "$PROJECT_SKU" + __dest="${_chroot}/share/doc/${PROJECT_SCOPE}/${PROJECT_SKU}/changelog.gz" + I18N_Create "$__dest" + DEB_Create_Changelog "$__dest" "$_changelog" "$PROJECT_SKU" if [ $? -ne 0 ]; then I18N_Create_Failed return 1 @@ -162,10 +162,10 @@ PACKAGE_Assemble_DEB_Content() { # NOTE: REQUIRED file - ___dest="${_chroot}/share/doc/${PROJECT_SCOPE}/${PROJECT_SKU}/copyright" - I18N_Create "$___dest" + __dest="${_chroot}/share/doc/${PROJECT_SCOPE}/${PROJECT_SKU}/copyright" + I18N_Create "$__dest" COPYRIGHT_Create \ - "$___dest" \ + "$__dest" \ "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/licenses/deb-copyright" \ "$PROJECT_SKU" \ "$PROJECT_CONTACT_NAME" \ @@ -178,10 +178,10 @@ PACKAGE_Assemble_DEB_Content() { # NOTE: REQUIRED file - ___dest="${_chroot}/share/man/man1/${PROJECT_SCOPE}-${PROJECT_SKU}.1" - I18N_Create "$___dest" + __dest="${_chroot}/share/man/man1/${PROJECT_SCOPE}-${PROJECT_SKU}.1" + I18N_Create "$__dest" MANUAL_Create \ - "$___dest" \ + "$__dest" \ "$PROJECT_SKU" \ "$PROJECT_CONTACT_NAME" \ "$PROJECT_CONTACT_EMAIL" \ @@ -203,12 +203,17 @@ PACKAGE_Assemble_DEB_Content() { # NOTE: OPTIONAL (Comment to turn it off) I18N_Create "${_directory}/source.list" + __url="$PROJECT_STATIC_URL" + if [ $(STRINGS_Is_Empty "$PROJECT_DEB_URL") -ne 0 ]; then + __url="$PROJECT_DEB_URL" + fi + DEB_Create_Source_List \ "$_directory" \ "$PROJECT_GPG_ID" \ - "$PROJECT_STATIC_URL" \ - "$PROJECT_REPREPRO_CODENAME" \ - "$PROJECT_DEBIAN_DISTRIBUTION" \ + "$__url" \ + "$PROJECT_DEB_COMPONENT" \ + "$PROJECT_DEB_DISTRIBUTION" \ "$_gpg_keyring" if [ $? -ne 0 ]; then I18N_Create_Failed @@ -217,20 +222,30 @@ PACKAGE_Assemble_DEB_Content() { # WARNING: THIS REQUIRED FILE MUST BE THE LAST ONE + __arch="$_target_arch" + if [ "$__arch" = "any" ]; then + __arch="all" + fi + + __os="$_target_os" + if [ "$__os" = "any" ]; then + __os="all" + fi + I18N_Create "${_directory}/control/control" DEB_Create_Control \ "$_directory" \ "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}" \ "$_package" \ "$PROJECT_VERSION" \ - "$_target_arch" \ - "$_target_os" \ + "$__arch" \ + "$__os" \ "$PROJECT_CONTACT_NAME" \ "$PROJECT_CONTACT_EMAIL" \ "$PROJECT_CONTACT_WEBSITE" \ "$PROJECT_PITCH" \ - "$PROJECT_DEBIAN_PRIORITY" \ - "$PROJECT_DEBIAN_SECTION" \ + "$PROJECT_DEB_PRIORITY" \ + "$PROJECT_DEB_SECTION" \ "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/docs/ABSTRACTS.txt" if [ $? -ne 0 ]; then I18N_Create_Failed diff --git a/src/.ci/_package-deb_windows-any.ps1 b/src/.ci/_package-deb_windows-any.ps1 index 68542ed4..c21b8255 100644 --- a/src/.ci/_package-deb_windows-any.ps1 +++ b/src/.ci/_package-deb_windows-any.ps1 @@ -65,9 +65,9 @@ function PACKAGE-Assemble-DEB-Content { ## (2) please avoid: usr/, usr/{TYPE}/, usr/bin/, & usr/lib{TYPE}/ ## whenever possible for avoiding conflicts with your OS native ## system packages. - $_chroot = "${_directory}/data/usr/" - if ($(STRINGS-To-Lowercase "${env:PROJECT_DEBIAN_IS_NATIVE}") -ne "true") { - $_chroot = "${_chroot}/local/" + $_chroot = "${_directory}/data/usr" + if ($(STRINGS-To-Lowercase "${env:PROJECT_DEB_IS_NATIVE}") -ne "true") { + $_chroot = "${_chroot}/local" } $_gpg_keyring = "${env:PROJECT_SKU}" @@ -77,42 +77,42 @@ function PACKAGE-Assemble-DEB-Content { } elseif ($(FS-Is-Target-A-Docs "${_target}") -eq 0) { return 10 # not applicable } elseif ($(FS-Is-Target-A-Library "${_target}") -eq 0) { - $___dest = "${_chroot}\lib\${env:PROJECT_SCOPE}\${env:PROJECT_SKU}" + $__dest = "${_chroot}\lib\${env:PROJECT_SCOPE}\${env:PROJECT_SKU}" if ($(FS-Is-Target-A-NPM "${_target}") -eq 0) { return 10 # not applicable } elseif ($(FS-Is-Target-A-TARGZ "${_target}") -eq 0) { # unpack library - $null = I18N-Assemble "${_target}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = TAR-Extract-GZ "${___dest}" "${_target}" + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = TAR-Extract-GZ "${__dest}" "${_target}" if ($___process -ne 0) { $null = I18N-Assemble-Failed return 1 } } elseif ($(FS-Is-Target-A-TARXZ "${_target}") -eq 0) { # unpack library - $null = I18N-Assemble "${_target}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = TAR-Extract-XZ "${___dest}" "${_target}" + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = TAR-Extract-XZ "${__dest}" "${_target}" if ($___process -ne 0) { $null = I18N-Assemble-Failed return 1 } } elseif ($(FS-Is-Target-A-ZIP "${_target}") -eq 0) { # unpack library - $null = I18N-Assemble "${_target}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = ZIP-Extract "${___dest}" "${_target}" + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = ZIP-Extract "${__dest}" "${_target}" if ($___process -ne 0) { $null = I18N-Assemble-Failed return 1 } } else { # copy library file - $null = I18N-Assemble "${_target}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = FS-Copy-File "${_target}" "${___dest}" + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = FS-Copy-File "${_target}" "${__dest}" if ($___process -ne 0) { $null = I18N-Assemble-Failed return 1 @@ -137,11 +137,11 @@ function PACKAGE-Assemble-DEB-Content { return 10 # not applicable } else { # copy main program - $___dest = "${_chroot}\bin\" + $__dest = "${_chroot}\bin\${env:PROJECT_SKU}" - $null = I18N-Assemble "${_target}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = FS-Copy-File "${_target}" "${___dest}" + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Housing-Directory "${__dest}" + $___process = FS-Copy-File "${_target}" "${__dest}" if ($___process -ne 0) { $null = I18N-Assemble-Failed return 1 @@ -150,9 +150,9 @@ function PACKAGE-Assemble-DEB-Content { # NOTE: REQUIRED file - $___dest = "${_chroot}\share\doc\${env:PROJECT_SCOPE}\${env:PROJECT_SKU}\changelog.gz" - $null = I18N-Create "${___dest}" - $___process = DEB-Create-Changelog "${___dest}" "${_changelog}" "${env:PROJECT_SKU}" + $__dest = "${_chroot}\share\doc\${env:PROJECT_SCOPE}\${env:PROJECT_SKU}\changelog.gz" + $null = I18N-Create "${__dest}" + $___process = DEB-Create-Changelog "${__dest}" "${_changelog}" "${env:PROJECT_SKU}" if ($___process -ne 0) { $null = I18N-Create-Failed return 1 @@ -160,10 +160,10 @@ function PACKAGE-Assemble-DEB-Content { # NOTE: REQUIRED file - $___dest = "${_chroot}\share\doc\${env:PROJECT_SCOPE}\${env:PROJECT_SKU}\copyright" - $null = I18N-Create "${___dest}" + $__dest = "${_chroot}\share\doc\${env:PROJECT_SCOPE}\${env:PROJECT_SKU}\copyright" + $null = I18N-Create "${__dest}" $___process = COPYRIGHT-Create ` - "${___dest}" ` + "${__dest}" ` "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\licenses\deb-copyright" ` "${env:PROJECT_SKU}" ` "${env:PROJECT_CONTACT_NAME}" ` @@ -176,11 +176,11 @@ function PACKAGE-Assemble-DEB-Content { # NOTE: REQUIRED file - $___dest = "${_chroot}\share\man\man1\${env:PROJECT_SCOPE}-${env:PROJECT_SKU}.1" - $null = I18N-Create "${___dest}" + $__dest = "${_chroot}\share\man\man1\${env:PROJECT_SCOPE}-${env:PROJECT_SKU}.1" + $null = I18N-Create "${__dest}" $___process = MANUAL-Create ` - "${___dest}" ` - "${env:PROJECT_DEBIAN_IS_NATIVE}" ` + "${__dest}" ` + "${env:PROJECT_DEB_IS_NATIVE}" ` "${env:PROJECT_SKU}" ` "${env:PROJECT_CONTACT_NAME}" ` "${env:PROJECT_CONTACT_EMAIL}" ` @@ -202,12 +202,17 @@ function PACKAGE-Assemble-DEB-Content { # NOTE: OPTIONAL (Comment to turn it off) $null = I18N-Create "source.list" + $__url = "${env:PROJECT_STATIC_URL}" + if ($(STRINGS-Is-Empty "${env:PROJECT_DEB_URL}") -ne 0) { + $__url = "${env:PROJECT_DEB_URL}" + } + $___process = DEB-Create-Source-List ` "${_directory}" ` "${env:PROJECT_GPG_ID}" ` - "${env:PROJECT_STATIC_URL}" ` - "${env:PROJECT_REPREPRO_CODENAME}" ` - "${env:PROJECT_DEBIAN_DISTRIBUTION}" ` + "${__url}" ` + "${env:PROJECT_DEB_COMPONENT}" ` + "${env:PROJECT_DEB_DISTRIBUTION}" ` "${_gpg_keyring}" if ($___process -ne 0) { $null = I18N-Create-Failed @@ -216,20 +221,31 @@ function PACKAGE-Assemble-DEB-Content { # WARNING: THIS REQUIRED FILE MUST BE THE LAST ONE + $__arch = "${_target_arch}" + if ($__arch -eq "any") { + $__arch = "all" + } + + $__os = "${_target_os}" + if ($__os -eq "any") { + $__os = "all" + } + + $null = I18N-Create "${_directory}\control\control" $___process = DEB-Create-Control ` "${_directory}" ` "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}" ` "${_package}" ` "${env:PROJECT_VERSION}" ` - "${_target_arch}" ` - "${_target_os}" ` + "${__arch}" ` + "${__os}" ` "${env:PROJECT_CONTACT_NAME}" ` "${env:PROJECT_CONTACT_EMAIL}" ` "${env:PROJECT_CONTACT_WEBSITE}" ` "${env:PROJECT_PITCH}" ` - "${env:PROJECT_DEBIAN_PRIORITY}" ` - "${env:PROJECT_DEBIAN_SECTION}" ` + "${env:PROJECT_DEB_PRIORITY}" ` + "${env:PROJECT_DEB_SECTION}" ` "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\docs\ABSTRACTS.txt" if ($___process -ne 0) { $null = I18N-Create-Failed diff --git a/src/.ci/_package-docker_unix-any.sh b/src/.ci/_package-docker_unix-any.sh index cf3e477b..9a183d07 100644 --- a/src/.ci/_package-docker_unix-any.sh +++ b/src/.ci/_package-docker_unix-any.sh @@ -58,13 +58,47 @@ PACKAGE_Assemble_DOCKER_Content() { fi case "$_target_os" in - linux|windows) + any) + _target_image="scratch" + __arch_list="" + ;; + linux) + _target_image="$PROJECT_CONTAINER_BASE_LINUX" + __arch_list="$PROJECT_CONTAINER_BASE_LINUX_ARCH" + ;; + windows) + _target_image="$PROJECT_CONTAINER_BASE_WINDOWS" + __arch_list="$PROJECT_CONTAINER_BASE_WINDOWS_ARCH" ;; *) - return 10 + return 10 # not supported ;; esac + __supported_arch=1 + if [ $(STRINGS_Is_Empty "$__arch_list") -ne 0 ] && + [ ! "$_target_image" = "scratch" ]; then + while [ ! "$__arch_list" = '' ]; do + __arch="${__arch_list%%|*}" + __arch_list="${__arch_list#*|}" + + if [ "$__arch_list" = "$__arch" ]; then + __arch_list="" + fi + + if [ "$_target_arch" = "$__arch" ]; then + __supported_arch=0 + break + fi + done + else + __supported_arch=0 + fi + + if [ $__supported_arch -ne 0 ]; then + return 10 # not supported + fi + # assemble the package FS_Copy_File "$_target" "${_directory}/${PROJECT_SKU}" @@ -80,19 +114,8 @@ PACKAGE_Assemble_DOCKER_Content() { # generate the Dockerfile FS_Write_File "${_directory}/Dockerfile" "\ -# Defining baseline image -" - if [ "$_target_os" = "windows" ]; then - FS_Append_File "${_directory}/Dockerfile" "\ -FROM --platform=${_target_os}/${_target_arch} mcr.microsoft.com/windows/nanoserver:ltsc2022 -" - else - FS_Append_File "${_directory}/Dockerfile" "\ -FROM --platform=${_target_os}/${_target_arch} busybox:latest -" - fi +FROM --platform=${_target_os}/${_target_arch} ${_target_image} - FS_Append_File "${_directory}/Dockerfile" "\ LABEL org.opencontainers.image.title=\"${PROJECT_NAME}\" LABEL org.opencontainers.image.description=\"${PROJECT_PITCH}\" LABEL org.opencontainers.image.authors=\"${PROJECT_CONTACT_NAME} <${PROJECT_CONTACT_EMAIL}>\" @@ -113,21 +136,22 @@ LABEL org.opencontainers.image.source=\"${PROJECT_SOURCE_URL}\" " fi - FS_Append_File "${_directory}/Dockerfile" "\ + FS_Append_File "${_directory}/Dockerfile" " # Defining environment variables ENV ARCH ${_target_arch} ENV OS ${_target_os} ENV PORT 80 # Assemble the file structure -COPY .blank /tmp/.tmpfile -ADD ${PROJECT_SKU} /app/bin/${PROJECT_SKU} +COPY .blank /tmp/.placeholder +ADD --chmod=765 ${PROJECT_SKU} /usr/local/bin/${PROJECT_SKU} # Set network port exposures EXPOSE 80 # Set entry point -ENTRYPOINT [\"/app/bin/${PROJECT_SKU}\"] +ENTRYPOINT ['/usr/local/bin/${PROJECT_SKU}'] +CMD ['help'] " if [ $? -ne 0 ]; then return 1 diff --git a/src/.ci/_package-docker_windows-any.ps1 b/src/.ci/_package-docker_windows-any.ps1 index 9a0b2565..136a81ba 100644 --- a/src/.ci/_package-docker_windows-any.ps1 +++ b/src/.ci/_package-docker_windows-any.ps1 @@ -54,15 +54,40 @@ function PACKAGE-Assemble-DOCKER-Content { return 10 # not applicable } elseif ($(FS-Is-Target-A-MSI "${_target}") -eq 0) { return 10 # not applicable + } elseif ($(FS-Is-Target-A-PDF "${_target}") -eq 0) { + return 10 # not applicable } switch ($_target_os) { - { $_ -in 'linux', 'windows' } { - # accepted + 'any' { + $_target_image = "scratch" + $__arch_list = "" + } 'linux' { + $_target_image = "${env:PROJECT_CONTAINER_BASE_LINUX}" + $__arch_list = "${env:PROJECT_CONTAINER_BASE_LINUX_ARCH}" + } 'windows' { + $_target_image = "${env:PROJECT_CONTAINER_BASE_WINDOWS}" + $__arch_list = "${env:PROJECT_CONTAINER_BASE_WINDOWS_ARCH}" } default { - return 10 + return 10 # not supported }} + $__supported = 1 + if (($(STRINGS-Is-Empty "${__arch_list}") -ne 0) -and ($_target_image -ne "scratch")) { + $__arch_list.Split("|") | ForEach { + if ($_target_arch -eq $_) { + $__supported = 0 + break + } + } + } else { + $__supported = 0 + } + + if ($__supported -ne 0) { + return 10 # not supported + } + # assemble the package $___process = FS-Copy-File "${_target}" "${_directory}\${env:PROJECT_SKU}" @@ -77,23 +102,9 @@ function PACKAGE-Assemble-DOCKER-Content { # generate the Dockerfile - $___process = FS-Write-File "${_directory}\Dockerfile" @" -# Defining baseline image - -"@ - if (${_target_os} == "windows") { - $___process = FS-Append-File "${_directory}\Dockerfile" @" -FROM --platform=${_target_os}/${_target_arch} mcr.microsoft.com/windows/nanoserver:ltsc2022 + $null = FS-Write-File "${_directory}\Dockerfile" @" +FROM --platform=${_target_os}/${_target_arch} ${_target_image} -"@ - } else { - $___process = FS-Append-File "${_directory}\Dockerfile" @" -FROM --platform=${_target_os}/${_target_arch} busybox:latest - -"@ - } - - $___process = FS-Append-File "${_directory}\Dockerfile" @" LABEL org.opencontainers.image.title=`"${env:PROJECT_NAME}`" LABEL org.opencontainers.image.description=`"${env:PROJECT_PITCH}`" LABEL org.opencontainers.image.authors=`"${env:PROJECT_CONTACT_NAME} <${env:PROJECT_CONTACT_EMAIL}>`" @@ -104,34 +115,36 @@ LABEL org.opencontainers.image.licenses=`"${env:PROJECT_LICENSE}`" "@ if ($(STRINGS-Is-Empty "${env:PROJECT_CONTACT_WEBSITE}") -ne 0) { - $___process = FS-Append-File "${_directory}\Dockerfile" @" + $null = FS-Append-File "${_directory}\Dockerfile" @" LABEL org.opencontainers.image.url=`"${env:PROJECT_CONTACT_WEBSITE}`" "@ } if ($(STRINGS-Is-Empty "${env:PROJECT_SOURCE_URL}") -ne 0) { - $___process = FS-Append-File "${_directory}\Dockerfile" @" + $null = FS-Append-File "${_directory}\Dockerfile" @" LABEL org.opencontainers.image.source=`"${env:PROJECT_SOURCE_URL}`" "@ } $___process = FS-Append-File "${_directory}\Dockerfile" @" + # Defining environment variables ENV ARCH ${_target_arch} ENV OS ${_target_os} ENV PORT 80 # Assemble the file structure -COPY .blank /tmp/.tmpfile -ADD ${PROJECT_SKU} /app/bin/${PROJECT_SKU} +COPY .blank /tmp/.placeholder +ADD --chmod 765 ${PROJECT_SKU} /usr/local/bin/${PROJECT_SKU} # Set network port exposures EXPOSE 80 # Set entry point -ENTRYPOINT ["/app/bin/${PROJECT_SKU}"] +ENTRYPOINT ['/usr/local/bin/${PROJECT_SKU}'] +CMD ['help'] "@ if ($___process -ne 0) { diff --git a/src/.ci/_package-homebrew_unix-any.sh b/src/.ci/_package-homebrew_unix-any.sh index 44d55281..d38a0f35 100644 --- a/src/.ci/_package-homebrew_unix-any.sh +++ b/src/.ci/_package-homebrew_unix-any.sh @@ -20,6 +20,10 @@ if [ "$PROJECT_PATH_ROOT" = "" ]; then return 1 fi +. "${LIBS_AUTOMATACI}/services/io/fs.sh" +. "${LIBS_AUTOMATACI}/services/io/strings.sh" +. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" + @@ -31,6 +35,95 @@ PACKAGE_Assemble_HOMEBREW_Content() { _target_arch="$5" + # validate input + if [ "$(STRINGS_Is_Empty "$PROJECT_HOMEBREW_URL")" -eq 0 ]; then + return 10 # disabled explictly + fi + + case "$_target_os" in + any|darwin|linux) + ;; + *) + return 10 # not supported + ;; + esac + + # execute - return 10 # not applicable - should be tech-oriented. + if [ $(FS_Is_Target_A_Source "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_Docs "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_Library "$_target") -eq 0 ]; then + __dest="${_directory}/lib" + + if [ $(FS_Is_Target_A_NPM "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_TARGZ "$_target") -eq 0 ]; then + # unpack library + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + TAR_Extract_GZ "$__dest" "$_target" + if [ $? -ne 0 ]; then + I18N_Assemble_Failed + return 1 + fi + elif [ $(FS_Is_Target_A_TARXZ "$_target") -eq 0 ]; then + # unpack library + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + TAR_Extract_XZ "$__dest" "$_target" + if [ $? -ne 0 ]; then + I18N_Assemble_Failed + return 1 + fi + elif [ $(FS_Is_Target_A_ZIP "$_target") -eq 0 ]; then + # unpack library + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + ZIP_Extract "$__dest" "$_target" + if [ $? -ne 0 ]; then + I18N_Assemble_Failed + return 1 + fi + else + # copy library file + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + FS_Copy_File "$_target" "$__dest" + if [ $? -ne 0 ]; then + I18N_Assemble_Failed + return 1 + fi + fi + elif [ $(FS_Is_Target_A_WASM_JS "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_WASM "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_Chocolatey "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_Homebrew "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_Cargo "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_MSI "$_target") -eq 0 ]; then + return 10 # not applicable + elif [ $(FS_Is_Target_A_PDF "$_target") -eq 0 ]; then + return 10 # not applicable + else + # copy main program + __dest="${_directory}/bin/$(FS_Get_File "$_target")" + + I18N_Assemble "$_target" "$__dest" + FS_Make_Housing_Directory "$__dest" + FS_Copy_File "$_target" "$__dest" + if [ $? -ne 0 ]; then + I18N_Assemble_Failed + return 1 + fi + fi + + + # report status + return 0 } diff --git a/src/.ci/_package-homebrew_windows-any.ps1 b/src/.ci/_package-homebrew_windows-any.ps1 index 1b845465..02957af6 100644 --- a/src/.ci/_package-homebrew_windows-any.ps1 +++ b/src/.ci/_package-homebrew_windows-any.ps1 @@ -19,6 +19,10 @@ if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { exit 1 } +. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" +. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" + @@ -32,6 +36,92 @@ function PACKAGE-Assemble-HOMEBREW-Content { ) - # execute - return 10 # not applicable - should be tech-oriented. + # validate project + if ($(STRINGS-Is-Empty "${env:PROJECT_HOMEBREW_URL}") -eq 0) { + return 10 # disabled explictly + } + + switch ("${_target_os}") { + { $_ -in "any", "darwin", "linux" } { + # accepted + } default { + return 10 # not supported + }} + + if ($(FS-Is-Target-A-Source "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-Docs "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-Library "${_target}") -eq 0) { + $__dest = "${_directory}\lib" + + if ($(FS-Is-Target-A-NPM "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-TARGZ "${_target}") -eq 0) { + # unpack library + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = TAR-Extract-GZ "${__dest}" "${_target}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } + } elseif ($(FS-Is-Target-A-TARXZ "${_target}") -eq 0) { + # unpack library + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = TAR-Extract-XZ "${__dest}" "${_target}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } + } elseif ($(FS-Is-Target-A-ZIP "${_target}") -eq 0) { + # unpack library + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = ZIP-Extract "${__dest}" "${_target}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } + } else { + # copy library file + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = FS-Copy-File "${_target}" "${__dest}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } + } + } elseif ($(FS-Is-Target-A-WASM-JS "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-WASM "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-Chocolatey "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-Homebrew "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-Cargo "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-MSI "${_target}") -eq 0) { + return 10 # not applicable + } elseif ($(FS-Is-Target-A-PDF "${_target}") -eq 0) { + return 10 # not applicable + } else { + # copy main program + $__dest = "${_directory}\bin\$(FS-Get-File "${_target}")" + + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Housing-Directory "${__dest}" + $___process = FS-Copy-File "${_target}" "${__dest}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } + } + + + # report status + return 0 } diff --git a/src/.ci/_package-ipk_unix-any.sh b/src/.ci/_package-ipk_unix-any.sh index 42937c68..26189ae2 100644 --- a/src/.ci/_package-ipk_unix-any.sh +++ b/src/.ci/_package-ipk_unix-any.sh @@ -53,8 +53,8 @@ PACKAGE_Assemble_IPK_Content() { ## (2) please avoid: usr/, usr/{TYPE}/, usr/bin/, & usr/lib{TYPE}/ ## whenever possible for avoiding conflicts with your OS native ## system packages. - _chroot="${_directory}/data/usr/" - if [ ! "$(STRINGS_To_Lowercase "$PROJECT_DEBIAN_IS_NATIVE")" = "true" ]; then + _chroot="${_directory}/data/usr" + if [ ! "$(STRINGS_To_Lowercase "$PROJECT_DEB_IS_NATIVE")" = "true" ]; then _chroot="${_chroot}/local" fi @@ -65,42 +65,42 @@ PACKAGE_Assemble_IPK_Content() { elif [ $(FS_Is_Target_A_Docs "$_target") -eq 0 ]; then return 10 # not applicable elif [ $(FS_Is_Target_A_Library "$_target") -eq 0 ]; then - ___dest="${_chroot}/lib/${PROJECT_SCOPE}/${PROJECT_SKU}" + __dest="${_chroot}/lib/${PROJECT_SCOPE}/${PROJECT_SKU}" if [ $(FS_Is_Target_A_NPM "$_target") -eq 0 ]; then return 10 # not applicable elif [ $(FS_Is_Target_A_TARGZ "$_target") -eq 0 ]; then # unpack library - I18N_Assemble "$_target" "$___dest" - FS_Make_Directory "$___dest" - TAR_Extract_GZ "$___dest" "$_target" + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + TAR_Extract_GZ "$__dest" "$_target" if [ $? -ne 0 ]; then I18N_Assemble_Failed return 1 fi elif [ $(FS_Is_Target_A_TARXZ "$_target") -eq 0 ]; then # unpack library - I18N_Assemble "$_target" "$___dest" - FS_Make_Directory "$___dest" - TAR_Extract_XZ "$___dest" "$_target" + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + TAR_Extract_XZ "$__dest" "$_target" if [ $? -ne 0 ]; then I18N_Assemble_Failed return 1 fi elif [ $(FS_Is_Target_A_ZIP "$_target") -eq 0 ]; then # unpack library - I18N_Assemble "$_target" "$___dest" - FS_Make_Directory "$___dest" - ZIP_Extract "$___dest" "$_target" + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + ZIP_Extract "$__dest" "$_target" if [ $? -ne 0 ]; then I18N_Assemble_Failed return 1 fi else # copy library file - I18N_Assemble "$_target" "$___dest" - FS_Make_Directory "$___dest" - FS_Copy_File "$_target" "$___dest" + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + FS_Copy_File "$_target" "$__dest" if [ $? -ne 0 ]; then I18N_Assemble_Failed return 1 @@ -125,11 +125,14 @@ PACKAGE_Assemble_IPK_Content() { return 10 # not applicable else # copy main program - ___dest="${_chroot}/bin/" + __dest="${_chroot}/bin/${PROJECT_SKU}" + if [ "$_target_os" = "windows" ]; then + __dest="${__dest}.exe" + fi - I18N_Assemble "$_target" "$___dest" - FS_Make_Directory "$___dest" - FS_Copy_File "$_target" "$___dest" + I18N_Assemble "$_target" "$__dest" + FS_Make_Housing_Directory "$__dest" + FS_Copy_File "$_target" "$__dest" if [ $? -ne 0 ]; then I18N_Assemble_Failed return 1 @@ -150,8 +153,8 @@ PACKAGE_Assemble_IPK_Content() { "$PROJECT_CONTACT_EMAIL" \ "$PROJECT_CONTACT_WEBSITE" \ "$PROJECT_PITCH" \ - "$PROJECT_DEBIAN_PRIORITY" \ - "$PROJECT_DEBIAN_SECTION" \ + "$PROJECT_DEB_PRIORITY" \ + "$PROJECT_DEB_SECTION" \ "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/docs/ABSTRACTS.txt" if [ $? -ne 0 ]; then I18N_Create_Failed diff --git a/src/.ci/_package-ipk_windows-any.ps1 b/src/.ci/_package-ipk_windows-any.ps1 index 31cbc5b9..88b83726 100644 --- a/src/.ci/_package-ipk_windows-any.ps1 +++ b/src/.ci/_package-ipk_windows-any.ps1 @@ -53,9 +53,9 @@ function PACKAGE-Assemble-IPK-Content { ## (2) please avoid: usr/, usr/{TYPE}/, usr/bin/, & usr/lib{TYPE}/ ## whenever possible for avoiding conflicts with your OS native ## system packages. - $_chroot = "${_directory}/data/usr/" - if ($(STRINGS-To-Lowercase "${env:PROJECT_DEBIAN_IS_NATIVE}") -ne "true") { - $_chroot = "${_chroot}/local/" + $_chroot = "${_directory}/data/usr" + if ($(STRINGS-To-Lowercase "${env:PROJECT_DEB_IS_NATIVE}") -ne "true") { + $_chroot = "${_chroot}/local" } $_gpg_keyring = "${env:PROJECT_SKU}" @@ -65,42 +65,42 @@ function PACKAGE-Assemble-IPK-Content { } elseif ($(FS-Is-Target-A-Docs "${_target}") -eq 0) { return 10 # not applicable } elseif ($(FS-Is-Target-A-Library "${_target}") -eq 0) { - $___dest = "${_chroot}\lib\${env:PROJECT_SCOPE}\${env:PROJECT_SKU}" + $__dest = "${_chroot}\lib\${env:PROJECT_SCOPE}\${env:PROJECT_SKU}" if ($(FS-Is-Target-A-NPM "${_target}") -eq 0) { return 10 # not applicable } elseif ($(FS-Is-Target-A-TARGZ "${_target}") -eq 0) { # unpack library - $null = I18N-Assemble "${_target}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = TAR-Extract-GZ "${___dest}" "${_target}" + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = TAR-Extract-GZ "${__dest}" "${_target}" if ($___process -ne 0) { $null = I18N-Assemble-Failed return 1 } } elseif ($(FS-Is-Target-A-TARXZ "${_target}") -eq 0) { # unpack library - $null = I18N-Assemble "${_target}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = TAR-Extract-XZ "${___dest}" "${_target}" + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = TAR-Extract-XZ "${__dest}" "${_target}" if ($___process -ne 0) { $null = I18N-Assemble-Failed return 1 } } elseif ($(FS-Is-Target-A-ZIP "${_target}") -eq 0) { # unpack library - $null = I18N-Assemble "${_target}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = ZIP-Extract "${___dest}" "${_target}" + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = ZIP-Extract "${__dest}" "${_target}" if ($___process -ne 0) { $null = I18N-Assemble-Failed return 1 } } else { # copy library file - $null = I18N-Assemble "${_target}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = FS-Copy-File "${_target}" "${___dest}" + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = FS-Copy-File "${_target}" "${__dest}" if ($___process -ne 0) { $null = I18N-Assemble-Failed return 1 @@ -127,11 +127,14 @@ function PACKAGE-Assemble-IPK-Content { return 10 # not applicable } else { # copy main program - $___dest = "${_chroot}\bin\" + $__dest = "${_chroot}\bin\${env:PROJECT_SKU}" + if ($_target_os -eq "windows") { + $__dest = "${__dest}.exe" + } - $null = I18N-Assemble "${_target}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = FS-Copy-File "${_target}" "${___dest}" + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Housing-Directory "${__dest}" + $___process = FS-Copy-File "${_target}" "${__dest}" if ($___process -ne 0) { $null = I18N-Assemble-Failed return 1 @@ -152,8 +155,8 @@ function PACKAGE-Assemble-IPK-Content { "${env:PROJECT_CONTACT_EMAIL}" ` "${env:PROJECT_CONTACT_WEBSITE}" ` "${env:PROJECT_PITCH}" ` - "${env:PROJECT_DEBIAN_PRIORITY}" ` - "${env:PROJECT_DEBIAN_SECTION}" ` + "${env:PROJECT_DEB_PRIORITY}" ` + "${env:PROJECT_DEB_SECTION}" ` "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\docs\ABSTRACTS.txt" if ($___process -ne 0) { $null = I18N-Create-Failed diff --git a/src/.ci/_package-lib_unix-any.sh b/src/.ci/_package-lib_unix-any.sh index c083d017..3e2324be 100644 --- a/src/.ci/_package-lib_unix-any.sh +++ b/src/.ci/_package-lib_unix-any.sh @@ -43,8 +43,13 @@ PACKAGE_Assemble_LIB_Content() { # execute - ## copy over known archived files + _workspace="packagers-lib-$(FS_Get_File "$_target")" + _workspace="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/${_workspace}" + FS_Remove_Silently "$_workspace" + + __dest="${_workspace}/lib" if [ $(FS_Is_Target_A_NPM "$_target") -eq 0 ]; then + # copy over - do not further modify its content anymore __dest="lib${PROJECT_SKU}-NPM_${PROJECT_VERSION}_js-js.tgz" __dest="${_directory}/${__dest}" I18N_Copy "$_target" "$__dest" @@ -56,67 +61,111 @@ PACKAGE_Assemble_LIB_Content() { return 0 elif [ $(FS_Is_Target_A_TARGZ "$_target") -eq 0 ]; then - __dest="lib${PROJECT_SKU}_${PROJECT_VERSION}_${_target_os}-${target_arch}.tar.gz" - __dest="${_directory}/${__dest}" - I18N_Copy "$_target" "$__dest" - FS_Copy_File "$_target" "$__dest" + # unpack library + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + TAR_Extract_GZ "$__dest" "$_target" if [ $? -ne 0 ]; then I18N_Copy_Failed return 1 fi - - return 0 elif [ $(FS_Is_Target_A_TARXZ "$_target") -eq 0 ]; then - __dest="lib${PROJECT_SKU}_${PROJECT_VERSION}_${_target_os}-${target_arch}.tar.xz" - __dest="${_directory}/${__dest}" - I18N_Copy "$_target" "$__dest" - FS_Copy_File "$_target" "$__dest" + # unpack library + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + TAR_Extract_XZ "$__dest" "$_target" if [ $? -ne 0 ]; then I18N_Copy_Failed return 1 fi - - return 0 elif [ $(FS_Is_Target_A_ZIP "$_target") -eq 0 ]; then - __dest="lib${PROJECT_SKU}_${PROJECT_VERSION}_${_target_os}-${target_arch}.zip" - __dest="${_directory}/${__dest}" - I18N_Copy "$_target" "$__dest" + # unpack library + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + ZIP_Extract "$__dest" "$_target" + if [ $? -ne 0 ]; then + I18N_Assemble_Failed + return 1 + fi + else + # assumed it is a standalone library file + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" FS_Copy_File "$_target" "$__dest" if [ $? -ne 0 ]; then - I18N_Copy_Failed + I18N_Assemble_Failed return 1 fi - - return 0 fi - ## assume standalone library file - manually package into .tar.xz, .zip, and .nupkg - __workspace="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/package-${_target_name}" - FS_Remake_Directory "$__workspace" - I18N_Copy "$_target" "$__workspace" - FS_Copy_File "$_target" "$__workspace" - if [ $? -ne 0 ]; then - I18N_Copy_Failed + + # sanity check before proceeding + FS_Is_Directory_Empty "$__dest" + if [ $? -eq 0 ]; then + I18N_Assemble_Failed return 1 fi + + # copy README.md __source="${PROJECT_PATH_ROOT}/${PROJECT_README}" - I18N_Copy "$__source" "$__workspace" - FS_Copy_File "$__source" "$__workspace" + __dest="${_workspace}/${PROJECT_README}" + I18N_Assemble "$__source" "$__dest" + FS_Copy_File "$__source" "$__dest" if [ $? -ne 0 ]; then - I18N_Copy_Failed + I18N_Assemble_Failed return 1 fi - __source="${PROJECT_PATH_ROOT}/${PROJECT_LICENSE_FILE}" - I18N_Copy "$__source" "$__workspace" - FS_Copy_File "$__source" "$__workspace" + + # copy user guide files + for __source in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/docs/USER-GUIDES"*.pdf; do + FS_Is_Target_Exist "$__source" + if [ $? -ne 0 ]; then + continue + fi + + __dest="${_workspace}/$(FS_Get_File "$__source")" + I18N_Copy "$__source" "$__dest" + FS_Copy_File "$__source" "$__dest" + if [ $? -ne 0 ]; then + I18N_Copy_Failed + return 1 + fi + done + + + # copy license files + for __source in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/licenses/LICENSE"*.pdf; do + FS_Is_Target_Exist "$__source" + if [ $? -ne 0 ]; then + continue + fi + + __dest="${_workspace}/$(FS_Get_File "$__source")" + I18N_Copy "$__source" "$__dest" + FS_Copy_File "$__source" "$__dest" + if [ $? -ne 0 ]; then + I18N_Copy_Failed + return 1 + fi + done + + + # assemble icon.png + __source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/icons/icon-128x128.png" + __dest="${_workspace}/icon.png" + I18N_Assemble "$__source" "$__dest" + FS_Copy_File "$__source" "$__dest" if [ $? -ne 0 ]; then - I18N_Copy_Failed + I18N_Assemble_Failed return 1 fi - __current_path="$PWD" && cd "$__workspace" + + # begin packaging + __current_path="$PWD" && cd "$_workspace" + ## package tar.xz __dest="lib${PROJECT_SKU}_${PROJECT_VERSION}_${_target_os}-${_target_arch}.tar.xz" I18N_Create_Package "$__dest" @@ -140,14 +189,14 @@ PACKAGE_Assemble_LIB_Content() { fi ## package nupkg - __dest="./Package.nuspec" __acceptance="false" if [ $(STRINGS_To_Lowercase "$PROJECT_LICENSE_ACCEPTANCE_REQUIRED") = "true" ]; then __acceptance="true" fi + __dest="lib${PROJECT_SKU}.nuspec" I18N_Create "$__dest" - FS_Write_File "$__dest" "\ + FS_Write_File "./${__dest}" "\ @@ -161,7 +210,13 @@ PACKAGE_Assemble_LIB_Content() { ${PROJECT_LICENSE} ${__acceptance} ${PROJECT_README} + icon.png + + + + + " if [ $? -ne 0 ]; then diff --git a/src/.ci/_package-lib_windows-any.ps1 b/src/.ci/_package-lib_windows-any.ps1 index 7b65e78b..9cdd1172 100644 --- a/src/.ci/_package-lib_windows-any.ps1 +++ b/src/.ci/_package-lib_windows-any.ps1 @@ -44,8 +44,13 @@ function PACKAGE-Assemble-LIB-Content { # execute - ## copy over known archived files + $_workspace = "packagers-lib-lib${env:PROJECT_SKU}_${_target_os}-${_target_arch}" + $_workspace = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\${_workspace}" + $null = FS-Remove-Silently "${_workspace}" + + $__dest = "${_workspace}\lib" if ($(FS-Is-Target-A-NPM "${_target}") -eq 0) { + # copy over - do not modify anymore $__dest = "lib${env:PROJECT_SKU}-NPM_${env:PROJECT_VERSION}_js-js.tgz" $__dest = "${_directory}\${__dest}" $null = I18N-Copy "${_target}" "${__dest}" @@ -57,69 +62,106 @@ function PACKAGE-Assemble-LIB-Content { return 0 } elseif ($(FS-Is-Target-A-TARGZ "${_target}") -eq 0) { - $__dest = "lib${env:PROJECT_SKU}_${env:PROJECT_VERSION}_${_target_os}-${_target_arch}.tar.gz" - $__dest = "${_directory}\${__dest}" - $null = I18N-Copy "${_target}" "${__dest}" - $___process = FS-Copy-File "${_target}" "${__dest}" + # unpack library + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = TAR-Extract-GZ "${__dest}" "${_target}" if ($___process -ne 0) { - $null = I18N-Copy-Failed + $null = I18N-Assemble-Failed return 1 } - - return 0 } elseif ($(FS-Is-Target-A-TARXZ "${_target}") -eq 0) { - $__dest = "lib${env:PROJECT_SKU}_${env:PROJECT_VERSION}_${_target_os}-${_target_arch}.tar.xz" - $__dest = "${_directory}\${__dest}" - $null = I18N-Copy "${_target}" "${__dest}" - $___process = FS-Copy-File "${_target}" "${__dest}" + # unpack library + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = TAR-Extract-XZ "${__dest}" "${_target}" if ($___process -ne 0) { - $null = I18N-Copy-Failed + $null = I18N-Assemble-Failed return 1 } - - return 0 } elseif ($(FS-Is-Target-A-ZIP "${_target}") -eq 0) { - $__dest = "lib${env:PROJECT_SKU}_${env:PROJECT_VERSION}_${_target_os}-${_target_arch}.zip" - $__dest = "${_directory}\${__dest}" - $null = I18N-Copy "${_target}" "${__dest}" + # unpack library + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = ZIP-Extract "${__dest}" "${_target}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } + } else { + # assumed it is a standalone library file + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" $___process = FS-Copy-File "${_target}" "${__dest}" if ($___process -ne 0) { - $null = I18N-Copy-Failed + $null = I18N-Assemble-Failed return 1 } - - return 0 } - ## assume standalone library file - manually package into .tar.xz, .zip, and .nupkg - $__workspace = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\package-${_target_name}" - $null = FS-Remake-Directory "${__workspace}" - $null = I18N-Copy "${_target}" "${__workspace}" - $___process = FS-Copy-File "${_target}" "${__workspace}" - if ($___process -ne 0) { - $null = I18N-Copy-Failed + # sanity check before proceeding + $___process = FS-Is-Directory-Empty "${__dest}" + if ($___process -eq 0) { + $null = I18N-Assemble-Failed return 1 } + + # copy README.md $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_README}" - $null = I18N-Copy "${__source}" "${__workspace}" - $___process = FS-Copy-File "${__source}" "${__workspace}" + $__dest = "${_workspace}\${env:PROJECT_README}" + $null = I18N-Assemble "${__source}" "${__dest}" + $___process = FS-Copy-File "${__source}" "${__dest}" if ($___process -ne 0) { - $null = I18N-Copy-Failed + $null = I18N-Assemble-Failed return 1 } - $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_LICENSE_FILE}" - $null = I18N-Copy "${__source}" "${__workspace}" - $___process = FS-Copy-File "${__source}" "${__workspace}" + + # copy user guide + Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\docs" ` + | Where-Object { ($_.Name -like "USER-GUIDES*.pdf") } ` + | ForEach-Object { $__source = $_.FullName + $__dest = "${_workspace}\$(FS-Get-File "${__source}")" + $null = I18N-Assemble "${__source}" "${__dest}" + $___process = FS-Copy-File "${__source}" "${__dest}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } + } + + + # copy license file + Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\licenses" ` + | Where-Object { ($_.Name -like "LICENSE*.pdf") } ` + | ForEach-Object { $__source = $_.FullName + $__dest = "${_workspace}\$(FS-Get-File "${__source}")" + $null = I18N-Assemble "${__source}" "${__dest}" + $___process = FS-Copy-File "${__source}" "${__dest}" + if ($___process -ne 0) { + $null = I18N-Assemble-Failed + return 1 + } + } + + + # assemble icon.png + $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\icons\icon-128x128.png" + $__dest = "${_workspace}\icon.png" + $null = I18N-Assemble "${__source}" "${__dest}" + $___process = FS-Copy-File "${__source}" "${__dest}" if ($___process -ne 0) { - $null = I18N-Copy-Failed + $null = I18N-Assemble-Failed return 1 } + + # begin packaging $__current_path = Get-Location - $null = Set-Location -Path "${__workspace}" + $null = Set-Location -Path "${_workspace}" + ## package tar.xz $__dest = "lib${env:PROJECT_SKU}_${env:PROJECT_VERSION}_${_target_os}-${_target_arch}.tar.xz" $null = I18N-Create-Package "${__dest}" @@ -145,28 +187,34 @@ function PACKAGE-Assemble-LIB-Content { } ## package nupkg - $__dest = ".\Package.nuspec" $__acceptance = "false" if ($(STRINGS-To-Lowercase "${env:PROJECT_LICENSE_ACCEPTANCE_REQUIRED}") -eq "true") { $__acceptance = "true" } + $__dest = "lib${env:PROJECT_SKU}.nuspec" $null = I18N-Create "${__dest}" + $__dest = ".\${__dest}" $___process = FS-Write-File "${__dest}" @" - ${PROJECT_SKU} - ${PROJECT_VERSION} - ${PROJECT_CONTACT_NAME} - ${PROJECT_CONTACT_NAME} - ${PROJECT_SOURCE_URL} - ${PROJECT_NAME} - ${PROJECT_PITCH} - ${PROJECT_LICENSE} + ${env:PROJECT_SKU} + ${env:PROJECT_VERSION} + ${env:PROJECT_CONTACT_NAME} + ${env:PROJECT_CONTACT_NAME} + ${env:PROJECT_SOURCE_URL} + ${env:PROJECT_NAME} + ${env:PROJECT_PITCH} + ${env:PROJECT_LICENSE} ${__acceptance} - ${PROJECT_README} + ${env:PROJECT_README} + + + + + "@ @@ -177,7 +225,6 @@ function PACKAGE-Assemble-LIB-Content { return 1 } - $__dest = "lib${env:PROJECT_SKU}_${env:PROJECT_VERSION}_${_target_os}-${_target_arch}.nupkg" $null = I18N-Create-Package "${__dest}" $__dest = "${_directory}\${__dest}" diff --git a/src/.ci/_package-pdf_unix-any.sh b/src/.ci/_package-pdf_unix-any.sh index 34b1fe69..a9d87354 100644 --- a/src/.ci/_package-pdf_unix-any.sh +++ b/src/.ci/_package-pdf_unix-any.sh @@ -40,9 +40,9 @@ PACKAGE_Assemble_PDF_Content() { # execute - ___dest="${_directory}/$(FS_Get_File "$_target")" - I18N_Copy "$_target" "$___dest" - FS_Copy_File "$_target" "$___dest" + __dest="${_directory}/$(FS_Get_File "$_target")" + I18N_Copy "$_target" "$__dest" + FS_Copy_File "$_target" "$__dest" if [ $? -ne 0 ]; then I18N_Copy_Failed return 1 diff --git a/src/.ci/_package-pdf_windows-any.ps1 b/src/.ci/_package-pdf_windows-any.ps1 index 561c81cb..e769fe54 100644 --- a/src/.ci/_package-pdf_windows-any.ps1 +++ b/src/.ci/_package-pdf_windows-any.ps1 @@ -41,9 +41,9 @@ function PACKAGE-Assemble-PDF-Content { # execute - $___dest = "${_directory}\$(FS-Get-File "${_target}")" - $null = I18N-Copy "${_target}" "${___dest}" - $___process = FS-Copy-File "${_target}" "${___dest}" + $__dest = "${_directory}\$(FS-Get-File "${_target}")" + $null = I18N-Copy "${_target}" "${__dest}" + $___process = FS-Copy-File "${_target}" "${__dest}" if ($___process -ne 0) { $null = I18N-Copy-Failed return 1 diff --git a/src/.ci/_package-rpm_unix-any.sh b/src/.ci/_package-rpm_unix-any.sh index ab839634..14c68d3e 100644 --- a/src/.ci/_package-rpm_unix-any.sh +++ b/src/.ci/_package-rpm_unix-any.sh @@ -54,7 +54,7 @@ PACKAGE_Assemble_RPM_Content() { ## whenever possible for avoiding conflicts with your OS native ## system packages. _chroot="usr" - if [ ! "$(STRINGS_To_Lowercase "$PROJECT_DEBIAN_IS_NATIVE")" = "true" ]; then + if [ ! "$(STRINGS_To_Lowercase "$PROJECT_RPM_IS_NATIVE")" = "true" ]; then _chroot="${_chroot}/local" fi @@ -68,76 +68,76 @@ PACKAGE_Assemble_RPM_Content() { return 10 # not applicable elif [ $(FS_Is_Target_A_TARGZ "$_target") -eq 0 ]; then # unpack library - ___source="${PROJECT_SCOPE}/${PROJECT_SKU}" - ___dest="${_directory}/BUILD/${___source}" - ___target="${_chroot}/lib/${___source}" + __source="${PROJECT_SCOPE}/${PROJECT_SKU}" + __dest="${_directory}/BUILD/${__source}" + __target="${_chroot}/lib" - I18N_Assemble "$_target" "$___dest" - FS_Make_Directory "$___dest" - TAR_Extract_GZ "$___dest" "$_target" + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + TAR_Extract_GZ "$__dest" "$_target" if [ $? -ne 0 ]; then I18N_Assemble_Failed return 1 fi - RPM_Register "$_directory" "$___source" "$___target" "true" + RPM_Register "$_directory" "$__source" "$__target" "true" if [ $? -ne 0 ]; then I18N_Assemble_Failed return 1 fi elif [ $(FS_Is_Target_A_TARXZ "$_target") -eq 0 ]; then # unpack library - ___source="${PROJECT_SCOPE}/${PROJECT_SKU}" - ___dest="${_directory}/BUILD/${___source}" - ___target="${_chroot}/lib/${___source}" + __source="${PROJECT_SCOPE}/${PROJECT_SKU}" + __dest="${_directory}/BUILD/${__source}" + __target="${_chroot}/lib" - I18N_Assemble "$_target" "$___dest" - FS_Make_Directory "$___dest" - TAR_Extract_XZ "$___dest" "$_target" + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + TAR_Extract_XZ "$__dest" "$_target" if [ $? -ne 0 ]; then I18N_Assemble_Failed return 1 fi - RPM_Register "$_directory" "$___source" "$___target" "true" + RPM_Register "$_directory" "$__source" "$__target" "true" if [ $? -ne 0 ]; then I18N_Assemble_Failed return 1 fi elif [ $(FS_Is_Target_A_ZIP "$_target") -eq 0 ]; then # unpack library - ___source="${PROJECT_SCOPE}/${PROJECT_SKU}" - ___dest="${_directory}/BUILD/${___source}" - ___target="${_chroot}/lib/${___source}" + __source="${PROJECT_SCOPE}/${PROJECT_SKU}" + __dest="${_directory}/BUILD/${__source}" + __target="${_chroot}/lib" - I18N_Assemble "$_target" "$___dest" - FS_Make_Directory "$___dest" - ZIP_Extract "$___dest" "$_target" + I18N_Assemble "$_target" "$__dest" + FS_Make_Directory "$__dest" + ZIP_Extract "$__dest" "$_target" if [ $? -ne 0 ]; then I18N_Assemble_Failed return 1 fi - RPM_Register "$_directory" "$___source" "$___target" "true" + RPM_Register "$_directory" "$__source" "$__target" "true" if [ $? -ne 0 ]; then I18N_Assemble_Failed return 1 fi else # copy library file - ___source="$(FS_Get_File "$_target")" - ___dest="${_directory}/BUILD/${___source}" - ___target="${_chroot}/lib/${___source}" + __source="$(FS_Get_File "$_target")" + __dest="${_directory}/BUILD/${__source}" + __target="${_chroot}/lib/${__source}" - I18N_Assemble "$_target" "$___dest" - FS_Make_Housing_Directory "$___dest" - FS_Copy_File "$_target" "$___dest" + I18N_Assemble "$_target" "$__dest" + FS_Make_Housing_Directory "$__dest" + FS_Copy_File "$_target" "$__dest" if [ $? -ne 0 ]; then I18N_Assemble_Failed return 1 fi - RPM_Register "$_directory" "$___source" "$___target" + RPM_Register "$_directory" "$__source" "$__target" if [ $? -ne 0 ]; then I18N_Assemble_Failed return 1 @@ -162,19 +162,19 @@ PACKAGE_Assemble_RPM_Content() { return 10 # not applicable else # copy main program - ___source="$(FS_Get_File "$_target")" - ___dest="${_directory}/BUILD/${___source}" - ___target="${_chroot}/bin/${___source}" + __source="$(FS_Get_File "$_target")" + __dest="${_directory}/BUILD/${__source}" + __target="${_chroot}/bin/${PROJECT_SKU}" - I18N_Assemble "$_target" "$___dest" - FS_Make_Housing_Directory "$___dest" - FS_Copy_File "$_target" "$___dest" + I18N_Assemble "$_target" "$__dest" + FS_Make_Housing_Directory "$__dest" + FS_Copy_File "$_target" "$__dest" if [ $? -ne 0 ]; then I18N_Assemble_Failed return 1 fi - RPM_Register "$_directory" "$___source" "$___target" + RPM_Register "$_directory" "$__source" "$__target" if [ $? -ne 0 ]; then I18N_Create_Failed return 1 @@ -185,12 +185,12 @@ PACKAGE_Assemble_RPM_Content() { # NOTE: REQUIRED file - ___source="copyright" - ___dest="${_directory}/BUILD/${___source}" - ___target="${_chroot}/share/doc/${PROJECT_SCOPE}/${PROJECT_SKU}/${___source}" - I18N_Create "$___source" + __source="copyright" + __dest="${_directory}/BUILD/${__source}" + __target="${_chroot}/share/doc/${PROJECT_SCOPE}/${PROJECT_SKU}/${__source}" + I18N_Create "$__source" COPYRIGHT_Create \ - "$___dest" \ + "$__dest" \ "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/licenses/deb-copyright" \ "$PROJECT_SKU" \ "$PROJECT_CONTACT_NAME" \ @@ -201,7 +201,7 @@ PACKAGE_Assemble_RPM_Content() { return 1 fi - RPM_Register "$_directory" "$___source" "$___target" + RPM_Register "$_directory" "$__source" "$__target" if [ $? -ne 0 ]; then I18N_Create_Failed return 1 @@ -209,12 +209,13 @@ PACKAGE_Assemble_RPM_Content() { # NOTE: REQUIRED file - ___source="${PROJECT_SCOPE}-${PROJECT_SKU}.1" - ___dest="${_directory}/BUILD/${___source}" - ___target="${_chroot}/share/man/man1/${___source}" - I18N_Create "$___source" + __source="${PROJECT_SCOPE}-${PROJECT_SKU}.1" + __dest="${_directory}/BUILD/${__source}" + __source="${__source}.gz" + __target="${_chroot}/share/man/man1/${__source}" + I18N_Create "$__source" MANUAL_Create \ - "$___dest" \ + "$__dest" \ "$PROJECT_SKU" \ "$PROJECT_CONTACT_NAME" \ "$PROJECT_CONTACT_EMAIL" \ @@ -224,7 +225,7 @@ PACKAGE_Assemble_RPM_Content() { return 1 fi - RPM_Register "$_directory" "$___source" "$___target" + RPM_Register "$_directory" "$__source" "$__target" if [ $? -ne 0 ]; then I18N_Create_Failed return 1 @@ -233,12 +234,25 @@ PACKAGE_Assemble_RPM_Content() { # NOTE: OPTIONAL (Comment to turn it off) I18N_Create "source.repo" + ___metalink="" + if [ $(STRINGS_Is_Empty "$PROJECT_RPM_FLAT_MODE") -ne 0 ]; then + # flat mode enabled + if [ $(STRINGS_Is_Empty "$PROJECT_RPM_METALINK") -eq 0 ]; then + I18N_Create_Failed + return 1 + fi + + ___metalink="${PROJECT_RPM_URL}/${PROJECT_RPM_METALINK}" + fi + RPM_Create_Source_Repo \ - "$PROJECT_SIMULATE_RELEASE_REPO" \ + "$PROJECT_SIMULATE_RUN" \ "$_directory" \ "$PROJECT_GPG_ID" \ - "$PROJECT_STATIC_URL" \ + "$PROJECT_RPM_URL" \ + "$___metalink" \ "$PROJECT_NAME" \ + "$PROJECT_SCOPE" \ "$_gpg_keyring" if [ $? -ne 0 ]; then I18N_Create_Failed diff --git a/src/.ci/_package-rpm_windows-any.ps1 b/src/.ci/_package-rpm_windows-any.ps1 index ebeceffa..30a7a59a 100644 --- a/src/.ci/_package-rpm_windows-any.ps1 +++ b/src/.ci/_package-rpm_windows-any.ps1 @@ -54,7 +54,7 @@ function PACKAGE-Assemble-RPM-Content { ## whenever possible for avoiding conflicts with your OS native ## system packages. $_chroot = "usr" - if ("$(STRINGS-To-Lowercase "$PROJECT_DEBIAN_IS_NATIVE")" -eq "true") { + if ("$(STRINGS-To-Lowercase "$PROJECT_RPM_IS_NATIVE")" -eq "true") { $_chroot = "${_chroot}/local" } @@ -68,13 +68,13 @@ function PACKAGE-Assemble-RPM-Content { return 10 # not applicable } elseif ($(FS-Is-Target-A-TARGZ "${_target}" -eq 0)) { # unpack library - $___source = "${env:PROJECT_SCOPE}\${env:PROJECT_SKU}" - $___dest = "${_directory}\BUILD\${___source}" - $___target = "${_chroot}\lib\${___source}" + $__source = "${env:PROJECT_SCOPE}\${env:PROJECT_SKU}" + $__dest = "${_directory}\BUILD\${__source}" + $__target = "${_chroot}\lib" - $null = I18N-Assemble "${_target}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = TAR-Extract-GZ "${___dest}" "${_target}" + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = TAR-Extract-GZ "${__dest}" "${_target}" if ($___process -ne 0) { $null = I18N-Assemble-Failed return 1 @@ -82,8 +82,8 @@ function PACKAGE-Assemble-RPM-Content { $___process = RPM-Register ` "${_directory}" ` - "${___source}" ` - "${___target}" ` + "${__source}" ` + "${__target}" ` "true" if ($___process -ne 0) { $null = I18N-Assemble-Failed @@ -91,13 +91,13 @@ function PACKAGE-Assemble-RPM-Content { } } elseif ($(FS-Is-Target-A-TARXZ "${_target}" -eq 0)) { # unpack library - $___source = "${env:PROJECT_SCOPE}\${env:PROJECT_SKU}" - $___dest = "${_directory}\BUILD\${___source}" - $___target = "${_chroot}\lib\${___source}" + $__source = "${env:PROJECT_SCOPE}\${env:PROJECT_SKU}" + $__dest = "${_directory}\BUILD\${__source}" + $__target = "${_chroot}\lib" - $null = I18N-Assemble "${_target}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = TAR-Extract-XZ "${___dest}" "${_target}" + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = TAR-Extract-XZ "${__dest}" "${_target}" if ($___process -ne 0) { $null = I18N-Assemble-Failed return 1 @@ -105,8 +105,8 @@ function PACKAGE-Assemble-RPM-Content { $___process = RPM-Register ` "${_directory}" ` - "${___source}" ` - "${___target}" ` + "${__source}" ` + "${__target}" ` "true" if ($___process -ne 0) { $null = I18N-Assemble-Failed @@ -114,13 +114,13 @@ function PACKAGE-Assemble-RPM-Content { } } elseif ($(FS-Is-Target-A-ZIP "${_target}" -eq 0)) { # unpack library - $___source = "${env:PROJECT_SCOPE}\${env:PROJECT_SKU}" - $___dest = "${_directory}\BUILD\${___source}" - $___target = "${_chroot}\lib\${___source}" + $__source = "${env:PROJECT_SCOPE}\${env:PROJECT_SKU}" + $__dest = "${_directory}\BUILD\${__source}" + $__target = "${_chroot}\lib" - $null = I18N-Assemble "${_target}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = ZIP-Extract "${___dest}" "${_target}" + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = ZIP-Extract "${__dest}" "${_target}" if ($___process -ne 0) { $null = I18N-Assemble-Failed return 1 @@ -128,8 +128,8 @@ function PACKAGE-Assemble-RPM-Content { $___process = RPM-Register ` "${_directory}" ` - "${___source}" ` - "${___target}" ` + "${__source}" ` + "${__target}" ` "true" if ($___process -ne 0) { $null = I18N-Assemble-Failed @@ -137,19 +137,19 @@ function PACKAGE-Assemble-RPM-Content { } } else { # copy library file - $___source = "$(FS-Get-File "${_target}")" - $___dest = "${_directory}\BUILD\${___source}" - $___target = "${_chroot}\lib\${___source}" + $__source = "$(FS-Get-File "${_target}")" + $___dest = "${_directory}\BUILD\${__source}" + $__target = "${_chroot}\lib" - $null = I18N-Assemble "${_target}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = FS-Copy-File "${_target}" "${___dest}" + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = FS-Copy-File "${_target}" "${__dest}" if ($___process -ne 0) { $null = I18N-Assemble-Failed return 1 } - $___process = RPM-Register "${_directory}" "${___source}" "${___target}" + $___process = RPM-Register "${_directory}" "${__source}" "${__target}" if ($___process -ne 0) { $null = I18N-Assemble-Failed return 1 @@ -174,19 +174,19 @@ function PACKAGE-Assemble-RPM-Content { return 10 # not applicable } else { # copy main program - $___source = "$(FS-Get-File "${_target}")" - $___dest = "${_directory}\BUILD\${___source}" - $___target = "${_chroot}\lib\${___source}" + $__source = "$(FS-Get-File "${_target}")" + $__dest = "${_directory}\BUILD\${__source}" + $__target = "${_chroot}\bin\${env:PROJECT_SKU}" - $null = I18N-Assemble "${_target}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = FS-Copy-File "${_target}" "${___dest}" + $null = I18N-Assemble "${_target}" "${__dest}" + $null = FS-Make-Directory "${__dest}" + $___process = FS-Copy-File "${_target}" "${__dest}" if ($___process -ne 0) { $null = I18N-Assemble-Failed return 1 } - $___process = RPM-Register "${_directory}" "${___source}" "${___target}" + $___process = RPM-Register "${_directory}" "${__source}" "${__target}" if ($___process -ne 0) { $null = I18N-Assemble-Failed return 1 @@ -197,12 +197,12 @@ function PACKAGE-Assemble-RPM-Content { # NOTE: REQUIRED file - $___source = "copyright" - $___dest = "${_directory}/BUILD/${___source}" - $___target = "${_chroot}/share/doc/${env:PROJECT_SCOPE}/${env:PROJECT_SKU}/${___source}" + $__source = "copyright" + $__dest = "${_directory}/BUILD/${__source}" + $__target = "${_chroot}/share/doc/${env:PROJECT_SCOPE}/${env:PROJECT_SKU}/${__source}" $null = I18N-Create "${___source}" $___process = COPYRIGHT-Create ` - "${___dest}" ` + "${__dest}" ` "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\licenses\deb-copyright" ` "${env:PROJECT_SKU}" ` "${env:PROJECT_CONTACT_NAME}" ` @@ -213,7 +213,7 @@ function PACKAGE-Assemble-RPM-Content { return 1 } - $___process = RPM-Register "${_directory}" "${___source}" "${___target}" + $___process = RPM-Register "${_directory}" "${__source}" "${__target}" if ($___process -ne 0) { $null = I18N-Create-Failed return 1 @@ -221,12 +221,13 @@ function PACKAGE-Assemble-RPM-Content { # NOTE: REQUIRED file - $___source = "${env:PROJECT_SCOPE}-${env:PROJECT_SKU}.1" - $___dest = "${_directory}/BUILD/${___source}" - $___target = "${_chroot}/share/man/man1/${___source}" - $null = I18N-Create "${___source}" + $__source = "${env:PROJECT_SCOPE}-${env:PROJECT_SKU}.1" + $__dest = "${_directory}/BUILD/${__source}" + $__source = "${__source}.gz" + $__target = "${_chroot}/share/man/man1/${__source}" + $null = I18N-Create "${__source}" $___process = MANUAL-Create ` - "${___dest}" ` + "${__dest}" ` "${env:PROJECT_SKU}" ` "${env:PROJECT_CONTACT_NAME}" ` "${env:PROJECT_CONTACT_EMAIL}" ` @@ -236,7 +237,7 @@ function PACKAGE-Assemble-RPM-Content { return 1 } - $___process = RPM-Register "${_directory}" "${___source}" "${___target}" + $___process = RPM-Register "${_directory}" "${__source}" "${__target}" if ($___process -ne 0) { $null = I18N-Create-Failed return 1 @@ -245,13 +246,25 @@ function PACKAGE-Assemble-RPM-Content { # NOTE: OPTIONAL (Comment to turn it off) $null = I18N-Create "source.repo" + $___metalink = "" + if ($(STRINGS-IS-Empty "${env:PROJECT_RPM_FLAT_MODE}") -ne 0) { + # flat mode enabled + if ($(STRINGS-IS-Empty "${env:PROJECT_RPM_METALINK}") -ne 0) { + $null = I18N-Create-Failed + return 1 + } + + $___metalink = "${env:PROJECT_RPM_URL}\${env:PROJECT_RPM_METALINK}" + } + $___process = RPM-Create-Source-Repo ` - "${env:PROJECT_SIMULATE_RELEASE_REPO}" ` + "${env:PROJECT_SIMULATE_RUN}" ` "${_directory}" ` "${env:PROJECT_GPG_ID}" ` - "${env:PROJECT_STATIC_URL}" ` - "${env:PROJECT_REPREPRO_CODENAME}" ` - "${env:PROJECT_DEBIAN_DISTRIBUTION}" ` + "${env:PROJECT_RPM_URL}" ` + "${___metalink}" ` + "${env:PROJECT_NAME}" ` + "${env:PROJECT_SCOPE}" ` "${_gpg_keyring}" if ($___process -ne 0) { $null = I18N-Create-Failed diff --git a/src/.ci/build_unix-any.sh b/src/.ci/build_unix-any.sh index 51ed6fd0..4aaa765b 100644 --- a/src/.ci/build_unix-any.sh +++ b/src/.ci/build_unix-any.sh @@ -21,6 +21,7 @@ if [ "$PROJECT_PATH_ROOT" = "" ]; then fi . "${LIBS_AUTOMATACI}/services/io/fs.sh" +. "${LIBS_AUTOMATACI}/services/io/time.sh" . "${LIBS_AUTOMATACI}/services/i18n/translations.sh" . "${LIBS_AUTOMATACI}/services/compilers/changelog.sh" @@ -39,9 +40,9 @@ fi # execute -__file="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/changelog" +__directory="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/changelog" I18N_Create "${PROJECT_VERSION} DATA CHANGELOG" -CHANGELOG_Build_Data_Entry "$__file" +CHANGELOG_Build_Data_Entry "$__directory" if [ $? -ne 0 ]; then I18N_Create_Failed return 1 @@ -50,14 +51,14 @@ fi I18N_Create "${PROJECT_VERSION} DEB CHANGELOG" CHANGELOG_Build_DEB_Entry \ - "$__file" \ + "$__directory" \ "$PROJECT_VERSION" \ "$PROJECT_SKU" \ - "$PROJECT_DEBIAN_DISTRIBUTION" \ - "$PROJECT_DEBIAN_URGENCY" \ + "$PROJECT_DEB_DISTRIBUTION" \ + "$PROJECT_DEB_URGENCY" \ "$PROJECT_CONTACT_NAME" \ "$PROJECT_CONTACT_EMAIL" \ - "$(date -R)" + "$(TIME_Format_Datetime_RFC5322 "$(TIME_Now)")" if [ $? -ne 0 ]; then I18N_Create_Failed return 1 diff --git a/src/.ci/build_windows-any.ps1 b/src/.ci/build_windows-any.ps1 index da75c4cf..cc4cdcd3 100644 --- a/src/.ci/build_windows-any.ps1 +++ b/src/.ci/build_windows-any.ps1 @@ -20,6 +20,7 @@ if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { } . "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\time.ps1" . "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" . "${env:LIBS_AUTOMATACI}\services\compilers\changelog.ps1" @@ -38,9 +39,9 @@ if ($___process -ne 0) { # execute -$__file = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\changelog" +$__directory = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\changelog" $null = I18N-Create "${env:PROJECT_VERSION} DATA CHANGELOG" -$___process = CHANGELOG-Build-DATA-Entry $__file +$___process = CHANGELOG-Build-DATA-Entry $__directory if ($___process -ne 0) { $null = I18N-Create-Failed return 1 @@ -49,14 +50,14 @@ if ($___process -ne 0) { $null = I18N-Create "${env:PROJECT_VERSION} DEB CHANGELOG" $___process = CHANGELOG-Build-DEB-Entry ` - "${__file}" ` + "${__directory}" ` "$env:PROJECT_VERSION" ` "$env:PROJECT_SKU" ` - "$env:PROJECT_DEBIAN_DISTRIBUTION" ` - "$env:PROJECT_DEBIAN_URGENCY" ` + "$env:PROJECT_DEB_DISTRIBUTION" ` + "$env:PROJECT_DEB_URGENCY" ` "$env:PROJECT_CONTACT_NAME" ` "$env:PROJECT_CONTACT_EMAIL" ` - (Get-Date -Format 'R') + "$(TIME-Format-Datetime-RFC5322 "$(TIME-Now)")" if ($___process -ne 0) { $null = I18N-Create-Failed return 1 diff --git a/srcC/.ci/_package-archive_unix-any.sh b/srcC/.ci/_package-archive_unix-any.sh deleted file mode 100644 index fd4a7a7a..00000000 --- a/srcC/.ci/_package-archive_unix-any.sh +++ /dev/null @@ -1,130 +0,0 @@ -#!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" - - - - -PACKAGE_Assemble_ARCHIVE_Content() { - _target="$1" - _directory="$2" - _target_name="$3" - _target_os="$4" - _target_arch="$5" - - - # package based on target's nature - if [ $(FS_Is_Target_A_Source "$_target") -eq 0 ]; then - _target="${PROJECT_PATH_ROOT}/${PROJECT_C}/" - I18N_Assemble "$_target" "$_directory" - FS_Copy_All "$_target" "$_directory" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - FS_Remove_Silently "${_directory}/.ci" - elif [ $(FS_Is_Target_A_Docs "$_target") -eq 0 ]; then - ___source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_DOCS}/" - FS_Is_Directory "$___source" - if [ $? -ne 0 ]; then - return 10 # not applicable - fi - - I18N_Assemble "$___source" "$_directory" - FS_Copy_All "${___source}/" "$_directory" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - elif [ $(FS_Is_Target_A_Library "$_target") -eq 0 ]; then - I18N_Assemble "$_target" "$_directory" - FS_Copy_File "$_target" "$_directory" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - elif [ $(FS_Is_Target_A_WASM_JS "$_target") -eq 0 ]; then - return 10 # handled by wasm instead - elif [ $(FS_Is_Target_A_WASM "$_target") -eq 0 ]; then - I18N_Assemble "$_target" "$_directory" - FS_Copy_File "$_target" "$_directory" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - ___source="$(FS_Extension_Remove "$_target" ".wasm").js" - FS_Is_File "$___source" - if [ $? -eq 0 ]; then - I18N_Assemble "$___source" "$_directory" - FS_Copy_File "$___source" "$_directory" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - fi - elif [ $(FS_Is_Target_A_Chocolatey "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Homebrew "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Cargo "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_MSI "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_PDF "$_target") -eq 0 ]; then - return 10 # not applicable - else - I18N_Assemble "$_target" "$_directory" - FS_Copy_File "$_target" "$_directory" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - fi - - - # copy user guide - ___source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/docs/USER-GUIDES-EN.pdf" - I18N_Assemble "$___source" "$_directory" - FS_Copy_File "$___source" "${_directory}/." - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - - # copy license file - ___source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/licenses/LICENSE-EN.pdf" - I18N_Assemble "$___source" "$_directory" - FS_Copy_File "$___source" "${_directory}/." - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - - # report status - return 0 -} diff --git a/srcC/.ci/_package-archive_windows-any.ps1 b/srcC/.ci/_package-archive_windows-any.ps1 deleted file mode 100644 index a2593046..00000000 --- a/srcC/.ci/_package-archive_windows-any.ps1 +++ /dev/null @@ -1,131 +0,0 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - return 1 -} - -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" - - - - -function PACKAGE-Assemble-ARCHIVE-Content { - param( - [string]$_target, - [string]$_directory, - [string]$_target_name, - [string]$_target_os, - [string]$_target_arch - ) - - - # package based on target's nature - if ($(FS-Is-Target-A-Source "${_target}") -eq 0) { - $_target = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_C}\" - $null = I18N-Assemble "${_target}" "${_directory}" - $___process = FS-Copy-All "${_target}" "${_directory}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - $null = FS-Remove-Silently "${_directory}\.ci" - } elseif ($(FS-Is-Target-A-Docs "${_target}") -eq 0) { - $___source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_DOCS}\" - $___process = FS-Is-Directory "${___source}" - if ($___process -ne 0) { - return 10 # not applicable - } - - $null = I18N-Assemble "${___source}" "${_directory}" - $___process = FS-Copy-All "${___source}" "${_directory}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } elseif ($(FS-Is-Target-A-Library "${_target}") -eq 0) { - I18N-Assemble "${_target}" "${_directory}" - $___process = FS-Copy-File "${_target}" "${_directory}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } elseif ($(FS-Is-Target-A-WASM-JS "${_target}") -eq 0) { - return 10 # handled by wasm instead - } elseif ($(FS-Is-Target-A-WASM "${_target}") -eq 0) { - $null = I18N-Assemble "${_target}" "${_directory}" - $___process = FS-Copy-File "${_target}" "${_directory}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - $___source = "$(FS-Extension-Remove "${_target}" ".wasm").js" - $___process = FS-Is-File "${___source}" - if ($___process -eq 0) { - $null = I18N-Assemble "${___source}" "${_directory}" - $___process = Fs-Copy-File "${___source}" "${_directory}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } - } elseif ($(FS-Is-Target-A-Chocolatey "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Homebrew "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Cargo "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-MSI "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-PDF "${_target}") -eq 0) { - return 10 # not applicable - } else { - $null = I18N-Assemble "${_target}" "${_directory}" - $___process = FS-Copy-File "${_target}" "${_directory}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } - - - # copy user guide - $___source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\docs\USER-GUIDES-EN.pdf" - $null = I18N-Assemble "${___source}" "${_directory}" - $___process = FS-Copy-File "${___source}" "${_directory}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - - # copy license file - $___source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\licenses\LICENSE-EN.pdf" - $null = I18N-Assemble "${___source}" "${_directory}" - $___process = FS-Copy-File "${___source}" "${_directory}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - - # report status - return 0 -} diff --git a/srcC/.ci/_package-chocolatey_unix-any.sh b/srcC/.ci/_package-chocolatey_unix-any.sh deleted file mode 100644 index e1cdeeea..00000000 --- a/srcC/.ci/_package-chocolatey_unix-any.sh +++ /dev/null @@ -1,260 +0,0 @@ -#!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" - - - - -PACKAGE_Assemble_CHOCOLATEY_Content() { - _target="$1" - _directory="$2" - _target_name="$3" - _target_os="$4" - _target_arch="$5" - - - # validate project - if [ $(FS_Is_Target_A_Chocolatey "$_target") -ne 0 ]; then - return 10 # not applicable - fi - - - # assemble the package - ___source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/" - ___dest="${_directory}/Data/${PROJECT_PATH_SOURCE}" - I18N_Assemble "$___source" "$___dest" - FS_Make_Directory "$___dest" - FS_Copy_All "$___source" "$___dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - ___source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/.ci/" - ___dest="${_directory}/Data/${PROJECT_PATH_SOURCE}/.ci" - I18N_Assemble "$___source" "$___dest" - FS_Make_Directory "$___dest" - FS_Copy_All "$___source" "$___dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - ___source="${PROJECT_PATH_ROOT}/${PROJECT_C}/" - ___dest="${_directory}/Data/${PROJECT_C}" - I18N_Assemble "$___source" "$___dest" - FS_Make_Directory "$___dest" - FS_Copy_All "$___source" "$___dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - ___source="${PROJECT_PATH_ROOT}/${PROJECT_C}/.ci/" - ___dest="${_directory}/Data/${PROJECT_C}/.ci" - I18N_Assemble "$___source" "$___dest" - FS_Make_Directory "$___dest" - FS_Copy_All "$___source" "$___dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - ___source="${PROJECT_PATH_ROOT}/automataCI/" - ___dest="${_directory}/Data/automataCI" - I18N_Assemble "$___source" "$___dest" - FS_Make_Directory "$___dest" - FS_Copy_All "$___source" "$___dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - ___source="${PROJECT_PATH_ROOT}/CONFIG.toml" - ___dest="${_directory}/Data" - I18N_Assemble "$___source" "$___dest" - FS_Copy_File "$___source" "$___dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - ___source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/icons/icon-128x128.png" - ___dest="${_directory}/icon.png" - I18N_Assemble "$___source" "$___dest" - FS_Copy_File "$___source" "$___dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - ___source="${PROJECT_PATH_ROOT}/README.md" - ___dest="${_directory}/README.md" - I18N_Assemble "$___source" "$___dest" - FS_Copy_File "$___source" "$___dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - - # REQUIRED: chocolatey required tools\ directory - ___dest="${_directory}/tools" - I18N_Create "$___dest" - FS_Make_Directory "${_directory}/tools" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - - # OPTIONAL: chocolatey tools\chocolateyBeforeModify.ps1 - ___dest="${_directory}/tools/chocolateyBeforeModify.ps1" - I18N_Create "$___dest" - FS_Write_File "$___dest" "\ -# REQUIRED - BEGIN EXECUTION -Write-Host \"Performing pre-configurations...\" -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - - # REQUIRED: chocolatey tools\chocolateyinstall.ps1 - ___dest="${_directory}/tools/chocolateyinstall.ps1" - I18N_Create "$___dest" - FS_Write_File "$___dest" "\ -# REQUIRED - PREPARING INSTALLATION -\$tools_dir = \"\$(Split-Path -Parent -Path \$MyInvocation.MyCommand.Definition)\" -\$data_dir = \"\$(Split-Path -Parent -Path \$tools_dir)\\\\Data\" -\$root_dir = \"\$(Split-Path -Parent -Path \$root_dir)\" -\$current_dir = (Get-Location).Path - - - - -# REQUIRED - BEGIN EXECUTION -# Materialize the binary -Write-Host \"Building ${PROJECT_SKU} (${PROJECT_VERSION})...\" -Set-Location \"\$data_dir\" -.\\\\automataCI\\\\ci.sh.ps1 setup -if (\$LASTEXITCODE -ne 0) { - Set-Location \"\$current_dir\" - Set-PowerShellExitCode 1 - return -} - -.\\\\automataCI\\\\ci.sh.ps1 prepare -if (\$LASTEXITCODE -ne 0) { - Set-Location \"\$current_dir\" - Set-PowerShellExitCode 1 - return -} - -.\\\\automataCI\\\\ci.sh.ps1 materialize -if (\$LASTEXITCODE -ne 0) { - Set-Location \"\$current_dir\" - Set-PowerShellExitCode 1 - return -} - -if (-not (Test-Path \"\${data_dir}\\\\bin\\\\${PROJECT_SKU}.exe\")) { - Set-Location \"\$current_dir\" - Write-Host \"Compile Failed. Missing executable.\" - Set-PowerShellExitCode 1 - return -} - - -# Install -Write-Host \"assembling workspace for installation...\" -if (Test-Path -PathType Container -Path \"\${data_dir}\\\\bin\") { - Move-Item -Path \"\${data_dir}\\\\bin\" -Destination \"\${root_dir}\" -} -if (Test-Path -PathType Container -Path \"\${data_dir}\\\\lib\") { - Move-Item -Path \"\${data_dir}\\\\lib\" -Destination \"\${root_dir}\" -} -Set-Location \"\$current_dir\" -Remove-Item \$data_dir -Force -Recurse -ErrorAction SilentlyContinue -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - - # REQUIRED: chocolatey tools\chocolateyuninstall.ps1 - ___dest="${_directory}/tools/chocolateyuninstall.ps1" - I18N_Create "$___dest" - FS_Write_File "$___dest" "\ -# REQUIRED - PREPARING UNINSTALLATION -Write-Host \"Uninstalling ${PROJECT_SKU} (${PROJECT_VERSION})...\" -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - - # REQUIRED: chocolatey xml.nuspec file - ___dest="${_directory}/${PROJECT_SKU}.nuspec" - I18N_Create "$___dest" - FS_Write_File "$___dest" "\ - - - - ${PROJECT_SKU} - ${PROJECT_NAME} - ${PROJECT_VERSION} - ${PROJECT_CONTACT_NAME} - ${PROJECT_CONTACT_NAME} - ${PROJECT_CONTACT_WEBSITE} - ${PROJECT_LICENSE} - ${PROJECT_PITCH} - README.md - icon.png - - - - - - - - - - - - - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - - # report status - return 0 -} diff --git a/srcC/.ci/_package-chocolatey_windows-any.ps1 b/srcC/.ci/_package-chocolatey_windows-any.ps1 deleted file mode 100644 index a4fd663e..00000000 --- a/srcC/.ci/_package-chocolatey_windows-any.ps1 +++ /dev/null @@ -1,260 +0,0 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - exit 1 -} - -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" - - - - -function PACKAGE-Assemble-CHOCOLATEY-Content { - param ( - [string]$_target, - [string]$_directory, - [string]$_target_name, - [string]$_target_os, - [string]$_target_arch - ) - - - # validate project - if ($(FS-Is-Target-A-Chocolatey "${_target}") -ne 0) { - return 10 # not applicable - } - - - # assemble the package - $___source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\" - $___dest = "${_directory}\Data\${env:PROJECT_PATH_SOURCE}" - $null = I18N-Assemble "${___source}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = FS-Copy-All "${___source}" "${___dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - $___source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\.ci\" - $___dest = "${_directory}\Data\${env:PROJECT_PATH_SOURCE}\.ci" - $null = I18N-Assemble "${___source}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = FS-Copy-All "${___source}" "${___dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - $___source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_C}\" - $___dest = "${_directory}\Data\${env:PROJECT_C}" - $null = I18N-Assemble "${___source}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = FS-Copy-All "${___source}" "${___dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - $___source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_C}\.ci\" - $___dest = "${_directory}\Data\${env:PROJECT_C}\.ci" - $null = I18N-Assemble "${___source}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = FS-Copy-All "${___source}" "${___dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - $___source = "${env:PROJECT_PATH_ROOT}\automataCI\" - $___dest = "${_directory}\Data\automataCI" - $null = I18N-Assemble "${___source}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = FS-Copy-All "${___source}" "${___dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - $___source = "${env:PROJECT_PATH_ROOT}\CONFIG.toml" - $___dest = "${_directory}\Data" - $null = I18N-Assemble "${___source}" "${___dest}" - $___process = FS-Copy-File "${___source}" "${___dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - $___source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\icons\icon-128x128.png" - $___dest = "${_directory}\icon.png" - $null = I18N-Assemble "${___source}" "${___dest}" - $___process = FS-Copy-File "${___source}" "${___dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - $___source = "${env:PROJECT_PATH_ROOT}\README.md" - $___dest = "${_directory}\README.md" - $null = I18N-Assemble "${___source}" "${___dest}" - $___process = FS-Copy-File "${___source}" "${___dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - - # REQUIRED: chocolatey required tools\ directory - $___dest = "${_directory}\tools" - $null = I18N-Create "${___dest}" - $___process = FS-Make-Directory "${___dest}" - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - - # OPTIONAL: chocolatey tools\chocolateyBeforeModify.ps1 - $___dest = "${_directory}\tools\chocolateyBeforeModify.ps1" - $null = I18N-Create "${___dest}" - $___process = FS-Write-File "${___dest}" @" -# REQUIRED - BEGIN EXECUTION -Write-Host "Performing pre-configurations..." -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - - # REQUIRED: chocolatey tools\chocolateyinstall.ps1 - $___dest = "${_directory}\tools\chocolateyinstall.ps1" - $null = I18N-Create "${___dest}" - $___process = FS-Write-File "${___dest}" @" -# REQUIRED - PREPARING INSTALLATION -`$tools_dir = "`$(Split-Path -Parent -Path `$MyInvocation.MyCommand.Definition)" -`$data_dir = "`$(Split-Path -Parent -Path `$tools_dir)\Data" -`$root_dir = "`$(Split-Path -Parent -Path `$tools_dir)" -`$current_dir = (Get-Location).Path - - - - -# REQUIRED - BEGIN EXECUTION -# Materialize the binary -Write-Host "Building ${env:PROJECT_SKU} (${env:PROJECT_VERSION})..." -Set-Location "`$data_dir" -.\automataCI\ci.sh.ps1 setup -if (`$LASTEXITCODE -ne 0) { - Set-Location "`$current_dir" - Set-PowerShellExitCode 1 - return -} - -.\automataCI\ci.sh.ps1 prepare -if (`$LASTEXITCODE -ne 0) { - Set-Location "`$current_dir" - Set-PowerShellExitCode 1 - return -} - -.\automataCI\ci.sh.ps1 materialize -if (`$LASTEXITCODE -ne 0) { - Set-Location "`$current_dir" - Set-PowerShellExitCode 1 - return -} - -if (-not (Test-Path "`${data_dir}\bin\${env:PROJECT_SKU}.exe")) { - Set-Location "`$current_dir" - Write-Host "Compile Failed. Missing executable." - Set-PowerShellExitCode 1 - return -} - - -Write-Host "assembling workspace for installation..." -if (Test-Path -PathType Container -Path "`${data_dir}\bin") { - Move-Item -Path "`${data_dir}\bin" -Destination "`${root_dir}" -} -if (Test-Path -PathType Container -Path "`${data_dir}\lib") { - Move-Item -Path "`${data_dir}\lib" -Destination "`${root_dir}" -} -Set-Location "`$current_dir" -Remove-Item `$data_dir -Force -Recurse -ErrorAction SilentlyContinue -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - - # REQUIRED: chocolatey tools\chocolateyuninstall.ps1 - $___dest = "${_directory}\tools\chocolateyuninstall.ps1" - $null = I18N-Create "${___dest}" - $___process = FS-Write-File "${___dest}" @" -# REQUIRED - PREPARING UNINSTALLATION -Write-Host "Uninstalling ${env:PROJECT_SKU} (${env:PROJECT_VERSION})..." -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - - # REQUIRED: chocolatey xml.nuspec file - $___dest = "${_directory}\${env:PROJECT_SKU}.nuspec" - $null = I18N-Create "${___dest}" - $___process = FS-Write-File "${___dest}" @" - - - - ${env:PROJECT_SKU} - ${env:PROJECT_NAME} - ${env:PROJECT_VERSION} - ${env:PROJECT_CONTACT_NAME} - ${env:PROJECT_CONTACT_NAME} - ${env:PROJECT_CONTACT_WEBSITE} - ${env:PROJECT_LICENSE} - ${env:PROJECT_PITCH} - README.md - icon.png - - - - - - - - - - - - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - - # report status - return 0 -} diff --git a/srcC/.ci/_package-docker_unix-any.sh b/srcC/.ci/_package-docker_unix-any.sh deleted file mode 100644 index 35d6943a..00000000 --- a/srcC/.ci/_package-docker_unix-any.sh +++ /dev/null @@ -1,151 +0,0 @@ -#!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/io/strings.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" - - - - -PACKAGE_Assemble_DOCKER_Content() { - _target="$1" - _directory="$2" - _target_name="$3" - _target_os="$4" - _target_arch="$5" - - - # validate project - if [ $(FS_Is_Target_A_Source "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Docs "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Library "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_WASM_JS "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_WASM "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Chocolatey "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Homebrew "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Cargo "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_MSI "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_PDF "$_target") -eq 0 ]; then - return 10 # not applicable - fi - - case "$_target_arch" in - avr|js) - return 10 # not applicable - ;; - *) - ;; - esac - - - # assemble the package - ___dest="${_directory}/${PROJECT_SKU}" - I18N_Assemble "$_target" "$___dest" - FS_Copy_File "$_target" "$___dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - ___dest="${_directory}/.blank" - I18N_Create "$___dest" - FS_Touch_File "$___dest" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - - # generate the Dockerfile - ___dest="${_directory}/Dockerfile" - I18N_Create "$___dest" - FS_Write_File "$___dest" "\ -# Defining baseline image -FROM --platform=${_target_os}/${_target_arch} scratch -LABEL org.opencontainers.image.title=\"${PROJECT_NAME}\" -LABEL org.opencontainers.image.description=\"${PROJECT_PITCH}\" -LABEL org.opencontainers.image.authors=\"${PROJECT_CONTACT_NAME} <${PROJECT_CONTACT_EMAIL}>\" -LABEL org.opencontainers.image.version=\"${PROJECT_VERSION}\" -LABEL org.opencontainers.image.revision=\"${PROJECT_CADENCE}\" -LABEL org.opencontainers.image.licenses=\"${PROJECT_LICENSE}\" -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - - if [ $(STRINGS_Is_Empty "$PROJECT_CONTACT_WEBSITE") -ne 0 ]; then - FS_Append_File "$___dest" "\ -LABEL org.opencontainers.image.url=\"${PROJECT_CONTACT_WEBSITE}\" -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - fi - - if [ $(STRINGS_Is_Empty "$PROJECT_SOURCE_URL") -ne 0 ]; then - FS_Append_File "$___dest" "\ -LABEL org.opencontainers.image.source=\"${PROJECT_SOURCE_URL}\" -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - fi - - FS_Append_File "$___dest" "\ -# Defining environment variables -ENV ARCH ${_target_arch} -ENV OS ${_target_os} -ENV PORT 80 - -# Assemble the file structure -COPY .blank /tmp/.tmpfile -ADD ${PROJECT_SKU} /app/bin/${PROJECT_SKU} - -# Set network port exposures -EXPOSE 80 - -# Set entry point -ENTRYPOINT [\"/app/bin/${PROJECT_SKU}\"] -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - - # report status - return 0 -} diff --git a/srcC/.ci/_package-docker_windows-any.ps1 b/srcC/.ci/_package-docker_windows-any.ps1 deleted file mode 100644 index cb751f47..00000000 --- a/srcC/.ci/_package-docker_windows-any.ps1 +++ /dev/null @@ -1,150 +0,0 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - exit 1 -} - -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" - - - - -function PACKAGE-Assemble-DOCKER-Content { - param ( - [string]$_target, - [string]$_directory, - [string]$_target_name, - [string]$_target_os, - [string]$_target_arch - ) - - - # validate project - if ($(FS-Is-Target-A-Source "${_target}") -ne 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Docs "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Library "${_target}") -ne 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-WASM-JS "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-WASM "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Chocolatey "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Homebrew "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Cargo "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-MSI "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-PDF "${_target}") -eq 0) { - return 10 # not applicable - } - - switch ($_target_arch) { - { $_ -in "avr", "js" } { - return 10 # not applicable - } default { - # accepted - }} - - - # assemble the package - $___dest = "${_directory}\${env:PROJECT_SKU}" - $null = I18N-Assemble "${_target}" "${___dest}" - $___process = FS-Copy-File "${_target}" "${___dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - $___dest = "${_directory}\.blank" - $null = I18N-Create "${___dest}" - $___process = FS-Touch-File "${___dest}" - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - - # generate the Dockerfile - $___dest = "${_directory}\Dockerfile" - $null = I18N-Create "${___dest}" - $___process = FS-Write-File "${___dest}" @" -# Defining baseline image -FROM --platform=${_target_os}/${_target_arch} scratch -LABEL org.opencontainers.image.title=`"${env:PROJECT_NAME}`" -LABEL org.opencontainers.image.description=`"${env:PROJECT_PITCH}`" -LABEL org.opencontainers.image.authors=`"${env:PROJECT_CONTACT_NAME} <${env:PROJECT_CONTACT_EMAIL}>`" -LABEL org.opencontainers.image.version=`"${env:PROJECT_VERSION}`" -LABEL org.opencontainers.image.revision=`"${env:PROJECT_CADENCE}`" -LABEL org.opencontainers.image.licenses=`"${env:PROJECT_LICENSE}`" -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - if ($(STRINGS-Is-Empty "${env:PROJECT_CONTACT_WEBSITE}") -ne 0) { - $___process = FS-Append-File "${___dest}" @" -LABEL org.opencontainers.image.url=`"${env:PROJECT_CONTACT_WEBSITE}`" -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - } - - if ($(STRINGS-Is-Empty "${env:PROJECT_SOURCE_URL}") -ne 0) { - $___process = FS-Append-File "${___dest}" @" -LABEL org.opencontainers.image.source=`"${env:PROJECT_SOURCE_URL}`" -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - } - - $___process = FS-Append-File "${___dest}" @" -# Defining environment variables -ENV ARCH ${_target_arch} -ENV OS ${_target_os} -ENV PORT 80 - -# Assemble the file structure -COPY .blank /tmp/.tmpfile -ADD ${env:PROJECT_SKU} /app/bin/${env:PROJECT_SKU} - -# Set network port exposures -EXPOSE 80 - -# Set entry point -ENTRYPOINT ["/app/bin/${env:PROJECT_SKU}"] -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - - # report status - return 0 -} diff --git a/srcC/.ci/_package-homebrew_unix-any.sh b/srcC/.ci/_package-homebrew_unix-any.sh deleted file mode 100644 index 25e39047..00000000 --- a/srcC/.ci/_package-homebrew_unix-any.sh +++ /dev/null @@ -1,150 +0,0 @@ -#!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/io/strings.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" - - - - -PACKAGE_Assemble_HOMEBREW_Content() { - _target="$1" - _directory="$2" - _target_name="$3" - _target_os="$4" - _target_arch="$5" - - - # validate project - if [ $(FS_Is_Target_A_Homebrew "$_target") -ne 0 ]; then - return 10 # not applicable - fi - - - # assemble the package - ___source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/" - ___dest="${_directory}/${PROJECT_PATH_SOURCE}" - I18N_Assemble "$___source" "$___dest" - FS_Make_Directory "$___dest" - FS_Copy_All "$___source" "$___dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - ___source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/.ci/" - ___dest="${_directory}/${PROJECT_PATH_SOURCE}/.ci" - I18N_Assemble "$___source" "$___dest" - FS_Make_Directory "$___dest" - FS_Copy_All "$___source" "$___dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - ___source="${PROJECT_PATH_ROOT}/${PROJECT_C}/" - ___dest="${_directory}/${PROJECT_C}" - I18N_Assemble "$___source" "$___dest" - FS_Make_Directory "$___dest" - FS_Copy_All "$___source" "$___dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - ___source="${PROJECT_PATH_ROOT}/${PROJECT_C}/.ci/" - ___dest="${_directory}/${PROJECT_C}/.ci" - I18N_Assemble "$___source" "$___dest" - FS_Make_Directory "$___dest" - FS_Copy_All "$___source" "$___dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - ___source="${PROJECT_PATH_ROOT}/automataCI/" - ___dest="${_directory}/automataCI" - I18N_Assemble "$___source" "$___dest" - FS_Make_Directory "$___dest" - FS_Copy_All "$___source" "$___dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - ___source="${PROJECT_PATH_ROOT}/CONFIG.toml" - ___dest="$_directory" - I18N_Assemble "$___source" "$___dest" - FS_Make_Directory "$___dest" - FS_Copy_File "$___source" "$___dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - - # script formula.rb - ___dest="${_directory}/formula.rb" - I18N_Create "$___dest" - FS_Write_File "$___dest" "\ -class $(STRINGS_To_Titlecase "$PROJECT_SKU") < Formula - desc \"${PROJECT_PITCH}\" - homepage \"${PROJECT_CONTACT_WEBSITE}\" - license \"${PROJECT_LICENSE}\" - url \"${PROJECT_HOMEBREW_SOURCE_URL}/{{ TARGET_PACKAGE }}\" - sha256 \"{{ TARGET_SHASUM }}\" - - on_linux do - depends_on \"gcc\" => [:build, :test] - end - - on_macos do - depends_on \"clang\" => [:build, :test] - end - - def install - system \"./automataCI/ci.sh.ps1 setup\" - system \"./automataCI/ci.sh.ps1 prepare\" - system \"./automataCI/ci.sh.ps1 materialize\" - chmod 0755, \"bin/${PROJECT_SKU}\" - libexec.install \"bin/${PROJECT_SKU}\" - bin.install_symlink libexec/\"${PROJECT_SKU}\" => \"${PROJECT_SKU}\" - end - - test do - system \"./automataCI/ci.sh.ps1 setup\" - system \"./automataCI/ci.sh.ps1 prepare\" - system \"./automataCI/ci.sh.ps1 materialize\" - assert_predicate ./bin/${PROJECT_SKU}, :exist? - end -end -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - - # report status - return 0 -} diff --git a/srcC/.ci/_package-homebrew_windows-any.ps1 b/srcC/.ci/_package-homebrew_windows-any.ps1 deleted file mode 100644 index 0cc3c7eb..00000000 --- a/srcC/.ci/_package-homebrew_windows-any.ps1 +++ /dev/null @@ -1,151 +0,0 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - exit 1 -} - -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" - - - - -function PACKAGE-Assemble-HOMEBREW-Content { - param ( - [string]$_target, - [string]$_directory, - [string]$_target_name, - [string]$_target_os, - [string]$_target_arch - ) - - - # validate project - if ($(FS-Is-Target-A-Homebrew "${_target}") -ne 0) { - return 10 # not applicable - } - - - # assemble the package - $___source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\" - $___dest = "${_directory}\${env:PROJECT_PATH_SOURCE}" - $null = I18N-Assemble "${___source}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = FS-Copy-All "${___source}" "${___dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - $___source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\.ci\" - $___dest = "${_directory}\${env:PROJECT_PATH_SOURCE}\.ci" - $null = I18N-Assemble "${___source}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = FS-Copy-All "${___source}" "${___dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - $___source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_C}\" - $___dest = "${_directory}\${env:PROJECT_C}" - $null = I18N-Assemble "${___source}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = FS-Copy-All "${___source}" "${___dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - $___source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_C}\.ci\" - $___dest = "${_directory}\${env:PROJECT_C}\.ci" - $null = I18N-Assemble "${___source}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = FS-Copy-All "${___source}" "${___dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - $___source = "${env:PROJECT_PATH_ROOT}\automataCI\" - $___dest = "${_directory}\automataCI" - $null = I18N-Assemble "${___source}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = FS-Copy-All "${___source}" "${___dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - $___source = "${env:PROJECT_PATH_ROOT}\CONFIG.toml" - $___dest = "${_directory}" - $null = I18N-Assemble "${___source}" "${___dest}" - $null = FS-Make-Directory "${___dest}" - $___process = FS-Copy-File "${___source}" "${___dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - - # script formula.rb - $___dest = "${_directory}\formula.rb" - $null = I18N-Create "${___dest}" - $___process = FS-Write-File "${___dest}" @" -class $(STRINGS-To-Titlecase "${env:PROJECT_SKU}") < Formula - desc "${env:PROJECT_PITCH}" - homepage "${env:PROJECT_CONTACT_WEBSITE}" - license "${env:PROJECT_LICENSE}" - url "${env:PROJECT_HOMEBREW_SOURCE_URL}/{{ TARGET_PACKAGE }}" - sha256 "{{ TARGET_SHASUM }}" - - on_linux do - depends_on \"gcc\" => [:build, :test] - end - - on_macos do - depends_on \"clang\" => [:build, :test] - end - - def install - system "./automataCI/ci.sh.ps1 setup" - system "./automataCI/ci.sh.ps1 prepare" - system "./automataCI/ci.sh.ps1 materialize" - chmod 0755, "bin/${env:PROJECT_SKU}" - libexec.install "bin/${env:PROJECT_SKU}" - bin.install_symlink libexec/"${env:PROJECT_SKU}" => "${env:PROJECT_SKU}" - end - - test do - system "./automataCI/ci.sh.ps1 setup" - system "./automataCI/ci.sh.ps1 prepare" - system "./automataCI/ci.sh.ps1 materialize" - assert_predicate ./bin/${env:PROJECT_SKU}, :exist? - end -end -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - - # report status - return 0 -} diff --git a/srcC/.ci/build_unix-any.sh b/srcC/.ci/build_unix-any.sh index 8774c732..4db7e2fd 100644 --- a/srcC/.ci/build_unix-any.sh +++ b/srcC/.ci/build_unix-any.sh @@ -24,27 +24,40 @@ fi . "${LIBS_AUTOMATACI}/services/io/fs.sh" . "${LIBS_AUTOMATACI}/services/io/strings.sh" . "${LIBS_AUTOMATACI}/services/i18n/translations.sh" +. "${LIBS_AUTOMATACI}/services/archive/tar.sh" +. "${LIBS_AUTOMATACI}/services/archive/zip.sh" . "${LIBS_AUTOMATACI}/services/compilers/c.sh" # execute +## define workspace configurations (avoid changes unless absolute necessary) +__source_directory="${PROJECT_PATH_ROOT}/${PROJECT_C}" __output_directory="${PROJECT_PATH_ROOT}/${PROJECT_PATH_BUILD}" -FS_Remake_Directory "$__output_directory" +FS_Make_Directory "$__output_directory" -__log_directory="${PROJECT_PATH_ROOT}/${PROJECT_PATH_LOG}" +__log_directory="${PROJECT_PATH_ROOT}/${PROJECT_PATH_LOG}/build-${PROJECT_C}" FS_Make_Directory "$__log_directory" __tmp_directory="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}" FS_Make_Directory "$__tmp_directory" -__parallel_directory="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/c-parallel" +__parallel_directory="${__tmp_directory}/build-parallel-C" FS_Remake_Directory "$__parallel_directory" +__output_lib_directory="${__tmp_directory}/build-lib${PROJECT_SKU}-C" +FS_Remake_Directory "$__output_lib_directory" + + +## define build targets +## +## Pattern: '[OS]|[ARCH]|[COMPILER]|[TYPE]|[CONTROL_FILE]' +## (1) '[TYPE]' - can either be 'executable' or 'library' only. +## (2) '[CONTROL_FILE]' - the full filepath for a AutomataCI list of +## targets text file. __executable="${PROJECT_PATH_ROOT}/${PROJECT_C}/executable.txt" __library="${PROJECT_PATH_ROOT}/${PROJECT_C}/library.txt" - __build_targets="\ darwin|amd64|clang|executable|${__executable} darwin|amd64|clang|library|${__library} @@ -84,14 +97,128 @@ windows|arm64|x86_64-w64-mingw32-gcc|executable|${__executable} windows|arm64|x86_64-w64-mingw32-gcc|library|${__library} " + +## NOTE: (1) Additional files like .h files, c source code files, assets files, +## and etc to pack into library bulk. +## +## (2) Basic package files like README.md and LICENSE.txt are not +## required. The Package CI job will package it automatically in later +## CI stage. Just focus on only the end-user consumption. +## +## (3) Pattern: '[FULL_PATH]|[NEW_FILENAME]' +__libs_files="\ +${__source_directory}/libs/greeters/Vanilla.h|lib${PROJECT_SKU}.h +" + + __placeholders="\ -${PROJECT_SKU}-src_any-any -${PROJECT_SKU}-homebrew_any-any -${PROJECT_SKU}-chocolatey_any-any ${PROJECT_SKU}-msi_any-any " +## NOTE: (1) C Compilers Optimization flags for known target OS and ARCH types. +Get_Optimization_Flags() { + __target_os="$1" + __target_arch="$2" + + + case "$__target_os" in + darwin) + __arguments="$(C_Get_Strict_Settings) -fPIC" + ;; + windows) + __arguments="\ +-Wall \ +-Wextra \ +-std=gnu89 \ +-pedantic \ +-Wstrict-prototypes \ +-Wold-style-definition \ +-Wundef \ +-Wno-trigraphs \ +-fno-strict-aliasing \ +-fno-common \ +-fshort-wchar \ +-fno-stack-protector \ +-Werror-implicit-function-declaration \ +-Wno-format-security \ +-Os \ +-static \ +" + ;; + *) + __arguments="$(C_Get_Strict_Settings) -static -pie -fPIE" + ;; + esac + + case "$__target_arch" in + armle|armel|armhf) + __arguments="\ +-Wall \ +-Wextra \ +-std=gnu89 \ +-pedantic \ +-Wstrict-prototypes \ +-Wold-style-definition \ +-Wundef \ +-Wno-trigraphs \ +-fno-strict-aliasing \ +-fno-common \ +-fstack-protector-all \ +-Werror-implicit-function-declaration \ +-Wno-format-security \ +-Os \ +-static \ +" + ;; + wasm) + __arguments="\ +-Wall \ +-Wextra \ +-std=gnu89 \ +-pedantic \ +-Wstrict-prototypes \ +-Wold-style-definition \ +-Wundef \ +-Wno-trigraphs \ +-fno-strict-aliasing \ +-fno-common \ +-fshort-wchar \ +-fno-stack-protector \ +-Werror-implicit-function-declaration \ +-Wno-format-security \ +-Os \ +-static \ +" + ;; + *) + ;; + esac + + + # report status + printf -- "%s" "$__arguments" + return 0 +} + + +## NOTE: (1) perform any hard-coded overriding restrictions or gatekeeping +## customization adjustments here (e.g. interim buggy compiler, +## geo-politic distruption). By default, it is returning 0. Any +## rejection shall return a non-zero value (e.g. 1). +Check_Host_Can_Build_Target() { + case "${__target_os}-${__target_arch}" in + *) + # no issue by default + return 0 + ;; + esac +} + + + + +# build algorithms - modify only when absolute necessary SUBROUTINE_Build() { __line="$1" @@ -117,7 +244,19 @@ SUBROUTINE_Build() { __line="${__line#*|}" __target_compiler="${__line%%|*}" - __arguments="${__line#*|}" + __line="${__line#*|}" + + __arguments="${__line%%|*}" + __line="${__line#*|}" + + __output_directory="${__line%%|*}" + __line="${__line#*|}" + + __output_lib_directory="${__line%%|*}" + __line="${__line#*|}" + + __tmp_directory="${__line%%|*}" + __log_directory="${__line#*|}" # validate input @@ -127,15 +266,19 @@ SUBROUTINE_Build() { [ $(STRINGS_Is_Empty "$__target_os") -eq 0 ] || [ $(STRINGS_Is_Empty "$__target_arch") -eq 0 ] || [ $(STRINGS_Is_Empty "$__target_compiler") -eq 0 ] || - [ $(STRINGS_Is_Empty "$__arguments") -eq 0 ]; then + [ $(STRINGS_Is_Empty "$__arguments") -eq 0 ] || + [ $(STRINGS_Is_Empty "$__output_directory") -eq 0 ] || + [ $(STRINGS_Is_Empty "$__output_lib_directory") -eq 0 ] || + [ $(STRINGS_Is_Empty "$__tmp_directory") -eq 0 ] || + [ $(STRINGS_Is_Empty "$__log_directory") -eq 0 ]; then return 1 fi # prepare critical parameters __target="$(FS_Extension_Remove "$(FS_Get_File "$__file_output")" "*")" - __workspace="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/build-${__target}" - __log="${PROJECT_PATH_ROOT}/${PROJECT_PATH_LOG}/build-${__target}" + __workspace="${__tmp_directory}/build-${__target}" + __log="${__log_directory}/${__target}" __file_output="${__workspace}/$(FS_Get_File "$__file_output")" I18N_Build_Parallel "$__file_output" @@ -157,7 +300,11 @@ SUBROUTINE_Build() { # export target - __dest="${PROJECT_PATH_ROOT}/${PROJECT_PATH_BUILD}/$(FS_Get_File "$__file_output")" + __dest="$__output_directory" + if [ "$__file_type" = "library" ]; then + __dest="$__output_lib_directory" + fi + __dest="${__dest}/$(FS_Get_File "$__file_output")" FS_Remove_Silently "$__dest" FS_Copy_File "$__file_output" "$__dest" if [ $? -ne 0 ]; then @@ -185,10 +332,8 @@ SUBROUTINE_Build() { } - - -# register targets and execute parallel build -old_IFS="$IFS" +## register targets and execute parallel build +__old_IFS="$IFS" while IFS="" read -r __line || [ -n "$__line" ]; do if [ $(STRINGS_Is_Empty "$__line") -eq 0 ]; then continue @@ -211,7 +356,6 @@ while IFS="" read -r __line || [ -n "$__line" ]; do __source="${__source#*|}" - # validate input case "$__target_type" in elf|exe|executable) @@ -271,94 +415,17 @@ while IFS="" read -r __line || [ -n "$__line" ]; do fi fi + Check_Host_Can_Build_Target + if [ $? -ne 0 ]; then + continue + fi - ## NOTE: perform any hard-coded host system restrictions or gatekeeping - ## customization adjustments here. - case "${__target_os}-${__target_arch}" in - *) - # accepted - ;; - esac - - - # formulate compiler optimization flags - case "$__target_os" in - darwin) - __arguments="$(C_Get_Strict_Settings) -fPIC" - ;; - windows) - __arguments="\ --Wall \ --Wextra \ --std=gnu89 \ --pedantic \ --Wstrict-prototypes \ --Wold-style-definition \ --Wundef \ --Wno-trigraphs \ --fno-strict-aliasing \ --fno-common \ --fshort-wchar \ --fno-stack-protector \ --Werror-implicit-function-declaration \ --Wno-format-security \ --Os \ --static \ -" - ;; - *) - __arguments="$(C_Get_Strict_Settings) -static -pie -fPIE" - ;; - esac - - case "$__target_arch" in - armle|armel|armhf) - __arguments="\ --Wall \ --Wextra \ --std=gnu89 \ --pedantic \ --Wstrict-prototypes \ --Wold-style-definition \ --Wundef \ --Wno-trigraphs \ --fno-strict-aliasing \ --fno-common \ --fstack-protector-all \ --Werror-implicit-function-declaration \ --Wno-format-security \ --Os \ --static \ -" - ;; - wasm) - __arguments="\ --Wall \ --Wextra \ --std=gnu89 \ --pedantic \ --Wstrict-prototypes \ --Wold-style-definition \ --Wundef \ --Wno-trigraphs \ --fno-strict-aliasing \ --fno-common \ --fshort-wchar \ --fno-stack-protector \ --Werror-implicit-function-declaration \ --Wno-format-security \ --Os \ --static \ -" - ;; - *) - ;; - esac + __arguments="$(Get_Optimization_Flags "$__target_os" "$__target_arch")" # target is healthy - register into build list FS_Append_File "${__parallel_directory}/parallel.txt" "\ -${__file_output}|${__source}|${__target_type}|${__target_os}|${__target_arch}|${__target_compiler}|${__arguments} +${__file_output}|${__source}|${__target_type}|${__target_os}|${__target_arch}|${__target_compiler}|${__arguments}|${__output_directory}|${__output_lib_directory}|${__tmp_directory}|${__log_directory} " done < -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - - - - -# (0) initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - -. "${PROJECT_PATH_ROOT}/${PROJECT_C}/${PROJECT_PATH_CI}/_package-archive_unix-any.sh" -. "${PROJECT_PATH_ROOT}/${PROJECT_C}/${PROJECT_PATH_CI}/_package-chocolatey_unix-any.sh" -. "${PROJECT_PATH_ROOT}/${PROJECT_C}/${PROJECT_PATH_CI}/_package-docker_unix-any.sh" -. "${PROJECT_PATH_ROOT}/${PROJECT_C}/${PROJECT_PATH_CI}/_package-homebrew_unix-any.sh" - - - - -# report status -return 0 diff --git a/srcC/.ci/package_windows-any.ps1 b/srcC/.ci/package_windows-any.ps1 deleted file mode 100644 index 9596cac0..00000000 --- a/srcC/.ci/package_windows-any.ps1 +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - return 1 -} - -. "${env:PROJECT_PATH_ROOT}\${env:PROJECT_C}\${env:PROJECT_PATH_CI}\_package-archive_windows-any.ps1" -. "${env:PROJECT_PATH_ROOT}\${env:PROJECT_C}\${env:PROJECT_PATH_CI}\_package-chocolatey_windows-any.ps1" -. "${env:PROJECT_PATH_ROOT}\${env:PROJECT_C}\${env:PROJECT_PATH_CI}\_package-docker_windows-any.ps1" -. "${env:PROJECT_PATH_ROOT}\${env:PROJECT_C}\${env:PROJECT_PATH_CI}\_package-homebrew_windows-any.ps1" - - - - -# report status -return 0 diff --git a/srcC/executable.txt b/srcC/executable.txt index c180cf31..656c3d67 100644 --- a/srcC/executable.txt +++ b/srcC/executable.txt @@ -3,12 +3,17 @@ # Step to do: # (1) List all the source codes for compilation in the following patterns: # [OS]-[ARCH] relative/path/to/code.[TYPE] -# Example: +# Example (1): # any-any main.c # linux-amd64 fx1_linux-amd64.c # linux-amd64 fx2_linux-amd64.o -# linux-arm64 fx1_linux-amd64.c -# linux-arm64 fx2_linux-amd64.o +# linux-amd64 lib1_linux-amd64.a +# +# Example (2): +# any-any main.c +# linux-arm64 fx1_linux-arm64.c +# linux-arm64 fx2_linux-arm64.o +# linux-arm64 lib1_linux-arm64.a # # (2) The leading platform tag is to tell AutomataCI when a source is compatible # with a target build during cross-compilation. Use the value 'any' to @@ -18,5 +23,5 @@ # (3) The list also accepts pre-built library object files (.o extension). # AutomataCI will register it for linking only and copy it into the # workspace. -any-any libs/sample/greeter_any-any.c +any-any libs/greeters/Vanilla.c any-any main.c diff --git a/srcC/library.txt b/srcC/library.txt index 96bd2628..3f5ba018 100644 --- a/srcC/library.txt +++ b/srcC/library.txt @@ -3,12 +3,17 @@ # Step to do: # (1) List all the source codes for compilation in the following patterns: # [OS]-[ARCH] relative/path/to/code.[TYPE] -# Example: +# Example (1): # any-any main.c # linux-amd64 fx1_linux-amd64.c # linux-amd64 fx2_linux-amd64.o -# linux-arm64 fx1_linux-amd64.c -# linux-arm64 fx2_linux-amd64.o +# linux-amd64 lib1_linux-amd64.a +# +# Example (2): +# any-any main.c +# linux-arm64 fx1_linux-arm64.c +# linux-arm64 fx2_linux-arm64.o +# linux-arm64 lib1_linux-arm64.a # # (2) The leading platform tag is to tell AutomataCI when a source is compatible # with a target build during cross-compilation. Use the value 'any' to @@ -18,4 +23,4 @@ # (3) The list also accepts pre-built library object files (.o extension). # AutomataCI will register it for linking only and copy it into the # workspace. -any-any libs/sample/greeter_any-any.c +any-any libs/greeters/Vanilla.c diff --git a/srcC/libs/sample/entity_any-any.h b/srcC/libs/entities/Vanilla.h similarity index 95% rename from srcC/libs/sample/entity_any-any.h rename to srcC/libs/entities/Vanilla.h index 2873d507..e212256d 100644 --- a/srcC/libs/sample/entity_any-any.h +++ b/srcC/libs/entities/Vanilla.h @@ -4,6 +4,12 @@ #ifndef SAMPLE_ENTITY_H #define SAMPLE_ENTITY_H + + + const char *NAME = "Jane"; + + + #endif diff --git a/srcC/libs/sample/greeter_any-any.c b/srcC/libs/greeters/Vanilla.c similarity index 100% rename from srcC/libs/sample/greeter_any-any.c rename to srcC/libs/greeters/Vanilla.c diff --git a/srcC/libs/sample/greeter_any-any.h b/srcC/libs/greeters/Vanilla.h similarity index 98% rename from srcC/libs/sample/greeter_any-any.h rename to srcC/libs/greeters/Vanilla.h index 79852117..e2ff7b36 100644 --- a/srcC/libs/sample/greeter_any-any.h +++ b/srcC/libs/greeters/Vanilla.h @@ -1,13 +1,18 @@ /* * [ LICENSE CLAUSE HERE ] */ - #ifndef SAMPLE_GREETER_H #define SAMPLE_GREETER_H + + + /* Process is a sample function of formatting string output with given name and * location. */ extern void Process(char writer[500], const char *name, const char *location); + + + #endif diff --git a/srcC/libs/sample/greeter_any-any_test.c b/srcC/libs/greeters/Vanilla_test.c similarity index 78% rename from srcC/libs/sample/greeter_any-any_test.c rename to srcC/libs/greeters/Vanilla_test.c index 5adc80ad..58bfb946 100644 --- a/srcC/libs/sample/greeter_any-any_test.c +++ b/srcC/libs/greeters/Vanilla_test.c @@ -1,33 +1,10 @@ /* * [ LICENSE CLAUSE HERE ] */ - - - - -/* define test libraries */ -#pragma GCC diagnostic ignored "-Wunknown-pragmas" -#pragma clang diagnostic ignored "-Wunknown-pragmas" -#pragma GCC diagnostic ignored "-Wvariadic-macros" -#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" - -#include - -struct Scenario { - long ID; - const char *Name; - const char *Description; -}; - -#define Logf(...) fprintf(stderr,##__VA_ARGS__); -/* define test libraries */ - - - - -/* import test target's source code (.c file directly) and setup test suite */ #include -#include "greeter_any-any.c" + +#include "../testing/Vanilla.h" +#include "./Vanilla.c" diff --git a/srcC/libs/sample/location_any-any.h b/srcC/libs/locations/Vanilla.h similarity index 95% rename from srcC/libs/sample/location_any-any.h rename to srcC/libs/locations/Vanilla.h index a62db0a5..1e1333f3 100644 --- a/srcC/libs/sample/location_any-any.h +++ b/srcC/libs/locations/Vanilla.h @@ -4,6 +4,12 @@ #ifndef SAMPLE_LOCATION_H #define SAMPLE_LOCATION_H + + + const char *LOCATION = "Sample"; + + + #endif diff --git a/srcC/libs/testing/Vanilla.h b/srcC/libs/testing/Vanilla.h new file mode 100644 index 00000000..f7ea2757 --- /dev/null +++ b/srcC/libs/testing/Vanilla.h @@ -0,0 +1,28 @@ +/* + * [ LICENSE CLAUSE HERE ] + */ +#ifndef TESTING_H +#define TESTING_H + + + + +#pragma GCC diagnostic ignored "-Wunknown-pragmas" +#pragma clang diagnostic ignored "-Wunknown-pragmas" +#pragma GCC diagnostic ignored "-Wvariadic-macros" +#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + +#include + +struct Scenario { + long ID; + const char *Name; + const char *Description; +}; + +#define Logf(...) fprintf(stderr,##__VA_ARGS__); + + + + +#endif diff --git a/srcC/main.c b/srcC/main.c index 58a5a03a..4fdc927a 100644 --- a/srcC/main.c +++ b/srcC/main.c @@ -2,9 +2,10 @@ * [ LICENSE CLAUSE HERE ] */ #include -#include "libs/sample/entity_any-any.h" -#include "libs/sample/location_any-any.h" -#include "libs/sample/greeter_any-any.h" + +#include "libs/entities/Vanilla.h" +#include "libs/locations/Vanilla.h" +#include "libs/greeters/Vanilla.h"