From ee28c90b20dd8feb2efc0049a09dbddd361d8c0c Mon Sep 17 00:00:00 2001 From: "(Holloway) Chew, Kean Ho" Date: Sun, 16 Jun 2024 22:07:22 +0800 Subject: [PATCH] root: integrated C programming language for its library construction Since the hardest library construction is C programming language, we should deal with it first. Hence, let's do this. This patch integrates C programming language for its library construction in root repository. 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 | 887 +++++++++++++----- LICENSE.pdf | Bin 0 -> 49604 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-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 | 261 +++++- 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 | 146 +++ automataCI/_release-flatpak_windows-any.ps1 | 150 +++ automataCI/_release-homebrew_unix-any.sh | 152 +-- automataCI/_release-homebrew_windows-any.ps1 | 160 ++-- 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 | 280 ++++-- automataCI/package_windows-any.ps1 | 277 ++++-- 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 | 24 +- automataCI/services/archive/tar.sh | 24 +- 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 + .../services/i18n/_simulate-conclusion.ps1 | 2 +- automataCI/services/i18n/translations.ps1 | 1 + automataCI/services/i18n/translations.sh | 1 + automataCI/services/io/disk.ps1 | 39 +- automataCI/services/io/disk.sh | 36 +- automataCI/services/io/fs.ps1 | 83 ++ automataCI/services/io/fs.sh | 98 ++ 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 | 114 ++- 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/build_unix-any.sh | 518 ++++++++++ srcC/.ci/build_windows-any.ps1 | 484 ++++++++++ srcC/.ci/materialize_unix-any.sh | 149 +++ srcC/.ci/materialize_windows-any.ps1 | 149 +++ srcC/.ci/test_unix-any.sh | 60 ++ srcC/.ci/test_windows-any.ps1 | 55 ++ srcC/executable.txt | 27 + srcC/library.txt | 26 + srcC/libs/entities/Vanilla.h | 15 + srcC/libs/greeters/Vanilla.c | 112 +++ srcC/libs/greeters/Vanilla.h | 18 + srcC/libs/greeters/Vanilla_test.c | 110 +++ srcC/libs/locations/Vanilla.h | 15 + srcC/libs/testing/Vanilla.h | 28 + srcC/main.c | 32 + 141 files changed, 9425 insertions(+), 2530 deletions(-) create mode 100644 LICENSE.pdf delete mode 100644 LICENSE.txt 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/publishers/unix.ps1 create mode 100644 automataCI/services/publishers/unix.sh create mode 100644 srcC/.ci/build_unix-any.sh create mode 100644 srcC/.ci/build_windows-any.ps1 create mode 100644 srcC/.ci/materialize_unix-any.sh create mode 100644 srcC/.ci/materialize_windows-any.ps1 create mode 100644 srcC/.ci/test_unix-any.sh create mode 100644 srcC/.ci/test_windows-any.ps1 create mode 100644 srcC/executable.txt create mode 100644 srcC/library.txt create mode 100644 srcC/libs/entities/Vanilla.h create mode 100644 srcC/libs/greeters/Vanilla.c create mode 100644 srcC/libs/greeters/Vanilla.h create mode 100644 srcC/libs/greeters/Vanilla_test.c create mode 100644 srcC/libs/locations/Vanilla.h create mode 100644 srcC/libs/testing/Vanilla.h create mode 100644 srcC/main.c diff --git a/.github/workflows/git-push.yml b/.github/workflows/git-push.yml index 0a86c72..b8f2960 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 1cd7a01..a00fbd4 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 = "hestiaerror" +PROJECT_SKU = 'hestiaerror' # 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 = "hestiaERROR" +PROJECT_SKU_TITLECASE = 'hestiaERROR' # PROJECT_APP_ID @@ -36,7 +36,7 @@ PROJECT_SKU_TITLECASE = "hestiaERROR" # 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.hestiaerror" +PROJECT_APP_ID = 'com.github.chewkeanho.hestiaerror' # PRODUCT_APP_UUID @@ -60,19 +60,19 @@ PROJECT_APP_ID = "com.github.chewkeanho.hestiaerror" # 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 = "7E665EAF-446B-7738-84D9-FE18BE03949E" +PRODUCT_APP_UUID = '7E665EAF-446B-7738-84D9-FE18BE03949E' # PROJECT_NAME # This is the name of the product used in documentation, marketing addresses # etc only. For programming purposes, PROJECT_SKU is used instead. -PROJECT_NAME = "Chew Kean Ho's hestiaERROR" +PROJECT_NAME = "Chew Kean Ho's hestiaERROR Library" # PROJECT_PITCH # A short elevator pitch about the project used as a short description. Max # Max: 60 characters. -PROJECT_PITCH = "One Peaceful Frontend+Backend Software Library Suite." +PROJECT_PITCH = 'One Peaceful Frontend+Backend Software Library Suite.' # PROJECT_VERSION @@ -85,7 +85,7 @@ PROJECT_PITCH = "One Peaceful Frontend+Backend Software Library Suite." # 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 = "0.0.1" +PROJECT_VERSION = '0.0.1' # PROJECT_CADENCE @@ -94,48 +94,48 @@ PROJECT_VERSION = "0.0.1" # 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" +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. # GitHub Username|Organization Name, NPMJS scope, etc). This is required for # certain packages' ecosystems such as but not limited to NPM. -PROJECT_SCOPE = "chewkeanho" +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/hestiaERROR" +PROJECT_CONTACT_WEBSITE = 'https://github.com/ChewKeanHo/hestiaERROR' # PROJECT_SOURCE_URL @@ -147,7 +147,7 @@ PROJECT_CONTACT_WEBSITE = "https://github.com/ChewKeanHo/hestiaERROR" # # Example: # 1. GitHub Packages : https://github.com/OWNER/REPO -PROJECT_SOURCE_URL = "https://github.com/ChewKeanHo/hestiaERROR" +PROJECT_SOURCE_URL = 'https://github.com/ChewKeanHo/hestiaERROR' # PROJECT_SOURCE_GIT_REMOTE @@ -181,8 +181,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 @@ -206,7 +206,7 @@ PROJECT_LICENSE_ACCEPTANCE_REQUIRED = 'true' # fr – International French. # zh-hans – International Simplified Chinese. # zh-hant – International Traditional Chinese. -AUTOMATACI_LANG = "" +AUTOMATACI_LANG = '' @@ -256,7 +256,17 @@ PROJECT_BOOK = 'srcBOOK' # # To enable it: simply supply the path (e.g. default is 'srcC'). # To disable it: simply supply an empty path (e.g. default is ''). -PROJECT_C = '' +PROJECT_C = 'srcC' + + +# 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 +280,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 +316,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 +327,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 +339,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 +347,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' @@ -483,7 +493,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. @@ -492,13 +502,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' @@ -521,7 +531,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' @@ -544,7 +554,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' @@ -567,7 +577,7 @@ PROJECT_NODE = 'srcNODE' # 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 @@ -638,25 +648,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' @@ -714,37 +724,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 @@ -752,19 +762,303 @@ 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' + + + + +############################# +# 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_DEBIAN_IS_NATIVE +# 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_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 @@ -772,245 +1066,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/hestiaERROR.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. +# +# 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 (''). # -# When left empty, AutomataCI shall generate a full list of arch-only hard-coded -# arch values. -PROJECT_REPREPRO_ARCH = "" +# !! IMPORTANT !! - Please avoid ending with the URL slash. +PROJECT_DOCS_URL = 'https://github.io/ChewKeanHo/hestiaERROR' -# 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/hestiaERROR.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/hestiaERROR.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 # -# PROJECT_SIMULATE_RELEASE_REPO = "" # Reserved - provided externally. +# 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. +# +# 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. +# +# 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. # -# PROJECT_ROBOT_RUN = "" # Reserved - provided externally. +# 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/hestiaERROR.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/hestiaERROR/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/Collections.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_FLATPAK_SDK +# The runtime module where the Flatpak is operating on. +PROJECT_FLATPAK_SDK = 'org.freedesktop.Sdk' -# PROJECT_HOMEBREW_REPO_BRANCH -# The git upstream branch. Default is 'main' or 'master'. -PROJECT_HOMEBREW_REPO_BRANCH = "main" -# PROJECT_HOMEBREW_DIRECTORY -# The directory name housing the Homebrew repo. Value CANNOT be empty. -# Default is 'homebrew'. -PROJECT_HOMEBREW_DIRECTORY = "homebrew" +########################### +# 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]' +# +# 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_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_HOMEBREW_REPO_KEY +# The git upstream key. Value CANNOT be empty. +# +# Default is 'origin'. +PROJECT_HOMEBREW_REPO_KEY = 'origin' -# 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. +# PROJECT_HOMEBREW_REPO_BRANCH +# The git upstream branch. Value CANNOT be empty. # -# NOTE: Please avoid ending with the URL slash. -PROJECT_HOMEBREW_SOURCE_URL = "https://github.com/ChewKeanHo/Collections/releases/download/store" +# Default is 'main' or 'master'. +PROJECT_HOMEBREW_REPO_BRANCH = 'main' -# 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_CHOCOLATEY_REPO_KEY -# The git upstream key. Default is 'origin'. -PROJECT_CHOCOLATEY_REPO_KEY = "origin" +########################## +# 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. +# +# 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_CHOCOLATEY_REPO_BRANCH -# The git upstream branch. Default is 'main' or 'master'. -PROJECT_CHOCOLATEY_REPO_BRANCH = "main" +# 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_CHOCOLATEY_DIRECTORY -# The directory name housing the Chocolatey repo. Value CANNOT be empty. -# Default is 'chocolatey'. -PROJECT_CHOCOLATEY_DIRECTORY = "chocolatey" +# 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_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. +# 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. # -# NOTE: Please avoid ending with the URL slash. -PROJECT_CHOCOLATEY_SOURCE_URL = "https://github.com/ChewKeanHo/Collections/releases/download/store" +# Default is: 'METALINK_RPM' +PROJECT_RPM_METALINK = 'METALINK_RPM' -# 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/hestiaERROR.git" +# 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_REPO_KEY -# The git upstream key. Default is 'origin'. -PROJECT_DOCS_REPO_KEY = "origin" +# 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'. +# +# 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/hestiaERROR.wiki.git' -# PROJECT_DOCS_REPO_BRANCH -# The git upstream branch. Default is 'gh-pages'. -PROJECT_DOCS_REPO_BRANCH = "gh-pages" +# PROJECT_RPM_REPO_KEY +# The git upstream key. Value CANNOT be empty. +# +# Default is 'origin'. +PROJECT_DEB_REPO_KEY = 'origin' -# 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_REPO_BRANCH +# The git upstream branch. Value CANNOT be empty. +# +# Default is 'master' or 'main'. +PROJECT_RPM_REPO_BRANCH = 'master' -# 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_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). # -# NOTE: Please avoid ending with the URL slash. -PROJECT_DOCS_SOURCE_URL = "https://github.io/ChewKeanHo/hestiaERROR" +# If left empty, AutomataCI shall use 'rpm' as its value. +# +# Default is 'rpm'. +PROJECT_RPM_PATH = 'rpm' @@ -1030,79 +1483,79 @@ PROJECT_DOCS_SOURCE_URL = "https://github.io/ChewKeanHo/hestiaERROR" # # 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..f969d7143a9e382590359276c78cade40fa3ad2d GIT binary patch literal 49604 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 vMxvEfkjexCT1iz+1*xQtQpI3Ei3&7H_Jr -# -# 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 c35f6c7..0000000 --- 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 8a758bb..2b950d2 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 4b0fc0e..261a7f4 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 751c752..0c0f039 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 + 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" + I18N_Commit "DEB" + 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_Commit_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 f7ad6b8..d8e2f3e 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,11 @@ # 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\compilers\rpm.ps1" +. "${env:LIBS_AUTOMATACI}\services\publishers\createrepo.ps1" +. "${env:LIBS_AUTOMATACI}\services\versioners\git.ps1" @@ -27,10 +29,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 + 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}" + $null = I18N-Commit "DEB" + $___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-Commit-Failed + return 1 + } + + + # return status + return 0 +} + + + + function RELEASE-Run-DEB { param( [string]$__target, - [string]$__directory + [string]$__repo_directory, + [string]$__data_directory ) @@ -40,55 +128,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 55e1c1c..218b11e 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 1ecb8a1..4435555 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 4cbee00..770c3f3 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 2730fdf..caccec5 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 0000000..ead6816 --- /dev/null +++ b/automataCI/_release-flatpak_unix-any.sh @@ -0,0 +1,146 @@ +#!/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 + I18N_Commit "FLATPAK" + __current_path="$PWD" && cd "$1" + GIT_Pull_To_Latest + if [ $? -ne 0 ]; then + cd "$__current_path" && unset __current_path + I18N_Commit_Failed + return 1 + fi + + GIT_Autonomous_Commit "${PROJECT_SKU} ${PROJECT_VERSION}" + if [ $? -ne 0 ]; then + cd "$__current_path" && unset __current_path + I18N_Commit_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_Commit_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 0000000..91628d4 --- /dev/null +++ b/automataCI/_release-flatpak_windows-any.ps1 @@ -0,0 +1,150 @@ +# 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 + $null = I18N-Commit "FLATPAK" + $__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-Commit-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-Commit-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-Commit-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 627210a..b287b0f 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 + 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 + I18N_Commit "HOMEBREW" + __current_path="$PWD" && cd "$1" + GIT_Pull_To_Latest + if [ $? -ne 0 ]; then + cd "$__current_path" && unset __current_path + I18N_Commit_Failed return 1 fi + GIT_Autonomous_Commit "${PROJECT_SKU} ${PROJECT_VERSION}" + if [ $? -ne 0 ]; then + cd "$__current_path" && unset __current_path + I18N_Commit_Failed + return 1 + fi - # execute - HOMEBREW_Publish "$1" "${2}/Formula/${PROJECT_SKU}.rb" + GIT_Push "$PROJECT_HOMEBREW_REPO_KEY" "$PROJECT_HOMEBREW_REPO_BRANCH" + ___process=$? + cd "$__current_path" && unset __current_path + if [ $___process -ne 0 ]; then + I18N_Commit_Failed + return 1 + fi + + + # 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_Commit_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_Commit_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 30c4871..5e6a1c1 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,66 +28,36 @@ 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 + if ($(OS-Is-Run-Simulated) -eq 0) { + $null = I18N-Simulate-Conclude "HOMEBREW" + return 0 } - # execute + # commit the formula first + $null = I18N-Commit "HOMEBREW" $__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 @@ -94,8 +65,7 @@ function RELEASE-Conclude-HOMEBREW { 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 @@ -103,7 +73,6 @@ function RELEASE-Conclude-HOMEBREW { return 1 } - $___process = GIT-Push ` "${env:PROJECT_HOMEBREW_REPO_KEY}" ` "${env:PROJECT_HOMEBREW_REPO_BRANCH}" @@ -115,6 +84,30 @@ function RELEASE-Conclude-HOMEBREW { } + # 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-Commit-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-Commit-Failed + return 1 + } + + # return status return 0 } @@ -122,29 +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}" } diff --git a/automataCI/_release-lib_unix-any.sh b/automataCI/_release-lib_unix-any.sh index 2b6b462..cd7f60e 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 56fe45f..0801736 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 d309085..566815d 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 0d620d8..23e186f 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 0000000..939fb18 --- /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 0000000..c53744e --- /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 8482988..77bc2c0 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 2c4ec0b..405d074 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 e422fd3..2282d27 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 + 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" + I18N_Commit "RPM" + 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_Commit_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 5780304..6f37a12 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 + 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}" + $null = I18N-Commit "RPM" + $___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-Commit-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 fc7605b..0000000 --- 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 2f60b82..0000000 --- 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 ace249e..c4fc41c 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 d5bdb08..fb71873 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 ddb64a2..4217296 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 e859436..715f058 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 175d0e1..97a2925 100644 --- a/automataCI/package_unix-any.sh +++ b/automataCI/package_unix-any.sh @@ -24,6 +24,8 @@ fi . "${LIBS_AUTOMATACI}/services/io/strings.sh" . "${LIBS_AUTOMATACI}/services/io/sync.sh" . "${LIBS_AUTOMATACI}/services/i18n/translations.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 +62,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 +229,204 @@ 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 + if [ $(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 +443,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 2c5f18c..a379681 100644 --- a/automataCI/package_windows-any.ps1 +++ b/automataCI/package_windows-any.ps1 @@ -23,6 +23,8 @@ 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\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 +42,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 +208,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 +244,202 @@ 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 + if ($(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 +459,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 b1b196c..3562d3e 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 884883b..297576a 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-Run-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 e68f238..059ab77 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 70a1bf7..dac8898 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 7a277b5..781bd5e 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 + } } diff --git a/automataCI/services/archive/tar.sh b/automataCI/services/archive/tar.sh index fae3045..54e2576 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 diff --git a/automataCI/services/checksum/md5.ps1 b/automataCI/services/checksum/md5.ps1 index af80db2..c625450 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 1f74263..923a7a2 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 2b7f795..e0b6c9f 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 e8b3211..d4969e1 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 f3e50e1..efddc0d 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 50861dd..f6d8a09 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 928e03d..4642f01 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 8e7c276..86dffe9 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 fa926a7..5c088a9 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 29cbaec..b645f1e 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 ef15067..0df151c 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 3870e22..28afbf9 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 40543e8..6739dd7 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 c8d96e9..934ecd8 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 0000000..0b43c55 --- /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 0000000..7cfd441 --- /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/_simulate-conclusion.ps1 b/automataCI/services/i18n/_simulate-conclusion.ps1 index 916705e..2f65ba4 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 230275b..35dd85d 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" diff --git a/automataCI/services/i18n/translations.sh b/automataCI/services/i18n/translations.sh index ce29c3b..abffb60 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" diff --git a/automataCI/services/io/disk.ps1 b/automataCI/services/io/disk.ps1 index 8a5f5f9..9aa2a39 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 7bbe2a0..bc2cc55 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 b12736d..e848b78 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,35 @@ function FS-Is-Directory { +function FS-Is-Directory-Empty { + param ( + [string]$___target + ) + + + # validate input + $___process = FS-Is-Directory "${___target}" + if ($___process -ne 0) { + return 1 + } + + + # execute + $___items = (Get-ChildItem "${___target}" -force ` + | Select-Object -First 1 ` + | Measure-Object).Count + if ($___items -ne 0) { + return 1 + } + + + # report status + return 0 +} + + + + function FS-Is-File { param ( [string]$___target @@ -339,6 +388,35 @@ function FS-Is-File { +function FS-Is-Target-A-C { + param ( + [string]$___target + ) + + + # execute + if ($(FS-Is-Target-A-Cargo) -eq 0) { + return 1 + } + + if ($(FS-Is-Target-A-Chocolatey) -eq 0) { + return 1 + } + + + if (($("${___target}" -replace '^.*-C') -ne "${___target}") -or + ($("${___target}" -replace '^.*-c') -ne "${___target}")) { + return 0 + } + + + # report status + return 1 +} + + + + function FS-Is-Target-A-Cargo { param ( [string]$___target @@ -812,6 +890,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 d043cc3..108e4ad 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,36 @@ 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 [ "$___item" = "${1}/*" ]; then + continue + fi + + if [ -e "$___item" ]; then + return 1 + fi + done + + + # report status + return 0 +} + + + + FS_Is_File() { #___target="$1" @@ -300,6 +350,33 @@ FS_Is_File() { +FS_Is_Target_A_C() { + #___target="$1" + + + # execute + if [ $(FS_Is_Target_A_Cargo) -eq 0 ]; then + return 1 + fi + + if [ $(FS_Is_Target_A_Chocolatey) -eq 0 ]; then + return 1 + fi + + if [ "${1#*-C}" != "$1" ] || [ "${1#*-c}" != "$1" ]; then + printf -- "0" + return 0 + fi + + + # report status + printf -- "1" + return 1 +} + + + + FS_Is_Target_A_Cargo() { #___target="$1" @@ -753,6 +830,11 @@ FS_Move() { return 1 fi + FS_Is_Target_Exist "$1" + if [ $? -ne 0 ]; then + return 1 + fi + # execute mv "$1" "$2" @@ -837,6 +919,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 e9df560..45ea61e 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 e5f4ba1..cd9572f 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 22d58c4..5eedd9b 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 57be53f..dc2cbbd 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 3b6bcc9..1e1fe7a 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 95ca6d4..f21a2f4 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 bd8e389..b7cdb84 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 8a44dab..0ef1f0f 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 ba34251..f2c9bba 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 0000000..961c590 --- /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 0000000..a6b0e60 --- /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 04b4fee..066772c 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 479ef83..0d28260 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 57b5cbc..cca7e23 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 933639b..7fb5621 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 7cde15c..da5a640 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 68542ed..c21b825 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 cf3e477..9a183d0 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 9a0b256..136a81b 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 44d5528..d38a0f3 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 1b84546..02957af 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 42937c6..26189ae 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 31cbc5b..88b8372 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 c083d01..3e2324b 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 7b65e78..0001ab1 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}" - $___process = FS-Copy-File "${_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-Copy-Failed + $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-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}" + # sanity check before proceedind + $___process = FS-Is-Directory-Empty "${__dest}" if ($___process -ne 0) { - $null = I18N-Copy-Failed + $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-Copy "${__source}" "${__dest}" + $___process = FS-Copy-File "${__source}" "${__dest}" if ($___process -ne 0) { $null = I18N-Copy-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-Copy "${__source}" "${__dest}" + $___process = FS-Copy-File "${__source}" "${__dest}" + if ($___process -ne 0) { + $null = I18N-Copy-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-Copy "${__source}" "${__dest}" + $___process = FS-Copy-File "${__source}" "${__dest}" + if ($___process -ne 0) { + $null = I18N-Copy-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-Copy "${__source}" "${__dest}" + $___process = FS-Copy-File "${__source}" "${__dest}" if ($___process -ne 0) { $null = I18N-Copy-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,13 +187,14 @@ 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${PROJECT_SKU}.nuspec" $null = I18N-Create "${__dest}" + $__dest = ".\${__dest}" $___process = FS-Write-File "${__dest}" @" @@ -177,7 +220,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 34b1fe6..a9d8735 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 561c81c..e769fe5 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 ab83963..14c68d3 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 ebeceff..30a7a59 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 51ed6fd..4aaa765 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 da75c4c..cc4cdcd 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/build_unix-any.sh b/srcC/.ci/build_unix-any.sh new file mode 100644 index 0000000..4db7e2f --- /dev/null +++ b/srcC/.ci/build_unix-any.sh @@ -0,0 +1,518 @@ +#!/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/os.sh" +. "${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_Make_Directory "$__output_directory" + +__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="${__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} +darwin|arm64|clang|executable|${__executable} +darwin|arm64|clang|library|${__library} +js|wasm|emcc|executable|${__executable} +js|wasm|emcc|library|${__library} +linux|amd64|x86_64-linux-gnu-gcc|executable|${__executable} +linux|amd64|x86_64-linux-gnu-gcc|library|${__library} +linux|arm64|aarch64-linux-gnu-gcc|executable|${__executable} +linux|arm64|aarch64-linux-gnu-gcc|library|${__library} +linux|armle|arm-linux-gnueabi-gcc|executable|${__executable} +linux|armle|arm-linux-gnueabi-gcc|library|${__library} +linux|armhf|arm-linux-gnueabihf-gcc|executable|${__executable} +linux|armhf|arm-linux-gnueabihf-gcc|library|${__library} +linux|mips|mips-linux-gnu-gcc|executable|${__executable} +linux|mips|mips-linux-gnu-gcc|library|${__library} +linux|mipsle|mipsel-linux-gnu-gcc|executable|${__executable} +linux|mipsle|mipsel-linux-gnu-gcc|library|${__library} +linux|mips64|mips64-linux-gnuabi64-gcc|executable|${__executable} +linux|mips64|mips64-linux-gnuabi64-gcc|library|${__library} +linux|mips64le|mips64el-linux-gnuabi64-gcc|executable|${__executable} +linux|mips64le|mips64el-linux-gnuabi64-gcc|library|${__library} +linux|mips64r6|mipsisa64r6-linux-gnuabi64-gcc|executable|${__executable} +linux|mips64r6|mipsisa64r6-linux-gnuabi64-gcc|library|${__library} +linux|mips64r6le|mipsisa64r6el-linux-gnuabi64-gcc|executable|${__executable} +linux|mips64r6le|mipsisa64r6el-linux-gnuabi64-gcc|library|${__library} +linux|powerpc|powerpc-linux-gnu-gcc|executable|${__executable} +linux|powerpc|powerpc-linux-gnu-gcc|library|${__library} +linux|ppc64le|powerpc64le-linux-gnu-gcc|executable|${__executable} +linux|ppc64le|powerpc64le-linux-gnu-gcc|library|${__library} +linux|riscv64|riscv64-linux-gnu-gcc|executable|${__executable} +linux|riscv64|riscv64-linux-gnu-gcc|library|${__library} +windows|amd64|x86_64-w64-mingw32-gcc|executable|${__executable} +windows|amd64|x86_64-w64-mingw32-gcc|library|${__library} +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}-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" + + + # parse input + if [ $(STRINGS_Is_Empty "$1") -eq 0 ]; then + return 0 + fi + + __file_output="${__line%%|*}" + __line="${__line#*|}" + + __file_sources="${__line%%|*}" + __line="${__line#*|}" + + __file_type="${__line%%|*}" + __line="${__line#*|}" + + __target_os="${__line%%|*}" + __line="${__line#*|}" + + __target_arch="${__line%%|*}" + __line="${__line#*|}" + + __target_compiler="${__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 + if [ $(STRINGS_Is_Empty "$__file_output") -eq 0 ] || + [ $(STRINGS_Is_Empty "$__file_sources") -eq 0 ] || + [ $(STRINGS_Is_Empty "$__file_type") -eq 0 ] || + [ $(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 ] || + [ $(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="${__tmp_directory}/build-${__target}" + __log="${__log_directory}/${__target}" + __file_output="${__workspace}/$(FS_Get_File "$__file_output")" + + I18N_Build_Parallel "$__file_output" + FS_Make_Directory "$__workspace" + FS_Make_Directory "$__log" + C_Build "$__file_output" \ + "$__file_sources" \ + "$__file_type" \ + "$__target_os" \ + "$__target_arch" \ + "$__workspace" \ + "$__log" \ + "$__target_compiler" \ + "$__arguments" + if [ $? -ne 0 ]; then + I18N_Build_Failed_Parallel "$__file_output" + return 1 + fi + + + # export target + __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 + I18N_Build_Failed_Parallel "$__file_output" + return 1 + fi + + if [ "${__target_os}-${__target_arch}" = "js-wasm" ]; then + __source="$(FS_Extension_Remove "$__file_output" "*").js" + FS_Is_File "$__source" + if [ $? -eq 0 ]; then + __dest="$(FS_Extension_Remove "$__dest" "*").js" + FS_Remove_Silently "$__dest" + FS_Copy_File "$__source" "$__dest" + if [ $? -ne 0 ]; then + I18N_Build_Failed_Parallel "$__file_output" + return 1 + fi + fi + fi + + + # report status + return 0 +} + + +## 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 + fi + + + # parse target data + __source="${__line}" + + __target_os="$(STRINGS_To_Lowercase "${__source%%|*}")" + __source="${__source#*|}" + + __target_arch="$(STRINGS_To_Lowercase ${__source%%|*})" + __source="${__source#*|}" + + __target_compiler="${__source%%|*}" + __source="${__source#*|}" + + __target_type="${__source%%|*}" + __source="${__source#*|}" + + + # validate input + case "$__target_type" in + elf|exe|executable) + __file_output="${PROJECT_SKU}_${__target_os}-${__target_arch}" + if [ "$__target_os" = "js" ] && [ "$__target_arch" = "wasm" ]; then + __file_output="${__file_output}.wasm" + elif [ "$__target_os" = "windows" ]; then + __file_output="${__file_output}.exe" + else + __file_output="${__file_output}.elf" + fi + ;; + lib|dll|library) + __file_output="lib${PROJECT_SKU}_${__target_os}-${__target_arch}" + if [ "$__target_os" = "js" ] && [ "$__target_arch" = "wasm" ]; then + __file_output="${__file_output}.wasm" + elif [ "$__target_os" = "windows" ]; then + __file_output="${__file_output}.dll" + else + __file_output="${__file_output}.a" + fi + ;; + *) + return 1 + ;; + esac + I18N_Sync_Register "${__file_output}" + + FS_Is_File "$__source" + if [ $? -ne 0 ]; then + I18N_Sync_Failed + return 1 + fi + + if [ $(STRINGS_Is_Empty "$__target_os") -eq 0 ] || + [ $(STRINGS_Is_Empty "$__target_arch") -eq 0 ]; then + I18N_Sync_Register_Skipped_Missing_Target + continue + fi + + if [ $(STRINGS_Is_Empty "$__target_compiler") -ne 0 ]; then + OS_Is_Command_Available "$__target_compiler" + if [ $? -ne 0 ]; then + I18N_Sync_Register_Skipped_Missing_Compiler + continue + fi + else + __target_compiler="$(C_Get_Compiler \ + "$__target_os" \ + "$__target_arch" \ + "$PROJECT_OS" \ + "$PROJECT_ARCH" \ + )" + if [ $(STRINGS_Is_Empty "$__target_compiler") -eq 0 ]; then + I18N_Sync_Register_Skipped_Missing_Compiler + continue + fi + fi + + Check_Host_Can_Build_Target + if [ $? -ne 0 ]; then + continue + fi + + __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}|${__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. + + + + +# 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\os.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" +. "${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\archive\tar.ps1" +. "${env:LIBS_AUTOMATACI}\services\archive\zip.ps1" +. "${env:LIBS_AUTOMATACI}\services\compilers\c.ps1" + + + + +# execute +## define workspace configurations (avoid changes unless absolute necessary) +$__source_directory = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_C}" +$__output_directory = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_BUILD}" +$null = FS-Remake-Directory "${__output_directory}" + +$__log_directory = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_LOG}\build-${env:PROJECT_C}" +$null = FS-Make-Directory "${__log_directory}" + +$__tmp_directory = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}" +$null = FS-Make-Directory "${__tmp_directory}" + +$__parallel_directory = "${__tmp_directory}\build-parallel-C" +$null = FS-Remake-Directory "${__parallel_directory}" + +$__output_lib_directory = "${__tmp_directory}\build-lib${env:PROJECT_SKU}-C" +$null = 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 = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_C}\executable.txt" +$__library = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_C}\library.txt" +$__build_targets = @( + "darwin|amd64|clang|executable|${__executable}" + "darwin|amd64|clang|library|${__library}" + "darwin|arm64|clang|executable|${__executable}" + "darwin|arm64|clang|library|${__library}" + "js|wasm|emcc|executable|${__executable}" + "js|wasm|emcc|library|${__library}" + "linux|amd64|x86_64-linux-gnu-gcc|executable|${__executable} " + "linux|amd64|x86_64-linux-gnu-gcc|library|${__library}" + "linux|arm64|aarch64-linux-gnu-gcc|executable|${__executable}" + "linux|arm64|aarch64-linux-gnu-gcc|library|${__library}" + "linux|armle|arm-linux-gnueabi-gcc|executable|${__executable}" + "linux|armle|arm-linux-gnueabi-gcc|library|${__library}" + "linux|armhf|arm-linux-gnueabihf-gcc|executable|${__executable}" + "linux|armhf|arm-linux-gnueabihf-gcc|library|${__library}" + "linux|mips|mips-linux-gnu-gcc|executable|${__executable}" + "linux|mips|mips-linux-gnu-gcc|library|${__library}" + "linux|mipsle|mipsel-linux-gnu-gcc|executable|${__executable}" + "linux|mipsle|mipsel-linux-gnu-gcc|library|${__library}" + "linux|mips64|mips64-linux-gnuabi64-gcc|executable|${__executable}" + "linux|mips64|mips64-linux-gnuabi64-gcc|library|${__library}" + "linux|mips64le|mips64el-linux-gnuabi64-gcc|executable|${__executable}" + "linux|mips64le|mips64el-linux-gnuabi64-gcc|library|${__library}" + "linux|mips64r6|mipsisa64r6-linux-gnuabi64-gcc|executable|${__executable}" + "linux|mips64r6|mipsisa64r6-linux-gnuabi64-gcc|library|${__library}" + "linux|mips64r6le|mipsisa64r6el-linux-gnuabi64-gcc|executable|${__executable}" + "linux|mips64r6le|mipsisa64r6el-linux-gnuabi64-gcc|library|${__library}" + "linux|powerpc|powerpc-linux-gnu-gcc|executable|${__executable}" + "linux|powerpc|powerpc-linux-gnu-gcc|library|${__library}" + "linux|ppc64le|powerpc64le-linux-gnu-gcc|executable|${__executable}" + "linux|ppc64le|powerpc64le-linux-gnu-gcc|library|${__library}" + "linux|riscv64|riscv64-linux-gnu-gcc|executable|${__executable}" + "linux|riscv64|riscv64-linux-gnu-gcc|library|${__library}" + "windows|amd64|x86_64-w64-mingw32-gcc|executable|${__executable}" + "windows|amd64|x86_64-w64-mingw32-gcc|library|${__library}" + "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${env:PROJECT_SKU}.h" +) + + +$__placeholders = @( + "${env:PROJECT_SKU}-msi_any-any" +) + + +## NOTE: (1) C Compilers Optimization flags for known target OS and ARCH types. +function Get-Optimization-Flags { + param( + [string]$__target_os, + [string]$__target_arch + ) + + + switch ("${__target_os}") { + 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" + } default { + $__arguments = "$(C-Get-Strict-Settings) -static -pie -fPIE" + }} + + switch ("${__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" + } default { + # no changes + }} + + + # report status + return $__arguments +} + + +## 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). +function Check-Host-Can-Build-Target { + switch ("${__target_os}-${__target_arch}") { + default { + # no issue by default + return 0 + }} +} + + + + +# build algorithms - modify only when absolute necessary +function SUBROUTINE-Build { + param( + [string]$__line + ) + + + # initialize + . "${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\c.ps1" + + + # parse output + if ($(STRINGS-Is-Empty "${__line}") -eq 0) { + return 0 + } + + $__list = $__line -split "\|" + $__file_output = $__list[0] + $__file_sources = $__list[1] + $__file_type = $__list[2] + $__target_os = $__list[3] + $__target_arch = $__list[4] + $__target_compiler = $__list[5] + $__arguments = $__list[6] + $__output_directory = $__list[7] + $__output_lib_directory = $__list[8] + $__tmp_directory = $__list[9] + $__log_directory = $__list[10] + + + # validate input + if (($(STRINGS-Is-Empty "${__file_output}") -eq 0) -or + ($(STRINGS-Is-Empty "${__file_sources}") -eq 0) -or + ($(STRINGS-Is-Empty "${__file_type}") -eq 0) -or + ($(STRINGS-Is-Empty "${__target_os}") -eq 0) -or + ($(STRINGS-Is-Empty "${__target_arch}") -eq 0) -or + ($(STRINGS-Is-Empty "${__target_compiler}") -eq 0) -or + ($(STRINGS-Is-Empty "${__arguments}") -eq 0) -or + ($(STRINGS-Is-Empty "${__output_directory}") -eq 0) -or + ($(STRINGS-Is-Empty "${__output_lib_directory}") -eq 0) -or + ($(STRINGS-Is-Empty "${__tmp_directory}") -eq 0) -or + ($(STRINGS-Is-Empty "${__log_directory}") -eq 0)) { + return 1 + } + + + # prepare critical parameters + $__target = "$(FS-Extension-Remove "$(FS-Get-File "${__file_output}")" "*")" + $__workspace = "${__tmp_directory}\build-${__target}" + $__log = "${__log_directory}\${__target}" + $__file_output = "${__workspace}\$(FS-Get-File "${__file_output}")" + + $null = I18N-Build-Parallel "${__file_output}" + $null = FS-Make-Directory "${__workspace}" + $null = FS-Make-Directory "${__log}" + $___process = C-Build "${__file_output}" ` + "${__file_sources}" ` + "${__file_type}" ` + "${__target_os}" ` + "${__target_arch}" ` + "${__workspace}" ` + "${__log}" ` + "${__target_compiler}" ` + "${__arguments}" + if ($___process -ne 0) { + $null = I18N-Build-Failed-Parallel "${__file_output}" + return 1 + } + + + # export target + $__dest = "${__output_directory}" + if ("${__file_type}" -eq "library") { + $__dest = "${__output_lib_directory}" + } + $__dest = "${__dest}\$(FS-Get-File "${__file_output}")" + $null = FS-Remove-Silently "${__dest}" + $___process = FS-Copy-File "${__file_output}" "${__dest}" + if ($___process -ne 0) { + $null = I18N-Build-Failed-Parallel "${__file_output}" + return 1 + } + + if ("${__target_os}-${__target_arch}" -eq "js-wasm") { + $__source = "$(FS-Extension-Remove "${__file_output}" "*").js" + if ($(FS-Is-File "${__source}") -eq 0) { + $__dest = "$(FS-Extension-Remove "${__dest}" "*").js" + $null = FS-Remove-Silently "${__dest}" + $___process = FS-Move "${__source}" "${__dest}" + if ($___process -ne 0) { + $null = I18N-Build-Failed-Parallel "${__file_output}" + return 1 + } + } + } + + + # report status + return 0 +} + + +## register targets and execute parallel build +foreach ($__line in $__build_targets) { + if ($(STRINGS-Is-Empty "${__line}") -eq 0) { + continue + } + + + # parse target data + $__list = $__line -split "\|" + $__target_os = "$(STRINGS-To-Lowercase $__list[0])" + $__target_arch = "$(STRINGS-To-Lowercase $__list[1])" + $__target_compiler = $__list[2] + $__target_type = $__list[3] + $__source = $__list[4] + + + # validate input + switch ("${__target_type}") { + { $_ -in "elf", "exe", "executable" } { + $__file_output = "${env:PROJECT_SKU}_${__target_os}-${__target_arch}" + if (("${__target_os}" -eq "js") -and ("${__target_arch}" -eq "wasm")) { + $__file_output = "${__file_output}.wasm" + } elseif ("${__target_os}" -eq "windows") { + $__file_output = "${__file_output}.exe" + } else { + $__file_output = "${__file_output}.elf" + } + } { $_ -in "lib", "dll", "library" } { + $__file_output = "lib${env:PROJECT_SKU}_${__target_os}-${__target_arch}" + if (("${__target_os}" -eq "js") -and ("${__target_arch}" -eq "wasm")) { + $__file_output = "${__file_output}.wasm" + } elseif ("${__target_os}" -eq "windows") { + $__file_output = "${__file_output}.dll" + } else { + $__file_output = "${__file_output}.a" + } + } default { + return 1 + }} + $null = I18N-Sync-Register "${__file_output}" + + $___process = FS-Is-File "${__source}" + if ($___process -ne 0) { + $null = I18N-Sync-Failed + return 1 + } + + if (($(STRINGS-Is-Empty "${__target_os}") -eq 0) -or + ($(STRINGS-Is-Empty "${__target_arch}") -eq 0)) { + $null = I18N-Sync-Register-Skipped-Missing-Target + continue + } + + if ($(STRINGS-Is-Empty "${__target_compiler}") -eq 0) { + $___process = OS-Is-Command-Available "${__target_compiler}" + if ($___process -ne 0) { + $null = I18N-Sync-Register-Skipped-Missing-Compiler + continue + } + } else { + $__target_compiler = "$(C-Get-Compiler ` + "${__target_os}" ` + "${__target_arch}" ` + "${env:PROJECT_OS}" ` + "${env:PROJECT_ARCH}" + )" + if ($(STRINGS-Is-Empty "${__target_compiler}") -eq 0) { + $null = I18N-Sync-Register-Skipped-Missing-Compiler + continue + } + } + + $___process = Check-Host-Can-Build-Target + if ($___process -ne 0) { + continue + } + + $__arguments = "$(Get-Optimization-Flags "${__target_os}" "${__target_arch}")" + + + # target is healthy - register into build list + $null = FS-Append-File "${__parallel_directory}\parallel.txt" @" +${__file_output}|${__source}|${__target_type}|${__target_os}|${__target_arch}|${__target_compiler}|${__arguments}|${__output_directory}|${__output_lib_directory}|${__tmp_directory}|${__log_directory} + +"@ +} + + +## Execute the build +## NOTE: For some reason, the sync flag in parallel run is not free up at this +## layer. The underlying layer (object files building) is in parallel run +## and shall be given that priority. +## +## Hence, we can only use serial run for the time being. +$___process = SYNC-Exec-Serial ` + ${function:SUBROUTINE-Build}.ToString() ` + "${__parallel_directory}\parallel.txt" ` + "${__parallel_directory}" +if ($___process -ne 0) { + return 1 +} + + +## assemble additional library files +foreach ($__line in $__libs_files) { + if ($(STRINGS-Is-Empty "${__line}") -eq 0) { + continue + } + + $__list = $__line -split "\|" + + + # build the file + $__source = $__list[0] + $__dest = $__list[1] + $__file = "${__output_lib_directory}\${__dest}" + $null = I18N-Copy "${__source}" "${__dest}" + $null = FS-Remove-Silently "${__dest}" + $___process = FS-Copy-File "${__source}" "${__dest}" + if ($___process -ne 0) { + $null = I18N-Copy-Failed + return 1 + } +} + + +## export library package +$___process = FS-Is-Directory-Empty "${__output_lib_directory}" +if ($___process -ne 0) { + $__dest = "${__output_directory}/lib${env:PROJECT_SKU}-C_any-any.tar.xz" + + $null = I18N-Export "${__dest}" + $__current_path = Get-Location + $null = Set-Location -Path "${__output_lib_directory}" + $___process = TAR-Create-XZ "${__dest}" "." + $null = Set-Location -Path "${__current_path}" + $null = Remove-Variable -Name __current_path + if ($___process -ne 0) { + $null = I18N-Export-Failed + return 1 + } +} + + + + +# placeholding flag files +foreach ($__line in $__placeholders) { + if ($(STRINGS-Is-Empty "${__line}") -eq 0) { + continue + } + + + # build the file + $__file = "${__output_directory}\${__line}" + $null = I18N-Build "${__line}" + $null = FS-Remove-Silently "${__file}" + $___process = FS-Touch-File "${__file}" + if ($___process -ne 0) { + $null = I18N-Build-Failed + return 1 + } +} + + + + +# report status +return 0 diff --git a/srcC/.ci/materialize_unix-any.sh b/srcC/.ci/materialize_unix-any.sh new file mode 100644 index 0000000..fde69dc --- /dev/null +++ b/srcC/.ci/materialize_unix-any.sh @@ -0,0 +1,149 @@ +#!/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" +. "${LIBS_AUTOMATACI}/services/compilers/c.sh" + + + + +# execute +__arguments="$(C_Get_Strict_Settings)" +case "$PROJECT_OS" in +darwin) + __arguments="${__arguments} -fPIC" + ;; +*) + __arguments="${__arguments} -static -pie -fPIE" + ;; +esac + +__compiler="$(C_Get_Compiler "$PROJECT_OS" "$PROJECT_ARCH" "$PROJECT_OS" "$PROJECT_ARCH")" +if [ $(STRINGS_Is_Empty "$__compiler") -eq 0 ]; then + I18N_Build_Failed + return 1 +fi + +FS_Make_Directory "${PROJECT_PATH_ROOT}/${PROJECT_PATH_BUILD}" +FS_Remake_Directory "${PROJECT_PATH_ROOT}/${PROJECT_PATH_BIN}" +FS_Remake_Directory "${PROJECT_PATH_ROOT}/${PROJECT_PATH_LIB}" + + + + +# build main exectuable +I18N_Configure_Build_Settings +__target="${PROJECT_SKU}_${PROJECT_OS}-${PROJECT_ARCH}" +__workspace="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/materialize-${__target}" +__log="${PROJECT_PATH_ROOT}/${PROJECT_PATH_LOG}/materialize-${PROJECT_C}/${__target}" +case "$PROJECT_OS" in +windows) + __target="${__workspace}/${__target}.exe" + ;; +*) + __target="${__workspace}/${__target}.elf" + ;; +esac + +I18N_Build "$__target" +FS_Remove_Silently "$__target" +C_Build "$__target" \ + "${PROJECT_PATH_ROOT}/${PROJECT_C}/executable.txt" \ + "executable" \ + "$PROJECT_OS" \ + "$PROJECT_ARCH" \ + "$__workspace" \ + "$__log" \ + "$__compiler" \ + "$__arguments" +if [ $? -ne 0 ]; then + I18N_Build_Failed + return 1 +fi + +__dest="${PROJECT_PATH_ROOT}/${PROJECT_PATH_BIN}/${PROJECT_SKU}" +if [ "$PROJECT_OS" = "windows" ]; then + __dest="${__dest}.exe" +fi +I18N_Export "$__dest" +FS_Make_Housing_Directory "$__dest" +FS_Remove_Silently "$__dest" +FS_Move "$__target" "$__dest" +if [ $? -ne 0 ]; then + I18N_Export_Failed + return 1 +fi + + + + +# build main library +I18N_Configure_Build_Settings +__target="lib${PROJECT_SKU}_${PROJECT_OS}-${PROJECT_ARCH}" +__workspace="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/materialize-${__target}" +__log="${PROJECT_PATH_ROOT}/${PROJECT_PATH_LOG}/materialize-${PROJECT_C}/${__target}" +case "$PROJECT_OS" in +windows) + __target="${__workspace}/${__target}.dll" + ;; +*) + __target="${__workspace}/${__target}.a" + ;; +esac + +I18N_Build "$__target" +FS_Remove_Silently "$__target" +C_Build "$__target" \ + "${PROJECT_PATH_ROOT}/${PROJECT_C}/library.txt" \ + "library" \ + "$PROJECT_OS" \ + "$PROJECT_ARCH" \ + "$__workspace" \ + "$__log" \ + "$__compiler" \ + "$__arguments" +if [ $? -ne 0 ]; then + I18N_Build_Failed + return 1 +fi + +__dest="${PROJECT_PATH_ROOT}/${PROJECT_PATH_LIB}/lib${PROJECT_SKU}" +if [ "$PROJECT_OS" = "windows" ]; then + __dest="${__dest}.dll" +else + __dest="${__dest}.a" +fi +I18N_Export "$__dest" +FS_Make_Housing_Directory "$__dest" +FS_Remove_Silently "$__dest" +FS_Move "$__target" "$__dest" +if [ $? -ne 0 ]; then + I18N_Export_Failed + return 1 +fi + + + + +# report status +return 0 diff --git a/srcC/.ci/materialize_windows-any.ps1 b/srcC/.ci/materialize_windows-any.ps1 new file mode 100644 index 0000000..ccff9d7 --- /dev/null +++ b/srcC/.ci/materialize_windows-any.ps1 @@ -0,0 +1,149 @@ +# 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" +. "${env:LIBS_AUTOMATACI}\services\compilers\c.ps1" + + + + +# execute +$__arguments = "$(C-Get-Strict-Settings)" +switch ("${env:PROJECT_OS}") { +"darwin" { + $__arguments = "${__arguments} -fPIC" +} default { + $__arguments = "${__arguments} -static -pie -fPIE" +}} + +$__compiler = "$(C-Get-Compiler ` + "${env:PROJECT_OS}" ` + "${env:PROJECT_ARCH}" ` + "${env:PROJECT_OS}" ` + "${env:PROJECT_ARCH}" ` +)" +if ($(STRINGS-Is-Empty "${__compiler}") -eq 0) { + $null = I18N-Build-Failed + return 1 +} + +$null = FS-Make-Directory "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_BUILD}" +$null = FS-Remake-Directory "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_BIN}" +$null = FS-Remake-Directory "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_LIB}" + + + + +# build main executable +$null = I18N-Configure-Build-Settings +$__target = "${env:PROJECT_SKU}_${env:PROJECT_OS}-${env:PROJECT_ARCH}" +$__workspace = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\materialize-${__target}" +$__log = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_LOG}\materialize-${env:PROEJCT_C}\${__target}" +switch ("${env:PROJECT_OS}") { +"windows" { + $__target = "${__workspace}\${__target}.exe" +} default { + $__target = "${__workspace}\${__target}.elf" +}} + +$null = I18N-Build "${__target}" +$null = FS-Remove-Silently "${__target}" +$___process = C-Build "${__target}" ` + "${env:PROJECT_PATH_ROOT}\${env:PROJECT_C}\executable.txt" ` + "executable" ` + "${env:PROJECT_OS}" ` + "${env:PROJECT_ARCH}" ` + "${__workspace}" ` + "${__log}" ` + "${__compiler}" ` + "${__arguments}" +if ($___process -ne 0) { + $null = I18N-Build-Failed + return 1 +} + +$__dest = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_BIN}\${env:PROJECT_SKU}" +if ("${env:PROJECT_OS}" -eq "windows") { + $__dest = "${__dest}.exe" +} else { + $__dest = "${__dest}.elf" +} +$null = I18N-Export "${__dest}" +$null = FS-Make-Housing-Directory "${__dest}" +$null = FS-Remove-Silently "${__dest}" +$___process = FS-Move "${__target}" "${__dest}" +if ($___process -ne 0) { + $null = I18N-Export-Failed + return 1 +} + + + + +# build main library +$null = I18N-Configure-Build-Settings +$__target = "lib${env:PROJECT_SKU}_${env:PROJECT_OS}-${env:PROJECT_ARCH}" +$__workspace = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\materialize-${__target}" +$__log = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_LOG}\materialize-${env:PROEJCT_C}\${__target}" +switch ("${env:PROJECT_OS}") { +"windows" { + $__target = "${__workspace}\${__target}.dll" +} default { + $__target = "${__workspace}\${__target}.a" +}} + +$null = I18N-Build "${__target}" +$null = FS-Remove-Silently "${__target}" +$___process = C-Build "${__target}" ` + "${env:PROJECT_PATH_ROOT}\${env:PROJECT_C}\library.txt" ` + "library" ` + "${env:PROJECT_OS}" ` + "${env:PROJECT_ARCH}" ` + "${__workspace}" ` + "${__log}" ` + "${__compiler}" ` + "${__arguments}" +if ($___process -ne 0) { + $null = I18N-Build-Failed + return 1 +} + +$__dest = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_LIB}\lib${env:PROJECT_SKU}" +if ("${env:PROJECT_OS}" -eq "windows") { + $__dest = "${__dest}.dll" +} else { + $__dest = "${__dest}.a" +} +$null = I18N-Export "${__target}" "${__dest}" +$null = FS-Make-Housing-Directory "${__dest}" +$null = FS-Remove-Silently "${__dest}" +$___process = FS-Move "${__target}" "${__dest}" +if ($___process -ne 0) { + $null = I18N-Export-Failed + return 1 +} + + + + +# report status +return 0 diff --git a/srcC/.ci/test_unix-any.sh b/srcC/.ci/test_unix-any.sh new file mode 100644 index 0000000..3ff3a67 --- /dev/null +++ b/srcC/.ci/test_unix-any.sh @@ -0,0 +1,60 @@ +#!/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" +. "${LIBS_AUTOMATACI}/services/compilers/c.sh" + + + + +# execute +___source="${PROJECT_PATH_ROOT}/${PROJECT_C}" +I18N_Prepare "$___source" +___arguments="$(C_Get_Strict_Settings)" +case "$PROJECT_OS" in +darwin) + ___arguments="${___arguments} -fPIC" + ;; +*) + ___arguments="${___arguments} -pie -fPIE" + ;; +esac + + +I18N_Run_Test +C_Test "$___source" "$PROJECT_OS" "$PROJECT_ARCH" "$___arguments" +case "$?" in +0|10) + # accepted + ;; +*) + I18N_Run_Failed + return 1 + ;; +esac + + + + +# return status +return 0 diff --git a/srcC/.ci/test_windows-any.ps1 b/srcC/.ci/test_windows-any.ps1 new file mode 100644 index 0000000..aad497e --- /dev/null +++ b/srcC/.ci/test_windows-any.ps1 @@ -0,0 +1,55 @@ +# 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" +. "${env:LIBS_AUTOMATACI}\services\compilers\c.ps1" + + + + +# execute +$___source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_C}" +$null = I18N-Prepare "${___source}" +$___arguments = "$(C-Get-Strict-Settings)" +switch ("${env:PROJECT_OS}") { +"darwin" { + $___arguments = "${___arguments} -fPIC" +} default { + $___arguments = "${___arguments} -pie -fPIE" +}} + + +$null = I18N-Run-Test +$___process = C-Test "${___source}" "${env:PROJECT_OS}" "${env:PROJECT_ARCH}" "${___arguments}" +switch ("${___process}") { +{ $_ -in "0", "10" } { + # accepted +} default { + $null = I18N-Run-Failed + return 1 +}} + + + + +# report status +return 0 diff --git a/srcC/executable.txt b/srcC/executable.txt new file mode 100644 index 0000000..656c3d6 --- /dev/null +++ b/srcC/executable.txt @@ -0,0 +1,27 @@ +# AUTOMATACI SOURCE CODES LIST +# +# Step to do: +# (1) List all the source codes for compilation in the following patterns: +# [OS]-[ARCH] relative/path/to/code.[TYPE] +# Example (1): +# any-any main.c +# linux-amd64 fx1_linux-amd64.c +# linux-amd64 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 +# signal an omninous source for a particular OS or ARCH. 'any-any' for all +# types of OS and ARCH. +# +# (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/greeters/Vanilla.c +any-any main.c diff --git a/srcC/library.txt b/srcC/library.txt new file mode 100644 index 0000000..3f5ba01 --- /dev/null +++ b/srcC/library.txt @@ -0,0 +1,26 @@ +# AUTOMATACI SOURCE CODES LIST +# +# Step to do: +# (1) List all the source codes for compilation in the following patterns: +# [OS]-[ARCH] relative/path/to/code.[TYPE] +# Example (1): +# any-any main.c +# linux-amd64 fx1_linux-amd64.c +# linux-amd64 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 +# signal an omninous source for a particular OS or ARCH. 'any-any' for all +# types of OS and ARCH. +# +# (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/greeters/Vanilla.c diff --git a/srcC/libs/entities/Vanilla.h b/srcC/libs/entities/Vanilla.h new file mode 100644 index 0000000..e212256 --- /dev/null +++ b/srcC/libs/entities/Vanilla.h @@ -0,0 +1,15 @@ +/* + * [ LICENSE CLAUSE HERE ] + */ +#ifndef SAMPLE_ENTITY_H +#define SAMPLE_ENTITY_H + + + + +const char *NAME = "Jane"; + + + + +#endif diff --git a/srcC/libs/greeters/Vanilla.c b/srcC/libs/greeters/Vanilla.c new file mode 100644 index 0000000..b98b626 --- /dev/null +++ b/srcC/libs/greeters/Vanilla.c @@ -0,0 +1,112 @@ +/* + * [ COPYRIGHT CLAUSE HERE ] + */ +static int len(const char *str) { + const char *anchor = str; + while (*str) { + str++; + } + return str - anchor; +} + + + + +extern void Process(char writer[500], const char *name, const char *location) { + int i=0, j; + + if (!name || len(name) == 0 || name[0] == '\0' ) { + if (!location || len(location) == 0 || location[0] == '\0' ) { + writer[i] = '\0'; + return; + } + + /* valid location only */ + writer[i] = 's'; + i++; + writer[i] = 't'; + i++; + writer[i] = 'r'; + i++; + writer[i] = 'a'; + i++; + writer[i] = 'n'; + i++; + writer[i] = 'g'; + i++; + writer[i] = 'e'; + i++; + writer[i] = 'r'; + i++; + writer[i] = ' '; + i++; + writer[i] = 'f'; + i++; + writer[i] = 'r'; + i++; + writer[i] = 'o'; + i++; + writer[i] = 'm'; + i++; + writer[i] = ' '; + i++; + + j=0; + while (location[j] != '\0') { + writer[i] = location[j]; + i++; + j++; + } + + writer[i] = '!'; + i++; + writer[i] = '\0'; + return; + } else if (!location || len(location) == 0 || location[0] == '\0' ) { + /* valid name only */ + j=0; + while (name[j] != '\0') { + writer[i] = name[j]; + i++; + j++; + } + + writer[i] = '!'; + i++; + writer[i] = '\0'; + return; + } else { + /* valid name and location */ + j=0; + while (name[j] != '\0') { + writer[i] = name[j]; + i++; + j++; + } + + writer[i] = ' '; + i++; + writer[i] = 'f'; + i++; + writer[i] = 'r'; + i++; + writer[i] = 'o'; + i++; + writer[i] = 'm'; + i++; + writer[i] = ' '; + i++; + + j=0; + while (location[j] != '\0') { + writer[i] = location[j]; + i++; + j++; + } + + writer[i] = '!'; + i++; + writer[i] = '\0'; + return; + } +} diff --git a/srcC/libs/greeters/Vanilla.h b/srcC/libs/greeters/Vanilla.h new file mode 100644 index 0000000..e2ff7b3 --- /dev/null +++ b/srcC/libs/greeters/Vanilla.h @@ -0,0 +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/greeters/Vanilla_test.c b/srcC/libs/greeters/Vanilla_test.c new file mode 100644 index 0000000..58bfb94 --- /dev/null +++ b/srcC/libs/greeters/Vanilla_test.c @@ -0,0 +1,110 @@ +/* + * [ LICENSE CLAUSE HERE ] + */ +#include + +#include "../testing/Vanilla.h" +#include "./Vanilla.c" + + + + +/* define test algorithm */ +static int test_process_api(struct Scenario *s, const char *name, const char *location) { + /* prepare */ + char str[500] = { '\0' }; + + + /* test */ + Process(str, name, location); + + + /* log output */ + Logf("TEST CASE\n"); + Logf("=========\n"); + + Logf("Test Scenario ID\n"); + Logf(" %ld\n", s->ID); + + Logf("Test Scenario Name\n"); + Logf(" %s\n", s->Name); + + Logf("Test Scenario Description\n"); + Logf(" %s\n", s->Description); + + Logf("Input Name\n"); + Logf(" %s\n", name); + + Logf("Input Location\n"); + Logf(" %s\n", location); + + Logf("Got Output:\n"); + Logf(" %s\n", str); + + Logf("\n"); + + + /* assert */ + Logf("Asserting conditions...\n"); + if (strcmp(str, "") != 0) { + if (strcmp(name, "") == 0 && strcmp(location, "") == 0) { + Logf("[ FAILED ] Expecting string but got empty instead.\n\n\n"); + return 1; + } + } else { + /* it's an empty output */ + if (!(strcmp(name, "") == 0 && strcmp(location, "") == 0)) { + Logf("[ FAILED ] Expecting empty string but got result instead.\n\n\n"); + return 1; + } + } + + + /* report status */ + Logf("[ PASSED ]\n\n\n"); + return 0; +} + + + + +/* execute test suite on run */ +int main(void) { + int exit=0; + struct Scenario s; + + + /* setup test suite */ + s.ID = 0; + s.Name = "Test Process(...) API"; + + + /* run test */ + s.Description = "Test Process() is able to work with proper name and location."; + if (test_process_api(&s, "Alpha", "Rivendell") != 0) { + exit=1; + } + s.ID++; + + s.Description = "Test Process() is able to work with proper name and empty location."; + if (test_process_api(&s, "Alpha", "") != 0) { + exit=1; + } + s.ID++; + + s.Description = "Test Process() is able to work with empty name and proper location."; + if (test_process_api(&s, "", "Rivendell") != 0) { + exit=1; + } + s.ID++; + + s.Description = "Test Process() is able to work with empty name and empty location."; + if (test_process_api(&s, "", "") != 0) { + exit=1; + } + s.ID++; + + + /* report status */ + return exit; +} diff --git a/srcC/libs/locations/Vanilla.h b/srcC/libs/locations/Vanilla.h new file mode 100644 index 0000000..1e1333f --- /dev/null +++ b/srcC/libs/locations/Vanilla.h @@ -0,0 +1,15 @@ +/* + * [ LICENSE CLAUSE HERE ] + */ +#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 0000000..f7ea275 --- /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 new file mode 100644 index 0000000..4fdc927 --- /dev/null +++ b/srcC/main.c @@ -0,0 +1,32 @@ +/* + * [ LICENSE CLAUSE HERE ] + */ +#include + +#include "libs/entities/Vanilla.h" +#include "libs/locations/Vanilla.h" +#include "libs/greeters/Vanilla.h" + + + + +int main(int argc, char *argv[]) { + int i; + + + /* run functions */ + char str[500] = { '\0' }; + Process(str, NAME, LOCATION); + printf("Hello %s\n", str); + + + /* handle parameters */ + printf("\n\nThese are your given arguments: \n"); + for (i=0; i