Permalink
Browse files

Remove Echoe and roll our own packaging/release...

* Manifest/CHANGELOG can be maintainance is painful.
  I really hate having those in the source tree when
  I have a version control system that already:

    1) encourages me to make meaningful commits
    2) is highly scriptable for generating manifests/changelogs

* hand-rolled gemspec allows more control for specifying
  pre-release gem versions

* Less magic over what the `rubyforge` command does, being
  able to spawn $VISUAL on changelogs/release notes and make
  edits on them is nice.

Additionally I still strongly prefer GNU make over Rake for many
tasks since it offers better parallelization and some things are
easier *for me* in shell than Ruby.
  • Loading branch information...
1 parent 382d12a commit 8d1b95587c1ebea4631c66b8e7e4130153c70b26 Eric Wong committed Sep 17, 2009
Showing with 197 additions and 188 deletions.
  1. 0 CHANGELOG → .CHANGELOG.old
  2. +2 −0 .gitignore
  3. +40 −0 GIT-VERSION-GEN
  4. +64 −12 GNUmakefile
  5. +0 −138 Manifest
  6. +45 −38 Rakefile
  7. +46 −0 unicorn.gemspec
File renamed without changes.
View
@@ -14,3 +14,5 @@ pkg/
/vendor
/NEWS
/ChangeLog
+/.manifest
+/GIT-VERSION-FILE
View
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+GVF=GIT-VERSION-FILE
+DEF_VER=v0.91.0.GIT
+
+LF='
+'
+
+# First see if there is a version file (included in release tarballs),
+# then try git-describe, then default.
+if test -f version
+then
+ VN=$(cat version) || VN="$DEF_VER"
+elif test -d .git -o -f .git &&
+ VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
+ case "$VN" in
+ *$LF*) (exit 1) ;;
+ v[0-9]*)
+ git update-index -q --refresh
+ test -z "$(git diff-index --name-only HEAD --)" ||
+ VN="$VN-dirty" ;;
+ esac
+then
+ VN=$(echo "$VN" | sed -e 's/-/./g');
+else
+ VN="$DEF_VER"
+fi
+
+VN=$(expr "$VN" : v*'\(.*\)')
+
+if test -r $GVF
+then
+ VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
+else
+ VC=unset
+fi
+test "$VN" = "$VC" || {
+ echo >&2 "GIT_VERSION = $VN"
+ echo "GIT_VERSION = $VN" >$GVF
+}
View
@@ -3,7 +3,13 @@ all:: test
ruby = ruby
rake = rake
ragel = ragel
+GIT_URL = $(shell git config --get remote.origin.url 2>/dev/null || \
+ echo git://git.bogomips.org/unicorn.git)
RLFLAGS = -G2
+
+GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
+ @./GIT-VERSION-GEN
+-include GIT-VERSION-FILE
-include local.mk
ruby_bin := $(shell which $(ruby))
ifeq ($(DLEXT),) # "so" for Linux
@@ -30,8 +36,9 @@ test_prefix = $(CURDIR)/test/install-$(RUBY_VERSION)
ext := ext/unicorn_http
c_files := $(ext)/unicorn_http.c $(wildcard $(ext)/*.h)
-rl_files := $(addprefix $(ext)/,unicorn_http.rl unicorn_http_common.rl)
-rb_files := $(shell grep '^\(bin\|lib\)' Manifest)
+rl_files := $(wildcard $(ext)/*.rl)
+bins := $(wildcard bin/*)
+rb_files := $(bins) $(shell find lib -type f -name '*.rb')
inst_deps := $(c_files) $(rb_files)
ragel: $(ext)/unicorn_http.c
@@ -49,13 +56,11 @@ http: lib/unicorn_http.$(DLEXT)
$(test_prefix)/.stamp: $(inst_deps)
mkdir -p $(test_prefix)/.ccache
- tar c `cat Manifest` | (cd $(test_prefix) && tar x)
+ tar c `cat .manifest` | (cd $(test_prefix) && tar x)
$(MAKE) -C $(test_prefix) clean
$(MAKE) -C $(test_prefix) http shebang
> $@
-bins := $(wildcard bin/*)
-
# this is only intended to be run within $(test_prefix)
shebang: $(bins)
$(ruby) -i -p -e '$$_.gsub!(%r{^#!.*$$},"#!$(ruby_bin)")' $^
@@ -124,17 +129,18 @@ clean:
$(RM) $(setup_rb_files) $(t_log)
$(RM) -r $(test_prefix)
-Manifest:
- (git ls-files && echo $(ext)/unicorn_http.c) | LC_ALL=C sort > $@+
+.manifest: GIT-VERSION-FILE NEWS ChangeLog $(ext)/unicorn_http.c
+ (git ls-files && \
+ for i in $@ $^; do echo $$i; done) | LC_ALL=C sort > $@+
cmp $@+ $@ || mv $@+ $@
- $(RM) -f $@+
+ $(RM) $@+
-NEWS:
+NEWS: GIT-VERSION-FILE
$(rake) -s history > $@+
mv $@+ $@
-ChangeLog:
- @echo ChangeLog from git://git.bogomips.org/unicorn.git > $@+
+ChangeLog: GIT-VERSION-FILE
+ @echo "ChangeLog from $(GIT_URL) ($(GIT_VERSION))" > $@+
@echo >> $@+
git log | sed -e 's/^/ /' >> $@+
mv $@+ $@
@@ -164,4 +170,50 @@ $(T_r).%.r: export RAILS_GIT_REPO = $(CURDIR)/$(rails_git)
$(T_r).%.r: $(test_prefix)/.stamp $(rails_git)/info/cloned-stamp
$(run_test)
-.PHONY: doc $(T) $(slow_tests) Manifest ChangeLog
+ifneq ($(VERSION),)
+rfproject := mongrel
+rfpackage := unicorn
+pkggem := pkg/$(rfpackage)-$(VERSION).gem
+pkgtgz := pkg/$(rfpackage)-$(VERSION).tgz
+release_notes := release_notes-$(VERSION)
+release_changes := release_changes-$(VERSION)
+
+release-notes: $(release_notes)
+release-changes: $(release_changes)
+$(release_changes):
+ $(rake) -s release_changes > $@+
+ $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
+$(release_notes):
+ GIT_URL=$(GIT_URL) $(rake) -s release_notes > $@+
+ $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
+verify:
+ git rev-parse --verify refs/tags/v$(VERSION)^{}
+ git diff-index --quiet HEAD^0
+ test `git rev-parse --verify HEAD^0` = \
+ `git rev-parse --verify refs/tags/v$(VERSION)^{}`
+
+$(pkggem): .manifest
+ gem build $(rfpackage).gemspec
+ mkdir -p pkg
+ mv $(@F) $@
+
+$(pkgtgz): distdir = $(basename $@)
+$(pkgtgz): HEAD = v$(VERSION)
+$(pkgtgz): .manifest
+ @test -n "$(distdir)"
+ $(RM) -r $(distdir)
+ git archive --format=tar --prefix=$(distdir)/ $(HEAD) | tar xv
+ install -m644 $^ $(distdir)/
+ cd pkg && tar c $(basename $(@F)) | gzip -9 > $(@F)+
+ mv $@+ $@
+
+package: $(pkgtgz) $(pkggem)
+
+release: package $(release_notes) $(release_changes)
+ rubyforge add_release -f -n $(release_notes) -a $(release_changes) \
+ $(rfproject) $(rfpackage) $(VERSION) $(pkggem)
+ rubyforge add_file \
+ $(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
+endif
+
+.PHONY: .FORCE-GIT-VERSION-FILE doc $(T) $(slow_tests) .manifest
View
138 Manifest
@@ -1,138 +0,0 @@
-.document
-.gitignore
-.mailmap
-CHANGELOG
-CONTRIBUTORS
-COPYING
-DESIGN
-GNUmakefile
-LICENSE
-Manifest
-PHILOSOPHY
-README
-Rakefile
-SIGNALS
-TODO
-TUNING
-bin/unicorn
-bin/unicorn_rails
-examples/echo.ru
-examples/git.ru
-examples/init.sh
-ext/unicorn_http/c_util.h
-ext/unicorn_http/common_field_optimization.h
-ext/unicorn_http/ext_help.h
-ext/unicorn_http/extconf.rb
-ext/unicorn_http/global_variables.h
-ext/unicorn_http/unicorn_http.c
-ext/unicorn_http/unicorn_http.rl
-ext/unicorn_http/unicorn_http_common.rl
-lib/unicorn.rb
-lib/unicorn/app/exec_cgi.rb
-lib/unicorn/app/inetd.rb
-lib/unicorn/app/old_rails.rb
-lib/unicorn/app/old_rails/static.rb
-lib/unicorn/cgi_wrapper.rb
-lib/unicorn/configurator.rb
-lib/unicorn/const.rb
-lib/unicorn/http_request.rb
-lib/unicorn/http_response.rb
-lib/unicorn/launcher.rb
-lib/unicorn/socket_helper.rb
-lib/unicorn/tee_input.rb
-lib/unicorn/util.rb
-local.mk.sample
-setup.rb
-test/aggregate.rb
-test/benchmark/README
-test/benchmark/dd.ru
-test/exec/README
-test/exec/test_exec.rb
-test/rails/app-1.2.3/.gitignore
-test/rails/app-1.2.3/Rakefile
-test/rails/app-1.2.3/app/controllers/application.rb
-test/rails/app-1.2.3/app/controllers/foo_controller.rb
-test/rails/app-1.2.3/app/helpers/application_helper.rb
-test/rails/app-1.2.3/config/boot.rb
-test/rails/app-1.2.3/config/database.yml
-test/rails/app-1.2.3/config/environment.rb
-test/rails/app-1.2.3/config/environments/development.rb
-test/rails/app-1.2.3/config/environments/production.rb
-test/rails/app-1.2.3/config/routes.rb
-test/rails/app-1.2.3/db/.gitignore
-test/rails/app-1.2.3/log/.gitignore
-test/rails/app-1.2.3/public/404.html
-test/rails/app-1.2.3/public/500.html
-test/rails/app-2.0.2/.gitignore
-test/rails/app-2.0.2/Rakefile
-test/rails/app-2.0.2/app/controllers/application.rb
-test/rails/app-2.0.2/app/controllers/foo_controller.rb
-test/rails/app-2.0.2/app/helpers/application_helper.rb
-test/rails/app-2.0.2/config/boot.rb
-test/rails/app-2.0.2/config/database.yml
-test/rails/app-2.0.2/config/environment.rb
-test/rails/app-2.0.2/config/environments/development.rb
-test/rails/app-2.0.2/config/environments/production.rb
-test/rails/app-2.0.2/config/routes.rb
-test/rails/app-2.0.2/db/.gitignore
-test/rails/app-2.0.2/log/.gitignore
-test/rails/app-2.0.2/public/404.html
-test/rails/app-2.0.2/public/500.html
-test/rails/app-2.1.2/.gitignore
-test/rails/app-2.1.2/Rakefile
-test/rails/app-2.1.2/app/controllers/application.rb
-test/rails/app-2.1.2/app/controllers/foo_controller.rb
-test/rails/app-2.1.2/app/helpers/application_helper.rb
-test/rails/app-2.1.2/config/boot.rb
-test/rails/app-2.1.2/config/database.yml
-test/rails/app-2.1.2/config/environment.rb
-test/rails/app-2.1.2/config/environments/development.rb
-test/rails/app-2.1.2/config/environments/production.rb
-test/rails/app-2.1.2/config/routes.rb
-test/rails/app-2.1.2/db/.gitignore
-test/rails/app-2.1.2/log/.gitignore
-test/rails/app-2.1.2/public/404.html
-test/rails/app-2.1.2/public/500.html
-test/rails/app-2.2.2/.gitignore
-test/rails/app-2.2.2/Rakefile
-test/rails/app-2.2.2/app/controllers/application.rb
-test/rails/app-2.2.2/app/controllers/foo_controller.rb
-test/rails/app-2.2.2/app/helpers/application_helper.rb
-test/rails/app-2.2.2/config/boot.rb
-test/rails/app-2.2.2/config/database.yml
-test/rails/app-2.2.2/config/environment.rb
-test/rails/app-2.2.2/config/environments/development.rb
-test/rails/app-2.2.2/config/environments/production.rb
-test/rails/app-2.2.2/config/routes.rb
-test/rails/app-2.2.2/db/.gitignore
-test/rails/app-2.2.2/log/.gitignore
-test/rails/app-2.2.2/public/404.html
-test/rails/app-2.2.2/public/500.html
-test/rails/app-2.3.3.1/.gitignore
-test/rails/app-2.3.3.1/Rakefile
-test/rails/app-2.3.3.1/app/controllers/application_controller.rb
-test/rails/app-2.3.3.1/app/controllers/foo_controller.rb
-test/rails/app-2.3.3.1/app/helpers/application_helper.rb
-test/rails/app-2.3.3.1/config/boot.rb
-test/rails/app-2.3.3.1/config/database.yml
-test/rails/app-2.3.3.1/config/environment.rb
-test/rails/app-2.3.3.1/config/environments/development.rb
-test/rails/app-2.3.3.1/config/environments/production.rb
-test/rails/app-2.3.3.1/config/routes.rb
-test/rails/app-2.3.3.1/db/.gitignore
-test/rails/app-2.3.3.1/log/.gitignore
-test/rails/app-2.3.3.1/public/404.html
-test/rails/app-2.3.3.1/public/500.html
-test/rails/test_rails.rb
-test/test_helper.rb
-test/unit/test_configurator.rb
-test/unit/test_http_parser.rb
-test/unit/test_http_parser_ng.rb
-test/unit/test_request.rb
-test/unit/test_response.rb
-test/unit/test_server.rb
-test/unit/test_signals.rb
-test/unit/test_socket_helper.rb
-test/unit/test_tee_input.rb
-test/unit/test_upload.rb
-test/unit/test_util.rb
Oops, something went wrong.

0 comments on commit 8d1b955

Please sign in to comment.