-- |Creates a text record for a package in a format required by @package.accept_keywords@ file.
toPackageAcceptKeywordRecord :: FlatPackage -> Maybe Text
toPackageAcceptKeywordRecord fp
  | null kws = Nothing
  | otherwise = Just $ withAtom fp $ showText kws
  where kws = Set.toAscList $_fpKeywords fp

-- |Creates a list of lines to be written to portage accept_keywords file @/etc/portage/package.accept_keywords/*@
-- See 'toPackageAcceptKeywordRecord'
toPackageAcceptKeywordRecord :: FlatPackage -> Maybe Text
toPackageAcceptKeywordRecord fp
  | null kws = Nothing
  | otherwise = Just $ withAtom fp $ showText kws
  where kws = Set.toAscList $_fpKeywords fp

-- |Creates a list of lines to be written to portage accept_keywords file @/etc/portage/package.accept_keywords/*@
-- See 'toPackageAcceptKeywordRecord'
toPackageAcceptKeywordRecord fp
  | null kws = Nothing
  | otherwise = Just $ withAtom fp $ showText kws
  where kws = Set.toAscList $_fpKeywords fp

-- |Creates a list of lines to be written to portage accept_keywords file @/etc/portage/package.accept_keywords/*@
-- See 'toPackageAcceptKeywordRecord'