mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-04 10:31:02 +02:00
Review and clean the vagrant setup, add tests.
This commit is contained in:
parent
fb818ee0e3
commit
208d10c919
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,2 +1,6 @@
|
||||
.vagrant
|
||||
local-data
|
||||
pgloader.1
|
||||
pgloader.html
|
||||
pgloader.pdf
|
||||
build/
|
||||
|
||||
69
Makefile
Normal file
69
Makefile
Normal file
@ -0,0 +1,69 @@
|
||||
# pgloader build tools
|
||||
|
||||
POMO_PATCH = $(realpath patches/postmodern-send-copy-done.patch)
|
||||
ASDF_CONFD = ~/.config/common-lisp/source-registry.conf.d
|
||||
ASDF_CONF = $(ASDF_CONFD)/projects.conf
|
||||
|
||||
docs:
|
||||
pandoc pgloader.1.md -o pgloader.1
|
||||
pandoc pgloader.1.md -o pgloader.html
|
||||
pandoc pgloader.1.md -o pgloader.pdf
|
||||
|
||||
~/quicklisp/local-projects/Postmodern:
|
||||
git clone https://github.com/marijnh/Postmodern.git $@
|
||||
cd ~/quicklisp/local-projects/Postmodern/ && patch -p1 < $(POMO_PATCH)
|
||||
|
||||
postmodern: ~/quicklisp/local-projects/Postmodern ;
|
||||
|
||||
~/quicklisp/local-projects/cl-csv:
|
||||
git clone -b empty-strings-and-nil https://github.com/dimitri/cl-csv.git $@
|
||||
|
||||
cl-csv: ~/quicklisp/local-projects/cl-csv ;
|
||||
|
||||
~/quicklisp/setup.lisp:
|
||||
curl -o ~/quicklisp.lisp http://beta.quicklisp.org/quicklisp.lisp
|
||||
sbcl --load ~/quicklisp.lisp \
|
||||
--eval '(quicklisp-quickstart:install)' \
|
||||
--eval '(quit)'
|
||||
|
||||
quicklisp: ~/quicklisp/setup.lisp ;
|
||||
|
||||
$(ASDF_CONF):
|
||||
mkdir -p $(ASDF_CONFD)
|
||||
echo '(:tree "/vagrant")' > $@
|
||||
|
||||
asdf-config: $(ASDF_CONF) ;
|
||||
|
||||
libs: quicklisp $(ASDF_CONF) postmodern cl-csv
|
||||
# Quicklisp Install needed Common Lisp libs
|
||||
sbcl --load ~/quicklisp/setup.lisp \
|
||||
--eval '(ql:quickload "pgloader")' \
|
||||
--eval '(quit)'
|
||||
|
||||
./build/manifest.ql: libs
|
||||
sbcl --load ~/quicklisp/setup.lisp \
|
||||
--eval '(ql:write-asdf-manifest-file "./build/manifest.ql")' \
|
||||
--eval '(quit)'
|
||||
|
||||
./build/buildapp: quicklisp
|
||||
sbcl --load ~/quicklisp/setup.lisp \
|
||||
--eval '(ql:quickload "buildapp")' \
|
||||
--eval '(buildapp:build-buildapp "./build/buildapp")' \
|
||||
--eval '(quit)'
|
||||
|
||||
./build/pgloader.exe: ./build/buildapp ./build/manifest.ql
|
||||
./build/buildapp --logfile /tmp/build.log \
|
||||
--asdf-tree ~/quicklisp/local-projects \
|
||||
--manifest-file ./build/manifest.ql \
|
||||
--asdf-tree ~/quicklisp/dists \
|
||||
--asdf-path . \
|
||||
--load-system pgloader \
|
||||
--entry pgloader:main \
|
||||
--dynamic-space-size 4096 \
|
||||
--compress-core \
|
||||
--output build/pgloader.exe
|
||||
|
||||
test: ./build/pgloader.exe
|
||||
$(MAKE) PGLOADER=build/pgloader.exe -C test all
|
||||
|
||||
check: test ;
|
||||
5
Vagrantfile
vendored
5
Vagrantfile
vendored
@ -7,5 +7,8 @@ VAGRANTFILE_API_VERSION = "2"
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.box = "wheezy64"
|
||||
|
||||
config.vm.provision :shell, :path => "bootstrap.sh"
|
||||
config.vm.provision "shell" do |s|
|
||||
s.path = "bootstrap.sh"
|
||||
s.privileged = false
|
||||
end
|
||||
end
|
||||
|
||||
72
bootstrap.sh
72
bootstrap.sh
@ -1,70 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main" > /etc/apt/sources.list.d/pgdg.list
|
||||
pgdg=/etc/apt/sources.list.d/pgdg.list
|
||||
pgdgkey=https://www.postgresql.org/media/keys/ACCC4CF8.asc
|
||||
echo "deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main" | sudo tee $pgdg
|
||||
|
||||
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
|
||||
wget --quiet -O - ${pgdgkey} | sudo apt-key add -
|
||||
|
||||
apt-get update
|
||||
apt-get install -y postgresql-9.3 postgresql-contrib-9.3
|
||||
apt-get install -y sbcl libmysqlclient-dev git patch unzip
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y postgresql-9.3 postgresql-contrib-9.3 \
|
||||
postgresql-9.3-ip4r \
|
||||
sbcl \
|
||||
git patch unzip \
|
||||
libmysqlclient-dev
|
||||
|
||||
HBA=/etc/postgresql/9.3/main/pg_hba.conf
|
||||
echo "local all all trust" | sudo tee $HBA
|
||||
echo "host all all 127.0.0.1/32 trust" | sudo tee -a $HBA
|
||||
|
||||
sudo pg_ctlcluster 9.3 main reload
|
||||
createuser -U postgres -SdR `whoami`
|
||||
createdb pgloader
|
||||
sudo createuser -U postgres -SdR `whoami`
|
||||
sudo createdb -U postgres -O `whoami` pgloader
|
||||
|
||||
wget --quiet http://beta.quicklisp.org/quicklisp.lisp
|
||||
sbcl --load quicklisp.lisp <<EOF
|
||||
(quicklisp-quickstart:install)
|
||||
(ql:add-to-init-file)
|
||||
|
||||
(ql:quickload "buildapp")
|
||||
(buildapp:build-buildapp "/home/vagrant/buildapp")
|
||||
(quit)
|
||||
EOF
|
||||
|
||||
cd ~/quicklisp/local-projects/
|
||||
git clone -b empty-strings-and-nil https://github.com/dimitri/cl-csv.git
|
||||
git clone https://github.com/marijnh/Postmodern.git
|
||||
|
||||
cd ~/quicklisp/local-projects/Postmodern/
|
||||
patch -p1 < /vagrant/patches/postmodern-send-copy-done.patch
|
||||
|
||||
cd ~
|
||||
|
||||
sbcl --load quicklisp/setup.lisp <<EOF
|
||||
(pushnew #p"/vagrant/" asdf:*central-registry*)
|
||||
(pushnew #p"/vagrant/lib/db3/" asdf:*central-registry*)
|
||||
(pushnew #p"/vagrant/lib/abnf/" asdf:*central-registry*)
|
||||
(ql:quickload "pgloader")
|
||||
(quit)
|
||||
EOF
|
||||
|
||||
REGISTRY=~/.config/common-lisp/source-registry.conf.d
|
||||
mkdir -p $REGISTRY
|
||||
echo "(:tree \"/vagrant/\")" > $REGISTRY/projects.conf
|
||||
|
||||
# echo "BUILDING PGLOADER SELF-CONTAINED BINARY"
|
||||
|
||||
# /home/vagrant/buildapp --logfile /tmp/build.log \
|
||||
# --asdf-tree ~/quicklisp/dists \
|
||||
# --asdf-tree /vagrant \
|
||||
# --load-system pgloader \
|
||||
# --entry pgloader:main \
|
||||
# --dynamic-space-size 4096 \
|
||||
# --output /home/vagrant/pgloader.exe
|
||||
|
||||
echo "TESTING"
|
||||
|
||||
/vagrant/pgloader.lisp --help
|
||||
|
||||
for test in /vagrant/test/*.load
|
||||
do
|
||||
echo "# TEST: $test"
|
||||
echo
|
||||
/vagrant/pgloader.lisp $test
|
||||
echo
|
||||
done
|
||||
make -C /vagrant test
|
||||
|
||||
9
test/Makefile
Normal file
9
test/Makefile
Normal file
@ -0,0 +1,9 @@
|
||||
TESTS = $(wildcard *.load)
|
||||
OUT = $(TESTS:.load=.out)
|
||||
|
||||
all: $(OUT)
|
||||
echo $(OUT)
|
||||
|
||||
%.out: %.load
|
||||
$(PGLOADER) --verbose $<
|
||||
@echo
|
||||
Loading…
x
Reference in New Issue
Block a user