From 457bc7438a4f0801dbf332fa2369248bddf5da0c Mon Sep 17 00:00:00 2001 Message-Id: <457bc7438a4f0801dbf332fa2369248bddf5da0c.1678309546.git.dev@jpoiret.xyz> From: Josselin Poiret Date: Wed, 8 Mar 2023 18:31:52 +0100 Subject: [PATCH] Add environment variable for library directories AGDA_LIBDIRS is a new environment colon-separated variable for site libraries. Agda will look for .agda-lib files directly inside direct descendants of these. --- src/full/Agda/Interaction/Library.hs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/full/Agda/Interaction/Library.hs b/src/full/Agda/Interaction/Library.hs index 09c1f2a82..774cc3e74 100644 --- a/src/full/Agda/Interaction/Library.hs +++ b/src/full/Agda/Interaction/Library.hs @@ -323,13 +323,25 @@ getInstalledLibraries overrideLibFile = mkLibM [] $ do raiseErrors' [ LibrariesFileNotFound theOverrideLibFile ] return [] Right file -> do - if not (lfExists file) then return [] else do + siteLibDirs <- liftIO $ fromMaybe [] . fmap splitAtColon . lookup "AGDA_LIBDIRS" <$> getEnvironment + siteLibs <- liftIO $ concat <$> mapM findSiteLibs siteLibDirs + if not (lfExists file) then parseLibFiles Nothing $ nubOn snd ((0,) <$> siteLibs) else do ls <- liftIO $ stripCommentLines <$> UTF8.readFile (lfPath file) files <- liftIO $ sequence [ (i, ) <$> expandEnvironmentVariables s | (i, s) <- ls ] - parseLibFiles (Just file) $ nubOn snd files + parseLibFiles (Just file) $ nubOn snd (files ++ fmap (0,) siteLibs) `catchIO` \ e -> do raiseErrors' [ ReadError e "Failed to read installed libraries." ] return [] + where splitAtColon :: String -> [String] + splitAtColon "" = [] + splitAtColon str = case break (==':') str of + (a, _:b) -> a : splitAtColon b + (a, "") -> [a] + findSiteLibs :: String -> IO [String] + findSiteLibs dir = do + subDirs <- filterM doesDirectoryExist =<< map (dir ) <$> listDirectory dir + subFiles <- mapM (\dir -> map (dir ) <$> listDirectory dir) subDirs + return $ concatMap (filter (List.isSuffixOf ".agda-lib")) subFiles -- | Parse the given library files. -- base-commit: 183534bc41af5a53daf685122997dc98883f2be2 -- 2.39.1 2bff'>update-guix-package.scm
AgeCommit message (Expand)Author
2020-11-12maint: update-guix-package: Optionally add sources to store....Following discussions in <https://issues.guix.gnu.org/43893>, keeping a copy of the updated package source is desirable when generating a release. * build-aux/update-guix-package.scm (version-controlled?): Remove variable. (call-with-temporary-git-worktree): Renamed from 'with-temporary-git-worktree'. Update doc. Do not change directory implicitly. Define as a procedure, not a syntax. (keep-source-in-store): New procedure. (main): Adjust to use with call-with-temporary-git-worktree. Add the sources to the store when GUIX_ALLOW_ME_TO_USE_PRIVATE_COMMIT is set. Exit gracefully when FIND-ORIGIN-REMOTE returns #f. (%savannah-guix-git-repo-push-url-regexp): Adjust match for a potential colon separator. * Makefile.am (GUIX_ALLOW_ME_TO_USE_PRIVATE_COMMIT): Adjust. * .dir-locals.el (scheme-mode): Remove entry for with-temporary-git-worktree. * doc/contributing.texi (Updating the Guix Package): Update doc. Co-authored-by: Ludovic Courtès <ludo@gnu.org> Maxim Cournoyer
2020-10-25maint: update-guix-package: Include the git.sv.gnu.org alias....* build-aux/update-guix-package.scm (%savannah-guix-git-repo-push-url): Rename to... (%savannah-guix-git-repo-push-url-regexp): ...this. Add the 'sv' alternative to 'savannah' and the (push) suffix in the URL regexp. (find-origin-remote): Adjust accordingly. Reported-by: Ludovic Courtès <ludo@gnu.org> Maxim Cournoyer
2020-10-19maint: update-guix-package: Prevent accidentally breaking guix pull....Fixes <https://issues.guix.gnu.org/43893>. This changes the 'update-guix-package' tool so that it: 1. Always uses a clean checkout to compute the hash of the updated 'guix' package. 2. Ensures the commit used in the updated 'guix' package definition has already been pushed upstream. * build-aux/update-guix-package.scm (%savannah-guix-git-repo-push-url): New variable. (with-input-pipe-to-string, with-temporary-git-worktree): New syntaxes. (find-origin-remote, git-add-worktree): New procedures. (commit-already-pushed?): New predicate. (main): Check the commit used has already been pushed upstream and compute the hash from a clean checkout. * doc/contributing.texi (Updating the Guix Package): Document it. * .dir-locals.el (scheme-mode): Fix indentation of with-temporary-git-worktree. Maxim Cournoyer
2020-05-28update-guix-package: Use 'origin-hash'....* gnu/packages/package-management.scm (main): Use 'origin-hash' instead of 'origin-sha256'. Signed-off-by: Tobias Geerinckx-Rice <me@tobias.gr> Vincent Legoll