[ostree] packages: Tweak srpm command



commit c746f3b37cca9df10e905074c4c79be5f4c852d8
Author: Colin Walters <walters verbum org>
Date:   Thu Sep 20 18:00:04 2012 -0400

    packages: Tweak srpm command
    
    This spec should be usable for both embedded dependencies and not.

 Makefile.am                       |    4 ++--
 packages/ostree.spec.in           |   30 ++++++++++++++++++++++++++----
 packages/substitute-gitversion.sh |    7 +++++++
 3 files changed, 35 insertions(+), 6 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 55b04b1..1b93c50 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -148,9 +148,9 @@ release-tarball-embedded:
 	mv ostree-embeddeps-$${GITVERSION}.tar{.tmp,}; \
 	gzip -f ostree-embeddeps-$${GITVERSION}.tar 
 
-srpm-embedded:
+srpm:
 	GITVERSION=$(git_version_rpm); export GITVERSION; \
-	(sed -e "s,^Version:.*,Version: $${GITVERSION}," $(srcdir)/packages/ostree.spec.in) > ostree.spec
+	$(srcdir)/packages/substitute-gitversion.sh $(srcdir)/packages/ostree.spec.in > ostree.spec
 	$(srcdir)/packages/rpmbuild-cwd -bs ostree.spec
 
 dist-snapshot:
diff --git a/packages/ostree.spec.in b/packages/ostree.spec.in
index d03edbb..f2c4411 100644
--- a/packages/ostree.spec.in
+++ b/packages/ostree.spec.in
@@ -1,3 +1,13 @@
+# Define this if we want to build with embedded dependencies
+# for e.g. RHEL6
+%define enable_embedded_dependencies 0
+
+%if 0%{?enable_embedded_dependencies}
+%define build_name ostree-embeddeps
+%else
+%define build_name ostree
+%endif
+
 %if 0%{?rhel}
 # HACK to fix building on RHEL6; find_debuginfo is crashing, not sure
 # why
@@ -9,7 +19,7 @@ Name: ostree
 Version: 2012.8
 Release: 1%{?dist}
 #VCS: git:git://git.gnome.org/ostree
-Source0: http://ftp.gnome.org/pub/GNOME/sources/ostree/%{version}/ostree-embeddeps-%{version}.tar.gz
+Source0: http://ftp.gnome.org/pub/GNOME/sources/ostree/%{version}/%{build_name}-%{version}.tar.gz
 License: LGPLv2+
 URL: http://live.gnome.org/OSTree
 # We always run autogen.sh
@@ -20,6 +30,7 @@ BuildRequires: libattr-devel
 BuildRequires: gtk-doc
 
 # Embedded GLib dependencies
+%if 0%{?enable_embedded_dependencies}
 BuildRequires: glibc-devel
 BuildRequires: pkgconfig(libffi)
 BuildRequires: python-devel
@@ -30,18 +41,29 @@ BuildRequires: pkgconfig(libselinux)
 BuildRequires: gnome-common
 BuildRequires: intltool
 BuildRequires: pkgconfig(libxml-2.0)
+%else
+BuildRequires: pkgconfig(gio-unix-2.0)
+BuildRequires: pkgconfig(libsoup-2.4)
+%endif
 
 %description
 See http://live.gnome.org/OSTree
 
 %prep
-%setup -q -n ostree-embeddeps-%{version}
+%setup -q -n %{build_name}-%{version}
 
 %build
 env NOCONFIGURE=1 ./autogen.sh
-%configure --disable-silent-rules --enable-embedded-dependencies \
+%if 0%{?enable_embedded_dependencies}
+%define embedded_dependencies_option --enable-embedded-dependencies
+%else
+%define embedded_dependencies_option %{nil}
+%endif
+
+%configure --disable-silent-rules \
 	   --enable-documentation \
-	   --disable-libarchive
+	   --disable-libarchive \
+	   %{embedded_dependencies_option}
 make %{?_smp_mflags}
 
 %install
diff --git a/packages/substitute-gitversion.sh b/packages/substitute-gitversion.sh
new file mode 100755
index 0000000..119bfb0
--- /dev/null
+++ b/packages/substitute-gitversion.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+set -e
+
+git_version=$(git describe)
+git_version_rpm=$(echo ${git_version} | sed -e 's,-,\.,g' -e 's,^v,,')
+exec sed -e "s,^Version:.*,Version: ${git_version_rpm}," "$@"



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