summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-07-31 11:49:32 -0400
committerNick Mathewson <nickm@torproject.org>2012-07-31 11:49:32 -0400
commit43b81325b5782ce7986421bdfefae57cd4c8ab81 (patch)
tree1fd3936907f6f91e0c00f5d72b16b01babbeb5db
parent5919e8e561d3abb3e74b92ac1b95f05243bb9372 (diff)
parentae75fb13e175ec24cb3bff44150fd2f932aa5385 (diff)
downloadtor-43b81325b5782ce7986421bdfefae57cd4c8ab81.tar.gz
tor-43b81325b5782ce7986421bdfefae57cd4c8ab81.zip
Merge remote-tracking branch 'origin/maint-0.2.3'
-rw-r--r--Makefile.am33
-rw-r--r--changes/bug60436
-rw-r--r--doc/tor-rpm-creation.txt56
-rw-r--r--tor.spec.in27
4 files changed, 81 insertions, 41 deletions
diff --git a/Makefile.am b/Makefile.am
index a80763d929..29bba715bd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,23 +24,22 @@ EXTRA_DIST = \
#install-data-local:
# $(INSTALL) -m 755 -d $(LOCALSTATEDIR)/lib/tor
-# Assume a tarball is in .. for now.
-dist-rpm:
- RPM_BUILD_DIR="/tmp/tor-rpm-build-$$$$"; \
- rm -rf $$RPM_BUILD_DIR; \
- mkdir $$RPM_BUILD_DIR || exit 1; \
- for subdir in BUILD RPMS SOURCES SPECS SRPMS; do \
- mkdir $$RPM_BUILD_DIR/$$subdir; \
- done; \
- mkdir $$RPM_BUILD_DIR/SOURCES/tor-$(VERSION); \
- cp -R ./ $$RPM_BUILD_DIR/SOURCES/tor-$(VERSION)/; \
- pushd $$RPM_BUILD_DIR/SOURCES/; \
- tar zcf tor-$(VERSION).tar.gz ./; \
- popd; \
- LIBS=-lrt rpmbuild -ba --define "_topdir $$RPM_BUILD_DIR" tor.spec; \
- mv $$RPM_BUILD_DIR/SRPMS/* .; \
- mv $$RPM_BUILD_DIR/RPMS/* .; \
- rm -rf $$RPM_BUILD_DIR
+# Allows to override rpmbuild with rpmbuild-md5 from fedora-packager so that
+# building for EL5 won't fail on https://bugzilla.redhat.com/show_bug.cgi?id=490613
+RPMBUILD ?= rpmbuild
+
+# Use automake's dist-gzip target to build the tarball
+dist-rpm: dist-gzip
+ TIMESTAMP=$$(date +"%Y-%m-%d_%H.%M.%S"); \
+ RPM_BUILD_DIR=$$(mktemp -d "/tmp/tor-rpm-build-$$TIMESTAMP-XXXX"); \
+ mkdir -p "$$RPM_BUILD_DIR"/{BUILD,RPMS,SOURCES/"tor-$(VERSION)",SPECS,SRPMS}; \
+ cp -fa "$(distdir).tar.gz" "$$RPM_BUILD_DIR"/SOURCES/; \
+ LIBS=-lrt $(RPMBUILD) -ba --define "_topdir $$RPM_BUILD_DIR" tor.spec; \
+ cp -fa "$$RPM_BUILD_DIR"/SRPMS/* .; \
+ cp -fa "$$RPM_BUILD_DIR"/RPMS/* .; \
+ rm -rf "$$RPM_BUILD_DIR"; \
+ echo "RPM build finished"; \
+ #end of dist-rpm
dist: check
diff --git a/changes/bug6043 b/changes/bug6043
new file mode 100644
index 0000000000..b88bafb788
--- /dev/null
+++ b/changes/bug6043
@@ -0,0 +1,6 @@
+ o Packaging (RPM):
+ - Our default RPM spec files have been updated to work with mock
+ and rpmbuild on RHEL/Fedora. They have an updated set of
+ dependencies and conflicts, a fix for an ancient typo when creating
+ the "_tor" user, and better instructions. Thanks to Ondrej
+ Mikle for the patch series; fix for bug 6043.
diff --git a/doc/tor-rpm-creation.txt b/doc/tor-rpm-creation.txt
index 3fc6bde79c..a03891e2b9 100644
--- a/doc/tor-rpm-creation.txt
+++ b/doc/tor-rpm-creation.txt
@@ -2,18 +2,9 @@
##
The process used to create the official rpms is as follows:
-Download latest stable libevent from
-http://www.monkey.org/~provos/libevent/
-
-The first step of compiling libevent is to configure it as follows:
-./configure --enable-static --disable-shared
-
-Complete the "make" and "make install". You will need to be root,
-or sudo -s, to complete the "make install".
-
-Check for a successful universal binary of libevent.a in, by default,
-/usr/local/lib by using the following command:
- "file /usr/local/lib/libevent.a"
+You'll need to install libevent headers, usually located in package named
+libevent-devel. Alternatively, you could download latest libevent from
+http://libevent.org/ but that shouldn't be necessary.
Download and Extract the latest tor source code from
https://www.torproject.org/download
@@ -23,4 +14,43 @@ LIBS=-lrt ./configure
make dist-rpm
You should have at least two, maybe three, rpms. There should be the binary
-i386.rpm, a src.rpm, and on redhat/centos machines, a debuginfo.rpm.
+(i686|x86_64).rpm, a src.rpm, and on redhat/centos machines, a debuginfo.rpm.
+The debuginfo rpms are created if package redhat-rpm-config is installed (case
+of redhat distros).
+
+This step suffices unless you want to create RPMs for distros other than the
+one you used for building.
+
+
+## Instructions for building RPMs for multiple architectures or distributions
+## using 'mock' on Fedora or RHEL (and clones)
+
+Make sure you have mock installed and configured, see following HOWTOs for setup:
+https://fedoraproject.org/wiki/How_to_create_an_RPM_package
+https://fedoraproject.org/wiki/Using_Mock_to_test_package_builds
+
+Take the source RPM generated by previous step, and execute mock for every
+target architecture (the names come from files in /etc/mock, strip the .cfg
+extension in the -r parameter):
+
+mock --rebuild -r fedora-17-x86_64 tor-X.Y.Z.src.rpm
+
+Building for EL5 from newer distro (e.g. EL6 or Fedora 17) will fail due to bug
+(https://bugzilla.redhat.com/show_bug.cgi?id=490613).
+Here's a workaround:
+
+Before even building the source RPM, install fedora-packager and instruct
+the build system to use rpmbuild-md5 like this:
+
+yum install fedora-packager
+export RPMBUILD=rpmbuild-md5
+
+Then proceed as usual to create the source RPM and binary RPMs:
+
+LIBS=-lrt ./configure
+make dist-rpm
+mock --rebuild -r epel-5-x86_64 tor-X.Y.Z.src.rpm
+
+
+(Note: don't build under OpenVZ - it breaks unshare() syscall, which in turn
+breaks mock. It could save you several hours.)
diff --git a/tor.spec.in b/tor.spec.in
index 25557b73e2..b452c9bb35 100644
--- a/tor.spec.in
+++ b/tor.spec.in
@@ -6,7 +6,7 @@
# This should be incremented whenever the spec file changes, but
# can drop back to zero at a new Tor version
-%define specver 0
+%define specver 1
## Things users may want to change
#
@@ -108,17 +108,14 @@ License: 3-clause BSD
Vendor: The Tor Project (https://torproject.org)
Packager: Erinn Clark <erinn@torproject.org>
-%if %{is_suse}
-Requires: openssl >= 0.9.7
-BuildRequires: openssl-devel >= 0.9.7, rpm >= 4.0, zlib-devel
-%else
-Requires: openssl >= 0.9.7
-BuildRequires: openssl-devel >= 0.9.7
-%endif
-%if %{is_fc}
-BuildRequires: rpm-build >= 4.0
+Requires: openssl >= 0.9.7, libevent >= 1.4.13
+BuildRequires: openssl-devel >= 0.9.7, libevent-devel >= 1.4.13, asciidoc
+
+# Fedora 16 and RHEL 5 have following conflicting packages according to rpm search
+%if %{is_rh}
Conflicts: tor-core, tor-lsb, tor-upstart
%endif
+
Requires(pre): /usr/bin/id, /bin/date, /bin/sh
Requires(pre): %{_sbindir}/useradd, %{_sbindir}/groupadd
@@ -213,7 +210,7 @@ if [ ! -n "`/usr/bin/id -u %{toruser} 2>/dev/null`" ]; then
# One would also like to default the UID, but doing that properly would
# also require thought.
if [ -x %{_sbindir}/nologin ]; then
- %{_sbindir}/useradd -r -g %{torgroup} -d% {_localstatedir}/lib/%{name} -s %{_sbindir}/nologin %{toruser} 2> /dev/null
+ %{_sbindir}/useradd -r -g %{torgroup} -d %{_localstatedir}/lib/%{name} -s %{_sbindir}/nologin %{toruser} 2> /dev/null
else
%{_sbindir}/useradd -r -g %{torgroup} -d %{_localstatedir}/lib/%{name} -s /bin/false %{toruser} 2> /dev/null
fi
@@ -287,6 +284,14 @@ exit 0
%attr(0750,%{toruser},%{torgroup}) %dir %{_localstatedir}/log/%{name}
%changelog
+* Thu Jun 21 2012 Ondrej Mikle <ondrej.mikle@gmail.com>
+- fixed to work with both rpmbuild and mock on RHEL/Fedora
+- removed unnecessary files from rpm such as .git repo
+- fixed build dependencies and package conflicts
+- fixed creating _tor user on Fedora 17 (ancient typo)
+- added/updated build instructions for RPM creation
+- confirmed to build and run on EL5, EL6, Fedora 16/17, OpenSuse 12.1
+
* Fri Aug 20 2010 Erinn Clark <erinn@torproject.org>
- add conflicts for Fedora packages
- add logic for SuSE since it requires special doc handling