Skip to content

Commit

Permalink
Undo the undo commit 39b3554 {sigh}
Browse files Browse the repository at this point in the history
Apparently I need to read graphs a bit more closely.  Or tell the
difference between left & right.  Or merge the proper branch X into the
proper branch Y before pushing to the outside world.  Or something.

Translation: restore Jon's bctt script and Ryan's packaging changes.
  • Loading branch information
slfritchie committed Dec 3, 2010
1 parent 5feb2f7 commit e0c1cc3
Show file tree
Hide file tree
Showing 20 changed files with 1,050 additions and 9 deletions.
40 changes: 31 additions & 9 deletions Makefile
@@ -1,6 +1,9 @@
.PHONY: rel deps
REPO ?= bitcask
BITCASK_TAG = $(shell git describe --tags)
REVISION ?= $(shell echo $(BITCASK_TAG) | sed -e 's/^$(REPO)-//')
PKG_VERSION ?= $(shell echo $(REVISION) | tr - .)

BITCASK_TAG = $(shell hg identify -t)
.PHONY: rel deps package pkgclean

all: deps compile

Expand All @@ -15,18 +18,37 @@ clean:

# Release tarball creation
# Generates a tarball that includes all the deps sources so no checkouts are necessary

archivegit = git archive --format=tar --prefix=$(1)/ HEAD | (cd $(2) && tar xf -)
archivehg = hg archive $(2)/$(1)
archive = if [ -d ".git" ]; then \
$(call archivegit,$(1),$(2)); \
else \
$(call archivehg,$(1),$(2)); \
fi

buildtar = mkdir distdir && \
git clone . distdir/$(REPO)-clone && \
cd distdir/$(REPO)-clone && \
git checkout $(BITCASK_TAG) && \
$(call archive,$(BITCASK_TAG),..) && \
mkdir ../$(BITCASK_TAG)/deps && \
make deps; \
for dep in deps/*; do cd $${dep} && $(call archive,$${dep},../../../$(BITCASK_TAG)); cd ../..; done

distdir:
$(if $(findstring tip,$(BITCASK_TAG)),$(error "You can't generate a release tarball from tip"))
mkdir distdir
hg clone -u $(BITCASK_TAG) . distdir/bitcask-clone
cd distdir/bitcask-clone; \
hg archive ../$(BITCASK_TAG)
$(if $(BITCASK_TAG), $(call buildtar), $(error "You can't generate a release tarball from a non-tagged revision. Run 'git checkout <tag>', then 'make dist'"))

dist $(BITCASK_TAG).tar.gz: distdir
cd distdir; \
tar czf ../$(BITCASK_TAG).tar.gz $(BITCASK_TAG)

distclean:
ballclean:
rm -rf $(BITCASK_TAG).tar.gz distdir

package: dist
$(MAKE) -C package package

pkgclean:
$(MAKE) -C package pkgclean

export BITCASK_TAG PKG_VERSION REPO REVISION
38 changes: 38 additions & 0 deletions package/Makefile
@@ -0,0 +1,38 @@
OS = $(shell uname -s)
KERNEL = $(shell uname -r)
ifeq ($(OS),Linux)
PKGER = $(shell cat /etc/redhat-release 2> /dev/null)
ifeq ($(PKGER),)
PKGER = debuild
PKGERDIR = deb
else
PKGER = rpmbuild
PKGERDIR = rpm
endif
endif
ifeq ($(OS),SunOS)
PKGER = make
PKGERDIR = solaris
DISTRO = $(shell awk '{ if (NR==1) print $$1; };' /etc/release)
endif

APP = $(shell echo "$(REPO)" | sed -e 's/_/-/g')
# Assumes CURDIR is $(REPO)/package/
RIAK_PATH ?= ..
RELEASE ?=

$(APP)-$(REVISION).tar.gz: ../$(BITCASK_TAG).tar.gz
ln -s $< $@

pkgclean: $(PKGERDIR)/pkgclean
rm -rf $(APP)-$(REVISION).tar.gz working rpmbuild debuild packages

pkgcheck:
$(if $(BITCASK_TAG),,$(error "You can't generate a release tarball from a non-tagged revision. Run 'git checkout <tag>', then 'make dist'"))
$(if $(RELEASE),,$(error "You must provide a package release number via RELEASE= on the command line"))
@echo "Packaging \"$(BITCASK_TAG)\""

# The heavy lifting is done by the individual packager Makefiles
package: pkgcheck build

include $(PKGERDIR)/Makefile
28 changes: 28 additions & 0 deletions package/deb/Makefile
@@ -0,0 +1,28 @@
BUILDPATH = debuild/$(APP)-$(REVISION)

build: $(BUILDPATH)/debian \
debuild/$(APP)_$(REVISION).orig.tar.gz
export DEBFULLNAME="Basho Buildbot Packager"; \
export DEBEMAIL="support@basho.com"; \
dch --noquery -c $(BUILDPATH)/debian/changelog \
-b -v "$(REVISION)-$(RELEASE)" "pants on head"
cd $(BUILDPATH) && debuild --no-lintian \
-e REVISION=$(REVISION) \
-e RELEASE=$(RELEASE) \
-uc -us
mkdir -p packages
mv debuild/$(APP)_$(REVISION)-$(RELEASE)_*.deb packages

$(BUILDPATH): $(APP)-$(REVISION).tar.gz
mkdir -p debuild
tar xz -C debuild -f $^

$(BUILDPATH)/debian: $(BUILDPATH)
cp -a $(PKGERDIR) $@
rm -rf $@/.hg $@/Makefile $@/.*.swp

debuild/$(APP)_$(REVISION).orig.tar.gz: $(APP)-$(REVISION).tar.gz
cp $^ $@

$(PKGERDIR)/pkgclean:
@echo
6 changes: 6 additions & 0 deletions package/deb/bitcask.debhelper.log
@@ -0,0 +1,6 @@
dh_installdirs
dh_strip
dh_compress
dh_installdeb
dh_gencontrol
dh_builddeb
1 change: 1 addition & 0 deletions package/deb/bitcask.substvars
@@ -0,0 +1 @@
misc:Depends=
5 changes: 5 additions & 0 deletions package/deb/changelog
@@ -0,0 +1,5 @@
bitcask (8) unstable; urgency=low

* Initial release of bitcask key/value store

-- Ryan Tilder <rtilder@basho.com> Wed, 26 May 2010 16:20:40 UTC
1 change: 1 addition & 0 deletions package/deb/compat
@@ -0,0 +1 @@
7
13 changes: 13 additions & 0 deletions package/deb/control
@@ -0,0 +1,13 @@
Source: bitcask
Section: net
Priority: extra
Maintainer: Basho Support <support@basho.com>
Build-Depends: debhelper (>= 7)
Standards-Version: 3.8.3
Homepage: http://basho.com/

Package: bitcask
Architecture: any
Depends: adduser, logrotate, ${shlibs:Depends}, ${misc:Depends}
Description: Because you need another a key/value storage engine
Because you need another a key/value storage engine
32 changes: 32 additions & 0 deletions package/deb/copyright
@@ -0,0 +1,32 @@
This package was debianized by Basho Support <support@basho.com> on
Wed, 26 May 2010 16:20:40 UTC

It was downloaded from http://downloads.basho.com/bitcask/bitcask-0.1/

Upstream Author(s):


Copyright:
2007-2010 Basho Technologies

License:
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

The Debian packaging is:

2007-2010 Basho Technologies

and is licensed under the Apache License, Version 2.0

# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.
1 change: 1 addition & 0 deletions package/deb/dirs
@@ -0,0 +1 @@
usr/lib/riak/lib/bitcask-0.1
1 change: 1 addition & 0 deletions package/deb/files
@@ -0,0 +1 @@
bitcask_0.1_i386.deb net extra
42 changes: 42 additions & 0 deletions package/deb/postrm
@@ -0,0 +1,42 @@
#!/bin/sh
# postrm script for riak
#
# see: dh_installdeb(1)


# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <overwriter>
# <overwriter-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package


case "$1" in
purge)
if [ -d /var/lib/riak/lib/bitcask-0.1 ]; then
rm -r /var/lib/riak/lib/bitcask-0.1
fi
;;

remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;

*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
48 changes: 48 additions & 0 deletions package/deb/rules
@@ -0,0 +1,48 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

package=bitcask

CFLAGS=
LDFLAGS=


build:
ERL_FLAGS="-smp enable" make
touch build

clean:
dh_clean
rm -f build

# Add here commands to clean up after the build process.
make clean

install: build
dh_testdir
dh_testroot
dh_installdirs
cp -R src debian/$(package)/usr/lib/riak/lib/$(package)-$(REVISION)
cp -R ebin debian/$(package)/usr/lib/riak/lib/$(package)-$(REVISION)
cp -R priv debian/$(package)/usr/lib/riak/lib/$(package)-$(REVISION)

binary-indep: install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: install
dh_strip -a
dh_compress -a
dh_installdeb
dh_gencontrol
dh_builddeb

binary: binary-indep binary-arch
31 changes: 31 additions & 0 deletions package/rpm/Makefile
@@ -0,0 +1,31 @@

build: $(PKGERDIR)/SOURCES/$(APP)-$(REVISION).tar.gz rpmbuild
@echo "BITCASK_TAG = $(BITCASK_TAG)"
@echo "REVISION = $(REVISION)"
@echo "RELEASE = $(RELEASE)"
rpmbuild --define '_topdir $(CURDIR)/rpmbuild' \
--define '_sourcedir $(CURDIR)/$(PKGERDIR)/SOURCES' \
--define '_specdir $(CURDIR)/$(PKGERDIR)/SPECS' \
--define '_rpmdir $(CURDIR)/packages' \
--define '_srcrpmdir $(CURDIR)/packages' \
--define "_revision $(REVISION)" \
--define "_version $(PKG_VERSION)" \
--define "_release $(RELEASE)" \
-ba $(PKGERDIR)/SPECS/$(APP).spec
mv packages/*/$(APP)-$(PKG_VERSION)-$(RELEASE)*.rpm packages
rm -rf packages/i?86 packages/x86_64

rpmbuild:
@mkdir -p rpmbuild/BUILD
@mkdir -p packages

# In case it doesn't exist because there aren't any patches to apply
$(PKGERDIR)/SOURCES:
@mkdir -m 0755 -p $(PKGERDIR)/SOURCES

$(PKGERDIR)/SOURCES/$(APP)-$(REVISION).tar.gz: $(APP)-$(REVISION).tar.gz \
$(PKGERDIR)/SOURCES
cp $(APP)-$(REVISION).tar.gz $(PKGERDIR)/SOURCES

$(PKGERDIR)/pkgclean:
@echo
55 changes: 55 additions & 0 deletions package/rpm/SPECS/bitcask.spec
@@ -0,0 +1,55 @@
# BuildArch should be determined automatically. Use of setarch on x86-64
# platform will allow one to build ix86 only
#
# _revision, _release, and _version should be defined on the rpmbuild command
# line like so:
#
# --define "_version 0.9.1.19.abcdef" --define "_release 7" \
# --define "_revision 0.9.1-19-abcdef"


Name: bitcask
Version: %{_version}
Release: %{_release}%{?dist}
License: GPLv2
Group: Development/Libraries
Source: http://downloads.basho.com/%{name}/%{name}-%{_revision}/%{name}-%{_revision}.tar.gz
URL: http://basho.com/
Vendor: Basho Technologies
Packager: Basho Support <support@basho.com>
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
Summary: Because you need another a key/value storage engine

%description
Because you need another a key/value storage engine

%define __prelink_undo_cmd /bin/cat prelink library

%prep
%setup -n %{name}-%{_revision}

%build
mkdir %{name}
ERL_FLAGS="-smp enable" make

%install
mkdir -p %{buildroot}%{_libdir}%{name}

#Copy all necessary lib files etc.
cp -r $RPM_BUILD_DIR/%{name}-%{_revision}/ebin %{buildroot}%{_libdir}%{name}
cp -r $RPM_BUILD_DIR/%{name}-%{_revision}/priv %{buildroot}%{_libdir}%{name}
# I don't see how the source is useful at the moment
#cp -r $RPM_BUILD_DIR/%{name}-%{_revision}/src %{buildroot}%{_libdir}%{name}

%files
%defattr(-,root,root)
%dir %{_libdir}%{name}
%{_libdir}%{name}/*

%clean
rm -rf %{buildroot}

%changelog
* Wed May 26 2010 Ryan Tilder <rtilder@basho.com> 0.1-1
- Initial packaging

0 comments on commit e0c1cc3

Please sign in to comment.