unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob 9fbb15ee29780fce5836183beb7eb85d2a6c12eb 1472 bytes (raw)
name: gnu/packages/patches/fpm-newer-clamp-fix.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 
Retrieved from: https://github.com/jordansissel/fpm/pull/1561.patch

From 956a218a7b35de08ea35da3b702ffdc716656b68 Mon Sep 17 00:00:00 2001
From: Jordan Sissel <jls@semicomplete.com>
Date: Mon, 15 Oct 2018 21:05:47 -0700
Subject: [PATCH] Check if an option has a default value before we try to look
 it up.

This fixes fpm when used with clamp 1.3.0 or above.

Fixes #1543
---
 lib/fpm/command.rb | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/fpm/command.rb b/lib/fpm/command.rb
index a204001e1..a99ddb627 100644
--- a/lib/fpm/command.rb
+++ b/lib/fpm/command.rb
@@ -394,7 +394,12 @@ def execute
     set = proc do |object, attribute|
       # if the package's attribute is currently nil *or* the flag setting for this
       # attribute is non-default, use the value.
-      if object.send(attribute).nil? || send(attribute) != send("default_#{attribute}")
+
+      # Not all options have a default value, so we assume `nil` if there's no default. (#1543)
+      # In clamp >= 1.3.0, options without `:default => ..` will not have any # `default_xyz` 
+      # methods generated, so we need to check for the presence of this method first.
+      default = respond_to?("default_#{attribute}") ? send("default_#{attribute}") : nil
+      if object.send(attribute).nil? || send(attribute) != default
         logger.info("Setting from flags: #{attribute}=#{send(attribute)}")
         object.send("#{attribute}=", send(attribute))
       end

debug log:

solving 9fbb15ee29 ...
found 9fbb15ee29 in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).