summaryrefslogtreecommitdiff
path: root/doc/forum/chroot_for_sbuild
diff options
context:
space:
mode:
Diffstat (limited to 'doc/forum/chroot_for_sbuild')
-rw-r--r--doc/forum/chroot_for_sbuild/comment_10_1eb7755df6ca4324f49908c1d1984c6b._comment9
-rw-r--r--doc/forum/chroot_for_sbuild/comment_1_7612dc49e14e896be8693be87200c7d3._comment25
-rw-r--r--doc/forum/chroot_for_sbuild/comment_2_b287ed52d9c19b6f7e4b48a5a868b703._comment12
-rw-r--r--doc/forum/chroot_for_sbuild/comment_3_bb01c327417848165197405f5f918caf._comment34
-rw-r--r--doc/forum/chroot_for_sbuild/comment_4_141e2f49bc9b04f7ef211394c8410cec._comment25
-rw-r--r--doc/forum/chroot_for_sbuild/comment_5_dec82cad1490a22c3f2fbbaa4edbd9f0._comment44
-rw-r--r--doc/forum/chroot_for_sbuild/comment_6_9a0b4cce3a9cac8504358d6a280c24bb._comment48
-rw-r--r--doc/forum/chroot_for_sbuild/comment_7_c350c4fba2d7e1bdde6e7cc249052c22._comment8
-rw-r--r--doc/forum/chroot_for_sbuild/comment_8_546b34de1ed2d853fb170f944bba307d._comment17
-rw-r--r--doc/forum/chroot_for_sbuild/comment_9_10dae8ccbd9a8b79e4adab2fa403a409._comment10
10 files changed, 232 insertions, 0 deletions
diff --git a/doc/forum/chroot_for_sbuild/comment_10_1eb7755df6ca4324f49908c1d1984c6b._comment b/doc/forum/chroot_for_sbuild/comment_10_1eb7755df6ca4324f49908c1d1984c6b._comment
new file mode 100644
index 00000000..00920707
--- /dev/null
+++ b/doc/forum/chroot_for_sbuild/comment_10_1eb7755df6ca4324f49908c1d1984c6b._comment
@@ -0,0 +1,9 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 10"""
+ date="2015-10-02T16:45:44Z"
+ content="""
+Seems like you could have a parameter giving the name of the schroot,
+and use that as the basis for both the location of the chroot, and the
+schroot config file.
+"""]]
diff --git a/doc/forum/chroot_for_sbuild/comment_1_7612dc49e14e896be8693be87200c7d3._comment b/doc/forum/chroot_for_sbuild/comment_1_7612dc49e14e896be8693be87200c7d3._comment
new file mode 100644
index 00000000..6604fab4
--- /dev/null
+++ b/doc/forum/chroot_for_sbuild/comment_1_7612dc49e14e896be8693be87200c7d3._comment
@@ -0,0 +1,25 @@
+[[!comment format=mdwn
+ username="picca"
+ subject="comment 1"
+ date="2015-09-29T12:35:27Z"
+ content="""
+ok, so I created this property but it does not work
+
+ sbuild :: System -> FilePath -> Property NoInfo
+ sbuild system tarball =
+ chroot `onChange` Tar.create chrootdir tarball
+ where
+ chroot = Chroot.debootstrapped system Debootstrap.BuilddD chrootdir
+ chrootdir = \"/tmp/chroot\"
+
+it fails with this error message
+
+ src/config.hs:167:3:
+ Couldn't match expected type `Property x0'
+ with actual type `Chroot.Chroot'
+ In the first argument of `onChange', namely `chroot'
+ In the expression: chroot `onChange` Tar.create chrootdir tarball
+
+What I understand it that onChange expect a Property instead of a Chroot.
+So what is the right way to tell propellor look at this chrootdir directory and create a tarball if its containt changed.
+"""]]
diff --git a/doc/forum/chroot_for_sbuild/comment_2_b287ed52d9c19b6f7e4b48a5a868b703._comment b/doc/forum/chroot_for_sbuild/comment_2_b287ed52d9c19b6f7e4b48a5a868b703._comment
new file mode 100644
index 00000000..a0281702
--- /dev/null
+++ b/doc/forum/chroot_for_sbuild/comment_2_b287ed52d9c19b6f7e4b48a5a868b703._comment
@@ -0,0 +1,12 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 2"""
+ date="2015-09-29T14:34:07Z"
+ content="""
+So you have a Chroot and want a Property of some kind.
+If you look in the Chroot module, see this:
+
+ provisioned :: Chroot -> RevertableProperty
+
+Which is just what you're looking for.
+"""]]
diff --git a/doc/forum/chroot_for_sbuild/comment_3_bb01c327417848165197405f5f918caf._comment b/doc/forum/chroot_for_sbuild/comment_3_bb01c327417848165197405f5f918caf._comment
new file mode 100644
index 00000000..1ce48047
--- /dev/null
+++ b/doc/forum/chroot_for_sbuild/comment_3_bb01c327417848165197405f5f918caf._comment
@@ -0,0 +1,34 @@
+[[!comment format=mdwn
+ username="picca"
+ subject="comment 3"
+ date="2015-09-30T10:05:08Z"
+ content="""
+Thanks for the information,
+
+Now I use the provision part but I am facing a problem when I try to create the chroot using withTmpDir
+I do not understand exactly how it must work
+
+here the signature of my two methods
+
+ sbuild :: System -> RevertableProperty
+ sbuild system = withTmpDir \"sbuild\" $ \tmpdir -> sbuild' system tmpdir
+
+And here the property which does the work (it works thanks to your comment, I will have other questions about this part later ;)
+
+ sbuild' :: System -> FilePath -> RevertableProperty
+ sbuild' system chrootdir = mksbuild `requires` create
+ ...
+
+When I tried this I got this error
+
+ src/config.hs:166:17:
+ Couldn't match expected type `RevertableProperty'
+ with actual type `m0 RevertableProperty'
+ In the expression:
+ withTmpDir \"sbuild\" $ \ tmpdir -> return $ sbuild' system tmpdir
+ In an equation for `sbuild':
+ sbuild system
+ = withTmpDir \"sbuild\" $ \ tmpdir -> return $ sbuild' system tmpdir
+
+I need to extract the property from the monad, but I do not know how ?
+"""]]
diff --git a/doc/forum/chroot_for_sbuild/comment_4_141e2f49bc9b04f7ef211394c8410cec._comment b/doc/forum/chroot_for_sbuild/comment_4_141e2f49bc9b04f7ef211394c8410cec._comment
new file mode 100644
index 00000000..5ba8eaed
--- /dev/null
+++ b/doc/forum/chroot_for_sbuild/comment_4_141e2f49bc9b04f7ef211394c8410cec._comment
@@ -0,0 +1,25 @@
+[[!comment format=mdwn
+ username="picca"
+ subject="comment 4"
+ date="2015-09-30T13:06:46Z"
+ content="""
+In fact the real error meassage is this one.
+
+ src/config.hs:166:17:
+ Couldn't match expected type `RevertableProperty'
+ with actual type `m0 a0'
+ In the expression:
+ withTmpDir \"sbuild\" $ \ tmpdir -> sbuild' system tmpdir
+ In an equation for `sbuild':
+ sbuild system
+ = withTmpDir \"sbuild\" $ \ tmpdir -> sbuild' system tmpdir
+
+ src/config.hs:166:50:
+ Couldn't match expected type `m0 a0'
+ with actual type `RevertableProperty'
+ In the return type of a call of sbuild'
+ In the expression: sbuild' system tmpdir
+ In the second argument of `($)', namely
+ `\ tmpdir -> sbuild' system tmpdir'
+
+"""]]
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/chroot_for_sbuild/comment_6_9a0b4cce3a9cac8504358d6a280c24bb._comment b/doc/forum/chroot_for_sbuild/comment_6_9a0b4cce3a9cac8504358d6a280c24bb._comment
new file mode 100644
index 00000000..b2196f8a
--- /dev/null
+++ b/doc/forum/chroot_for_sbuild/comment_6_9a0b4cce3a9cac8504358d6a280c24bb._comment
@@ -0,0 +1,48 @@
+[[!comment format=mdwn
+ username="picca"
+ subject="comment 6"
+ date="2015-10-02T14:15:23Z"
+ content="""
+Just for information, here my solution. It is not perfect but it works :)
+thanks a lot for your help
+
+ sbuild :: System -> RevertableProperty
+ sbuild system = sbuild' chroot
+ where
+ chroot = Chroot.debootstrapped system Debootstrap.BuilddD \"/var/lib/sbuild\"
+ & \"/etc/apt/apt.conf.d/01proxy\" `File.hasContent` [\"Acquire::http::Proxy \\"http://w.x.y.z:8080\\";\"]
+ & Apt.installed [\"apt-transport-https\"]
+
+
+ sbuild' :: Chroot -> RevertableProperty
+ sbuild' chroot@(Chroot basedir system _ _) = setup <!> cleanup
+ where
+ setup = toProp (Chroot.provisioned chroot) `onChange` setup'
+
+ setup' = property (\"sbuild-creatchroot \" ++ chrootdir) $ do
+ -- unmount helper filesystems such as proc from the chroot
+ -- before getting sizes
+ liftIO $ Mount.unmountBelow chrootdir
+ -- use the chroot for sbuild
+ ensureProperty $
+ scriptProperty (rmconfig chrootdir ++
+ [ \"sbuild-createchroot --setup-only --keep-sbuild-chroot-dir --make-sbuild-tarball=\" ++ tarball ++ \" \" ++ name ++ \" \" ++ chrootdir ++ \" http://httpredir.debian.org/debian\"
+ ])
+
+ cleanup = scriptProperty (rmconfig chrootname ++ [\"rm -f -v \" ++ tarball])
+ `onChange` toProp (revert (Chroot.provisioned chroot))
+
+ (name, arch) = case system of
+ (System (Debian (Stable suite)) a) -> (suite, a)
+
+ chrootname = name ++ \"-\" ++ arch
+
+ chrootdir = basedir </> chrootname
+
+ tarball = chrootdir ++ \".tar.gz\"
+
+ rmconfig c = [ \"rm -f -v \" ++ \"/etc/schroot/chroot.d\" </> (c ++ \"-sbuild-*\")
+ , \"rm -f -v \" ++ \"/etc/sbuild/chroot\" </> (c ++ \"-sbuild\")
+ ]
+
+"""]]
diff --git a/doc/forum/chroot_for_sbuild/comment_7_c350c4fba2d7e1bdde6e7cc249052c22._comment b/doc/forum/chroot_for_sbuild/comment_7_c350c4fba2d7e1bdde6e7cc249052c22._comment
new file mode 100644
index 00000000..c66c2609
--- /dev/null
+++ b/doc/forum/chroot_for_sbuild/comment_7_c350c4fba2d7e1bdde6e7cc249052c22._comment
@@ -0,0 +1,8 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 7"""
+ date="2015-10-02T15:20:30Z"
+ content="""
+Factoring out a generic Propellor.Property.Sbuild would make this more
+perfect... ;)
+"""]]
diff --git a/doc/forum/chroot_for_sbuild/comment_8_546b34de1ed2d853fb170f944bba307d._comment b/doc/forum/chroot_for_sbuild/comment_8_546b34de1ed2d853fb170f944bba307d._comment
new file mode 100644
index 00000000..77133891
--- /dev/null
+++ b/doc/forum/chroot_for_sbuild/comment_8_546b34de1ed2d853fb170f944bba307d._comment
@@ -0,0 +1,17 @@
+[[!comment format=mdwn
+ username="picca"
+ subject="comment 8"
+ date="2015-10-02T16:09:38Z"
+ content="""
+This could the plan, but I am not very confident that my code is generic enought.
+
+In this case I do not like the way I give the chroot to the sbuild method.
+In fact I do not find the interface of this command generic enought.
+
+There is assumtions in the code:
+ - the initial configuration of sbuild was done
+ - the chrootdir is hardcoded into /var/lib/sbuild and I do not know if this is the right way to do things.
+
+If you would have some advices about interface, because it seems to me thaht you are great for this :)
+
+"""]]
diff --git a/doc/forum/chroot_for_sbuild/comment_9_10dae8ccbd9a8b79e4adab2fa403a409._comment b/doc/forum/chroot_for_sbuild/comment_9_10dae8ccbd9a8b79e4adab2fa403a409._comment
new file mode 100644
index 00000000..b7a649e5
--- /dev/null
+++ b/doc/forum/chroot_for_sbuild/comment_9_10dae8ccbd9a8b79e4adab2fa403a409._comment
@@ -0,0 +1,10 @@
+[[!comment format=mdwn
+ username="picca"
+ subject="comment 9"
+ date="2015-10-02T16:16:41Z"
+ content="""
+Another problem is the schroot cofngiuration files.
+
+sbuild-createchroot create a configuration /stc/schroot/chroot.d/jessie-i386-sbuild-xxxx where xxxx is random.
+In this code I remove all jessie-i386-sbuild-* files, but this seems plain wrong...
+"""]]