summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xextra/xbs-lukeshu/db-repo-remove37
-rwxr-xr-xsrc/bin/db-pkg-add4
-rwxr-xr-xsrc/bin/db-pkg-rm4
-rw-r--r--src/etc/xbs.d/gnu+linux-legacy_dd.cfg2
-rw-r--r--src/share/xbs/db-functions56
5 files changed, 33 insertions, 70 deletions
diff --git a/extra/xbs-lukeshu/db-repo-remove b/extra/xbs-lukeshu/db-repo-remove
deleted file mode 100755
index aadc4ce..0000000
--- a/extra/xbs-lukeshu/db-repo-remove
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-
-. "$(dirname "$(readlink -e "$0")")/config"
-. "$(dirname "$(readlink -e "$0")")/db-functions"
-
-if [ $# -lt 3 ]; then
- msg "usage: %s <repo> <arch> <pkgname> ..." "${0##*/}"
- exit 1
-fi
-
-repo="$1"
-arch="$2"
-pkgnames=("${@:3}")
-
-ftppath="$FTP_BASE/$repo/os"
-
-if ! check_repo_permission "$repo"; then
- die "You don't have permission to remove packages from %s" "${repo}"
-fi
-
-if [ "$arch" == "any" ]; then
- tarches=("${ARCHES[@]}")
-else
- tarches=("$arch")
-fi
-
-for tarch in "${tarches[@]}"; do
- repo_lock "$repo" "$tarch" || exit 1
-done
-
-for tarch in "${tarches[@]}"; do
- for pkgname in "${pkgnames[@]}"; do
- msg "Removing %s from [%s]..." "$pkgname" "$repo"
- done
- arch_repo_remove "${repo}" "${tarch}" "${pkgnames[@]}"
- repo_unlock "$repo" "$tarch"
-done
diff --git a/src/bin/db-pkg-add b/src/bin/db-pkg-add
index 8f961ee..710f24b 100755
--- a/src/bin/db-pkg-add
+++ b/src/bin/db-pkg-add
@@ -22,7 +22,7 @@ for '_platform' in "${PLATFORMS[@]}"; do
if [ "${_platform_name}" == "${_platform}" ]; then
source "${CONFIG_DIR}/xbs.d/${_platform}.cfg"
- repo_path="${REPO_DIR}/${_platform}/${repo}/os"
+ repo_path="${REPO_DIR}/${repo}/os"
if ! check_repo_permission "${repo}"; then
die "You don't have permission to add packages to %s" "${repo}"
@@ -52,7 +52,7 @@ for '_platform' in "${PLATFORMS[@]}"; do
msg "Adding %s to [%s]..." "${pkg_file}" "${repo}"
fi
done
- arch_repo_add "${repo}" "${tarch}" "${pkg_files[@]}"
+ pkg_repo_add "${repo}" "${tarch}" "${pkg_files[@]}"
repo_unlock "${repo}" "${tarch}"
done
else
diff --git a/src/bin/db-pkg-rm b/src/bin/db-pkg-rm
index a2d5de1..f70141f 100755
--- a/src/bin/db-pkg-rm
+++ b/src/bin/db-pkg-rm
@@ -22,7 +22,7 @@ for '_platform' in "${PLATFORMS[@]}"; do
if [ "${_platform_name}" == "${_platform}" ]; then
source "${CONFIG_DIR}/xbs.d/${_platform}.cfg"
- repo_path="${REPO_DIR}/${_platform}/${repo}/os"
+ repo_path="${REPO_DIR}/${repo}/os"
if ! check_repo_permission "${repo}"; then
die "You don't have permission to remove packages to %s" "${repo}"
@@ -48,7 +48,7 @@ for '_platform' in "${PLATFORMS[@]}"; do
for 'pkg_name' in "${pkg_names[@]}"; do
msg "Removing %s from [%s]..." "${pkg_name}" "${repo}"
done
- arch_repo_remove "${repo}" "${tarch}" "${pkgnames[@]}"
+ pkg_repo_rm "${repo}" "${tarch}" "${pkgnames[@]}"
repo_unlock "${repo}" "${tarch}"
done
else
diff --git a/src/etc/xbs.d/gnu+linux-legacy_dd.cfg b/src/etc/xbs.d/gnu+linux-legacy_dd.cfg
index 34e6fea..715b0c7 100644
--- a/src/etc/xbs.d/gnu+linux-legacy_dd.cfg
+++ b/src/etc/xbs.d/gnu+linux-legacy_dd.cfg
@@ -34,7 +34,7 @@ PKG_REPOS=("${EXTRA_REPOS[@]}" "${PLATFORM_REPOS[@]}" "${MAIN_REPOS[@]}" "${DD_R
PKG_MULTILIB_REPOS=("${MAIN_MULTILIB_REPOS[@]}" "${DD_MULTILIB_REPOS[@]}")
# Base Repository
-REPO_DIR="${ROOT_DIR}/${PLATFORM}_dd"
+REPO_DIR="${ROOT_DIR}"
# Directories where packages are shared between repos
PKG_MAIN_POOLS=("${ROOT_DIR}/pool/parabola")
diff --git a/src/share/xbs/db-functions b/src/share/xbs/db-functions
index 62260bb..315ebbc 100644
--- a/src/share/xbs/db-functions
+++ b/src/share/xbs/db-functions
@@ -43,7 +43,7 @@ REPO_MODIFIED=0
. "$(librelib common)"
script_lock() {
- local LOCKDIR="$TMPDIR/.scriptlock.${0##*/}"
+ local LOCKDIR="$TMP_DIR/.scriptlock.${0##*/}"
if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then
local _owner="$(/usr/bin/stat -c %U "$LOCKDIR")"
error "Script %s is already locked by %s." "${0##*/}" "$_owner"
@@ -55,7 +55,7 @@ script_lock() {
}
script_unlock() {
- local LOCKDIR="$TMPDIR/.scriptlock.${0##*/}"
+ local LOCKDIR="$TMP_DIR/.scriptlock.${0##*/}"
if [ ! -d "$LOCKDIR" ]; then
warning "Script %s was not locked!" "${0##*/}"
restore_umask
@@ -76,19 +76,19 @@ cleanup() {
for l in "${LOCKS[@]}"; do
repo=${l%.*}
arch=${l#*.}
- if [ -d "$TMPDIR/.repolock.$repo.$arch" ]; then
+ if [ -d "$TMP_DIR/.repolock.$repo.$arch" ]; then
msg "Removing left over lock from [%s] (%s)" "${repo}" "${arch}"
repo_unlock "$repo" "$arch"
fi
done
- if [ -d "$TMPDIR/.scriptlock.${0##*/}" ]; then
+ if [ -d "$TMP_DIR/.scriptlock.${0##*/}" ]; then
msg "Removing left over lock from %s" "${0##*/}"
script_unlock
fi
rm -rf "$WORKDIR"
if (( REPO_MODIFIED )); then
- date +%s > "${FTP_BASE}/lastupdate"
+ date +%s > "${REPO_DIR}/lastupdate"
fi
[ "$1" ] && exit "$1"
@@ -100,9 +100,9 @@ trap cleanup EXIT
#repo_lock <repo-name> <arch> [timeout]
repo_lock () {
- local LOCKDIR="$TMPDIR/.repolock.$1.$2"
- local DBLOCKFILE="${FTP_BASE}/${1}/os/${2}/${1}${DBEXT}.lck"
- local FILESLOCKFILE="${FTP_BASE}/${1}/os/${2}/${1}${FILESEXT}.lck"
+ local LOCKDIR="$TMP_DIR/.repolock.$1.$2"
+ local DBLOCKFILE="${REPO_DIR}/${1}/os/${2}/${1}${DB_EXT}.lck"
+ local FILESLOCKFILE="${REPO_DIR}/${1}/os/${2}/${1}${FILES_EXT}.lck"
local _count
local _trial
local _timeout
@@ -148,7 +148,7 @@ repo_lock () {
}
repo_unlock () { #repo_unlock <repo-name> <arch>
- local LOCKDIR="$TMPDIR/.repolock.$1.$2"
+ local LOCKDIR="$TMP_DIR/.repolock.$1.$2"
if [ ! -d "$LOCKDIR" ]; then
warning "Repo lock [%s] (%s) was not locked!" "${1}" "${2}"
restore_umask
@@ -360,10 +360,10 @@ check_pkgrepos() {
local pkgarch="$(getpkgarch "${pkgfile}")"
[ $? -ge 1 ] && return 1
- [ -f "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} ] && return 1
- [ -f "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT}.sig ] && return 1
- [ -f "${FTP_BASE}/${PKGPOOL}/${pkgfile##*/}" ] && return 1
- [ -f "${FTP_BASE}/${PKGPOOL}/${pkgfile##*/}.sig" ] && return 1
+ [ -f "${REPO_DIR}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKG_EXT} ] && return 1
+ [ -f "${REPO_DIR}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKG_EXT}.sig ] && return 1
+ [ -f "${REPO_DIR}/${PKGPOOL}/${pkgfile##*/}" ] && return 1
+ [ -f "${REPO_DIR}/${PKGPOOL}/${pkgfile##*/}.sig" ] && return 1
return 0
}
@@ -386,14 +386,14 @@ check_repo_permission() {
in_array "${repo}" "${PKGREPOS[@]}" || return 1
- [ -w "$FTP_BASE/${PKGPOOL}" ] || return 1
+ [ -w "$REPO_DIR/${PKGPOOL}" ] || return 1
local arch
for arch in "${ARCHES[@]}"; do
- local dir="${FTP_BASE}/${repo}/os/${arch}/"
+ local dir="${REPO_DIR}/${repo}/os/${arch}/"
[ -w "${dir}" ] || return 1
- [ -f "${dir}${repo}"${DBEXT} -a ! -w "${dir}${repo}"${DBEXT} ] && return 1
- [ -f "${dir}${repo}"${FILESEXT} -a ! -w "${dir}${repo}"${FILESEXT} ] && return 1
+ [ -f "${dir}${repo}"${DB_EXT} -a ! -w "${dir}${repo}"${DB_EXT} ] && return 1
+ [ -f "${dir}${repo}"${FILES_EXT} -a ! -w "${dir}${repo}"${FILES_EXT} ] && return 1
done
return 0
@@ -402,8 +402,8 @@ check_repo_permission() {
set_repo_permission() {
local repo=$1
local arch=$2
- local dbfile="${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}"
- local filesfile="${FTP_BASE}/${repo}/os/${arch}/${repo}${FILESEXT}"
+ local dbfile="${REPO_DIR}/${repo}/os/${arch}/${repo}${DB_EXT}"
+ local filesfile="${REPO_DIR}/${repo}/os/${arch}/${repo}${FILES_EXT}"
if [ -w "${dbfile}" ]; then
local group=$(/usr/bin/stat --printf='%G' "$(dirname "${dbfile}")")
@@ -416,30 +416,30 @@ set_repo_permission() {
fi
}
-arch_repo_add() {
+pkg_repo_add() {
local repo=$1
local arch=$2
local pkgs=("${@:3}")
printf -v pkgs_str -- '%q ' "${pkgs[@]}"
# package files might be relative to repo dir
- pushd "${FTP_BASE}/${repo}/os/${arch}" >/dev/null
- /usr/bin/repo-add -q "${repo}${DBEXT}" "${pkgs[@]}" \
- || error 'repo-add %q %s' "${repo}${DBEXT}" "${pkgs_str% }"
- /usr/bin/repo-add -f -q "${repo}${FILESEXT}" "${pkgs[@]}" \
- || error 'repo-add -f %q %s' "${repo}${FILESEXT}" "${pkgs_str% }"
+ pushd "${REPO_DIR}/${repo}/os/${arch}" >/dev/null
+ /usr/bin/repo-add -q "${repo}${DB_EXT}" "${pkgs[@]}" \
+ || error 'repo-add %q %s' "${repo}${DB_EXT}" "${pkgs_str% }"
+ /usr/bin/repo-add -f -q "${repo}${FILES_EXT}" "${pkgs[@]}" \
+ || error 'repo-add -f %q %s' "${repo}${FILES_EXT}" "${pkgs_str% }"
popd >/dev/null
set_repo_permission "${repo}" "${arch}"
REPO_MODIFIED=1
}
-arch_repo_remove() {
+pkg_repo_rm() {
local repo=$1
local arch=$2
local pkgs=("${@:3}")
- local dbfile="${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}"
- local filesfile="${FTP_BASE}/${repo}/os/${arch}/${repo}${FILESEXT}"
+ local dbfile="${REPO_DIR}/${repo}/os/${arch}/${repo}${DB_EXT}"
+ local filesfile="${REPO_DIR}/${repo}/os/${arch}/${repo}${FILES_EXT}"
if [ ! -f "${dbfile}" ]; then
error "No database found at '%s'" "${dbfile}"