Skip to content

Commit

Permalink
[build] Make a separate noarch.spec.in for noarch RPMs
Browse files Browse the repository at this point in the history
Unfortunately old versions of RPM don't seem to like having noarch
subpackages. Work around this with a whole new spec file.
Unfortunately this means compiling the code twice.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
  • Loading branch information
David Scott committed Jun 12, 2012
1 parent cddf779 commit 06be7e4
Show file tree
Hide file tree
Showing 8 changed files with 170 additions and 116 deletions.
16 changes: 12 additions & 4 deletions Makefile
Expand Up @@ -74,6 +74,10 @@ lib-uninstall:
sdk-install: doc
omake sdk-install

.PHONY: noarch-install
noarch-install: doc
omake noarch-install

.PHONY: clean
clean:
omake clean
Expand Down Expand Up @@ -139,23 +143,27 @@ ocaml/fhs.ml :
.PHONY: clean
clean:

.PHONY: xapi.spec
xapi.spec: xapi.spec.in
noarch.spec: noarch.spec.in

%.spec: %.spec.in
sed -e 's/@RPM_RELEASE@/$(shell git rev-list HEAD | wc -l)/g' < $< > $@
sed -i "s!@OPTDIR@!${OPTDIR}!g" $@

.PHONY: srpm
srpm: xapi.spec
srpm: xapi.spec noarch.spec
mkdir -p $(RPM_SOURCESDIR) $(RPM_SPECSDIR) $(RPM_SRPMSDIR)
while ! [ -d .git ]; do cd ..; done; \
git archive --prefix=xapi-0.2/ --format=tar HEAD | bzip2 -z > $(RPM_SOURCESDIR)/xapi-0.2.tar.bz2 # xen-api/Makefile
git archive --prefix=xapi-noarch-0.2/ --format=tar HEAD | bzip2 -z > $(RPM_SOURCESDIR)/xapi-noarch-0.2.tar.bz2 # xen-api/Makefile
cp $(JQUERY) $(JQUERY_TREEVIEW) $(RPM_SOURCESDIR)
make -C $(REPO) version
rm -f $(RPM_SOURCESDIR)/xapi-version.patch
(cd $(REPO); diff -u /dev/null ocaml/util/version.ml > $(RPM_SOURCESDIR)/xapi-version.patch) || true
cp -f xapi.spec $(RPM_SPECSDIR)/
chown root.root $(RPM_SPECSDIR)/xapi.spec || true
cp -f xapi.spec noarch.spec $(RPM_SPECSDIR)/
chown root.root $(RPM_SPECSDIR)/xapi.spec $(RPM_SPECSDIR)/noarch.spec || true
$(RPMBUILD) -bs --nodeps $(RPM_SPECSDIR)/xapi.spec
$(RPMBUILD) -bs --nodeps $(RPM_SPECSDIR)/noarch.spec


.PHONY: build
Expand Down
4 changes: 2 additions & 2 deletions javascript/OMakefile
@@ -1,6 +1,6 @@

.PHONY: install
install:
.PHONY: noarch-install
noarch-install:
mkdir -p $(DESTDIR)$(OPTDIR)/debug/www
cp *.js *.html *.css $(DESTDIR)$(OPTDIR)/debug/www
mkdir -p $(DESTDIR)$(OPTDIR)/debug/www/jquery
Expand Down
6 changes: 3 additions & 3 deletions mk/Makefile
Expand Up @@ -69,7 +69,7 @@ $(OUTPUT_CLI_RT) $(OUTPUT_SDK): $(MY_MAIN_PACKAGES)/.dirstamp $(RPM_DIRECTORIES)

# extract the xapi-docs
mkdir -p $(OUTPUT_SDK_DIR)/tmp
(cd $(OUTPUT_SDK_DIR)/tmp; rpm2cpio $(RPM_RPMSDIR)/$(DOMAIN0_ARCH_OPTIMIZED)/xapi-docs*.rpm | cpio -i --make-directories; tar -zcf $(OUTPUT_SDK) .;zip -9rv $(OUTPUT_WEBZIP) .)
(cd $(OUTPUT_SDK_DIR)/tmp; rpm2cpio $(RPM_RPMSDIR)/noarch/xapi-noarch-docs*.rpm | cpio -i --make-directories; tar -zcf $(OUTPUT_SDK) .;zip -9rv $(OUTPUT_WEBZIP) .)
rm -rf $(OUTPUT_SDK_DIR)/tmp

# Unpack the xapi-datamodel-devel RPM for now
Expand All @@ -82,11 +82,11 @@ $(OUTPUT_CLI_RT) $(OUTPUT_SDK): $(MY_MAIN_PACKAGES)/.dirstamp $(RPM_DIRECTORIES)
# Make sure the right RPMs appear on the install CD
mkdir $(MY_MAIN_PACKAGES)
cp $(RPM_RPMSDIR)/$(DOMAIN0_ARCH_OPTIMIZED)/xapi-core-*.rpm $(MY_MAIN_PACKAGES)
cp $(RPM_RPMSDIR)/$(DOMAIN0_ARCH_OPTIMIZED)/xapi-backend-udev-*.rpm $(MY_MAIN_PACKAGES)
cp $(RPM_RPMSDIR)/noarch/xapi-noarch-backend-udev-*.rpm $(MY_MAIN_PACKAGES)
cp $(RPM_RPMSDIR)/$(DOMAIN0_ARCH_OPTIMIZED)/xapi-networkd-*.rpm $(MY_MAIN_PACKAGES)
cp $(RPM_RPMSDIR)/$(DOMAIN0_ARCH_OPTIMIZED)/xapi-squeezed-*.rpm $(MY_MAIN_PACKAGES)
cp $(RPM_RPMSDIR)/$(DOMAIN0_ARCH_OPTIMIZED)/xapi-tests-*.rpm $(MY_MAIN_PACKAGES)
cp $(RPM_RPMSDIR)/$(DOMAIN0_ARCH_OPTIMIZED)/xapi-www-*.rpm $(MY_MAIN_PACKAGES)
cp $(RPM_RPMSDIR)/noarch/xapi-noarch-www-*.rpm $(MY_MAIN_PACKAGES)
cp $(RPM_RPMSDIR)/$(DOMAIN0_ARCH_OPTIMIZED)/xapi-xe-*.rpm $(MY_MAIN_PACKAGES)
cp $(RPM_RPMSDIR)/$(DOMAIN0_ARCH_OPTIMIZED)/xapi-xenops-*.rpm $(MY_MAIN_PACKAGES)
cp $(RPM_RPMSDIR)/$(DOMAIN0_ARCH_OPTIMIZED)/xapi-xenopsd-*.rpm $(MY_MAIN_PACKAGES)
Expand Down
133 changes: 133 additions & 0 deletions noarch.spec.in
@@ -0,0 +1,133 @@
# -*- rpm-spec -*-

Summary: xapi-noarch - xen toolstack for XCP
Name: xapi-noarch
Version: 0.2
Release: @RPM_RELEASE@
Group: System/Hypervisor
License: LGPL+linking exception
URL: http://www.xen.org
Source0: xapi-noarch-%{version}.tar.bz2
Source1: jquery-1.1.3.1.pack.js
Source2: jquery.treeview.zip
Patch0: xapi-version.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: pam-devel tetex-latex xapi-libs-devel ocaml omake ocaml-findlib ocaml-xmlm ocaml-type-conv ocaml-xmlm-devel xen-devel zlib-devel
BuildArch: noarch

%description
XCP toolstack.

%package backend-udev
Summary: The udev rules and scripts needed by a network/block driver domain
Group: System/Hypervisor
Requires: util-linux ethtool bridge-utils iproute
# + openvswitch
# + a package with xenstore-{ls,read,write}

%description backend-udev
The udev rules are triggered by blkback/netback and implement part of the disk/network hotplug protocol. All driver domains must install this package (or a similar one)

%package www
Summary: The XenAPI www interface
Group: System/Hypervisor

%description www
This package contains the XenAPI www interface

%package docs
Summary: Xen-API documentation and examples
Group: Development/Documentation

%description docs
This package contains Xen-API documentation and examples in several programming languages.

%prep
%setup -q
cp $RPM_SOURCE_DIR/jquery* $RPM_BUILD_DIR/xapi-noarch-0.2/ocaml/idl
%patch0 -p0 -b xapi-version.patch

%build
COMPILE_JAVA=no %{__make}

%install
rm -rf %{buildroot}

DESTDIR=$RPM_BUILD_ROOT %{__make} noarch-install

%clean
rm -rf $RPM_BUILD_ROOT

%files backend-udev
%defattr(-,root,root,-)
/etc/udev/rules.d/xen-backend.rules
/etc/udev/rules.d/xen-frontend.rules
/etc/udev/xen-backend.rules
/etc/udev/xen-frontend.rules
/etc/xensource/scripts/block-frontend
/etc/xensource/scripts/tap
/etc/xensource/scripts/vif
/etc/xensource/scripts/block
@OPTDIR@/libexec/setup-vif-rules

%files www
%defattr(-,root,root,-)
#@OPTDIR@/debug/www/XenServerConsole.jar
@OPTDIR@/debug/www/api.js
@OPTDIR@/debug/www/apicall.css
@OPTDIR@/debug/www/apicall.js
@OPTDIR@/debug/www/construct_tree.js
@OPTDIR@/debug/www/devweb.css
@OPTDIR@/debug/www/devweb.js
@OPTDIR@/debug/www/editables.js
@OPTDIR@/debug/www/graphs.js
@OPTDIR@/debug/www/haplan.css
@OPTDIR@/debug/www/haplan.js
@OPTDIR@/debug/www/images/xen_logo.gif
@OPTDIR@/debug/www/index.html
@OPTDIR@/debug/www/jquery/jqDnR.css
@OPTDIR@/debug/www/jquery/jqDnR.js
@OPTDIR@/debug/www/jquery/jqModal.css
@OPTDIR@/debug/www/jquery/jqModal.js
@OPTDIR@/debug/www/jquery/jquery-1.3.2.js
@OPTDIR@/debug/www/jquery/jquery-dom.js
@OPTDIR@/debug/www/jquery/jquery.autocomplete.css
@OPTDIR@/debug/www/jquery/jquery.autocomplete.js
@OPTDIR@/debug/www/jquery/jquery.bgiframe.js
@OPTDIR@/debug/www/jquery/jquery.color.js
@OPTDIR@/debug/www/jquery/jquery.cookie.js
@OPTDIR@/debug/www/jquery/jquery.jeditable.js
@OPTDIR@/debug/www/jquery/jquery.rpc.js
@OPTDIR@/debug/www/jquery/jquery.treeview.js
@OPTDIR@/debug/www/main.js
@OPTDIR@/debug/www/messages.js
@OPTDIR@/debug/www/networks.css
@OPTDIR@/debug/www/networks.js
@OPTDIR@/debug/www/objectviewoverrides.js
@OPTDIR@/debug/www/offline.js
@OPTDIR@/debug/www/process_rrd.js
@OPTDIR@/debug/www/tree.css
@OPTDIR@/debug/www/vmsearch.js
@OPTDIR@/debug/www/xenapi.js

%files docs
%defattr(-,root,root,-)
/usr/share/doc/xapi/*
#/usr/share/doc/xapi/client-examples/*/*
#/usr/share/doc/xapi/docs/html/API/Classes/*/index.html
#/usr/share/doc/xapi/docs/html/API/Classes/*/Explicit/*
#/usr/share/doc/xapi/docs/html/API/Classes/*/Implicit/*
#/usr/share/doc/xapi/docs/html/API/Classes/*/Fields/*
#/usr/share/doc/xapi/docs/html/*
#/usr/share/doc/xapi/docs/html/images/*
#/usr/share/doc/xapi/docs/pdf/xenenterpriseapi.pdf

%changelog








4 changes: 3 additions & 1 deletion ocaml/doc/OMakefile
Expand Up @@ -19,14 +19,16 @@ doc: jsapi
sdk-install: doc
mkdir -p $(SDK)/docs/html/xcp
sh -c 'cp -r -L api $(SDK)/docs/html/xcp/'
sh -c 'cp -r -L content $(SDK)/docs/html/xcp/'
sh -c 'cp -r -L content $(SDK)/docs/html/xcp/ || true'
cp *.js *.html *.css *.png $(SDK)/docs/html/xcp/

mkdir -p $(SDK)/docs/html/xenserver
sh -c 'cp -r -L api $(SDK)/docs/html/xenserver/'
cp *.js *.html *.css *.png $(SDK)/docs/html/xenserver/
cp xenserver/* $(SDK)/docs/html/xenserver/

noarch-install: sdk-install

.PHONY: clean
clean:
rm -f *~ *.cmi *.cmx *.cmo *.a *.cma *.cmxa *.run *.opt *.annot *.o *.omc
Expand Down
4 changes: 2 additions & 2 deletions ocaml/idl/js_backend/OMakefile
Expand Up @@ -27,7 +27,7 @@ js_binding: main
./main > api.js
cp api.js ../../../js/

.PHONY: install
install:
.PHONY: noarch-install
noarch-install:
mkdir -p $(DESTDIR)$(OPTDIR)/debug/www
cp api.js $(DESTDIR)$(OPTDIR)/debug/www
26 changes: 15 additions & 11 deletions scripts/OMakefile
@@ -1,5 +1,20 @@
.SUBDIRS: examples templates host-backup-restore poweron

.PHONY: noarch-install
noarch-install:
mkdir -p $(DESTDIR)/etc/udev ### FHS_FIXME
$(IPROG) xen-backend.rules $(DESTDIR)/etc/udev ### FHS_FIXME
$(IPROG) xen-frontend.rules $(DESTDIR)/etc/udev ### FHS_FIXME
mkdir -p $(DESTDIR)/etc/udev/rules.d ### FHS_FIXME
sh -c \
'cd $(DESTDIR)/etc/udev/rules.d; \
ln -sf ../xen-backend.rules; \
ln -sf ../xen-frontend.rules'
mkdir -p $(DESTDIR)$(SCRIPTSDIR)
$(IPROG) block-frontend vif tap block $(DESTDIR)$(SCRIPTSDIR)
mkdir -p $(DESTDIR)$(LIBEXECDIR)
$(IPROG) setup-vif-rules $(DESTDIR)$(LIBEXECDIR)

.PHONY: install
install:
mkdir -p $(DESTDIR)$(BINDIR)
Expand Down Expand Up @@ -56,9 +71,6 @@ install:
$(IPROG) mpathalert-daemon $(DESTDIR)$(ETCDIR)/master.d/03-mpathalert-daemon
mkdir -p $(DESTDIR)/etc/sysconfig
$(IPROG) sysconfig-xapi $(DESTDIR)/etc/sysconfig/xapi
mkdir -p $(DESTDIR)/etc/udev ### FHS_FIXME
$(IPROG) xen-backend.rules $(DESTDIR)/etc/udev ### FHS_FIXME
$(IPROG) xen-frontend.rules $(DESTDIR)/etc/udev ### FHS_FIXME
$(IPROG) generate_ssl_cert $(DESTDIR)$(LIBEXECDIR)
$(IPROG) fix_firewall.sh $(DESTDIR)$(BINDIR)
mkdir -p $(DESTDIR)$(OPTDIR)/debug
Expand All @@ -73,13 +85,6 @@ install:
$(IPROG) xe-get-network-backend $(DESTDIR)$(BINDIR)
$(IPROG) static-vdis $(DESTDIR)$(BINDIR)
$(IPROG) with-vdi $(DESTDIR)$(OPTDIR)/debug
mkdir -p $(DESTDIR)/etc/udev/rules.d ### FHS_FIXME
sh -c \
'cd $(DESTDIR)/etc/udev/rules.d; \
ln -sf ../xen-backend.rules; \
ln -sf ../xen-frontend.rules'
mkdir -p $(DESTDIR)$(SCRIPTSDIR)
$(IPROG) block-frontend vif tap block $(DESTDIR)$(SCRIPTSDIR)
$(IPROG) pool.conf $(DESTDIR)$(ETCDIR)
mkdir -p $(DESTDIR)/etc/pam.d
$(IPROG) pam.d-xapi $(DESTDIR)/etc/pam.d/xapi
Expand Down Expand Up @@ -117,7 +122,6 @@ install:
mkdir -p $(DESTDIR)$(HOOKSDIR)/host-post-declare-dead
$(IPROG) 10resetvdis $(DESTDIR)$(HOOKSDIR)/host-post-declare-dead
$(IPROG) pci-info $(DESTDIR)$(LIBEXECDIR)
$(IPROG) setup-vif-rules $(DESTDIR)$(LIBEXECDIR)

.PHONY: sdk-install
sdk-install: install
Expand Down

0 comments on commit 06be7e4

Please sign in to comment.