From 08ec3a4a2644319a1c25f2aa5cb620eaefd0707c Mon Sep 17 00:00:00 2001 From: langfingaz Date: Sun, 25 Apr 2021 15:30:41 +0200 Subject: [PATCH] fix/improve repository manager (2) --- pkg/de-p1st-repo/arch-repo-push-new.sh | 10 ---------- pkg/de-p1st-repo/arch-repo-receive-new.sh | 23 ++++++++++++----------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/pkg/de-p1st-repo/arch-repo-push-new.sh b/pkg/de-p1st-repo/arch-repo-push-new.sh index cda7021..fef2ac8 100644 --- a/pkg/de-p1st-repo/arch-repo-push-new.sh +++ b/pkg/de-p1st-repo/arch-repo-push-new.sh @@ -6,19 +6,9 @@ source /etc/de-p1st-repo/arch-repo.cfg || exit cd "${LOCAL_PKG_DIR}" || exit -# get list of new packages, one package per line -rsync --ignore-existing --out-format="%n" --dry-run \ - ./*.pkg.tar.{xz,zst} "${REMOTE_SSH_HOST}":"${REMOTE_PKG_DIR}" > new-pkg.txt || exit - # transfer new packages using rsync rsync --ignore-existing --progress --human-readable \ ./*.pkg.tar.{xz,zst} "${REMOTE_SSH_HOST}":"${REMOTE_PKG_DIR}" || exit - - -# transfer new-pkg.txt -rsync --ignore-times --checksum --progress --human-readable \ - new-pkg.txt "${REMOTE_SSH_HOST}":"${REMOTE_PKG_DIR}" || exit - # add each new package to database ssh "${REMOTE_SSH_HOST}" "/usr/bin/arch-repo-receive-new" diff --git a/pkg/de-p1st-repo/arch-repo-receive-new.sh b/pkg/de-p1st-repo/arch-repo-receive-new.sh index 4d26fa1..9ec3370 100644 --- a/pkg/de-p1st-repo/arch-repo-receive-new.sh +++ b/pkg/de-p1st-repo/arch-repo-receive-new.sh @@ -13,20 +13,21 @@ function add_to_db(){ sort_pkgname_pkgver || return $? echo "For each package: Add latest version to database ..." - for PKGNAME in ./pkg/*; do + for PKGNAME in ./db/*; do # - # get latest version for PKGNAME + # get latest version for $PKGNAME # local LATEST - for PKGVER in ./pkg/"${PKGNAME}"/*; do + # pick one random version as starting point for the latest version + for PKGVER in ./db/"${PKGNAME}"/*; do LATEST="$PKGVER" break done local cmp - for PKGVER in ./pkg/"$PKGNAME"/*; do + for PKGVER in ./db/"$PKGNAME"/*; do # compare the currently known latest version # with the next version cmp=$(vercmp "$LATEST" "$PKGVER") || return $? @@ -39,8 +40,8 @@ function add_to_db(){ # # add latest version of PKGNAME to database # - PKG=$(cat "./pkg/${PKGNAME}/${LATEST}") || return $? - repo-add -n "${REMOTE_DB_NAME}.db.tar.gz" "${PKG}" || return $? + PKG=$(cat "./db/${PKGNAME}/${LATEST}") || return $? + repo-add --new "${REMOTE_DB_NAME}.db.tar.gz" "${PKG}" || return $? true done @@ -48,7 +49,7 @@ function add_to_db(){ # -# create files "./pkg/$pkgname/$pkgver" with content "$path_to_file" = "$PKG" +# create files "./db/$pkgname/$pkgver" with content "$path_to_file" = "$PKG" # function sort_pkgname_pkgver(){ echo "Sorting packages by package name and package version ..." @@ -56,11 +57,11 @@ function sort_pkgname_pkgver(){ for PKG in ./*.pkg.tar.{xz,zst}; do get_pkginfo "$PKG" || return $? get_pkgname "$PKGINFO" || return $? - get_pkgver "$PKGINFO" || return $? + get_pkgver "$PKGINFO" || return $? - echo "Creating file pkg/${PKGNAME} with content ${PKG} ..." - mkdir -p "pkg/${PKGNAME}" || return $? - echo "${PKG}" > "pkg/${PKGNAME}/${PKGVER}" || return $? + echo "Creating file ./db/${PKGNAME} with content ${PKG} ..." + mkdir -p "db/${PKGNAME}" || return $? + echo "${PKG}" > "db/${PKGNAME}/${PKGVER}" || return $? done }