summaryrefslogtreecommitdiff
path: root/doc/forum/upgrading_to_propellor_3.0/comment_1_ddf4b31102bf16a34afaa6f77e8464d1._comment
blob: da4ee68bbc91b498e2dce61c37dfb584de692ae9 (plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
[[!comment format=mdwn
 username="picca"
 subject="How to migrate this property"
 date="2016-04-13T08:52:10Z"
 content="""
Hello, I am trying to migrate this property

    -- | Property used to setup a schroot used by sbuild
    -- > schroot \"jessie-i386-sbuild\"
    -- >    debootstrapped Debootstrap.BuildD \"/srv/chroot/ghc-dev\"
    -- >	    & os (System (Debian (Stable \"jessie\")) \"i386\")
    -- > 	    & Apt.installed [\"ghc\", \"haskell-platform\"]
    -- > 	    & ...
    schroot :: SchrootName -> Chroot -> RevertableProperty (HasInfo + DebianLike) DebianLike
    schroot sn chroot@(Chroot.Chroot chrootdir _ _) = (setup `requires` installed) <!> cleanup
        where
          setup :: Property (HasInfo + DebianLike)
          setup = conf `requires` (provision `onChange` targz)
              where
                provision :: Property (HasInfo + DebianLike)
                provision = toChildProperty (Chroot.provisioned chroot) `before` umount
                    where
                      umount = property (\"umount \" ++ chrootdir) $ do
                                 liftIO $ Mount.unmountBelow chrootdir
                                 return NoChange
                targz = createTarball chrootdir tarball
                conf = chrootConf sn tarball
          cleanup :: Property DebianLike
          cleanup = File.notPresent (schrootChrootD </> sn)
                    `requires` File.notPresent tarball
                    `requires` toChildProperty (revert (Chroot.provisioned chroot))
          tarball = chrootdir <.> \"tar.gz\"


and when I compile it I get this error message

    src/Propellor/Property/Sbuild.hs:79:25-83:

    Couldn't match type ‘CombinedType
                           ChildProperty (Property (MetaTypes metatypes1))’
                   with ‘Property
                           (MetaTypes
                              '['WithInfo, 'Targeting 'OSDebian, 'Targeting 'OSBuntish])’
    The type variable ‘metatypes1’ is ambiguous
    Expected type: Property (HasInfo + DebianLike)
      Actual type: CombinedType
                     ChildProperty (Property (MetaTypes metatypes1))
    Relevant bindings include
      umount :: Property (MetaTypes metatypes1)
        (bound at src/Propellor/Property/Sbuild.hs:81:19)
    In the expression:
      toChildProperty (Chroot.provisioned chroot) `before` umount
    In an equation for ‘provision’:
        provision
          = toChildProperty (Chroot.provisioned chroot) `before` umount
          where
              umount
                = property (\"umount \" ++ chrootdir)
                  $ do { liftIO $ Mount.unmountBelow chrootdir;
                         .... }
    In an equation for ‘setup’:
        setup
          = conf `requires` (provision `onChange` targz)
          where
              provision :: Property (HasInfo + DebianLike)
              provision
                = toChildProperty (Chroot.provisioned chroot) `before` umount
                where
                    umount = property (\"umount \" ++ chrootdir) $ ...
              targz = createTarball chrootdir tarball
              conf = chrootConf sn tarball

    src/Propellor/Property/Sbuild.hs:(87,17)-(89,79):

    Couldn't match expected type ‘Property DebianLike’
                with actual type ‘CombinedType
                                    (Property
                                       (MetaTypes
                                          '['Targeting 'OSDebian, 'Targeting 'OSBuntish,
                                            'Targeting 'OSFreeBSD]))
                                    ChildProperty’
    In the expression:
      File.notPresent (schrootChrootD </> sn)
      `requires` File.notPresent tarball
      `requires` toChildProperty (revert (Chroot.provisioned chroot))
    In an equation for ‘cleanup’:
        cleanup
          = File.notPresent (schrootChrootD </> sn)
            `requires` File.notPresent tarball
            `requires` toChildProperty (revert (Chroot.provisioned chroot))
    In an equation for ‘schroot’:
        schroot sn chroot@(Chroot.Chroot chrootdir _ _)
          = (setup `requires` installed) <!> cleanup
          where
              setup :: Property (HasInfo + DebianLike)
              setup
                = conf `requires` (provision `onChange` targz)
                where
                    provision :: Property (HasInfo + DebianLike)
                    provision
                      = toChildProperty (Chroot.provisioned chroot) `before` umount
                      where
                          ...
                    ....
              cleanup :: Property DebianLike
              cleanup
                = File.notPresent (schrootChrootD </> sn)
                  `requires` File.notPresent tarball
                  `requires` toChildProperty (revert (Chroot.provisioned chroot))
              ....

    src/Propellor/Property/Sbuild.hs:98:18-42:

    Couldn't match expected type ‘Property DebianLike’
                with actual type ‘CombinedType
                                    (Property (MetaTypes metatypes0)) (Property DebianLike)’
    The type variable ‘metatypes0’ is ambiguous
    Relevant bindings include
      prop :: Property (MetaTypes metatypes0)
        (bound at src/Propellor/Property/Sbuild.hs:100:5)
    In the expression: prop `requires` installed
    In an equation for ‘addUsers’:
        addUsers users
          = prop `requires` installed
          where
              prop
                = property (\"sbuild add users \" ++ unwords names)
                  $ liftIO
                    $ toResult
                      <$> boolSystem \"sbuild-adduser\" [Param user | user <- names]
                where
                    names = ...

so my question is what is wrong with my code :))
"""]]