building a standalone rpm from the standalone tarball

This allows the rpm to be built anywhere the necessary build deps are
available (including on debian) and the resulting package will work on as
broad a range of rpm distributions as the libc/kernel supports.

The DistributionUpdate changes to use the new script have not yet been
tested.
This commit is contained in:
Joey Hess 2019-09-12 19:02:59 -04:00
parent 53fd746705
commit 4508198507
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 121 additions and 4 deletions

View file

@ -5,6 +5,9 @@
- Generates info files, containing the version (of the corresponding file
- from the autobuild).
-
- Builds standalone rpms from the standalone tarballs, and populates
- a rpm package repository with them using the createrepo program.
-
- Also gpg signs the files.
-}
@ -44,15 +47,46 @@ autobuilds =
)
autobuild f = "https://downloads.kitenet.net/git-annex/autobuild/" ++ f
-- Names of architectures in standalone tarballs and the corresponding
-- rpm architecture.
tarrpmarches :: [(String, String)]
tarrpmarches =
[ ("i386", "i386")
, ("amd64", "x86_64")
, ("arm64", "aarch64")
]
buildrpms :: FilePath -> [(FilePath, Version)] -> Annex ()
buildrpms topdir l = do
liftIO $ createDirectoryIfMissing True rpmrepo
forM_ tarrpmarches $ \(tararch, rpmarch) ->
forM_ (filter (isstandalonetarball tararch . fst) l) $ \(tarball, v) ->
void $ liftIO $ boolSystem script
[ Param rpmarch
, File tarball
, Param v
, File rpmrepo
]
void $ liftIO $ boolSystem "createrepo" [File rpmrepo]
void $ inRepo $ runBool [Param "annex", Param "add", File rpmrepo]
where
isstandalonetarball tararch f =
("git-annex-standalone-" ++ tararch ++ ".tar.gz") `isSuffixOf` f
script = topdir </> "standalone" </> "rpm" </> "rpmbuild-from-standalone-tarball"
rpmrepo = "git-annex/linux/current/rpms"
main :: IO ()
main = do
useFileSystemEncoding
version <- liftIO getChangelogVersion
version <- getChangelogVersion
repodir <- getRepoDir
topdir <- getCurrentDirectory
changeWorkingDirectory repodir
updated <- catMaybes <$> mapM (getbuild repodir) autobuilds
state <- Annex.new =<< Git.Construct.fromPath "."
Annex.eval state (makeinfos updated version)
Annex.eval state $ do
buildrpms topdir updated
makeinfos updated version
-- Download a build from the autobuilder, virus check it, and return its
-- version.