-- | 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 n :: String
n (VerRel v :: String
v _)) = 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 _ "" = String -> NVR
forall a. HasCallStack => String -> a
error "addRelease: release cannot be empty"
addRelease (NV n :: String
n v :: String
v) r :: 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 n :: String
n vr :: VerRel
vr _) = 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 _ "" = String -> NVRA
forall a. HasCallStack => String -> a
error "addArch: arch cannot be empty"
addArch (NVR n :: String
n vr :: VerRel
vr) a :: String
a = String -> VerRel -> String -> NVRA
NVRA String
n VerRel
vr String
a