Add stable package building Makefile and services

This commit is contained in:
Donald Curtis 2014-01-25 21:04:00 -08:00
parent b350df249c
commit 002a342c0d
4 changed files with 78 additions and 7 deletions

View file

@ -7,6 +7,12 @@ WEBROOT := $$HOME/www
EMACS ?= emacs EMACS ?= emacs
SLEEP ?= 0 SLEEP ?= 0
SANDBOX := ./sandbox SANDBOX := ./sandbox
ifdef STABLE
PKGDIR := ./packages-stable
endif
STABLE ?= nil
EVAL := $(EMACS)
## Check for needing to initialize CL-LIB from ELPA ## Check for needing to initialize CL-LIB from ELPA
NEED_CL-LIB := $(shell $(EMACS) --no-site-file --batch --eval '(prin1 (version< emacs-version "24.3"))') NEED_CL-LIB := $(shell $(EMACS) --no-site-file --batch --eval '(prin1 (version< emacs-version "24.3"))')
@ -48,7 +54,8 @@ clean-sandbox:
fi fi
sync: sync:
rsync -avz --delete $(PKGDIR) $(HTMLDIR)/* $(WEBROOT)/ rsync -avz --delete $(PKGDIR)/ $(WEBROOT)/packages
rsync -avz --safe-links --delete $(HTMLDIR)/* $(WEBROOT)/
chmod -R go+rx $(WEBROOT)/packages/* chmod -R go+rx $(WEBROOT)/packages/*
@ -56,21 +63,21 @@ clean: clean-working clean-packages clean-json clean-sandbox
packages: $(RCPDIR)/* packages: $(RCPDIR)/*
packages/archive-contents: packages/*.entry packages/archive-contents: $(PKGDIR)/*.entry
@echo " • Updating $@ ..." @echo " • Updating $@ ..."
$(EVAL) '(package-build-dump-archive-contents)' $(EVAL) '(package-build-dump-archive-contents)'
cleanup: cleanup:
$(EVAL) '(package-build-cleanup)' $(EVAL) '(let ((package-build-stable $(STABLE)) (package-build-archive-dir (expand-file-name "$(PKGDIR)/" pb/this-dir))) (package-build-cleanup))'
## Json rules ## Json rules
html/archive.json: packages/archive-contents html/archive.json: $(PKGDIR)/archive-contents
@echo " • Building $@ ..." @echo " • Building $@ ..."
$(EVAL) '(package-build-archive-alist-as-json "html/archive.json")' $(EVAL) '(let ((package-build-stable $(STABLE)) (package-build-archive-dir (expand-file-name "$(PKGDIR)/" pb/this-dir))) (package-build-archive-alist-as-json "html/archive.json"))'
html/recipes.json: $(RCPDIR)/.dirstamp html/recipes.json: $(RCPDIR)/.dirstamp
@echo " • Building $@ ..." @echo " • Building $@ ..."
$(EVAL) '(package-build-recipe-alist-as-json "html/recipes.json")' $(EVAL) '(let ((package-build-stable $(STABLE)) (package-build-archive-dir (expand-file-name "$(PKGDIR)/" pb/this-dir))) (package-build-recipe-alist-as-json "html/recipes.json"))'
json: html/archive.json html/recipes.json json: html/archive.json html/recipes.json
@ -83,7 +90,7 @@ $(RCPDIR)/.dirstamp: .FORCE
$(RCPDIR)/%: .FORCE $(RCPDIR)/%: .FORCE
@echo " • Building recipe $(@F) ..." @echo " • Building recipe $(@F) ..."
- $(TIMEOUT) $(EVAL) "(package-build-archive '$(@F))" - $(TIMEOUT) $(EVAL) "(let ((package-build-stable $(STABLE)) (package-build-archive-dir (expand-file-name \"$(PKGDIR)\" pb/this-dir))) (package-build-archive '$(@F)))"
@echo " ✓ Wrote $$(ls -lsh $(PKGDIR)/$(@F)-*) " @echo " ✓ Wrote $$(ls -lsh $(PKGDIR)/$(@F)-*) "
@echo " Sleeping for $(SLEEP) ..." @echo " Sleeping for $(SLEEP) ..."

25
service/builder-stable Executable file
View file

@ -0,0 +1,25 @@
#!/bin/bash -e
export HOME=/home/melpa
cd ${HOME}/melpa
export MELPA_BRANCH=stable
export STABLE=t
source $HOME/melpa/scripts/env
## git pull
cd ${MELPA_HOME}
git fetch origin
git checkout ${MELPA_BRANCH}
git reset --hard origin/${MELPA_BRANCH}
git pull origin ${MELPA_BRANCH}
echo
# Build all the packages.
scripts/parallel_build_all
echo '{"completed":' `date "+%s"` '}' > /home/melpa/www/build-status.json
# Sleep for an hour before rebuilding.
sleep 1h

24
service/reporter-stable Executable file
View file

@ -0,0 +1,24 @@
#!/bin/bash -e
# Service for reporting missing and old packages.
export HOME=/home/melpa
BODY=`mktemp`
cd ${HOME}/melpa
echo "To: MP <dcurtis@milkbox.net>" > ${BODY}
echo "Subject: [MELPA] `date "+%Y%m%d %H:%M %z"`" >> ${BODY}
echo >> ${BODY}
echo "# Old Packages" >> ${BODY}
echo >> ${BODY}
emacs --no-site-file --batch -l package-build.el --eval '(setq package-archive-dir (expand-file-name "packages-stable" pb/this-dir)))' scripts/expired >> ${BODY}
echo >> ${BODY}
echo "# Missing Packages" >> ${BODY}
echo >> ${BODY}
emacs --no-site-file --batch -l package-build.el --eval '(setq package-archive-dir (expand-file-name "packages-stable" pb/this-dir)))' sscripts/missing >> ${BODY}
/usr/sbin/sendmail -t < ${BODY}
sleep 12h

15
service/syncer-stable Executable file
View file

@ -0,0 +1,15 @@
#!/bin/bash -e
export STABLE=t
export HOME=/home/melpa
cd ${HOME}/melpa
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
make cleanup
make json
make html
make sync
# Sync every 5 minutes.
sleep 5m