16306: Monkeypatch fpm bug.
authorTom Clegg <tom@curii.com>
Tue, 22 Dec 2020 21:13:49 +0000 (16:13 -0500)
committerTom Clegg <tom@curii.com>
Tue, 22 Dec 2020 21:13:49 +0000 (16:13 -0500)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

cmd/arvados-dev/buildpackage.go

index 76228324eedc827a6028c87cd27dcad63564a55d..a6e0b544a029c7564e666d12ae477f1ac27b0a13 100644 (file)
@@ -9,6 +9,7 @@ import (
        "flag"
        "fmt"
        "io"
+       "os"
        "os/exec"
 
        "git.arvados.org/arvados.git/lib/install"
@@ -70,6 +71,17 @@ func (bldr *builder) run(ctx context.Context, prog string, args []string, stdin
                return fmt.Errorf("gem install fpm: %w", err)
        }
 
+       if _, err := os.Stat("/root/.gem/ruby/2.5.0/gems/fpm-1.11.0/lib/fpm/package/deb.rb"); err == nil {
+               // Workaround for fpm bug https://github.com/jordansissel/fpm/issues/1739
+               cmd = exec.Command("sed", "-i", `/require "digest"/a require "zlib"`, "/root/.gem/ruby/2.5.0/gems/fpm-1.11.0/lib/fpm/package/deb.rb")
+               cmd.Stdout = stdout
+               cmd.Stderr = stderr
+               err = cmd.Run()
+               if err != nil {
+                       return fmt.Errorf("monkeypatch fpm: %w", err)
+               }
+       }
+
        // Remove unneeded files. This is much faster than "fpm
        // --exclude X" because fpm copies everything into a staging
        // area before looking at the --exclude args.