summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJoey Hess2015-09-30 11:24:54 -0400
committerJoey Hess2015-09-30 11:24:54 -0400
commitfd9e7d443e6ac96f163781a27674c27b43ee101f (patch)
tree4714db0a8d30c9cf8287a8ccdb1c7b157794df03 /doc
parentebf24f6a8fc2694be53476de20a8c97561346a6a (diff)
comment
Diffstat (limited to 'doc')
-rw-r--r--doc/forum/chroot_for_sbuild/.comment_3_bb01c327417848165197405f5f918caf._comment.swpbin0 -> 12288 bytes
-rw-r--r--doc/forum/chroot_for_sbuild/comment_5_dec82cad1490a22c3f2fbbaa4edbd9f0._comment44
-rw-r--r--doc/forum/property_which_create_a_file/comment_1_bc541cd7e3fdaa8e1664e95bebecb2bc._comment14
3 files changed, 58 insertions, 0 deletions
diff --git a/doc/forum/chroot_for_sbuild/.comment_3_bb01c327417848165197405f5f918caf._comment.swp b/doc/forum/chroot_for_sbuild/.comment_3_bb01c327417848165197405f5f918caf._comment.swp
new file mode 100644
index 00000000..0036d873
--- /dev/null
+++ b/doc/forum/chroot_for_sbuild/.comment_3_bb01c327417848165197405f5f918caf._comment.swp
Binary files differ
diff --git a/doc/forum/chroot_for_sbuild/comment_5_dec82cad1490a22c3f2fbbaa4edbd9f0._comment b/doc/forum/chroot_for_sbuild/comment_5_dec82cad1490a22c3f2fbbaa4edbd9f0._comment
new file mode 100644
index 00000000..f1bc6717
--- /dev/null
+++ b/doc/forum/chroot_for_sbuild/comment_5_dec82cad1490a22c3f2fbbaa4edbd9f0._comment
@@ -0,0 +1,44 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 5"""
+ date="2015-09-30T14:57:26Z"
+ content="""
+You really have to follow the types here. `withTmpDir` passes a tmp dir to
+a monadic action. A RevertableProperty is not a monadic action (although it
+does contain one), so your code doesn't type check.
+
+What you can do is use `ensureProperty` to run a property from within
+the Propellor action of an enclosing property. The type of that is
+`ensureProperty :: Property NoInfo -> Propellor Result` ,
+so it can't be used on a RevertableProperty like your `sbuild'`.
+If you can get a `foo :: System -> FilePath -> Property NoInfo`, you can
+use it with `ensureProperty` like this:
+
+ sbuild system = property "some desc" $ do
+ ensureProperty $
+ withTmpDir "sbuild" $ \tmpdir -> foo system tmpdir
+
+But .. To get from a RevertableProperty to a Property NoInfo is a fraught
+conversion. `toProp` can get to a Property HasInfo. You'd have to use
+`ignoreInfo` to get from there to a Property NoInfo, and a lot of care
+should be taken when using `ignoreInfo`.
+
+It *might* be ok to ignoreInfo in this case; the agument would go that this
+is a chroot being used to create a sbuild image, so any Info belonging to
+properties of the chroot doesn't affect the host that it's built on,
+and so it doesn't need to propigate out. But, consider that this would
+break any properties inside the chroot that use privdata, since
+privdata works via info.
+
+I'd probably take an alternate tack here. Make `sbuild` use a chroot
+directory in a fixed location, instead of a temp directory. It could
+base the chroot location on the filename of the tarball it's creating
+`(++ ".chroot")`, for example.
+
+That approach also has the benefit of letting you alter properties of the
+chroot and propellor will modify the existing chroot to meet those
+properties, which is faster than building a new chroot every time.
+
+(Then you can use `onChange` to update the schroot tarball anytime the
+chroot changes.)
+"""]]
diff --git a/doc/forum/property_which_create_a_file/comment_1_bc541cd7e3fdaa8e1664e95bebecb2bc._comment b/doc/forum/property_which_create_a_file/comment_1_bc541cd7e3fdaa8e1664e95bebecb2bc._comment
new file mode 100644
index 00000000..cb8bd32f
--- /dev/null
+++ b/doc/forum/property_which_create_a_file/comment_1_bc541cd7e3fdaa8e1664e95bebecb2bc._comment
@@ -0,0 +1,14 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 1"""
+ date="2015-09-30T14:53:02Z"
+ content="""
+My suggestion in the specific case of the sbuild property would be to
+generate the file whenever the property that generates the chroot has to
+make a change. The `onChange` combinator accomplishes that.
+
+But if you really want to only run the property if the file doesn't exist,
+you can do that by using the `check` combinator. For example:
+
+ check (not <$> doesFileExist f) (createtarball f)
+"""]]