Skip to content
Snippets Groups Projects
  1. Nov 30, 2012
  2. Nov 20, 2012
    • Iustin Pop's avatar
      Add custom code for CV_E* constants to convert-constants · 9ba02574
      Iustin Pop authored
      
      Currently, the cluster verify errors are defined as follows:
      
      CV_ECLUSTER_FOO = (TCLUSTER, "ECLUSTER_FOO", "description")
      
      This means there's no standalone name for the string "ECLUSTER_FOO",
      which makes it hard to derive automatically a type for this union in
      Haskell.
      
      There are three possible fixes:
      
      - manually separate the CV_ECLUSTER_FOO_STR = "ECLUSTER_FOO" in
        constants.py
      - manually extract the strings in Haskell code
      - change convert-constants to automatically export virtual constants
        for those
      
      After discussion on IRC, I've taken the latter approach; even though a
      bit hack-ish, it avoids manual work and potential errors.
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      9ba02574
  3. Oct 11, 2012
  4. Sep 18, 2012
  5. Sep 03, 2012
  6. Aug 28, 2012
  7. May 07, 2012
    • Iustin Pop's avatar
      Implement reverse mapping of values to names · 79a04823
      Iustin Pop authored
      
      This adds a bit of dumb mapping of values to names, while trying to be
      safe. This is the best we can do without resorting to parsing or
      interpreting ASTs.
      
      The difference in the output is:
      
       -- | Converted from Python list or set ADMINST_ALL
       adminstAll :: [String]
      -adminstAll = ["down", "offline", "up"]
      +adminstAll = [adminstDown, adminstOffline, adminstUp]
      
      Since for most such values we use strings, we don't gain in type
      safety on the Haskell side. But it makes the output more readable and
      it might open up other opportunities later.
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      79a04823
    • Iustin Pop's avatar
      Implement support for multi-module export · 09dc9a02
      Iustin Pop authored
      
      This add support for exporting constants from multiple modules (as
      opposed to hard-coding constants), and also makes the output more
      readable by skipping things we know for sure we don't want to convert
      (as opposed to things we would like to but don't know _how_ to
      convert).
      
      Additionally, we export the constants from the luxi module too.
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      09dc9a02
  8. Jan 13, 2012
  9. Jul 13, 2011
  10. May 24, 2011
    • Iustin Pop's avatar
      Implement conversion of Python constants to Haskell · d99d1e36
      Iustin Pop authored
      
      With the merge of the repositories, we can now auto-generate the code
      for Haskell constants from the Python code.
      
      Currently this only handles the basic types (strings and
      integers). Handling containers such as lists and dictionaries is only
      possible if we would use a parser such that we recognise the element
      names. We could extend the convert-constants script if that becomes
      necessary, right now I'm looking at just the simple constants such as
      Iallocator modes, instance states, etc.
      
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      d99d1e36
Loading