CI: specify distribution in repo.json as well
x11-repo uses distribution x11, and root-repo distribution root. Store this information in the json file as well, and parse it to set both REPOSITORY_NAME and REPOSITORY_DISTRIBUTION. Also remove unnecessary `< repo.json` from jq command, jq accepts the file as an argument. This fixes upload issues to x11-repo and root-repo.
This commit is contained in:
parent
6d6f0c91f3
commit
56dbb9cf80
38
.github/workflows/packages.yml
vendored
38
.github/workflows/packages.yml
vendored
@ -78,8 +78,8 @@ jobs:
|
||||
cd ..
|
||||
fi
|
||||
|
||||
for repo_path in $(jq --raw-output 'keys | .[]' < repo.json); do
|
||||
repo=$(jq --raw-output '.["'${repo_path}'"]' < repo.json)
|
||||
for repo_path in $(jq --raw-output 'keys | .[]' repo.json); do
|
||||
repo=$(jq --raw-output '.["'${repo_path}'"].name' repo.json)
|
||||
# Parse changed files and identify new packages and deleted packages.
|
||||
# Create lists of those packages that will be passed to upload job for
|
||||
# further processing.
|
||||
@ -113,10 +113,10 @@ jobs:
|
||||
done
|
||||
else
|
||||
for pkg in ${{ github.event.inputs.packages }}; do
|
||||
repo_paths=$(jq --raw-output 'keys | .[]' < repo.json)
|
||||
repo_paths=$(jq --raw-output 'keys | .[]' repo.json)
|
||||
found=false
|
||||
for repo_path in $repo_paths; do
|
||||
repo=$(jq --raw-output '.["'${repo_path}'"]' < repo.json)
|
||||
repo=$(jq --raw-output '.["'${repo_path}'"].name' repo.json)
|
||||
if [ -d "${repo_path}/${pkg}" ]; then
|
||||
found=true
|
||||
echo "$pkg" >> ./built_${repo}_packages.txt
|
||||
@ -132,7 +132,7 @@ jobs:
|
||||
done
|
||||
fi
|
||||
|
||||
for repo in $(jq --raw-output '.[]' < repo.json); do
|
||||
for repo in $(jq --raw-output '.[]' repo.json); do
|
||||
# Fix so that lists do not contain duplicates
|
||||
if [ -f ./built_${repo}_packages.txt ]; then
|
||||
uniq ./built_${repo}_packages.txt > ./built_${repo}_packages.txt.tmp
|
||||
@ -161,8 +161,8 @@ jobs:
|
||||
- name: Lint packages
|
||||
run: |
|
||||
declare -a package_recipes
|
||||
for repo_path in $(jq --raw-output 'keys | .[]' < repo.json); do
|
||||
repo=$(jq --raw-output '.["'${repo_path}'"]' < repo.json)
|
||||
for repo_path in $(jq --raw-output 'keys | .[]' repo.json); do
|
||||
repo=$(jq --raw-output '.["'${repo_path}'"].name' repo.json)
|
||||
if [ -f ./built_${repo}_packages.txt ]; then
|
||||
package_recipes="$package_recipes $(cat ./built_${repo}_packages.txt | repo_path=${repo_path} awk '{print ENVIRON["repo_path"]"/"$1"/build.sh"}')"
|
||||
fi
|
||||
@ -175,8 +175,8 @@ jobs:
|
||||
- name: Build packages
|
||||
run: |
|
||||
declare -a packages
|
||||
for repo_path in $(jq --raw-output 'keys | .[]' < repo.json); do
|
||||
repo=$(jq --raw-output '.["'${repo_path}'"]' < repo.json)
|
||||
for repo_path in $(jq --raw-output 'keys | .[]' repo.json); do
|
||||
repo=$(jq --raw-output '.["'${repo_path}'"].name' repo.json)
|
||||
|
||||
if [ -f ./built_${repo}_packages.txt ]; then
|
||||
packages="$packages $(cat ./built_${repo}_packages.txt)"
|
||||
@ -192,7 +192,7 @@ jobs:
|
||||
run: |
|
||||
test -d termux-packages/output && mv termux-packages/output/* ./output/
|
||||
|
||||
for repo in $(jq --raw-output '.[]' < repo.json); do
|
||||
for repo in $(jq --raw-output '.[].name' repo.json); do
|
||||
# Put package lists into directory with *.deb files so they will be transferred to
|
||||
# upload job.
|
||||
test -f ./built_${repo}_packages.txt && mv ./built_${repo}_packages.txt ./debs/
|
||||
@ -235,7 +235,6 @@ jobs:
|
||||
path: ./
|
||||
- name: Upload to packages.termux.org
|
||||
env:
|
||||
REPOSITORY_DISTRIBUTION: stable
|
||||
REPOSITORY_URL: https://packages.termux.org/aptly-api
|
||||
run: |
|
||||
GITHUB_SHA=${{ github.sha }}
|
||||
@ -248,13 +247,14 @@ jobs:
|
||||
tar xf "$archive"
|
||||
done
|
||||
|
||||
for repo in $(jq --raw-output '.[]' < repo.json); do
|
||||
export REPOSITORY_NAME=$repo
|
||||
for repo in $(jq --raw-output 'keys | .[]' repo.json); do
|
||||
export REPOSITORY_NAME=$(jq --raw-output '.["'$repo'"].name' repo.json)
|
||||
export REPOSITORY_DISTRIBUTION=$(jq --raw-output '.["'$repo'"].distribution' repo.json)
|
||||
|
||||
# Upload file to temporary directory.
|
||||
uploaded_files=false
|
||||
shopt -s nullglob
|
||||
for filename in $(cat debs/built_${repo}_packages.txt | sed -E 's/(..*)/debs\/\1_\*.deb debs\/\1-static_\*.deb/g'); do
|
||||
for filename in $(cat debs/built_${REPOSITORY_NAME}_packages.txt | sed -E 's/(..*)/debs\/\1_\*.deb debs\/\1-static_\*.deb/g'); do
|
||||
if ! aptly_upload_file "$filename"; then
|
||||
exit 1
|
||||
fi
|
||||
@ -262,7 +262,7 @@ jobs:
|
||||
uploaded_files=true
|
||||
done
|
||||
shopt -u nullglob
|
||||
|
||||
|
||||
# Publishing repository changes.
|
||||
if [ "$uploaded_files" = "true" ]; then
|
||||
if ! aptly_add_to_repo; then
|
||||
@ -282,7 +282,6 @@ jobs:
|
||||
# Run even if upload to packages.termux.org failed:
|
||||
if: always()
|
||||
env:
|
||||
REPOSITORY_DISTRIBUTION: stable
|
||||
REPOSITORY_URL: https://aptly-api.grimler.se
|
||||
run: |
|
||||
GITHUB_SHA=${{ github.sha }}
|
||||
@ -291,13 +290,14 @@ jobs:
|
||||
source scripts/aptly_api.sh
|
||||
|
||||
|
||||
for repo in $(jq --raw-output '.[]' < repo.json); do
|
||||
export REPOSITORY_NAME=$repo
|
||||
for repo in $(jq --raw-output 'keys | .[]' repo.json); do
|
||||
export REPOSITORY_NAME=$(jq --raw-output '.["'$repo'"].name' repo.json)
|
||||
export REPOSITORY_DISTRIBUTION=$(jq --raw-output '.["'$repo'"].distribution' repo.json)
|
||||
|
||||
# Upload file to temporary directory.
|
||||
uploaded_files=false
|
||||
shopt -s nullglob
|
||||
for filename in $(cat debs/built_${repo}_packages.txt | sed -E 's/(..*)/debs\/\1_\*.deb debs\/\1-static_\*.deb/g'); do
|
||||
for filename in $(cat debs/built_${REPOSITORY_NAME}_packages.txt | sed -E 's/(..*)/debs\/\1_\*.deb debs\/\1-static_\*.deb/g'); do
|
||||
if ! aptly_upload_file "$filename"; then
|
||||
exit 1
|
||||
fi
|
||||
|
@ -39,7 +39,7 @@ if [ ! -e "$TERMUX_BUILD_LOCK_FILE" ]; then
|
||||
touch "$TERMUX_BUILD_LOCK_FILE"
|
||||
fi
|
||||
|
||||
export TERMUX_PACKAGES_DIRECTORIES=$(jq --raw-output 'keys | .[]' < ${TERMUX_SCRIPTDIR}/repo.json)
|
||||
export TERMUX_PACKAGES_DIRECTORIES=$(jq --raw-output 'keys | .[]' ${TERMUX_SCRIPTDIR}/repo.json)
|
||||
|
||||
# Special variable for internal use. It forces script to ignore
|
||||
# lock file.
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"packages": "termux-main",
|
||||
"root-packages": "termux-root",
|
||||
"x11-packages": "termux-x11"
|
||||
"packages": { "name" : "termux-main", "distribution" : "stable" },
|
||||
"root-packages": { "name" : "termux-root", "distribution" : "root" },
|
||||
"x11-packages": { "name" : "termux-x11", "distribution" : "x11" }
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ check() {
|
||||
if [ -d "${PKG_NAME}" ] && [ -f "${PKG_NAME}/build.sh" ]; then
|
||||
build_sh="${PKG_NAME}/build.sh"
|
||||
else
|
||||
for repo_dir in $(jq --raw-output 'keys | .[]' < $TERMUX_SCRIPTDIR/repo.json); do
|
||||
for repo_dir in $(jq --raw-output 'keys | .[]' $TERMUX_SCRIPTDIR/repo.json); do
|
||||
if [ -f $TERMUX_SCRIPTDIR/$repo_dir/$PKG_NAME/build.sh ]; then
|
||||
build_sh=$TERMUX_SCRIPTDIR/$repo_dir/$PKG_NAME/build.sh
|
||||
fi
|
||||
|
@ -34,7 +34,7 @@ fi
|
||||
for package in "${@}"; do
|
||||
package="${package%%/}"
|
||||
buildsh_path=
|
||||
for repo in $(jq --raw-output 'keys | .[]' < ${REPO_ROOT}/repo.json); do
|
||||
for repo in $(jq --raw-output 'keys | .[]' ${REPO_ROOT}/repo.json); do
|
||||
_buildsh_path="${REPO_ROOT}/${repo}/${package}/build.sh"
|
||||
echo $_buildsh_path
|
||||
|
||||
|
@ -39,7 +39,7 @@ for package in "${@}"; do
|
||||
buildsh_path="${package}/build.sh"
|
||||
package=$(basename ${package})
|
||||
else
|
||||
for repo_path in $(jq --raw-output 'keys | . []' < $REPO_ROOT/repo.json); do
|
||||
for repo_path in $(jq --raw-output 'keys | .[]' $REPO_ROOT/repo.json); do
|
||||
if [ -d "${repo_path}/${package}" ] && [ -f "${repo_path}/${package}/build.sh" ]; then
|
||||
buildsh_path="${repo_path}/${package}/build.sh"
|
||||
package=$(basename ${package})
|
||||
|
@ -130,7 +130,7 @@ main() {
|
||||
echo "INFO: Running update for: $*"
|
||||
|
||||
if [[ "$1" == "@all" ]]; then
|
||||
for repo_dir in $(jq --raw-output 'keys | .[]' < ${TERMUX_SCRIPTDIR}/repo.json); do
|
||||
for repo_dir in $(jq --raw-output 'keys | .[]' ${TERMUX_SCRIPTDIR}/repo.json); do
|
||||
for pkg_dir in $repo_dir/*; do
|
||||
_run_update "${pkg_dir}"
|
||||
done
|
||||
@ -138,7 +138,7 @@ main() {
|
||||
else
|
||||
for pkg in "$@"; do
|
||||
if [ ! -d "${pkg}" ]; then
|
||||
for repo_dir in $(jq --raw-output 'keys | .[]' < ${TERMUX_SCRIPTDIR}/repo.json); do
|
||||
for repo_dir in $(jq --raw-output 'keys | .[]' ${TERMUX_SCRIPTDIR}/repo.json); do
|
||||
if [ -d "${repo_dir}/${pkg}" ]; then
|
||||
pkg="${repo_dir}/${pkg}"
|
||||
break
|
||||
|
@ -453,7 +453,7 @@ linter_main() {
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
for repo_dir in $(jq --raw-output 'keys | .[]' < $REPO_DIR/repo.json); do
|
||||
for repo_dir in $(jq --raw-output 'keys | .[]' $REPO_DIR/repo.json); do
|
||||
linter_main $repo_dir/*/build.sh
|
||||
done || exit 1
|
||||
else
|
||||
|
@ -59,7 +59,7 @@ rm -rf "${TERMUX_PKG_TMPDIR}"
|
||||
)
|
||||
|
||||
# Package sources.
|
||||
for repo_path in $(jq --raw-output 'keys | .[]' < $TERMUX_SCRIPTDIR/repo.json); 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
|
||||
|
Loading…
Reference in New Issue
Block a user