Commit e1235448 authored by Jose A. Lopes's avatar Jose A. Lopes
Browse files

Move Haskell constants to proper module



Move Haskell constants from module 'Ganeti.HsConstants', which was a
transitional module part of the Haskell to Python constant generation
infrastructure, to module 'Ganeti.Constants'.
Signed-off-by: default avatarJose A. Lopes <jabolopes@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent 74e15780
......@@ -685,7 +685,6 @@ HS_LIB_SRCS = \
src/Ganeti/Hs2Py/GenConstants.hs \
src/Ganeti/Hs2Py/GenOpCodes.hs \
src/Ganeti/Hs2Py/OpDoc.hs \
src/Ganeti/HsConstants.hs \
src/Ganeti/JQueue.hs \
src/Ganeti/JSON.hs \
src/Ganeti/Jobs.hs \
......@@ -972,11 +971,12 @@ endif
# the reason for this is because 'hs2py-constants' needs to generate
# Python code, and 'Ganeti.Constants' is generated by Python.
src/hs2py-constants: src/hs2py-constants.hs src/AutoConf.hs \
src/Ganeti/BasicTypes.hs src/Ganeti/ConstantUtils.hs \
src/Ganeti/BasicTypes.hs \
src/Ganeti/Constants.hs \
src/Ganeti/ConstantUtils.hs \
src/Ganeti/JSON.hs src/Ganeti/THH.hs \
src/Ganeti/Hs2Py/GenConstants.hs \
src/Ganeti/Hs2Py/ListConstants.hs \
src/Ganeti/HsConstants.hs \
src/Ganeti/PyValueInstances.hs \
| stamp-srclinks
$(GHC) --make \
......@@ -1737,11 +1737,11 @@ src/Ganeti/Version.hs: src/Ganeti/Version.hs.in \
sed -e "s/%ver%/$$VCSVER/" < $< > $@
src/Ganeti/Hs2Py/ListConstants.hs: src/Ganeti/Hs2Py/ListConstants.hs.in \
src/Ganeti/HsConstants.hs \
src/Ganeti/Constants.hs \
| stamp-directories
@echo Generating $@
@set -e; \
## Extract constant names from 'HsConstants.hs' by extracting the left
## Extract constant names from 'Constants.hs' by extracting the left
## side of all lines containing an equal sign (i.e., '=') and
## prepending the apostrophe sign (i.e., "'").
##
......@@ -1749,7 +1749,7 @@ src/Ganeti/Hs2Py/ListConstants.hs: src/Ganeti/Hs2Py/ListConstants.hs.in \
## adminstDown = ...
## becomes
## 'adminstDown
NAMES=$$(sed -e "/^--/ d" $(abs_top_srcdir)/src/Ganeti/HsConstants.hs |\
NAMES=$$(sed -e "/^--/ d" $(abs_top_srcdir)/src/Ganeti/Constants.hs |\
sed -n -e "/=/ s/\(.*\) =.*/ '\1:/g p"); \
m4 -DPY_CONSTANT_NAMES="$$NAMES" $(abs_top_srcdir)/$< > $@
......
......@@ -53,7 +53,7 @@ Misc changes
- Opcodes are entirely generated from Haskell using the tool 'hs2py' and
the module 'src/Ganeti/OpCodes.hs'.
- Constants are also generated from Haskell using the tool
'hs2py-constants' and the module 'src/Ganeti/HsConstants.hs', with the
'hs2py-constants' and the module 'src/Ganeti/Constants.hs', with the
exception of socket related constants, which require changing the
cluster configuration file, and HVS related constants, because they
are part of a port of instance queries to Haskell. As a result, these
......
......@@ -89,25 +89,23 @@ instance PyValue Protocol where
-- | Failure exit code
--
-- These are defined here and not in 'Ganeti.HsConstants' together with
-- These are defined here and not in 'Ganeti.Constants' together with
-- the other exit codes in order to avoid a circular dependency
-- between 'Ganeti.HsConstants' and 'Ganeti.Runtime'
-- between 'Ganeti.Constants' and 'Ganeti.Runtime'
exitFailure :: Int
exitFailure = 1
-- | Console device
--
-- This is defined here and not in 'Ganeti.HsConstants' order to avoid
-- a circular dependency between 'Ganeti.HsConstants' and
-- 'Ganeti.Logging'
-- This is defined here and not in 'Ganeti.Constants' order to avoid a
-- circular dependency between 'Ganeti.Constants' and 'Ganeti.Logging'
devConsole :: String
devConsole = "/dev/console"
-- | Random uuid generator
--
-- This is defined here and not in 'Ganeti.HsConstants' order to avoid
-- a circular dependendy between 'Ganeti.HsConstants' and
-- 'Ganeti.Types'
-- This is defined here and not in 'Ganeti.Constants' order to avoid a
-- circular dependendy between 'Ganeti.Constants' and 'Ganeti.Types'
randomUuidFile :: String
randomUuidFile = "/proc/sys/kernel/random/uuid"
......@@ -135,7 +133,7 @@ buildVersion major minor revision =
-- | Confd protocol version
--
-- This is defined here in order to avoid a circular dependency
-- between 'Ganeti.Confd.Types' and 'Ganeti.HsConstants'.
-- between 'Ganeti.Confd.Types' and 'Ganeti.Constants'.
confdProtocolVersion :: Int
confdProtocolVersion = 1
......@@ -143,7 +141,7 @@ confdProtocolVersion = 1
--
-- These are defined here and not in 'Ganeti.Types' due to GHC stage
-- restrictions concerning Template Haskell. They are also not
-- defined in 'Ganeti.HsConstants' in order to avoid a circular
-- defined in 'Ganeti.Constants' in order to avoid a circular
-- dependency between that module and 'Ganeti.Types'.
confdReqqLink :: String
......
This diff is collapsed.
......@@ -28,8 +28,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
{-# LANGUAGE TemplateHaskell #-}
module Ganeti.Hs2Py.ListConstants where
import Ganeti.Constants
import Ganeti.Hs2Py.GenConstants
import Ganeti.HsConstants
import Ganeti.PyValueInstances ()
$(genPyConstants "pyConstants"
......
This diff is collapsed.
......@@ -539,7 +539,7 @@ addParamsToStorageUnit _ (SURaw StorageRados key) = SURados key
-- This is part of the 'IAllocator' interface and it is used, for
-- example, in 'Ganeti.HTools.Loader.RqType'. However, it must reside
-- in this module, and not in 'Ganeti.HTools.Types', because it is
-- also used by 'Ganeti.Constants'.
$(THH.declareLADT ''String "EvacMode"
[ ("ChangePrimary", "primary-only")
, ("ChangeSecondary", "secondary-only")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment