-- | This module re-exports most of the submodules.
module Data.RPM (
  module Data.RPM.NV,
  module Data.RPM.NVR,
  module Data.RPM.NVRA,
  module Data.RPM.VerRel,
  module Data.RPM.VerCmp,
  dropRelease,
  addRelease,
  dropArch,
  addArch
  ) where

import Data.RPM.NV
import Data.RPM.NVR
import Data.RPM.NVRA
import Data.RPM.VerCmp
import Data.RPM.VerRel

-- | Map a name-version-release into a name-version
dropRelease :: NVR -> NV
dropRelease :: NVR -> NV
dropRelease (NVR String
n (VerRel String
v String
_)) = String -> String -> NV
NV String
n String
v

-- | Add a release to name-version to make an NVR
addRelease :: NV -> String -> NVR
addRelease :: NV -> String -> NVR
addRelease NV
_ String
"" = String -> NVR
forall a. HasCallStack => String -> a
error String
"addRelease: release cannot be empty"
addRelease (NV String
n String
v) String
r = String -> VerRel -> NVR
NVR String
n (String -> String -> VerRel
VerRel String
v String
r)

-- | Map a name-version-release.arch into a name-version-release
dropArch :: NVRA -> NVR
dropArch :: NVRA -> NVR
dropArch (NVRA String
n VerRel
vr String
_) = String -> VerRel -> NVR
NVR String
n VerRel
vr

-- | Add an arch to NVR to make an NVRA
addArch :: NVR -> String -> NVRA
addArch :: NVR -> String -> NVRA
addArch NVR
_ String
"" = String -> NVRA
forall a. HasCallStack => String -> a
error String
"addArch: arch cannot be empty"
addArch (NVR String
n VerRel
vr) String
a = String -> VerRel -> String -> NVRA
NVRA String
n VerRel
vr String
a