Include magic database in the linux and OSX standalone builds.

This commit is contained in:
Joey Hess 2016-02-26 11:54:15 -04:00
parent 5d0b5eeefb
commit 471a211d21
Failed to extract signature
5 changed files with 21 additions and 2 deletions

View file

@ -33,6 +33,7 @@ import Git.CheckAttr (unspecifiedAttr)
#ifdef WITH_MAGICMIME #ifdef WITH_MAGICMIME
import Magic import Magic
import Utility.Env
#endif #endif
import Data.Either import Data.Either
@ -131,7 +132,12 @@ mkLargeFilesParser = do
#ifdef WITH_MAGICMIME #ifdef WITH_MAGICMIME
magicmime <- liftIO $ catchMaybeIO $ do magicmime <- liftIO $ catchMaybeIO $ do
m <- magicOpen [MagicMimeType] m <- magicOpen [MagicMimeType]
liftIO $ magicLoadDefault m liftIO $ do
md <- getEnv "GIT_ANNEX_DIR"
case md of
Nothing -> magicLoadDefault m
Just d -> magicLoad m
(d </> "magic" </> "magic.mgc")
return m return m
#endif #endif
let parse = parseToken $ commonTokens let parse = parseToken $ commonTokens

View file

@ -147,6 +147,8 @@ linuxstandalone-nobuild: Build/Standalone Build/LinuxMkLibs
install -d "$(LINUXSTANDALONE_DEST)/git-core" install -d "$(LINUXSTANDALONE_DEST)/git-core"
(cd "$(shell git --exec-path)" && tar c .) | (cd "$(LINUXSTANDALONE_DEST)"/git-core && tar x) (cd "$(shell git --exec-path)" && tar c .) | (cd "$(LINUXSTANDALONE_DEST)"/git-core && tar x)
install -d "$(LINUXSTANDALONE_DEST)/templates" install -d "$(LINUXSTANDALONE_DEST)/templates"
install -d "$(LINUXSTANDALONE_DEST)/magic"
cp /usr/share/file/magic.mgc "$(LINUXSTANDALONE_DEST)/magic"
./Build/LinuxMkLibs "$(LINUXSTANDALONE_DEST)" ./Build/LinuxMkLibs "$(LINUXSTANDALONE_DEST)"
@ -199,6 +201,12 @@ osxapp: Build/Standalone Build/OSXMkLibs
(cd "$(shell git --exec-path)" && tar c .) | (cd "$(OSXAPP_BASE)" && tar x) (cd "$(shell git --exec-path)" && tar c .) | (cd "$(OSXAPP_BASE)" && tar x)
install -d "$(OSXAPP_BASE)/templates" install -d "$(OSXAPP_BASE)/templates"
install -d "$(OSXAPP_BASE)/magic"
if [ -e "$(OSX_MAGIC_FILE)" ]; then \
cp "$(OSX_MAGIC_FILE)" "$(OSXAPP_BASE)/magic/magic.mgc"; \
else \
echo "** OSX_MAGIC_FILE not set; not including it" >&2; \
endif
# OSX looks in man dir nearby the bin # OSX looks in man dir nearby the bin
$(MAKE) install-mans DESTDIR="$(OSXAPP_BASE)/.." SHAREDIR="" PREFIX="" $(MAKE) install-mans DESTDIR="$(OSXAPP_BASE)/.." SHAREDIR="" PREFIX=""

1
debian/changelog vendored
View file

@ -11,6 +11,7 @@ git-annex (6.20160218) UNRELEASED; urgency=medium
so any system gpg will be preferred over it. so any system gpg will be preferred over it.
* Avoid crashing when built with MagicMime support, but when the magic * Avoid crashing when built with MagicMime support, but when the magic
database cannot be loaded. database cannot be loaded.
* Include magic database in the linux and OSX standalone builds.
-- Joey Hess <id@joeyh.name> Thu, 18 Feb 2016 13:09:21 -0400 -- Joey Hess <id@joeyh.name> Thu, 18 Feb 2016 13:09:21 -0400

Binary file not shown.

View file

@ -77,7 +77,11 @@ export ORIG_GIT_TEMPLATE_DIR
GIT_TEMPLATE_DIR="$bundle/templates" GIT_TEMPLATE_DIR="$bundle/templates"
export GIT_TEMPLATE_DIR export GIT_TEMPLATE_DIR
# Indicate which variables were exported above. GIT_ANNEX_DIR="$bundle"
export GIT_ANNEX_DIR
# Indicate which variables were exported above and should be cleaned
# when running non-bundled programs.
GIT_ANNEX_STANDLONE_ENV="PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR" GIT_ANNEX_STANDLONE_ENV="PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR"
export GIT_ANNEX_STANDLONE_ENV export GIT_ANNEX_STANDLONE_ENV