This is a first step—replacing the hardcoded strings with constants derived from the Python constants file.
Let me know if the idea is good or not—after this, we can't compile anymore htools without the Python codebase, whereas before this was still possible; basically Python becomes a prerequisite for the Haskell part. I wasn't able to run this on buildbot as the executable mode of convert-constants is not represented in patch, but passes a local commit-check (except for Sphinx's failing on itself). Iustin Pop (6): Implement conversion of Python constants to Haskell IAllocator.hs: replace a few strings with constants Replace instance states hardcoded with constants Convert group policies to constants Convert job status strings to constants Misc other conversions .gitignore | 1 + Makefile.am | 11 +++++- autotools/convert-constants | 78 ++++++++++++++++++++++++++++++++++++++ htools/Ganeti/Constants.hs.in | 28 +++++++++++++ htools/Ganeti/HTools/CLI.hs | 5 +- htools/Ganeti/HTools/IAlloc.hs | 47 ++++++++++++----------- htools/Ganeti/HTools/Instance.hs | 3 +- htools/Ganeti/HTools/QC.hs | 13 ++++-- htools/Ganeti/HTools/Rapi.hs | 3 +- htools/Ganeti/HTools/Types.hs | 20 +++++---- htools/Ganeti/Jobs.hs | 35 +++++++++-------- 11 files changed, 187 insertions(+), 57 deletions(-) create mode 100755 autotools/convert-constants create mode 100644 htools/Ganeti/Constants.hs.in -- 1.7.3.1
