Skip to content
This repository has been archived by the owner on May 6, 2021. It is now read-only.

Commit

Permalink
Support SUSE build on build.opensuse.org
Browse files Browse the repository at this point in the history
This adds a SUSE-specific spec file (calamari-clients.suse.spec) and
suse-tarball build target to the Makefile.

Ordinarily, we'd want SUSE's build service to be able to do a complete
build from source (think: make && make install invoked from a spec
file), but the calamari-clients build uses `npm install` internally,
which downloads various node dependencies at build time.  Instances
within SUSE's build service don't have network access, so there's no way
this is going to work.

Given these problems, the least-worst solution seems to be adding the
suse-tarball build target, which a package maintainer can run from a
source checkout on an openSUSE or SLES system to generate a suitable
tarball, then that can be uploaded to the build service along with
calamari-clients.suse.spec.

Note that there's no real reason the suse-tarball target is
SUSE-specific, except that it packs everything into /srv/www/calamari,
to match SUSE's packaging guidelines for web apps.

Signed-off-by: Tim Serong <tserong@suse.com>
  • Loading branch information
tserong committed Jul 22, 2014
1 parent d2b9ccc commit bc07da5
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
.git
*.swp
*.swo
calamari-clients*.tar.gz
**/.sass-cache
**/.tmp
**/dist
Expand Down
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ BPTAG ?= ""
DEBEMAIL ?= dan.mick@inktank.com
ARCH ?= x86_64

TSCOMMIT=$(shell git log -n1 --pretty=format:"%ct.%h")
SUSE_PKG=calamari-clients-$(VERSION)+git.$(TSCOMMIT)
SUSE_DEST=/srv/www/calamari
SUSE_TAR=$(SUSE_PKG).tar.gz

DISTNAMEVER=calamari-clients_$(VERSION)
PKGDIR=calamari-clients-$(VERSION)
TARNAME = ../$(DISTNAMEVER).tar.gz
Expand Down Expand Up @@ -120,6 +125,24 @@ install: build
tar xvfz $(BUILD_PRODUCT_TGZ); \
fi

# Does build-real (thus requiring grunt, bower and compass be installed),
# then packs everything into a tarball like the install target above,
# except it's created in the .tmp subdirectory of the source tree, and
# packed with a name in the form:
# calamari-clients-1.2+git.1406029226.d2b9ccc.tar.bz",
# i.e. the commit timestamp and hash are included in the tarball name.
# Note: the directory structure here is /srv/www/calamari, to follow
# SUSE packaging conventions for web apps.
suse-tarball: build-real
rm -rf .tmp
mkdir -p .tmp/$(SUSE_PKG)$(SUSE_DEST)/content
for d in $(UI_SUBDIRS); do \
instdir=$$(basename $$d); \
$(INSTALL) -d .tmp/$(SUSE_PKG)$(SUSE_DEST)/content/$$instdir; \
cp -rp $$d/dist/* .tmp/$(SUSE_PKG)$(SUSE_DEST)/content/$$instdir; \
done;
( cd .tmp ; tar cvfz ../$(SUSE_TAR) $(SUSE_PKG) )

dist:
@echo "making dist tarball in $(TARNAME)"
for d in $(UI_SUBDIRS); do \
Expand Down
48 changes: 48 additions & 0 deletions calamari-clients.suse.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#
# SUSE spec file for package calamari-clients
#
# Note that the SUSE build for calamari-clients requires that someone has
# already generated a suitable tarball from the source tree by invoking
# `make suse-tarball`. This will result in a tarball named similar to
# calamari-clients-X.Y+git.TIMESTAMP.COMMIT.tar.gz. Don't bother with
# `make rpm`, just use build.opensuse.org with this spec file and the
# appropriate tarball.
#
# NOTE: You will have to edit the Version tag in this spec file to match
# your tarball, once you've checked them in to the build service.
#

Name: calamari-clients
Version: 1.2+git.TIMESTAMP.COMMIT
Release: 0
License: MIT
Summary: Calamari GUI front-end components
Url: http://ceph.com/
Group: System/Filesystems
Source0: %{name}-%{version}.tar.gz
# Need BuildRequires calamari-server to avoid rpmlint warning about no package
# owning /srv/www/calamari (other than that it serves no actual purpose at build
# time).
BuildRequires: calamari-server
BuildRequires: fdupes
Requires: calamari-server
BuildArch: noarch
%description
Contains the JavaScript GUI content for the Calamari frontend components
(dashboard, login screens, administration screens)

%prep
%setup -q %{name}-%{version}

%build
# Nothing to do here, this relies on a prebuilt tarball

%install
cp -a srv %{buildroot}/
%fdupes %{buildroot}/srv/www/calamari/content

%files -n calamari-clients
%defattr(-,root,root,-)
/srv/www/calamari/content

%changelog

0 comments on commit bc07da5

Please sign in to comment.