[PATCH] Add RPM packaging to trace-cmd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(Applies to trace-cmd.git:84cc30df)

This patch adds a new make target "make srcrpm" which will build a
.src.rpm package out of the trace-cmd distribution.  You can then do
one of several steps:

Directly build the .src.rpm into a binary rpm with a command like

rpmbuild --rebuild /path/to/src.rpm

Or, alternatively, you can take the intermediate metadata:

  *) ./obj/trace-cmd-$(VERSION).tar.gz
  *) ./obj/trace-cmd-$(VERSION)/trace-cmd.spec

and build them with an external tool.

Note: the packaging currently only includes trace-cmd and not
kernelshark.  This is a function of the current "make install" target.
Enhancements to "make install" in the future may enhance the packaging
to include kernelshark as well.

Signed-off-by: Gregory Haskins <ghaskins@xxxxxxxxxx>
---

 Makefile       |   25 ++++++++++++++++++++++++-
 trace-cmd.spec |   39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 1 deletions(-)
 create mode 100644 trace-cmd.spec

diff --git a/Makefile b/Makefile
index 41f0d43..7bbe978 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # trace-cmd version
 TC_VERSION = 1
 TC_PATCHLEVEL = 1
-TC_EXTRAVERSION = 0-rc1
+TC_EXTRAVERSION = 0.rc1
 
 # Kernel Shark version
 KS_VERSION = 0
@@ -494,6 +494,7 @@ install_doc:
 clean:
 	$(RM) *.o *~ $(TARGETS) *.a *.so ctracecmd_wrap.c .*.d
 	$(RM) tags TAGS
+	$(RM) -rf $(OBJDIR)
 
 
 ##### PYTHON STUFF #####
@@ -546,3 +547,25 @@ force:
 # Declare the contents of the .PHONY variable as phony.  We keep that
 # information in a variable so we can use it in if_changed and friends.
 .PHONY: $(PHONY)
+
+NAME=trace-cmd
+VERSION=$(TC_VERSION).$(TC_PATCHLEVEL).$(TC_EXTRAVERSION)
+RELEASE=1
+OBJDIR=obj
+RPMBIN=$(OBJDIR)/$(NAME)-$(VERSION).tar.gz
+
+$(OBJDIR)/$(NAME)-$(VERSION):
+	@mkdir -p $(OBJDIR)/$(NAME)-$(VERSION)
+
+$(OBJDIR)/$(NAME)-$(VERSION)/$(NAME).spec: $(OBJDIR)/$(NAME)-$(VERSION) $(NAME).spec Makefile
+	@echo "Installing RPM specfile $@"
+	@cat $(NAME).spec | sed -e 's/_RPM_VERSION/$(VERSION)/;s/_RPM_RELEASE/$(RELEASE)/' > $@
+
+.PHONY: $(RPMBIN)
+
+$(RPMBIN): $(OBJDIR)/$(NAME)-$(VERSION)/$(NAME).spec 
+	tar -c --exclude=.git --exclude=*.spec --exclude=*~ --exclude=$(OBJDIR) * | (cd $(OBJDIR)/$(NAME)-$(VERSION); tar xf -)
+	(cd $(OBJDIR); tar cvz $(NAME)-$(VERSION)) > $(RPMBIN)
+
+srcrpm: $(RPMBIN)
+	rpmbuild -ts $(RPMBIN)
diff --git a/trace-cmd.spec b/trace-cmd.spec
new file mode 100644
index 0000000..6e135fb
--- /dev/null
+++ b/trace-cmd.spec
@@ -0,0 +1,39 @@
+%define rpmrel _RPM_RELEASE
+
+BuildRequires: libxml2-devel
+
+Summary: trace-cmd: Userspace trace tools for  
+Name: trace-cmd
+Version: _RPM_VERSION
+License: GPL
+Release: %{rpmrel}
+Requires: libxml2
+Group: System Tools
+Source: %{name}-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-root
+
+%description
+Authors
+--------------------------
+  Steven Rostedt <srostedt@xxxxxxxxxx>
+
+%debug_package
+%prep
+%setup
+
+%build
+make
+
+%install
+make install DESTDIR=$RPM_BUILD_ROOT
+
+# Install documentation  
+%clean
+make clean
+
+%files
+%defattr(-,root,root)
+/usr/local/bin/trace-cmd
+/usr/local/share/trace-cmd/*
+
+%changelog

--
To unsubscribe from this list: send the line "unsubscribe linux-trace-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux