diff --git a/.github/workflows/anchor-build-and-release.yml b/.github/workflows/anchor-build-and-release.yml index 6d9c103..7f9a740 100644 --- a/.github/workflows/anchor-build-and-release.yml +++ b/.github/workflows/anchor-build-and-release.yml @@ -1,82 +1,101 @@ -name: Build and Release +name: Build and Release (Anchor) on: + schedule: [{cron: "1 1 1 * *"}] + workflow_dispatch: { } push: + paths-ignore: + - '**.md' + - '**.json' + - '.gitignore' + - '.vscode/**' branches: - anchor + jobs: - BuildRaw: + suite-build: runs-on: ubuntu-latest + strategy: + max-parallel: 10 + fail-fast: false + matrix: + suite: [ jammy ] + variant: [ raw ] + architecture: [ armhf, arm64 ] #, amd64 ] + steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: docker/setup-qemu-action@v2 - - name: Setup Dependencies - run: sudo apt-get update; sudo apt-get install git build-essential binfmt-support qemu-user-static debootstrap -y - - - name: checkout submoudles + - name: ⤵️ Install Dependencies + run: | + sudo apt-get update + sudo apt-get install git build-essential binfmt-support qemu-user-static debootstrap -y + + - name: 📥 Download Submodules run: | git submodule init git submodule update - - name: Build tarballs - run: | - sudo bash build.sh -s jammy -v raw -a arm64 - - - name: upload artifacts + + - name: 🛠️ Build ${{ matrix.suite }}-${{ matrix.variant }}-${{ matrix.architecture }} + run: sudo bash build.sh -s ${{ matrix.suite }} -v ${{ matrix.variant }} -a ${{ matrix.architecture }} + + - name: ⬆️ Upload Tarballs uses: actions/upload-artifact@v3 with: - name: raw-tarballs - path: fs-cook/out/*.tar.gz - - Create-Release: + name: ${{ matrix.suite }}-${{ matrix.architecture }}-tarballs + path: fs-cook/out/${{ matrix.suite }}-${{ matrix.variant }}-${{ matrix.architecture }}.tar.gz + + create-release: runs-on: ubuntu-latest - needs: - - BuildRaw + + if: ${{ always() }} + needs: suite-build + steps: - - uses: actions/checkout@v2 - - uses: actions/download-artifact@v3 - with: - name: raw-tarballs - - name: Compute release tag - run: | - pip3 install requests - python3 /home/runner/work/udroid-download/udroid-download/.github/scripts/compute-release-tag.py - - - name: Generate release notes - run: sudo bash /home/runner/work/udroid-download/udroid-download/.github/scripts/generate-release-notes.sh - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ env.VERSIONTAG }} - release_name: ${{ env.VERSIONTAG }} - body_path: release.md - draft: false - prerelease: true - - name: Sleep for sometime - run: sleep 60 - - name: Upload assets - run: | - set -x - assets=() - for asset in ./*.tar.gz; do - assets+=("-a" "$asset") - done - tag_name="${VERSIONTAG}" - hub release edit -F release.md "${assets[@]}" -m "$tag_name" "$tag_name" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: update json - run: | - sudo apt-get install python3 -y - sudo python3 gen_data/gen-update-json.py --release-tag ${{ env.VERSIONTAG }} - set +e - git config user.name github-actions[bot] - git config user.email 41898282+github-actions[bot]@users.noreply.github.com - git add distro-data.json - git commit -m "AUTO: update distro-data.json" - git push - set -e + - uses: actions/checkout@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: 📥 Download All Tarballs + uses: actions/download-artifact@v3 + + - name: 🏷 Generate Release Tag + run: | + udroid_version=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' \ + https://github.com/RandomCoderOrg/ubuntu-on-android \ + | tail -n1 | cut -d / -f 3 | cut -d v -f 2- ) + + udroid_download=$( + git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' \ + https://github.com/RandomCoderOrg/udroid-download \ + | tail -n1 | cut -d / -f 3 + ) + + echo "VERSIONTAG=V${udroid_version}${BUILD_TYPE}R$((${udroid_download: -2} + 1))" >> $GITHUB_ENV + + - name: 📝 Generate Release Notes + run: sudo bash /home/runner/work/udroid-download/udroid-download/.github/scripts/generate-release-notes.sh + + - name: ⬆️ Upload Suite Tarballs + uses: ncipollo/release-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ env.VERSIONTAG }} + name: ${{ env.VERSIONTAG }} + bodyFile: release.md + draft: false + prerelease: false + artifacts: '*-*-tarballs/*.tar.gz' + makeLatest: true + + - name: ⚙️ Generate New distro-data.json + run: sudo python3 gen_data/gen-update-json.py --release-tag ${{ env.VERSIONTAG }} + + - name: ⚙️ Update distro-data.json + uses: stefanzweifel/git-auto-commit-action@v4 + with: + skip_fetch: false + skip_checkout: false + commit_message: 'AUTO JOB: (ANCHOR) update distro-data.json for ${{ env.VERSIONTAG }}' + file_pattern: distro-data.json diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 4d6dd91..f39207e 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -1,234 +1,106 @@ name: Build and Release on: schedule: [{cron: "1 1 1 * *"}] + workflow_dispatch: { } push: + paths-ignore: + - '**.md' + - '**.json' + - '.gitignore' + - '.vscode/**' branches: - main jobs: - lxqtDE: + generate-matrix: runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} steps: - - uses: actions/checkout@v2 - - uses: docker/setup-qemu-action@v2 + - uses: actions/checkout@v3 + - name: Generate Matrix JSON + id: set-matrix + run: echo "matrix=$( python3 gen_data/gen-suite-matrix.py )" >> $GITHUB_OUTPUT - - name: Setup Dependencies - run: sudo apt-get update; sudo apt-get install git build-essential binfmt-support qemu-user-static debootstrap -y - - - name: checkout submoudles - run: | - git submodule init - git submodule update - - name: Build tarballs - run: | - sudo bash build.sh -s jammy -v lxqtRaw -a arm64 - - - name: upload artifacts - uses: actions/upload-artifact@v3 - with: - name: lxqtde-tarballs - path: fs-cook/out/*.tar.gz - xfce4DE: + suite-build: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: docker/setup-qemu-action@v2 + needs: generate-matrix + strategy: + max-parallel: 10 + fail-fast: false + matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} - - name: Setup Dependencies - run: sudo apt-get update; sudo apt-get install git build-essential binfmt-support qemu-user-static debootstrap -y - - - name: checkout submoudles - run: | - git submodule init - git submodule update - - name: Build tarballs - run: | - sudo bash build.sh -s jammy -v xfce4Raw -a arm64 - - - name: upload artifacts - uses: actions/upload-artifact@v3 - with: - name: xfce4de-tarballs - path: fs-cook/out/*.tar.gz - kdeDE: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: docker/setup-qemu-action@v2 - - - name: Setup Dependencies - run: sudo apt-get update; sudo apt-get install git build-essential binfmt-support qemu-user-static debootstrap -y - - - name: checkout submoudles - run: | - git submodule init - git submodule update - - name: Build tarballs + - name: ⤵️ Install Dependencies run: | - sudo bash build.sh -s jammy -v kdeRaw -a arm64 - - name: upload artifacts - uses: actions/upload-artifact@v3 - with: - name: kdede-tarballs - path: fs-cook/out/*.tar.gz - gnomeDE: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: docker/setup-qemu-action@v2 + sudo apt-get update + sudo apt-get install git build-essential binfmt-support qemu-user-static debootstrap -y - - name: Setup Dependencies - run: sudo apt-get update; sudo apt-get install git build-essential binfmt-support qemu-user-static debootstrap -y - - - name: checkout submoudles + - name: 📥 Download Submodules run: | git submodule init git submodule update - - name: Build tarballs - run: | - sudo bash build.sh -s lunar -v gnomeRaw -a arm64 - - name: upload artifacts - uses: actions/upload-artifact@v3 - with: - name: gnomede-tarballs - path: fs-cook/out/*.tar.gz - mateDE: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: docker/setup-qemu-action@v2 + - name: 🛠️ Build ${{ matrix.suite }}-${{ matrix.variant }}-${{ matrix.architecture }} + run: sudo bash build.sh -s ${{ matrix.suite }} -v ${{ matrix.variant }} -a ${{ matrix.architecture }} - - name: Setup Dependencies - run: sudo apt-get update; sudo apt-get install git build-essential binfmt-support qemu-user-static debootstrap -y - - - name: checkout submoudles - run: | - git submodule init - git submodule update - - name: Build tarballs - run: | - sudo bash build.sh -s jammy -v mateRaw -a arm64 - - - name: upload artifacts + - name: ⬆️ Upload Tarballs uses: actions/upload-artifact@v3 with: - name: matede-tarballs - path: fs-cook/out/*.tar.gz + name: ${{ matrix.suite }}-${{ matrix.architecture }}-tarballs + path: fs-cook/out/${{ matrix.suite }}-${{ matrix.variant }}-${{ matrix.architecture }}.tar.gz - BuildRaw: + create-release: runs-on: ubuntu-latest + + if: ${{ always() }} + needs: suite-build + steps: - - uses: actions/checkout@v2 - - uses: docker/setup-qemu-action@v2 + - uses: actions/checkout@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: 📥 Download All Tarballs + uses: actions/download-artifact@v3 - - name: Setup Dependencies - run: sudo apt-get update; sudo apt-get install git build-essential binfmt-support qemu-user-static debootstrap -y - - - name: checkout submoudles + - name: 🏷 Generate Release Tag run: | - git submodule init - git submodule update - - name: Build tarballs - run: | - sudo bash build.sh -s jammy -v raw -a all - sudo bash build.sh -s kinetic -v raw -a all - sudo bash build.sh -s lunar -v raw -a all - sudo bash build.sh -s focal -v raw -a all - - - name: upload artifacts - uses: actions/upload-artifact@v3 + udroid_version=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' \ + https://github.com/RandomCoderOrg/ubuntu-on-android \ + | tail -n1 | cut -d / -f 3 | cut -d v -f 2- ) + + udroid_download=$( + git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' \ + https://github.com/RandomCoderOrg/udroid-download \ + | tail -n1 | cut -d / -f 3 + ) + + echo "VERSIONTAG=V${udroid_version}${BUILD_TYPE}R$((${udroid_download: -2} + 1))" >> $GITHUB_ENV + + - name: 📝 Generate Release Notes + run: sudo bash /home/runner/work/udroid-download/udroid-download/.github/scripts/generate-release-notes.sh + + - name: ⬆️ Upload Suite Tarballs + uses: ncipollo/release-action@v1 with: - name: raw-tarballs - path: fs-cook/out/*.tar.gz - - Create-Release: - runs-on: ubuntu-latest - needs: - - BuildRaw - - xfce4DE - - gnomeDE - - mateDE - - lxqtDE - - kdeDE + token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ env.VERSIONTAG }} + name: ${{ env.VERSIONTAG }} + bodyFile: release.md + draft: false + prerelease: false + artifacts: '*-*-tarballs/*.tar.gz' + makeLatest: true - steps: - - uses: actions/checkout@v2 - - name: ⬇️ Download xfce4 DE artifacts - uses: actions/download-artifact@v3 - with: - name: xfce4de-tarballs - - - name: ⬇️ Download gnome DE artifacts - uses: actions/download-artifact@v3 - with: - name: gnomede-tarballs - - - name: ⬇️ Download mate DE artifacts - uses: actions/download-artifact@v3 - with: - name: matede-tarballs - - - name: ⬇️ Download lxqt DE artifacts - uses: actions/download-artifact@v3 - with: - name: lxqtde-tarballs - - - name: ⬇️ Download kde DE artifacts - uses: actions/download-artifact@v3 - with: - name: kdede-tarballs - - - name: ⬇️ Download RAW artifacts - uses: actions/download-artifact@v3 - with: - name: raw-tarballs - - name: Compute release tag - run: | - udroid_version=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' \ - https://github.com/RandomCoderOrg/ubuntu-on-android \ - | tail -n1 | cut -d / -f 3 | cut -d v -f 2- ) - udroid_download=$( - git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' \ - https://github.com/RandomCoderOrg/udroid-download \ - | tail -n1 | cut -d / -f 3 - ) - echo "VERSIONTAG=V${udroid_version}${BUILD_TYPE}R$((${udroid_download: -2} + 1))" >> $GITHUB_ENV - - name: Generate release notes - run: sudo bash /home/runner/work/udroid-download/udroid-download/.github/scripts/generate-release-notes.sh - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ env.VERSIONTAG }} - release_name: ${{ env.VERSIONTAG }} - body_path: release.md - draft: false - prerelease: false - - name: Sleep for sometime - run: sleep 60 - - name: ⬆️ Upload assets - run: | - set -x - assets=() - for asset in ./*.tar.gz; do - assets+=("-a" "$asset") - done - tag_name="${VERSIONTAG}" - hub release edit -F release.md "${assets[@]}" -m "$tag_name" "$tag_name" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: ⚙️ update json - run: | - sudo apt-get install python3 -y - sudo python3 gen_data/gen-update-json.py --release-tag ${{ env.VERSIONTAG }} - set +e - git config user.name github-actions[bot] - git config user.email 41898282+github-actions[bot]@users.noreply.github.com - git add distro-data.json - git commit -m "AUTO: update distro-data.json" - git push - set -e + - name: ⚙️ Generate New distro-data.json + run: sudo python3 gen_data/gen-update-json.py --release-tag ${{ env.VERSIONTAG }} + + - name: ⚙️ Update distro-data.json + uses: stefanzweifel/git-auto-commit-action@v4 + with: + skip_fetch: false + skip_checkout: false + commit_message: 'AUTO JOB: (MAIN) update distro-data.json for ${{ env.VERSIONTAG }}' + file_pattern: distro-data.json diff --git a/README.md b/README.md new file mode 100644 index 0000000..6f1415a --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +[![CodeFactor](https://www.codefactor.io/repository/github/thatmg393/udroid-download/badge/main)](https://www.codefactor.io/repository/github/thatmg393/udroid-download/overview/main) + +# udroid-download + +An ( fs-cook & debootstrap ) wrapper to build udroid with cmdline diff --git a/build.sh b/build.sh index f6d9bad..9e0e7c3 100644 --- a/build.sh +++ b/build.sh @@ -79,7 +79,7 @@ function _help() { msg "USAGE: ${0} [options] [value]" msg "options:" msg "-s | --suite : To set suite name" - msg "-v | --vareint : To set varient name [ default = raw ]" + msg "-v | --varient : To set varient name [ default = raw ]" msg "-a | --arch : To set arch [ default = all ]" msg "-l | --list: To show all suites and varients" msg "examples:" diff --git a/distro-data.json b/distro-data.json index 6607670..3b7e775 100644 --- a/distro-data.json +++ b/distro-data.json @@ -25,10 +25,10 @@ ], "Name": "udroid-jammy-raw", "FirendlyName": "Ubuntu 22.04 LTS - Jammy (raw)", - "aarch64url": "https://github.com/RandomCoderOrg/udroid-download/releases/download/V3R36/jammy-raw-arm64.tar.gz", - "aarch64sha": "6366ba38d93ab12f73b59e3bc0c6321b1e42e33bf85a2e5c4c8163ef608bdf4f", - "armhfurl": "https://github.com/RandomCoderOrg/udroid-download/releases/download/V3R36/jammy-raw-armhf.tar.gz", - "armhfsha": "44f92502e9c427289c359e7aa99554eb325e69fc96ac1cb4a11af49d1748dcb3", + "aarch64url": "https://github.com/RandomCoderOrg/udroid-download/releases/download/V3R37/jammy-raw-arm64.tar.gz", + "aarch64sha": "d168da66a3fc67560359ca5af6510d9f8e5ec48fd5cedd8d624638bbe2db14f4", + "armhfurl": "https://github.com/RandomCoderOrg/udroid-download/releases/download/V3R37/jammy-raw-armhf.tar.gz", + "armhfsha": "ca0bb1a629692279698a4265d455240eda50dc955f9d551a316c3e295c2585e8", "amd64url": "https://github.com/RandomCoderOrg/udroid-download/releases/download/V3R36/jammy-raw-amd64.tar.gz", "amd64sha": "3778af173a70ef9cf5677136e74f92e17a8444f16f6505fefbc194f6798bc067" }, @@ -84,7 +84,9 @@ "kdeRaw": { "arch": [ "arm64", - "aarch64" + "aarch64", + "armhf", + "arm" ], "Name": "jammy-kdeRaw", "FirendlyName": "jammy kdeRaw", @@ -94,7 +96,9 @@ "lxqtRaw": { "arch": [ "arm64", - "aarch64" + "aarch64", + "armhf", + "arm" ], "Name": "jammy-lxqtRaw", "FirendlyName": "jammy lxqtRaw", @@ -104,7 +108,9 @@ "mateRaw": { "arch": [ "arm64", - "aarch64" + "aarch64", + "armhf", + "arm" ], "Name": "jammy-mateRaw", "FirendlyName": "jammy mateRaw", @@ -152,7 +158,8 @@ }, "kinetic": { "varients": [ - "raw" + "raw", + "gnomeRaw" ], "raw": { "arch": [ @@ -199,7 +206,9 @@ "gnomeRaw": { "arch": [ "arm64", - "aarch64" + "aarch64", + "armhf", + "arm" ], "Name": "lunar-gnomeRaw", "FirendlyName": "lunar gnomeRaw", diff --git a/gen_data/arch.py b/gen_data/arch.py index e3f5ac6..89f7081 100644 --- a/gen_data/arch.py +++ b/gen_data/arch.py @@ -10,22 +10,22 @@ def translated_arch() -> dict: # SystemArchitecture:PackageArchitecture return dict( { - "armhf": "armhf", - "arm": "armhf", - "arm64": "aarch64", - "aarch64": "aarch64", - "amd64": "amd64", - "x86_64": "amd64" + "armhf": "armhf", + "arm": "armhf", + "arm64": "aarch64", + "aarch64": "aarch64", + "amd64": "amd64", + "x86_64": "amd64" } ) def ReverseTranslate() -> dict: - StoPdict = translated_arch(); + StoPdict = translated_arch() PtoSdict = {} - for SysArch,PakArch in zip(StoPdict.keys(),StoPdict.values()): + for SysArch, PakArch in zip(StoPdict.keys(),StoPdict.values()): if PakArch in PtoSdict: PtoSdict[PakArch].append(SysArch) else: diff --git a/gen_data/gen-suite-matrix.py b/gen_data/gen-suite-matrix.py new file mode 100644 index 0000000..95e1772 --- /dev/null +++ b/gen_data/gen-suite-matrix.py @@ -0,0 +1,30 @@ +import json +import glob + +SUITES_DIR="./suites/*" + +# ARCHITECTURE CAN BE: all, amd64, arm64, armhf +# it has high priority over the architecture specified in the suite +# set it to "all" to build all architectures defined in the /.sh file +ARCHITECTURES = [ "all" ] + +def generate_matrix_json() -> None: + json_data = { "include": [ ] } + + for arch in ARCHITECTURES: + for variantPath in glob.iglob(f"{SUITES_DIR}/*", recursive=False): + suiteName = variantPath.split('/')[2] + variantName = variantPath.split('/')[3] + + element = { } + + element['suite'] = suiteName + element['variant'] = variantName + element['architecture'] = arch + + json_data['include'].append(element) + + print(json.dumps(json_data, sort_keys=True, indent=None, separators=(',', ':'))) + +if __name__ == '__main__': + generate_matrix_json() diff --git a/gen_data/gen-update-json.py b/gen_data/gen-update-json.py index ca786bc..47fbf92 100644 --- a/gen_data/gen-update-json.py +++ b/gen_data/gen-update-json.py @@ -4,14 +4,15 @@ import utils import arch -GIT_ROOT = os.popen("git rev-parse --show-toplevel").read().strip() -DIR = "." -VERBOSE = False -JSON_CONF = f"{GIT_ROOT}/distro-data.json" +GIT_ROOT = utils.Popen( ["/usr/bin/git", "rev-parse", "--show-toplevel"] ) +GIT_REMOTE_URL = utils.Popen( ["/usr/bin/git", "config", "--get", "remote.origin.url"] ) +DIR = "." +VERBOSE = False +DISTRO_DATA_JSON = f"{GIT_ROOT}/distro-data.json" -def update_json_conf(file) -> None: - data = strip_info(file) - jdata = json.load(open(JSON_CONF, 'r')) +def update_data_json(file_path: str) -> None: + data = strip_info(file_path) + jdata = json.load(open(DISTRO_DATA_JSON, 'r')) # resolv data jdata = utils.resolv_data(jdata, data[0], data[1], [data[2]]) @@ -24,29 +25,29 @@ def update_json_conf(file) -> None: # update sha jdata[data[0]] \ [data[1]] \ - [f"{data[2]}sha"] = os.popen(f"sha256sum {file}").read().split()[0] + [f"{data[2]}sha"] = utils.Popen( ["sha256sum", f"{file_path}"] ).split()[0] - # update JSON_CONF - file = open(JSON_CONF, 'w') + # update DISTRO_DATA_JSON + file = open(DISTRO_DATA_JSON, 'w') json.dump(jdata, file, indent=4) -def strip_info(file): - basename = os.path.basename(file) +def strip_info(file_path: str) -> list: + basename = os.path.basename(file_path) name = os.path.splitext(basename)[0] name = os.path.splitext(name)[0] - sp = name.split("-") + sp = name.split("-") StoPdict = arch.translated_arch() - suite = sp[0] + suite = sp[0] variant = sp[1] - packageArchitecture = StoPdict[sp[2]] + packageArchitecture = StoPdict[sp[2]] return [suite, variant, packageArchitecture, basename] -def get_release_url(release_tag, file) -> str: - repo ="https://github.com/RandomCoderOrg/udroid-download" - url ="{}/releases/download/{}/{}".format(repo, release_tag, file) +def get_release_url(release_tag: str, file_path: str) -> str: + url = "{}/releases/download/{}/{}".format(GIT_REMOTE_URL, release_tag, file_path) + return url if __name__ == '__main__': @@ -55,14 +56,11 @@ def get_release_url(release_tag, file) -> str: parser.add_option('-R', '--release-tag', dest='release_tag', help='release tag', type=str) - - options, args = parser.parse_args() - # get release tag - from utils import getfilesR + options, args = parser.parse_args() + # get release tag RELEASE_TAG = options.release_tag - for file in getfilesR(DIR): - if file.endswith(".tar.gz"): - update_json_conf(file) - + for file_path in utils.getfilesR(DIR): + if file_path.endswith(".tar.gz"): + update_data_json(file_path) diff --git a/gen_data/utils.py b/gen_data/utils.py index a89a8d0..3650de8 100644 --- a/gen_data/utils.py +++ b/gen_data/utils.py @@ -1,4 +1,5 @@ import os +import subprocess def add_suite(JsonFile: dict, suite: str) -> None: """ Add suite to the JsonFile @@ -54,7 +55,19 @@ def resolv_data( Name: str = ..., FriendlyName: str = ..., ) -> dict: - + """Resolvs the data and add it to the json_data + + Args: + json_data (dict): _description_ + suite (str): _description_ + variant (str): _description_ + arch (list[str]): _description_ + Name (str, optional): _description_. Defaults to .... + FriendlyName (str, optional): _description_. Defaults to .... + + Returns: + dict: _description_ + """ if Name is ...: Name = f"{suite}-{variant}" @@ -74,6 +87,14 @@ def resolv_data( return json_data def getfilesR(path: str) -> list: + """Get all files in a directory recursively + + Args: + path (str): The path to the directory + + Returns: + list: The list of files + """ files = [] # include depth @@ -82,3 +103,14 @@ def getfilesR(path: str) -> list: files.append(os.path.join(r, file)) return files + +def Popen(cmd: list) -> str: + """Run a command and return the output as a string + + Args: + cmd (list): The command to run + + Returns: + str: The output of the command + """ + return subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE).stdout.read().strip().decode('utf-8') diff --git a/setup.sh b/setup.sh index 42789d3..db6d19d 100644 --- a/setup.sh +++ b/setup.sh @@ -6,7 +6,7 @@ shout() { echo -e "[-] ${*}";:;} lshout() { echo -e "-> ${*}";:;} msg() { echo -e "${*} \e[0m" >&2;:;} -DEPS="debootstrap qemu-user-static binfmt-support git" +DEPS="git build-essential binfmt-support qemu-user-static debootstrap" # ROOT user check if ((UID != 0 )); then @@ -16,7 +16,7 @@ else fi # Force install dependencies -shout "resolving Dependencies" +shout "Resolving Dependencies" $SUDO apt update || { die "Failed to update indexes" } diff --git a/suites/kinetic/gnomeRaw/gnomeRaw.sh b/suites/kinetic/gnomeRaw/gnomeRaw.sh index f41743d..0a1b103 100644 --- a/suites/kinetic/gnomeRaw/gnomeRaw.sh +++ b/suites/kinetic/gnomeRaw/gnomeRaw.sh @@ -12,7 +12,7 @@ export ENABLE_EXIT export ENABLE_USER_SETUP export INCLUDE_PACKAGES -SUITE="lunar" +SUITE="kinetic" VARIENT="gnomeRaw" frn="out/$SUITE-$VARIENT" OVERRIDER_COMPRESSION_TYPE="gzip"