monorepo: apply changes suggested by buttaface
This commit is contained in:
parent
52c383b4d1
commit
f0ea9b922b
52
.github/workflows/packages.yml
vendored
52
.github/workflows/packages.yml
vendored
@ -5,14 +5,14 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
paths:
|
paths:
|
||||||
- 'main/**'
|
- 'packages/**'
|
||||||
- 'x11/**'
|
- 'root-packages/**'
|
||||||
- 'root/**'
|
- 'x11-packages/**'
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- 'main/**'
|
- 'packages/**'
|
||||||
- 'x11/**'
|
- 'root-packages/**'
|
||||||
- 'root/**'
|
- 'x11-packages/**'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
packages:
|
packages:
|
||||||
@ -78,32 +78,33 @@ jobs:
|
|||||||
cd ..
|
cd ..
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for repo in main x11 root; do
|
for repo_path in $(jq --raw-output 'keys | .[]' < repo.json); do
|
||||||
|
local repo=$(jq --raw-output '.["'$repo_path'"]' < repo.json)
|
||||||
# Parse changed files and identify new packages and deleted packages.
|
# Parse changed files and identify new packages and deleted packages.
|
||||||
# Create lists of those packages that will be passed to upload job for
|
# Create lists of those packages that will be passed to upload job for
|
||||||
# further processing.
|
# further processing.
|
||||||
while read -r file; do
|
while read -r file; do
|
||||||
if ! [[ $file == $repo/* ]]; then
|
if ! [[ $file == $repo_path/* ]]; then
|
||||||
# This file does not belong to a package, so ignore it
|
# This file does not belong to a package, so ignore it
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
if [[ $file =~ ^$repo/([.a-z0-9+-]*)/([.a-z0-9+-]*).subpackage.sh$ ]]; then
|
if [[ $file =~ ^$repo_path/([.a-z0-9+-]*)/([.a-z0-9+-]*).subpackage.sh$ ]]; then
|
||||||
# A subpackage was modified, check if it was deleted or just updated
|
# A subpackage was modified, check if it was deleted or just updated
|
||||||
pkg=${BASH_REMATCH[1]}
|
pkg=${BASH_REMATCH[1]}
|
||||||
subpkg=${BASH_REMATCH[2]}
|
subpkg=${BASH_REMATCH[2]}
|
||||||
if [ ! -f "${repo}/${pkg}/${subpkg}.subpackage.sh" ]; then
|
if [ ! -f "${repo_path}/${pkg}/${subpkg}.subpackage.sh" ]; then
|
||||||
echo "$subpkg" >> ./deleted_$repo_packages.txt
|
echo "$subpkg" >> ./deleted_$repo_packages.txt
|
||||||
fi
|
fi
|
||||||
elif [[ $file =~ ^$repo/([.a-z0-9+-]*)/.*$ ]]; then
|
elif [[ $file =~ ^$repo_path/([.a-z0-9+-]*)/.*$ ]]; then
|
||||||
# package, check if it was deleted or updated
|
# package, check if it was deleted or updated
|
||||||
pkg=${BASH_REMATCH[1]}
|
pkg=${BASH_REMATCH[1]}
|
||||||
if [ ! -d "${repo}/${pkg}" ]; then
|
if [ ! -d "${repo_path}/${pkg}" ]; then
|
||||||
echo "$pkg" >> ./deleted_$repo_packages.txt
|
echo "$pkg" >> ./deleted_$repo_packages.txt
|
||||||
else
|
else
|
||||||
echo "$pkg" >> ./built_$repo_packages.txt
|
echo "$pkg" >> ./built_$repo_packages.txt
|
||||||
# If there are subpackages we want to create a list of those
|
# If there are subpackages we want to create a list of those
|
||||||
# as well
|
# as well
|
||||||
for file in $(find "${repo}/${pkg}/" -maxdepth 1 -type f -name \*.subpackage.sh | sort); do
|
for file in $(find "${repo_path}/${pkg}/" -maxdepth 1 -type f -name \*.subpackage.sh | sort); do
|
||||||
echo "$(basename "${file%%.subpackage.sh}")" >> ./built_$repo_subpackages.txt
|
echo "$(basename "${file%%.subpackage.sh}")" >> ./built_$repo_subpackages.txt
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@ -112,7 +113,8 @@ jobs:
|
|||||||
done
|
done
|
||||||
else
|
else
|
||||||
for pkg in ${{ github.event.inputs.packages }}; do
|
for pkg in ${{ github.event.inputs.packages }}; do
|
||||||
for repo in main x11 root; do
|
for repo_path in $(jq --raw-output 'keys | .[]' < repo.json); do
|
||||||
|
local repo=$(jq --raw-output '.["'$repo_path'"]' < repo.json)
|
||||||
if [ -d "${repo}/${pkg}" ]; then
|
if [ -d "${repo}/${pkg}" ]; then
|
||||||
echo "$pkg" >> ./built_$repo_packages.txt
|
echo "$pkg" >> ./built_$repo_packages.txt
|
||||||
for subpkg in $(find "${repo}/${pkg}/" -maxdepth 1 -type f -name \*.subpackage.sh | sort); do
|
for subpkg in $(find "${repo}/${pkg}/" -maxdepth 1 -type f -name \*.subpackage.sh | sort); do
|
||||||
@ -125,7 +127,7 @@ jobs:
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for repo in main x11 root; do
|
for repo in $(jq --raw-output '.[]' < repo.json); do
|
||||||
# Fix so that lists do not contain duplicates
|
# Fix so that lists do not contain duplicates
|
||||||
if [ -f ./built_$repo_packages.txt ]; then
|
if [ -f ./built_$repo_packages.txt ]; then
|
||||||
uniq ./built_$repo_packages.txt > ./built_$repo_packages.txt.tmp
|
uniq ./built_$repo_packages.txt > ./built_$repo_packages.txt.tmp
|
||||||
@ -154,9 +156,10 @@ jobs:
|
|||||||
- name: Lint packages
|
- name: Lint packages
|
||||||
run: |
|
run: |
|
||||||
local package_recipes=
|
local package_recipes=
|
||||||
for repo in main x11 root; do
|
for repo_path in $(jq --raw-output 'keys | .[]' < repo.json); do
|
||||||
|
local repo=$(jq --raw-output '.["'$repo_path'"]' < repo.json)
|
||||||
if [ -f ./built_$repo_packages.txt ]; then
|
if [ -f ./built_$repo_packages.txt ]; then
|
||||||
package_recipes+=$(cat ./built_$repo_packages.txt | repo=$repo awk '{print ENVIRON["repo"]"/"$1"/build.sh"}')
|
package_recipes+=$(cat ./built_$repo_packages.txt | repo_path=$repo_path awk '{print ENVIRON["repo_path"]"/"$1"/build.sh"}')
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -165,7 +168,9 @@ jobs:
|
|||||||
- name: Build packages
|
- name: Build packages
|
||||||
run: |
|
run: |
|
||||||
local packages=
|
local packages=
|
||||||
for repo in main x11 root; do
|
for repo_path in $(jq --raw-output 'keys | .[]' < repo.json); do
|
||||||
|
local repo=$(jq --raw-output '.["'$repo_path'"]' < repo.json)
|
||||||
|
|
||||||
if [ -f ./built_$repo_packages.txt ]; then
|
if [ -f ./built_$repo_packages.txt ]; then
|
||||||
packages+=$(cat ./build_$repo_packages.txt)
|
packages+=$(cat ./build_$repo_packages.txt)
|
||||||
fi
|
fi
|
||||||
@ -178,7 +183,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
test -d termux-packages/output && mv termux-packages/output/* ./output/
|
test -d termux-packages/output && mv termux-packages/output/* ./output/
|
||||||
|
|
||||||
for repo in main x11 root; do
|
for repo in $(jq --raw-output '.[]' < repo.json); do
|
||||||
mkdir debs
|
mkdir debs
|
||||||
# Put package lists into directory with *.deb files so they will be transferred to
|
# Put package lists into directory with *.deb files so they will be transferred to
|
||||||
# upload job.
|
# upload job.
|
||||||
@ -223,7 +228,6 @@ jobs:
|
|||||||
path: ./
|
path: ./
|
||||||
- name: Upload to packages.termux.org
|
- name: Upload to packages.termux.org
|
||||||
env:
|
env:
|
||||||
REPOSITORY_NAME: termux-main
|
|
||||||
REPOSITORY_DISTRIBUTION: stable
|
REPOSITORY_DISTRIBUTION: stable
|
||||||
REPOSITORY_URL: https://packages.termux.org/aptly-api
|
REPOSITORY_URL: https://packages.termux.org/aptly-api
|
||||||
run: |
|
run: |
|
||||||
@ -233,8 +237,8 @@ jobs:
|
|||||||
|
|
||||||
source scripts/aptly_api.sh
|
source scripts/aptly_api.sh
|
||||||
|
|
||||||
for repo in main x11 root; do
|
for repo in $(jq --raw-output '.[]' < repo.json); do
|
||||||
export REPOSITORY_NAME=termux-$repo
|
export REPOSITORY_NAME=$repo
|
||||||
|
|
||||||
for archive in debs-*/debs-$repo-{aarch64,arm,i686,x86_64}-${{ github.sha }}.tar; do
|
for archive in debs-*/debs-$repo-{aarch64,arm,i686,x86_64}-${{ github.sha }}.tar; do
|
||||||
tar xf "$archive"
|
tar xf "$archive"
|
||||||
@ -284,8 +288,8 @@ jobs:
|
|||||||
source scripts/aptly_api.sh
|
source scripts/aptly_api.sh
|
||||||
|
|
||||||
|
|
||||||
for repo in main x11 root; do
|
for repo in $(jq --raw-output '.[]' < repo.json); do
|
||||||
export REPOSITORY_NAME=termux-$repo
|
export REPOSITORY_NAME=$repo
|
||||||
|
|
||||||
for archive in debs-*/debs-$repo-{aarch64,arm,i686,x86_64}-${{ github.sha }}.tar; do
|
for archive in debs-*/debs-$repo-{aarch64,arm,i686,x86_64}-${{ github.sha }}.tar; do
|
||||||
tar xf "$archive"
|
tar xf "$archive"
|
||||||
|
6
.gitignore
vendored
6
.gitignore
vendored
@ -18,6 +18,6 @@ scripts/.vagrant/
|
|||||||
/build-tools/
|
/build-tools/
|
||||||
|
|
||||||
# Predownloaded packages sources.
|
# Predownloaded packages sources.
|
||||||
/main/*/cache
|
/packages/*/cache
|
||||||
/root/*/cache
|
/root-packages/*/cache
|
||||||
/x11/*/cache
|
/x11-packages/*/cache
|
||||||
|
@ -39,6 +39,8 @@ if [ ! -e "$TERMUX_BUILD_LOCK_FILE" ]; then
|
|||||||
touch "$TERMUX_BUILD_LOCK_FILE"
|
touch "$TERMUX_BUILD_LOCK_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
export TERMUX_PACKAGES_DIRECTORIES=$(jq --raw-output 'keys | .[]' < ${TERMUX_SCRIPTDIR}/repo.json)
|
||||||
|
|
||||||
# Special variable for internal use. It forces script to ignore
|
# Special variable for internal use. It forces script to ignore
|
||||||
# lock file.
|
# lock file.
|
||||||
: "${TERMUX_BUILD_IGNORE_LOCK:=false}"
|
: "${TERMUX_BUILD_IGNORE_LOCK:=false}"
|
||||||
@ -451,23 +453,24 @@ for ((i=0; i<${#PACKAGE_LIST[@]}; i++)); do
|
|||||||
|
|
||||||
# Check the package to build:
|
# Check the package to build:
|
||||||
TERMUX_PKG_NAME=$(basename "${PACKAGE_LIST[i]}")
|
TERMUX_PKG_NAME=$(basename "${PACKAGE_LIST[i]}")
|
||||||
|
export TERMUX_PKG_BUILDER_DIR=
|
||||||
if [[ ${PACKAGE_LIST[i]} == *"/"* ]]; then
|
if [[ ${PACKAGE_LIST[i]} == *"/"* ]]; then
|
||||||
# Path to directory which may be outside this repo:
|
# Path to directory which may be outside this repo:
|
||||||
if [ ! -d "${PACKAGE_LIST[i]}" ]; then termux_error_exit "'${PACKAGE_LIST[i]}' seems to be a path but is not a directory"; fi
|
if [ ! -d "${PACKAGE_LIST[i]}" ]; then termux_error_exit "'${PACKAGE_LIST[i]}' seems to be a path but is not a directory"; fi
|
||||||
export TERMUX_PKG_BUILDER_DIR
|
export TERMUX_PKG_BUILDER_DIR=$(realpath "${PACKAGE_LIST[i]}")
|
||||||
TERMUX_PKG_BUILDER_DIR=$(realpath "${PACKAGE_LIST[i]}")
|
|
||||||
else
|
else
|
||||||
# Package name:
|
# Package name:
|
||||||
if [ -d "${TERMUX_SCRIPTDIR}/main/${TERMUX_PKG_NAME}" ]; then
|
for package_directory in $TERMUX_PACKAGES_DIRECTORIES; do
|
||||||
export TERMUX_PKG_BUILDER_DIR=$TERMUX_SCRIPTDIR/main/$TERMUX_PKG_NAME
|
if [ -d "${TERMUX_SCRIPTDIR}/${package_directory}/${TERMUX_PKG_NAME}" ]; then
|
||||||
elif [ -d "${TERMUX_SCRIPTDIR}/x11/${TERMUX_PKG_NAME}" ]; then
|
export TERMUX_PKG_BUILDER_DIR=${TERMUX_SCRIPTDIR}/$package_directory/$TERMUX_PKG_NAME
|
||||||
export TERMUX_PKG_BUILDER_DIR=$TERMUX_SCRIPTDIR/x11/$TERMUX_PKG_NAME
|
break
|
||||||
elif [ -d "${TERMUX_SCRIPTDIR}/root/${TERMUX_PKG_NAME}" ]; then
|
elif [ -n "${TERMUX_IS_DISABLED=""}" ] && [ -d "${TERMUX_SCRIPTDIR}/disabled-packages/${TERMUX_PKG_NAME}"]; then
|
||||||
export TERMUX_PKG_BUILDER_DIR=$TERMUX_SCRIPTDIR/root/$TERMUX_PKG_NAME
|
export TERMUX_PKG_BUILDER_DIR=$TERMUX_SCRIPTDIR/disabled-packages/$TERMUX_PKG_NAME
|
||||||
elif [ -n "${TERMUX_IS_DISABLED=""}" ] && [ -d "${TERMUX_SCRIPTDIR}/disabled/${TERMUX_PKG_NAME}"]; then
|
break
|
||||||
export TERMUX_PKG_BUILDER_DIR=$TERMUX_SCRIPTDIR/disabled/$TERMUX_PKG_NAME
|
fi
|
||||||
else
|
done
|
||||||
termux_error_exit "No package $TERMUX_PKG_NAME found in any of the enabled repositories, if you are trying to set up your custom repository give a look at build-package.sh:460-470"
|
if [ -z "${TERMUX_PKG_BUILDER_DIR}" ]; then
|
||||||
|
termux_error_exit "No package $TERMUX_PKG_NAME found in any of the enabled repositories. Are you trying to set up a custom repository?"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
TERMUX_PKG_BUILDER_SCRIPT=$TERMUX_PKG_BUILDER_DIR/build.sh
|
TERMUX_PKG_BUILDER_SCRIPT=$TERMUX_PKG_BUILDER_DIR/build.sh
|
||||||
|
5
repo.json
Normal file
5
repo.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"packages": "termux-main",
|
||||||
|
"root-packages": "termux-root",
|
||||||
|
"x11-packages": "termux-x11"
|
||||||
|
}
|
@ -7,7 +7,6 @@ termux_step_setup_variables() {
|
|||||||
: "${TERMUX_INSTALL_DEPS:="false"}"
|
: "${TERMUX_INSTALL_DEPS:="false"}"
|
||||||
: "${TERMUX_MAKE_PROCESSES:="$(nproc)"}"
|
: "${TERMUX_MAKE_PROCESSES:="$(nproc)"}"
|
||||||
: "${TERMUX_NO_CLEAN:="false"}"
|
: "${TERMUX_NO_CLEAN:="false"}"
|
||||||
: "${TERMUX_PACKAGES_DIRECTORIES:="main x11 root"}"
|
|
||||||
: "${TERMUX_PKG_API_LEVEL:="24"}"
|
: "${TERMUX_PKG_API_LEVEL:="24"}"
|
||||||
: "${TERMUX_CONTINUE_BUILD:="false"}"
|
: "${TERMUX_CONTINUE_BUILD:="false"}"
|
||||||
: "${TERMUX_QUIET_BUILD:="false"}"
|
: "${TERMUX_QUIET_BUILD:="false"}"
|
||||||
|
@ -86,7 +86,7 @@ termux_step_start_build() {
|
|||||||
|
|
||||||
local TERMUX_ELF_CLEANER_SRC=$TERMUX_COMMON_CACHEDIR/termux-elf-cleaner.cpp
|
local TERMUX_ELF_CLEANER_SRC=$TERMUX_COMMON_CACHEDIR/termux-elf-cleaner.cpp
|
||||||
local TERMUX_ELF_CLEANER_VERSION
|
local TERMUX_ELF_CLEANER_VERSION
|
||||||
TERMUX_ELF_CLEANER_VERSION=$(bash -c ". $TERMUX_SCRIPTDIR/main/termux-elf-cleaner/build.sh; echo \$TERMUX_PKG_VERSION")
|
TERMUX_ELF_CLEANER_VERSION=$(bash -c ". $TERMUX_SCRIPTDIR/packages/termux-elf-cleaner/build.sh; echo \$TERMUX_PKG_VERSION")
|
||||||
termux_download \
|
termux_download \
|
||||||
"https://raw.githubusercontent.com/termux/termux-elf-cleaner/v$TERMUX_ELF_CLEANER_VERSION/termux-elf-cleaner.cpp" \
|
"https://raw.githubusercontent.com/termux/termux-elf-cleaner/v$TERMUX_ELF_CLEANER_VERSION/termux-elf-cleaner.cpp" \
|
||||||
"$TERMUX_ELF_CLEANER_SRC" \
|
"$TERMUX_ELF_CLEANER_SRC" \
|
||||||
|
@ -59,7 +59,8 @@ rm -rf "${TERMUX_PKG_TMPDIR}"
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Package sources.
|
# Package sources.
|
||||||
for p in "$TERMUX_SCRIPTDIR"/{main,x11,root}/*; do
|
for repo_path in $(jq --raw-output 'keys | .[]' < $TERMUX_SCRIPTDIR/repo.json); do
|
||||||
|
for p in "$TERMUX_SCRIPTDIR"/$repo_path/*; do
|
||||||
(
|
(
|
||||||
. "$TERMUX_SCRIPTDIR"/scripts/properties.sh
|
. "$TERMUX_SCRIPTDIR"/scripts/properties.sh
|
||||||
. "$TERMUX_SCRIPTDIR"/scripts/build/get_source/termux_step_get_source.sh
|
. "$TERMUX_SCRIPTDIR"/scripts/build/get_source/termux_step_get_source.sh
|
||||||
@ -102,6 +103,7 @@ for p in "$TERMUX_SCRIPTDIR"/{main,x11,root}/*; do
|
|||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
done
|
done
|
||||||
|
done
|
||||||
|
|
||||||
# Mark to tell build-package.sh to enable offline mode.
|
# Mark to tell build-package.sh to enable offline mode.
|
||||||
touch "$TERMUX_SCRIPTDIR"/build-tools/.installed
|
touch "$TERMUX_SCRIPTDIR"/build-tools/.installed
|
||||||
|
Loading…
Reference in New Issue
Block a user