diff options
author | Mohammad Akhlaghi <mohammad@akhlaghi.org> | 2019-01-22 03:56:44 +0000 |
---|---|---|
committer | Mohammad Akhlaghi <mohammad@akhlaghi.org> | 2019-01-22 03:56:44 +0000 |
commit | 8aee1fd032bbfcee3ef0618f683723d119850da0 (patch) | |
tree | 7d493c6eff8dff2e3e5016aeb3bc5e0eca5c932e /reproduce/src | |
parent | 914e101735da4451ac77e7970b1b952afd95c7f4 (diff) |
Using fork of metastore to work when getpwuid isn't usable
After testing the built of Metastore on a server, I noticed that because
its `/etc/passwd' doesn't have the list of users, the `getpwuid' call
within metastore failed and wouldn't let it finish.
So I looked into the code and was able to implement a solution to this
problem by adding two options to it for default values for the user and
group. Also, file attributes are not necessary in our (current) use case of
metastore and caused crashes on our server, so they are also disabled.
Diffstat (limited to 'reproduce/src')
-rw-r--r-- | reproduce/src/bash/git-post-checkout | 2 | ||||
-rw-r--r-- | reproduce/src/bash/git-pre-commit | 4 | ||||
-rw-r--r--[-rwxr-xr-x] | reproduce/src/make/dependencies-basic.mk | 0 | ||||
-rw-r--r-- | reproduce/src/make/dependencies.mk | 46 |
4 files changed, 36 insertions, 16 deletions
diff --git a/reproduce/src/bash/git-post-checkout b/reproduce/src/bash/git-post-checkout index 4ec2fa6..4c69b2d 100644 --- a/reproduce/src/bash/git-post-checkout +++ b/reproduce/src/bash/git-post-checkout @@ -25,6 +25,6 @@ if [ ! -e "$MSFILE" ]; then fi exit_on_fail \ - @BINDIR@/metastore -a -m -e -E -q -f "$MSFILE" + @BINDIR@/metastore -a -m -e -E -q -O @USER@ -G @GROUP@ -f "$MSFILE" exit 0 diff --git a/reproduce/src/bash/git-pre-commit b/reproduce/src/bash/git-pre-commit index 295c033..4373898 100644 --- a/reproduce/src/bash/git-pre-commit +++ b/reproduce/src/bash/git-pre-commit @@ -31,12 +31,12 @@ exit_on_fail() { } exit_on_fail \ - @BINDIR@/metastore -s -f "$MSFILE" + @BINDIR@/metastore -O @USER@ -G @GROUP@ -s -f "$MSFILE" # If it's first metastore commit, store again to include $MSFILE in $MSFILE. if ! git-ls-tree --name-only HEAD 2>/dev/null | grep -Fqx "$MSFILE"; then exit_on_fail \ - @BINDIR@/metastore -s -f "$MSFILE" + @BINDIR@/metastore -O @USER@ -G @GROUP@ -s -f "$MSFILE" fi if [ ! -e "$MSFILE" ]; then diff --git a/reproduce/src/make/dependencies-basic.mk b/reproduce/src/make/dependencies-basic.mk index eb6bcce..eb6bcce 100755..100644 --- a/reproduce/src/make/dependencies-basic.mk +++ b/reproduce/src/make/dependencies-basic.mk diff --git a/reproduce/src/make/dependencies.mk b/reproduce/src/make/dependencies.mk index 128e4e5..9f3436d 100644 --- a/reproduce/src/make/dependencies.mk +++ b/reproduce/src/make/dependencies.mk @@ -138,7 +138,7 @@ $(tarballs): $(tdir)/%: elif [ $$n = libgit ]; then mergenames=0 w=https://github.com/libgit2/libgit2/archive/v$(libgit2-version).tar.gz - elif [ $$n = metastore ]; then w=http://ftp.przemoc.net/pub/software/utils/metastore + elif [ $$n = metastore ]; then w=http://akhlaghi.org/src elif [ $$n = tiff ]; then w=https://download.osgeo.org/libtiff elif [ $$n = wcslib ]; then w=ftp://ftp.atnf.csiro.au/pub/software/wcslib else @@ -359,26 +359,46 @@ $(ibdir)/git: $(tdir)/git-$(git-version).tar.xz \ $(ibdir)/metastore: $(tdir)/metastore-$(metastore-version).tar.gz \ $(ilidir)/libbsd \ $(ibdir)/git + + # The build command below will change the current directory of this + # build, so we'll fix its value here. + current_dir=$$(pwd) + # Metastore doesn't have any `./configure' script. So we'll just # call `pwd' as a place-holder for the `./configure' command. - current_dir=$$(pwd) - $(call gbuild, $<, metastore-$(metastore-version), static,,V=1,, \ - pwd, PREFIX=$(idir)) + # + # File attributes are also not available on some systems, since the + # main purpose here is modification dates (and not attributes), + # we'll also set the `NO_XATTR' flag. + $(call gbuild, $<, metastore-$(metastore-version), static,, \ + NO_XATTR=1 V=1,,pwd,PREFIX=$(idir)) # Write the relevant hooks into this system's Git hooks, so Git # calls metastore properly on every commit and every checkout. + # + # Note that the -O and -G options used here are currently only in a + # fork of `metastore' currently hosted at: + # https://github.com/mohammad-akhlaghi/metastore + user=$$(whoami) + group=$$(groups $$user | awk '{print $$1}') cd $$current_dir if [ -f $@ ]; then - rm -f .git/hooks/pre-commit .git/hooks/post-checkout - sed -e's|@BINDIR[@]|$(ibdir)|g' \ - reproduce/src/bash/git-pre-commit > .git/hooks/pre-commit - sed -e's|@BINDIR[@]|$(ibdir)|g' \ - reproduce/src/bash/git-post-checkout > .git/hooks/post-checkout - chmod +x .git/hooks/pre-commit .git/hooks/post-checkout + for f in pre-commit post-checkout; do + sed -e's|@USER[@]|'$$user'|g' \ + -e's|@GROUP[@]|'$$group'|g' \ + -e's|@BINDIR[@]|$(ibdir)|g' \ + reproduce/src/bash/git-$$f > .git/hooks/$$f + chmod +x .git/hooks/$$f + done else - echo; echo; echo "Metastore couldn't be built on this system!" - echo "Please contact mohammad@akhlaghi.org to try fixing the problem." - echo; echo "But this is not a vital element of the pipeline. You " + echo; echo; echo; + echo "*****************" + echo "metastore couldn't be installed!" + echo + echo "Its used for preserving timestamps on Git commits." + echo "Its useful for development, not simple running of the pipeline." + echo "So we won't stop the pipeline because it wasn't built." + echo "*****************" fi # The order of dependencies is based on how long they take to build (how |