]> git.corax.cc Git - foundry/commitdiff
src/distbot.sh: Fix handling of multi-architecture repositories
authorMatthias Kruk <m@m10k.eu>
Tue, 15 Feb 2022 10:18:03 +0000 (19:18 +0900)
committerMatthias Kruk <m@m10k.eu>
Tue, 15 Feb 2022 10:18:03 +0000 (19:18 +0900)
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.

README.md
src/distbot.sh

index 3c5edfa472e039bf16959f2466329ff744c830d0..4c0be6685c869146ff3e16fa559aad7ac6c52734 100644 (file)
--- 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 <keyid>             \
               --description "My repository"
 
index bb592e47109182e9a363e6eaa2671a6190a632c0..0b3f87f04f4c6da5d352c15b4c51f31d3e5cea21 100755 (executable)
@@ -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