From: Matthias Kruk Date: Tue, 15 Feb 2022 10:18:03 +0000 (+0900) Subject: src/distbot.sh: Fix handling of multi-architecture repositories X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=d840d5c82a94d22b66769ba75a4b62fac3c14dd3;p=foundry src/distbot.sh: Fix handling of multi-architecture repositories The conf/distributions file created by distbot for repositories with multiple architectures specifies the repository's architectures with a comma-separated list. However, the list should be space-separated. This commit changes distbot so that * architectures must be passed one-by-one using `--arch`, and * the generated conf/distributions file contains a space-separated list of architectures. --- diff --git a/README.md b/README.md index 3c5edfa..4c0be66 100644 --- a/README.md +++ b/README.md @@ -278,7 +278,8 @@ Distbot has a few more options, but most of them are fairly self-explanatory. $ distbot --name deb.example.org \ --output /srv/www/deb \ - --arch amd64,i386 \ + --arch amd64 \ + --arch i386 \ --gpg-key \ --description "My repository" diff --git a/src/distbot.sh b/src/distbot.sh index bb592e4..0b3f87f 100755 --- a/src/distbot.sh +++ b/src/distbot.sh @@ -287,6 +287,16 @@ looks_like_a_repository() { return 0 } +_add_arch() { + # local name="$1" # unused + local value="$2" + + # `architectures' is inherited from main() + architectures+=("$value") + + return 0 +} + main() { local path local codename @@ -294,10 +304,12 @@ main() { local watch local publish_to local name - local arch + local architectures local gpgkey local desc + architectures=() + opt_add_arg "e" "endpoint" "v" "pub/distbot" "The IPC endpoint to listen on" opt_add_arg "w" "watch" "v" "signs" \ "The topic to watch for sign messages" @@ -309,7 +321,7 @@ main() { opt_add_arg "c" "codename" "v" "stable" \ "The codename of the distribution (default: stable)" opt_add_arg "a" "arch" "rv" "" \ - "Comma separated list of supported architectures" + "Repository architecture (may be used more than once)" "" _add_arch opt_add_arg "k" "gpg-key" "rv" "" \ "The GPG key used for signing" opt_add_arg "d" "description" "rv" "" \ @@ -325,7 +337,6 @@ main() { watch=$(opt_get "watch") publish_to=$(opt_get "publish-to") name=$(opt_get "name") - arch=$(opt_get "arch") gpgkey=$(opt_get "gpg-key") desc=$(opt_get "description") @@ -333,7 +344,8 @@ main() { # Create new repository log_info "Initializing repository $name:$codename in $path" - if ! repo_init "$path" "$name" "$codename" "$arch" "$gpgkey" "$desc"; then + if ! repo_init "$path" "$name" "$codename" "${architectures[*]}" \ + "$gpgkey" "$desc"; then log_error "Could not initialize repository" return 1 fi