Verified Commit fa6f8f90 authored by Johannes Löthberg's avatar Johannes Löthberg Committed by Jelle van der Waa
Browse files

db-move: Check that the specified repositories are ones dbscripts was configured for

Otherwise if you use the dbscripts for core/extra for community repos,
or vice versa, you'll get an error saying that you don't have
permissions to move packages from or to the given repositories, which
can be confusing if you don't immediately notice your mistake.

Signed-off-by: Johannes Löthberg's avatarJohannes Löthberg <>
parent 40f09826
Pipeline #12298 passed with stage
in 8 minutes and 29 seconds
......@@ -404,6 +404,15 @@ chk_license() {
return 1
check_repo_configured() {
local repo=$1
local count=$(printf '%s\n' "${PKGREPOS[@]}" | grep --count --line-regexp "$repo")
[[ $count -gt 0 ]] && return 0
return 1
check_repo_permission() {
local repo=$1
......@@ -19,6 +19,12 @@ if in_array "${repo_from}" "${STAGING_REPOS[@]}" && in_array "${repo_to}" "${STA
if ! check_repo_configured "$repo_from"; then
die "%s is not a configured repository" "$repo_from"
elif ! check_repo_configured "$repo_to"; then
die "%s is not a configured repository" "$repo_to"
if ! check_repo_permission "$repo_to" || ! check_repo_permission "$repo_from"; then
die "You don't have permission to move packages from %s to %s" "$repo_from" "$repo_to"
......@@ -123,3 +123,12 @@ load ../lib/common
checkPackage extra pkg-split-a 1-1
checkPackage testing pkg-split-b 1-1
@test "move not configured repo" {
releasePackage extra pkg-any-a
run db-move extra community pkg-any-a
[ "$status" -ne 0 ]
[[ $output == *'community is not a configured'* ]]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment