diff options
authorJoey Hess2018-01-24 13:32:04 -0400
committerJoey Hess2018-01-24 13:32:04 -0400
commita730bbda2b91cf2bac9b63be8647ba322691e57f (patch)
parentd79367b4324dec67d929f18239e4159cf8b4d890 (diff)
Add HasCallStack constraint to pickOS and unsupportedOS, so the call stack includes the caller.
This commit was sponsored by Jochen Bartl on Patreon.
3 files changed, 32 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index 4545bcd1..2ffe4f8c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,8 @@ propellor (5.3.0) UNRELEASED; urgency=medium
* Added rawPartition to PartSpec, for specifying partitions with no
* Added BiosGrubFlag to PartFlag.
+ * Add HasCallStack constraint to pickOS and unsupportedOS, so the
+ call stack includes the caller.
-- Joey Hess <> Tue, 02 Jan 2018 13:06:45 -0400
diff --git a/doc/forum/__34__Unknown_host_OS__34___after_merging_recent_propellor/comment_1_6ed53a6752f3f88acce023a4fe1b9bf6._comment b/doc/forum/__34__Unknown_host_OS__34___after_merging_recent_propellor/comment_1_6ed53a6752f3f88acce023a4fe1b9bf6._comment
new file mode 100644
index 00000000..608bc3e2
--- /dev/null
+++ b/doc/forum/__34__Unknown_host_OS__34___after_merging_recent_propellor/comment_1_6ed53a6752f3f88acce023a4fe1b9bf6._comment
@@ -0,0 +1,27 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 1"""
+ date="2018-01-24T16:55:19Z"
+ content="""
+This comes from something using `unsupportedOS'`, perhaps via `pickOS`.
+Probably it's coming from the use of `Systemd.nspawned`,
+which is going to use debootstrap to build the container,
+since the container uses debian. To use debootstrap,
+it needs to install it, and `Debootstrap.installed`
+uses `pickOS` to work out how to install it, but only supports
+installing debootstrap on linux hosts. Your riva4 host does not have its OS
+declared, leading to the failure.
+It seems there ought to be a way to get a deeper call
+stack, to make it easier to work this out. It's possible to build
+propellor with profiling and get a complete call stack, as shown at
+<>. It might make sense for
+propellor to always be built that way.
+A simpler approach is to
+add `HasCallStack =>` constraints to `pickOS` and `unsupportedOS'`,
+so that those will have a call stack that reaches back to their
+caller, which in your case would reach back to `Debootstrap.installed`,
+which is probably enough. For now, I've made this change.
diff --git a/src/Propellor/Property.hs b/src/Propellor/Property.hs
index 884ee683..8c0a5859 100644
--- a/src/Propellor/Property.hs
+++ b/src/Propellor/Property.hs
@@ -55,6 +55,7 @@ import Data.Maybe
import Data.List
import Data.Hashable
import Control.Applicative
+import GHC.Stack
import Prelude
import Propellor.Types
@@ -283,6 +284,7 @@ isNewerThan x y = do
-- fail that way.
+ HasCallStack =>
( SingKind ('KProxy :: KProxy ka)
, SingKind ('KProxy :: KProxy kb)
, DemoteRep ('KProxy :: KProxy ka) ~ [MetaType]
@@ -344,7 +346,7 @@ unsupportedOS = property "unsupportedOS" unsupportedOS'
-- | Throws an error, for use in `withOS` when a property is lacking
-- support for an OS.
-unsupportedOS' :: Propellor Result
+unsupportedOS' :: HasCallStack => Propellor Result
unsupportedOS' = go =<< getOS
go Nothing = error "Unknown host OS is not supported by this property."