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.
This commit is contained in:
Michal Schmidt 2012-01-22 20:46:35 +01:00
parent df06c188ef
commit 5911067120
2 changed files with 42 additions and 5 deletions

28
make-git-snapshot.sh Executable file
View File

@ -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 <<EOGIT
$(git log ${HEAD}^..${HEAD} --pretty='format:%H %h %s')
EOGIT
popd > /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"

View File

@ -1,8 +1,9 @@
#% global gitcommit 3e52541
Name: systemd Name: systemd
Url: http://www.freedesktop.org/wiki/Software/systemd Url: http://www.freedesktop.org/wiki/Software/systemd
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Version: 38 Version: 38
Release: 4%{?dist} Release: 4%{?gitcommit:.git%{gitcommit}}%{?dist}
License: GPLv2+ License: GPLv2+
Group: System Environment/Base Group: System Environment/Base
Summary: A System and Service Manager Summary: A System and Service Manager
@ -22,15 +23,17 @@ BuildRequires: glib2-devel
BuildRequires: libgee06-devel BuildRequires: libgee06-devel
BuildRequires: libnotify-devel >= 0.7 BuildRequires: libnotify-devel >= 0.7
BuildRequires: libacl-devel BuildRequires: libacl-devel
BuildRequires: automake
BuildRequires: autoconf
BuildRequires: libtool
BuildRequires: make BuildRequires: make
BuildRequires: intltool >= 0.40.0 BuildRequires: intltool >= 0.40.0
BuildRequires: binutils BuildRequires: binutils
BuildRequires: gperf BuildRequires: gperf
BuildRequires: gawk BuildRequires: gawk
BuildRequires: xz-devel BuildRequires: xz-devel
%if %{defined gitcommit}
BuildRequires: automake
BuildRequires: autoconf
BuildRequires: libtool
%endif
Requires(post): authconfig Requires(post): authconfig
Requires: systemd-units = %{version}-%{release} Requires: systemd-units = %{version}-%{release}
Requires: dbus >= 1.4.6-3.fc15 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: selinux-policy < 3.9.16-12.fc15
Conflicts: kernel < 2.6.35.2-9.fc14 Conflicts: kernel < 2.6.35.2-9.fc14
Requires: nss-myhostname 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 Source0: http://www.freedesktop.org/software/systemd/%{name}-%{version}.tar.xz
%endif
# Adds support for the %%{_unitdir} macro # Adds support for the %%{_unitdir} macro
Source1: macros.systemd Source1: macros.systemd
Source2: systemd-sysv-convert Source2: systemd-sysv-convert
@ -112,10 +120,11 @@ Requires: %{name} = %{version}-%{release}
SysV compatibility tools for systemd SysV compatibility tools for systemd
%prep %prep
%setup -q %setup -q %{?gitcommit:-n %{name}-git%{gitcommit}}
%patch0 -p1 -b .big-endian %patch0 -p1 -b .big-endian
%build %build
%{?gitcommit: ./autogen.sh }
%configure --with-rootprefix= --with-distro=fedora --with-rootlibdir=/%{_lib} %configure --with-rootprefix= --with-distro=fedora --with-rootlibdir=/%{_lib}
make %{?_smp_mflags} make %{?_smp_mflags}