Skip to content

Commit

Permalink
Completely remove build-time git dependency
Browse files Browse the repository at this point in the history
Previous build system required the git build tools to be installed to
operate properly. Worse: the test suite required git to be *built* to
operate at all.

We now completely remove that dependency by doing our own "build" or
rather, by removing the need to do a build at all. We simply assume
/usr/bin/perl exists, and that we'll use the GITPERLLIB environment to
specify the path to our Git library during testing.

do not depend on an externally built git and assume it is available
  • Loading branch information
anarcat committed Nov 22, 2017
1 parent 02fe2f6 commit bfaa7d5
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 34 deletions.
7 changes: 3 additions & 4 deletions .travis.yml
@@ -1,14 +1,13 @@
language: perl language: perl


env:
- GIT_ROOT_DIR="$TRAVIS_BUILD_DIR/git"

before_install: before_install:
- sudo apt-get update -q - sudo apt-get update -q
- sudo apt-get install -y lighttpd php5 php5-cgi php5-cli php5-curl php5-sqlite git libmediawiki-api-perl liblwp-protocol-https-perl libdatetime-format-iso8601-perl - sudo apt-get install -y lighttpd php5 php5-cgi php5-cli php5-curl php5-sqlite git libmediawiki-api-perl liblwp-protocol-https-perl libdatetime-format-iso8601-perl


install: install:
- (cd t && ./install-wiki.sh install) - (cd t && ./install-wiki.sh install)
- git clone --depth=1 https://github.com/git/git "$TRAVIS_BUILD_DIR/git"
- ln -s /usr/bin/git "$TRAVIS_BUILD_DIR/git/git"


script: script:
- make test GIT_ROOT_DIR=$GIT_ROOT_DIR - env GITPERLLIB="$TRAVIS_BUILD_DIR" make test
25 changes: 6 additions & 19 deletions Makefile
Expand Up @@ -13,21 +13,17 @@
# make install # make install


GIT_MEDIAWIKI_PM=Git/Mediawiki.pm GIT_MEDIAWIKI_PM=Git/Mediawiki.pm
SCRIPT_PERL=git-remote-mediawiki.perl SCRIPT_PERL=git-remote-mediawiki
SCRIPT_PERL+=git-mw.perl SCRIPT_PERL+=git-mw
export GIT_ROOT_DIR=../git


INSTALL = install INSTALL = install


SCRIPT_PERL_FULL=$(patsubst %,$(HERE)/%,$(SCRIPT_PERL)) SCRIPT_PERL_FULL=$(patsubst %,$(shell pwd)/%,$(SCRIPT_PERL))
INSTLIBDIR=$(shell $(MAKE) -C $(GIT_ROOT_DIR)/perl \ INSTLIBDIR=$(PREFIX)/share/perl5/
-s --no-print-directory instlibdir)
DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
INSTLIBDIR_SQ = $(subst ','\'',$(INSTLIBDIR)) INSTLIBDIR_SQ = $(subst ','\'',$(INSTLIBDIR))


all: build test:

test: all
$(MAKE) -C t $(MAKE) -C t


check: perlcritic test check: perlcritic test
Expand All @@ -37,17 +33,8 @@ install_pm:
$(INSTALL) -m 644 $(GIT_MEDIAWIKI_PM) \ $(INSTALL) -m 644 $(GIT_MEDIAWIKI_PM) \
'$(DESTDIR_SQ)$(INSTLIBDIR_SQ)/$(GIT_MEDIAWIKI_PM)' '$(DESTDIR_SQ)$(INSTLIBDIR_SQ)/$(GIT_MEDIAWIKI_PM)'


build:
$(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL="$(SCRIPT_PERL_FULL)" \
build-perl-script

install: install_pm install: install_pm
$(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL="$(SCRIPT_PERL_FULL)" \ $(INSTALL) $(SCRIPT_PERL) $(DESTDIR)$(PREFIX)/lib/git-core/
install-perl-script

clean:
$(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL="$(SCRIPT_PERL_FULL)" \
clean-perl-script


perlcritic: perlcritic:
perlcritic -5 $(SCRIPT_PERL) perlcritic -5 $(SCRIPT_PERL)
Expand Down
9 changes: 4 additions & 5 deletions bin-wrapper/git
Expand Up @@ -3,12 +3,11 @@
# git executable wrapper script for Git-Mediawiki to run tests without # git executable wrapper script for Git-Mediawiki to run tests without
# installing all the scripts and perl packages. # installing all the scripts and perl packages.


GIT_ROOT_DIR=../../.. ROOT_DIR=$(dirname "$0")/..
GIT_EXEC_PATH=$(cd "$(dirname "$0")" && cd ${GIT_ROOT_DIR} && pwd)


GITPERLLIB="$GIT_EXEC_PATH"'/contrib/mw-to-git'"${GITPERLLIB:+:$GITPERLLIB}" GITPERLLIB="$ROOT_DIR${GITPERLLIB:+:$GITPERLLIB}"
PATH="$GIT_EXEC_PATH"'/contrib/mw-to-git:'"$PATH" PATH="$ROOT_DIR:$PATH"


export GITPERLLIB PATH export GITPERLLIB PATH


exec "${GIT_EXEC_PATH}/bin-wrappers/git" "$@" exec "${GIT_EXEC_PATH:-/usr/bin/}git" "$@"
2 changes: 2 additions & 0 deletions git-mw.perl → git-mw
@@ -1,5 +1,7 @@
#!/usr/bin/perl #!/usr/bin/perl


use lib (split(/:/, $ENV{GITPERLLIB}));

# Copyright (C) 2013 # Copyright (C) 2013
# Benoit Person <benoit.person@ensimag.imag.fr> # Benoit Person <benoit.person@ensimag.imag.fr>
# Celestin Matte <celestin.matte@ensimag.imag.fr> # Celestin Matte <celestin.matte@ensimag.imag.fr>
Expand Down
2 changes: 2 additions & 0 deletions git-remote-mediawiki.perl → git-remote-mediawiki
@@ -1,5 +1,7 @@
#! /usr/bin/perl #! /usr/bin/perl


use lib (split(/:/, $ENV{GITPERLLIB}));

# Copyright (C) 2011 # Copyright (C) 2011
# Jérémie Nikaes <jeremie.nikaes@ensimag.imag.fr> # Jérémie Nikaes <jeremie.nikaes@ensimag.imag.fr>
# Arnaud Lacurie <arnaud.lacurie@ensimag.imag.fr> # Arnaud Lacurie <arnaud.lacurie@ensimag.imag.fr>
Expand Down
6 changes: 0 additions & 6 deletions t/test-gitmw-lib.sh
Expand Up @@ -55,12 +55,6 @@ die_with_status () {


# Check the preconditions to run git-remote-mediawiki's tests # Check the preconditions to run git-remote-mediawiki's tests
test_check_precond () { test_check_precond () {
if ! test_have_prereq PERL
then
skip_all='skipping gateway git-mw tests, perl not available'
test_done
fi

GIT_EXEC_PATH=$(cd "$(dirname "$0")" && cd "../.." && pwd) GIT_EXEC_PATH=$(cd "$(dirname "$0")" && cd "../.." && pwd)
PATH="$GIT_EXEC_PATH"'/bin-wrapper:'"$PATH" PATH="$GIT_EXEC_PATH"'/bin-wrapper:'"$PATH"


Expand Down

0 comments on commit bfaa7d5

Please sign in to comment.