From 5911067120ed985a11ef611d31bb04d34229f08e Mon Sep 17 00:00:00 2001 From: Michal Schmidt Date: Sun, 22 Jan 2012 20:46:35 +0100 Subject: [PATCH] add easy building of git snapshots add make-git-snapshot.sh to make a tarball from upstream git. if %global gitcommit is defined on the top, a snapshot is being built. don't BuildRequire auto-tools to build from release tarballs. --- make-git-snapshot.sh | 28 ++++++++++++++++++++++++++++ systemd.spec | 19 ++++++++++++++----- 2 files changed, 42 insertions(+), 5 deletions(-) create mode 100755 make-git-snapshot.sh diff --git a/make-git-snapshot.sh b/make-git-snapshot.sh new file mode 100755 index 0000000..b4726c8 --- /dev/null +++ b/make-git-snapshot.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -e + +NAME=systemd +UPSTREAM=git://anongit.freedesktop.org/systemd/systemd +REFDIR="$HOME/git/systemd" # for faster cloning, if available + + +[ -n "$1" ] && HEAD="$1" || HEAD="HEAD" + +WORKDIR="$(mktemp -d --tmpdir "$NAME.XXXXXXXXXX")" +trap 'rm -rf $WORKDIR' exit + +[ -d "$REFDIR" ] && REFERENCE="--reference $REFDIR" +git clone $REFERENCE "$UPSTREAM" "$WORKDIR" + +pushd "$WORKDIR" > /dev/null +read COMMIT_ID COMMIT_SHORTID COMMIT_TITLE < /dev/null + +echo "Making git snapshot using commit: $COMMIT_SHORTID $COMMIT_TITLE" + +DIRNAME="$NAME-git$COMMIT_SHORTID" +git archive --remote="$WORKDIR" --format=tar --prefix="$DIRNAME/" "$COMMIT_ID" | xz -9 > "$DIRNAME.tar.xz" + +echo "Written $DIRNAME.tar.xz" diff --git a/systemd.spec b/systemd.spec index 1766da2..cd47c86 100644 --- a/systemd.spec +++ b/systemd.spec @@ -1,8 +1,9 @@ +#% global gitcommit 3e52541 Name: systemd Url: http://www.freedesktop.org/wiki/Software/systemd BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Version: 38 -Release: 4%{?dist} +Release: 4%{?gitcommit:.git%{gitcommit}}%{?dist} License: GPLv2+ Group: System Environment/Base Summary: A System and Service Manager @@ -22,15 +23,17 @@ BuildRequires: glib2-devel BuildRequires: libgee06-devel BuildRequires: libnotify-devel >= 0.7 BuildRequires: libacl-devel -BuildRequires: automake -BuildRequires: autoconf -BuildRequires: libtool BuildRequires: make BuildRequires: intltool >= 0.40.0 BuildRequires: binutils BuildRequires: gperf BuildRequires: gawk BuildRequires: xz-devel +%if %{defined gitcommit} +BuildRequires: automake +BuildRequires: autoconf +BuildRequires: libtool +%endif Requires(post): authconfig Requires: systemd-units = %{version}-%{release} Requires: dbus >= 1.4.6-3.fc15 @@ -41,7 +44,12 @@ Requires: filesystem >= 2.4.40 Conflicts: selinux-policy < 3.9.16-12.fc15 Conflicts: kernel < 2.6.35.2-9.fc14 Requires: nss-myhostname +%if %{defined gitcommit} +# Snapshot tarball can be created using: ./make-git-shapshot.sh [gitcommit] +Source0: %{name}-git%{gitcommit}.tar.xz +%else Source0: http://www.freedesktop.org/software/systemd/%{name}-%{version}.tar.xz +%endif # Adds support for the %%{_unitdir} macro Source1: macros.systemd Source2: systemd-sysv-convert @@ -112,10 +120,11 @@ Requires: %{name} = %{version}-%{release} SysV compatibility tools for systemd %prep -%setup -q +%setup -q %{?gitcommit:-n %{name}-git%{gitcommit}} %patch0 -p1 -b .big-endian %build +%{?gitcommit: ./autogen.sh } %configure --with-rootprefix= --with-distro=fedora --with-rootlibdir=/%{_lib} make %{?_smp_mflags}