forked from yugabyte/pgloader
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Review and clean the vagrant setup, add tests.
- Loading branch information
Showing
5 changed files
with
99 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
.vagrant | ||
local-data | ||
pgloader.1 | ||
pgloader.html | ||
pgloader.pdf | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
TESTS = $(wildcard *.load) | ||
OUT = $(TESTS:.load=.out) | ||
|
||
all: $(OUT) | ||
echo $(OUT) | ||
|
||
%.out: %.load | ||
$(PGLOADER) --verbose $< | ||
@echo |