From 64c8e0c87e02e3a05631d67c9d3072ca87234711 Mon Sep 17 00:00:00 2001 From: Mike Burns Date: Thu, 20 Feb 2014 15:49:36 +0100 Subject: Start bringing in the Makefile.am from gitsh It introduces the `Makefile.am` from gitsh, and abstracts it a bit. This `Makefile.am`, or most of it, could be dropped into gitsh again. How to use it is documented in `DEVELOPERS.md`. The whole release process is more consistent and simple: `make release` to build a tarball, Homebrew, Arch, Debian, HTML (from manpages), and tag it, pushed to the various repos, and with cleanup. The `release` target is composed of smaller targets that stack well. --- .gitignore | 27 +++++++--- DEVELOPERS.md | 70 ++++++++++++++++---------- Makefile.am | 138 ++++++++++++++++++++++++++++++++++++++++----------- arch/PKGBUILD | 39 --------------- arch/PKGBUILD.in | 33 ++++++++++++ autogen.sh | 4 +- bin/Makefile.am | 2 +- configure.ac | 3 +- debian/changelog | 29 +++++++++++ debian/compat | 2 +- debian/control | 12 ++--- debian/copyright | 2 +- debian/docs | 1 - debian/files | 1 - debian/rcm.substvars | 1 - debian/rules | 3 ++ homebrew/rcm.rb.in | 17 +++++++ man/Makefile.am | 20 +++++++- share/Makefile.am | 2 +- 19 files changed, 288 insertions(+), 118 deletions(-) delete mode 100644 arch/PKGBUILD create mode 100644 arch/PKGBUILD.in create mode 100644 debian/changelog delete mode 100644 debian/docs delete mode 100644 debian/files delete mode 100644 debian/rcm.substvars create mode 100644 homebrew/rcm.rb.in diff --git a/.gitignore b/.gitignore index 1bb98fb..f915ceb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,30 @@ +# autotools related files +Makefile +Makefile.in +*/Makefile +*/Makefile.in aclocal.m4 autom4te.cache +autoscan.log config.log config.status -Makefile -Makefile.in +configure +configure.scan +install-sh +missing +depcomp + +# Make targets debian/rcm debian/rcm.debhelper.log share/rcm.sh *deb -debian/changelog NEWS.md -missing -install-sh -configure +rcm-*.tar.gz + +# Sub-repositories for release +gh-pages +homebrew-formulae +release-arch +deb-build +rcm-* diff --git a/DEVELOPERS.md b/DEVELOPERS.md index 4d2b684..5a92da8 100644 --- a/DEVELOPERS.md +++ b/DEVELOPERS.md @@ -1,40 +1,60 @@ Developers ========== -GNU autoconf & automake ------------------------ +Making a release +---------------- -This project uses GNU autoconf and automake for installation and -building. To regenerate everything from first principles (`configure.ac` -and `**/Makefile.am`), run the command: +1. Bump the version in `configure.ac`, in `AC_INIT`. + +2. Update the build system. This depends on GNU autoconf and GNU automake. ./autogen.sh -Debian ------- +3. Build the packages: + +This all depends on a `gh-pages` branch: + + git branch gh-pages origin/gh-pages + +On any system you can build the tarball, Homebrew package, Arch +PKGBUILD, and tag: + + make release_build_tarball release_build_homebrew release_build_arch \ + release_build_tag + +You need mdocml to tranform the manpages into HTML: + + make release_build_man_html + +Only on Debian systems can you build the Debian package: + + make release_build_deb + +If you are on a Debian system with mdocml, here is a shortcut: + + make release_build + +From here you can push these: + + make release_push_tarball release_push_homebrew release_push_arch \ + release_push_tag release_push_man_html + make release_push_deb -First, everything must be set up just right: +Or, all at once: - mkdir -p ~/debian/rcm && \ - cp -a rcm ~/debian/rcm/rcm-0.0.2 && \ - cd ~/debian/rcm && \ - rm -f rcm_0.0.2.orig.tar.gz && \ - rm -f rcm-0.0.2/tags && \ - tar --exclude=*swp --exclude-backups --exclude-vcs --exclude=debian --exclude=config.status --exclude=config.log -zcf rcm_0.0.2.orig.tar.gz rcm-0.0.2 + make release_push -Given that, now you can generate the Debian package. This requires the -Debian packaging tools, especially debuild: +You can clean individual steps: - cd ~/debian/rcm/rcm-0.0.2 && \ - debuild -us -uc + make release_clean_tarball release_clean_homebrew release_clean_arch \ + release_clean_deb release_clean_tag release_clean_man_html -HTML documentation ------------------- +Or, again, everything at once: -The HTML documentation is generated using the mdocml suite. Use the -`upload-docs` make target to rebuild the HTML docs and upload them to -GitHub Pages. The `build-docs` target will just build them. + make release_clean - make upload-docs +If you are on a Debian system, have mdocml installed, have an absurd +amount of trust in the system, and know how to debug it intimately, give +everything a go: -More information on mdocml can be found on http://mdocml.bsd.lv/ . + make release diff --git a/Makefile.am b/Makefile.am index 95354db..1f881ef 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,42 +1,120 @@ AUTOMAKE_OPTIONS = foreign SUBDIRS = man share bin +EXTRA_DIST = LICENSE README.md NEWS.md -.PHONY: release deb-changelog build-tag push-tag deb build-docs upload-docs +.PHONY: release \ + release_build release_push release_clean \ + release_build_tarball release_build_homebrew release_build_arch \ + release_push_tarball release_push_homebrew release_push_arch \ + release_clean_tarball release_clean_homebrew release_clean_arch \ + release_build_deb release_push_deb release_clean_deb release_build_tag \ + release_push_tag release_clean_tag release_build_man_html \ + release_push_man_html release_clean_man_html ORIGIN_URL=$(shell git config --get remote.origin.url) +CURRENT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD) -release: deb push-tag upload-docs +edit_package = sed \ + -e 's|@PACKAGE[@]|$(PACKAGE)|g' \ + -e 's|@PACKAGE_VERSION[@]|$(PACKAGE_VERSION)|g' \ + -e 's|@DIST_ARCHIVES[@]|$(DIST_ARCHIVES)|g' \ + -e 's|@DIST_SHA[@]|$(DIST_SHA)|g' -deb-changelog: NEWS.md - cp -f NEWS.md debian/changelog +release: release_build release_push release_clean -deb: deb-changelog - mkdir /tmp/deb - cp -a . /tmp/deb/rcm-$(PACKAGE_VERSION) - cd /tmp/deb && \ - tar --exclude=*swp --exclude-backups --exclude-vcs --exclude=debian \ - --exclude=config.status --exclude=config.log \ - -zcf rcm_$(PACKAGE_VERSION).orig.tar.gz rcm-$(PACKAGE_VERSION) && \ - cd rcm-$(PACKAGE_VERSION) && \ - debuild -us -uc - cp /tmp/deb/rcm_$(PACKAGE_VERSION)*.deb $(abs_srcdir) +release_build: release_build_tarball release_build_homebrew release_build_arch \ + release_build_deb release_build_tag release_build_man_html -build-tag: - git tag -f -a v$(PACKAGE_VERSION) -m "Release $(PACKAGE_VERSION)" +release_push: release_push_tarball release_push_homebrew release_push_arch \ + release_push_deb release_push_tag release_push_man_html -push-tag: build-tag - git push origin --tags +release_clean: release_clean_tarball release_clean_homebrew release_clean_arch \ + release_clean_deb release_clean_tag release_clean_man_html + +###### Tarball +release_build_tarball: Makefile distcheck + ([ -d gh-pages ] || git clone --branch gh-pages . gh-pages) && \ + ([ -d gh-pages/dist ] || mkdir gh-pages/dist) && \ + cp $(DIST_ARCHIVES) gh-pages/dist && \ + cd gh-pages &&\ + git add dist/$(DIST_ARCHIVES) &&\ + git commit -m "Release version $(PACKAGE_VERSION) tarball" + +release_push_tarball: + cd gh-pages &&\ + git push + +release_clean_tarball: + rm -rf gh-pages + rm -rf $(DIST_ARCHIVES) + +###### Homebrew +release_build_homebrew: DIST_SHA + ([ -d homebrew-formulae ] || git clone git@github.com:thoughtbot/homebrew-formulae.git homebrew-formulae) && \ + $(edit_package) homebrew/$(PACKAGE).rb.in > homebrew-formulae/Formula/$(PACKAGE).rb && \ + cd homebrew-formulae &&\ + git commit -am "$(PACKAGE): Release version $(PACKAGE_VERSION)" + +release_push_homebrew: + cd homebrew-formulae &&\ + git push + +release_clean_homebrew: + rm -rf homebrew-formulae + rm -rf $(DIST_ARCHIVES) + +###### Arch +release_build_arch: DIST_SHA + ([ -d gh-pages ] || git clone --branch gh-pages . gh-pages) && \ + ([ -d gh-pages/arch ] || mkdir gh-pages/arch) && \ + $(edit_package) arch/PKGBUILD.in > gh-pages/arch/PKGBUILD &&\ + cd gh-pages &&\ + git add arch/PKGBUILD &&\ + git commit -m "Release version $(PACKAGE_VERSION) Arch package" + +release_push_arch: + cd gh-pages &&\ + git push -build-docs: - git clone --branch gh-pages --single-branch . gh-pages && \ - for i in lsrc.1 mkrc.1 rcm.7 rcrc.5 rcup.1 rcdn.1; do \ - mandoc -Thtml -Oman=%N.%S.html man/$$i > gh-pages/$$i.html ; \ - done ; \ - cp gh-pages/rcm.7.html gh-pages/index.html - -upload-docs: build-docs - cd gh-pages ; \ - git commit -am "update pages" ; \ - git push -f $(ORIGIN_URL) gh-pages ; \ - cd .. && \ +release_clean_arch: rm -rf gh-pages + rm -rf $(DIST_ARCHIVES) + +###### Deb +release_build_deb: NEWS.md DIST_SHA distcheck + ([ -d deb-build ] || mkdir -p deb-build) && \ + cp $(DIST_ARCHIVES) deb-build/$(PACKAGE)_$(PACKAGE_VERSION).orig.tar.gz && \ + tar -C deb-build -xf deb-build/$(PACKAGE)_$(PACKAGE_VERSION).orig.tar.gz && \ + cp -R debian deb-build/$(PACKAGE)-$(PACKAGE_VERSION) && \ + cd deb-build/$(PACKAGE)-$(PACKAGE_VERSION) && \ + dch -d "New upstream release" && dch -r "" && \ + cp debian/changelog $(abs_srcdir)/debian/changelog && \ + debuild -us -uc && \ + cd $(abs_srcdir) && \ + ([ -d gh-pages ] || git clone --branch gh-pages $(ORIGIN_URL) gh-pages) && \ + ([ -d gh-pages/debs ] || mkdir gh-pages/debs) && \ + cp deb-build/$(PACKAGE)_$(PACKAGE_VERSION)*.deb gh-pages/debs && \ + cd gh-pages && \ + git add debs/$(PACKAGE)_$(PACKAGE_VERSION)*deb && \ + git commit -m "Release version $(PACKAGE_VERSION) for Debian" -- debs/$(PACKAGE)_$(PACKAGE_VERSION)*deb + +release_push_deb: + cd gh-pages && \ + git push + +release_clean_deb: + rm -rf gh-pages + rm -rf deb-build + rm -rf $(DIST_ARCHIVES) + +###### Tag +release_build_tag: + git tag -s v$(PACKAGE_VERSION) -m "Release $(PACKAGE_VERSION)" + +release_push_tag: + git push origin --tags + +release_clean_tag: + +DIST_SHA: Makefile distcheck + $(eval DIST_SHA := $(shell shasum $(srcdir)/$(DIST_ARCHIVES) | cut -d' ' -f1)) diff --git a/arch/PKGBUILD b/arch/PKGBUILD deleted file mode 100644 index af5503e..0000000 --- a/arch/PKGBUILD +++ /dev/null @@ -1,39 +0,0 @@ -# Maintainer: Pat Brisbin -_gitname=rcm -pkgname=$_gitname-git -pkgver=0.0.0 -pkgrel=1 -pkgdesc="rc file (dotfile) management" -arch=('any') -url="https://github.com/mike-burns/rcm" -license=('BSD') -makedepends=('git') -source=('git://github.com/mike-burns/rcm') -md5sums=('SKIP') - -pkgver() { - cd $_gitname - - git describe --always | sed 's|-|.|g' -} - -build() { - cd $_gitname - - aclocal - automake --add-missing --copy - autoconf - - ./configure --prefix=/usr - make -} - -package() { - cd $_gitname - - make DESTDIR="$pkgdir/" install - - install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$_gitname/LICENSE" -} - -# vim:set ts=2 sw=2 et: diff --git a/arch/PKGBUILD.in b/arch/PKGBUILD.in new file mode 100644 index 0000000..3e197d9 --- /dev/null +++ b/arch/PKGBUILD.in @@ -0,0 +1,33 @@ +# Maintainer: Pat Brisbin +pkgname='@PACKAGE@' +pkgver=@PACKAGE_VERSION@ +pkgrel=1 +pkgdesc="rc file (dotfile) management" +arch=('any') +url="http://thoughtbot.github.io/@PACKAGE@/" +license=('BSD') +depends=('') +source=("http://thoughtbot.github.io/@PACKAGE@/dist/@DIST_ARCHIVES@") +sha1sums=('@DIST_SHA@') + +build() { + cd "$srcdir/$pkgname-$pkgver" + + ./configure \ + --disable-debug \ + --disable-dependency-tracking \ + --disable-silent-rules \ + --prefix=/usr + + make +} + +package() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir/" install + + install -Dm644 LICENSE "$pkgdir/usr/share/licenses/${pkgname}/LICENSE" +} + +# vim:set ts=2 sw=2 et: diff --git a/autogen.sh b/autogen.sh index e128e7c..248f54a 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,5 +1,3 @@ #!/bin/sh -aclocal && \ - automake --add-missing --copy && \ - autoconf +aclocal && autoconf && automake --add-missing --copy diff --git a/bin/Makefile.am b/bin/Makefile.am index 46ff33f..8fcb92b 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -1 +1 @@ -bin_SCRIPTS = lsrc mkrc rcup rcdn +dist_bin_SCRIPTS = lsrc mkrc rcup rcdn diff --git a/configure.ac b/configure.ac index 95fdb6a..d938afc 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) -AC_INIT(rcm, 1.2.0, mike@mike-burns.com) +AC_INIT(rcm, 1.2.1, mburns@thoughtbot.com) AM_INIT_AUTOMAKE # Checks for programs. @@ -15,4 +15,5 @@ AM_INIT_AUTOMAKE # Checks for library functions. +AM_EXTRA_RECURSIVE_TARGETS([release_build_man_html release_push_man_html release_clean_man_html]) AC_OUTPUT(Makefile bin/Makefile man/Makefile share/Makefile share/rcm.sh NEWS.md) diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..5e196b9 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,29 @@ +rcm (1.2.1-1) UNRELEASED; urgency=medium + + * Re-visit the Debian packaging. + + -- Mike Burns Sat, 22 Feb 2014 00:49:32 +0100 + +rcm (1.2.0-1) unstable; urgency=medium + + * New upstream release + + -- Mike Burns Mon, 03 Feb 2014 16:58:33 +0200 + +rcm (1.1.0-1) unstable; urgency=medium + + * New upstream release. + + -- Mike Burns Mon, 05 Aug 2013 16:43:33 +0200 + +rcm (1.0.0-1) unstable; urgency=medium + + * New upstream release. + + -- Mike Burns Tue, 01 Aug 2013 16:43:33 +0200 + +rcm (0.0.2-1) unstable; urgency=medium + + * New upstream release. + + -- Mike Burns Tue, 23 Jul 2013 16:43:33 +0200 diff --git a/debian/compat b/debian/compat index 45a4fb7..ec63514 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -8 +9 diff --git a/debian/control b/debian/control index 02f1b10..bb141f5 100644 --- a/debian/control +++ b/debian/control @@ -1,12 +1,12 @@ Source: rcm Section: utils -Priority: extra +Priority: optional Maintainer: Mike Burns -Build-Depends: debhelper (>= 8.0.0) -Standards-Version: 3.9.3 -Homepage: http://github.com/mike-burns/rcm -Vcs-Git: git://github.com/mike-burns/rcm.git -Vcs-Browser: http://github.com/mike-burns/rcm +Build-Depends: debhelper (>= 9) +Standards-Version: 3.9.4 +Homepage: http://thoughtbot.github.io/rcm +Vcs-Git: git://github.com/thoughtbot/rcm.git +Vcs-Browser: http://github.com/thoughtbot/rcm Package: rcm Architecture: all diff --git a/debian/copyright b/debian/copyright index 3fa949f..428f888 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,6 +1,6 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: rcm -Source: git@github.com:mike-burns/rcm.git +Source: git@github.com:thoughtbot/rcm.git Files: * Copyright: 2013 Mike Burns diff --git a/debian/docs b/debian/docs deleted file mode 100644 index b43bf86..0000000 --- a/debian/docs +++ /dev/null @@ -1 +0,0 @@ -README.md diff --git a/debian/files b/debian/files deleted file mode 100644 index 39ac931..0000000 --- a/debian/files +++ /dev/null @@ -1 +0,0 @@ -rcm_0.0.2-1_all.deb utils extra diff --git a/debian/rcm.substvars b/debian/rcm.substvars deleted file mode 100644 index abd3ebe..0000000 --- a/debian/rcm.substvars +++ /dev/null @@ -1 +0,0 @@ -misc:Depends= diff --git a/debian/rules b/debian/rules index c259a57..f7f9dcb 100755 --- a/debian/rules +++ b/debian/rules @@ -19,3 +19,6 @@ export DH_OPTIONS %: dh $@ + +override_dh_installchangelogs: + dh_installchangelogs NEWS.md diff --git a/homebrew/rcm.rb.in b/homebrew/rcm.rb.in new file mode 100644 index 0000000..3b858eb --- /dev/null +++ b/homebrew/rcm.rb.in @@ -0,0 +1,17 @@ +require 'formula' + +class Rcm < Formula + homepage 'http://thoughtbot.github.io/rcm' + url 'http://thoughtbot.github.io/@PACKAGE@/dist/@DIST_ARCHIVES@' + sha1 '@DIST_SHA@' + + def install + system "./configure", "--disable-debug", "--disable-dependency-tracking", + "--prefix=#{prefix}" + system "make", "install" + end + + test do + system "lsrc" + end +end diff --git a/man/Makefile.am b/man/Makefile.am index 0674e27..e05728f 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -1 +1,19 @@ -man_MANS = lsrc.1 mkrc.1 rcdn.1 rcup.1 rcrc.5 rcm.7 +dist_man_MANS = lsrc.1 mkrc.1 rcdn.1 rcup.1 rcrc.5 rcm.7 + +###### manpages as HTML +release_build_man_html: + ([ -d gh-pages ] || git clone --branch gh-pages --single-branch .. gh-pages) && \ + for i in $(dist_man_MANS); do \ + mandoc -Thtml -Oman=%N.%S.html $$i > gh-pages/$$i.html ; \ + done && \ + cd gh-pages && \ + cp rcm.7.html index.html && \ + git add -A && \ + git commit -m "HTML documentation for $(PACKAGE_VERSION)" + +release_push_man_html: + cd gh-pages && \ + git push -f $(ORIGIN_URL) gh-pages + +release_clean_man_html: + rm -rf gh-pages diff --git a/share/Makefile.am b/share/Makefile.am index a018095..56f5f84 100644 --- a/share/Makefile.am +++ b/share/Makefile.am @@ -1 +1 @@ -pkgdata_SCRIPTS = rcm.sh +dist_pkgdata_SCRIPTS = rcm.sh -- cgit v1.2.3