Commit ce200219 authored by bescoto's avatar bescoto

Now build both Fedora and ordinary rpms


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@427 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 9f6abd79
...@@ -8,6 +8,8 @@ DistDir = "dist" ...@@ -8,6 +8,8 @@ DistDir = "dist"
# Various details about the files must also be specified by the rpm # Various details about the files must also be specified by the rpm
# spec template. # spec template.
spec_template = "dist/rdiff-backup.spec.template" spec_template = "dist/rdiff-backup.spec.template"
# The Fedora distribution has its own spec template
fedora_spec_template = "dist/rdiff-backup.spec.template-fedora"
def CopyMan(destination, version): def CopyMan(destination, version):
"""Create updated man page at the specified location""" """Create updated man page at the specified location"""
...@@ -132,9 +134,10 @@ def MakeTar(): ...@@ -132,9 +134,10 @@ def MakeTar():
def MakeSpecFile(): def MakeSpecFile():
"""Create spec file using spec template""" """Create spec file using spec template"""
specfile = "rdiff-backup.spec" specfile, fedora_specfile= "rdiff-backup.spec", "rdiff-backup.spec-fedora"
VersionedCopy(spec_template, specfile) VersionedCopy(spec_template, specfile)
return specfile VersionedCopy(fedora_spec_template, fedora_specfile)
return specfile, fedora_specfile
def parse_cmdline(arglist): def parse_cmdline(arglist):
"""Returns action""" """Returns action"""
...@@ -163,8 +166,8 @@ def Main(): ...@@ -163,8 +166,8 @@ def Main():
print "Processing version " + Version print "Processing version " + Version
tarfile = MakeTar() tarfile = MakeTar()
print "Made tar file " + tarfile print "Made tar file " + tarfile
specfile = MakeSpecFile() specfiles = MakeSpecFile()
print "Made specfile ", specfile print "Made specfiles ", specfiles
if __name__ == "__main__" and not globals().has_key('__no_execute__'): if __name__ == "__main__" and not globals().has_key('__no_execute__'):
......
#!/usr/bin/env python #!/usr/bin/env python
#
# Builds two rpms, one for generic release, and the other for the
# Fedora project.
import os, sys import os, sys
...@@ -7,22 +10,29 @@ rpmroot = os.path.join(os.environ['HOME'], 'rpm') ...@@ -7,22 +10,29 @@ rpmroot = os.path.join(os.environ['HOME'], 'rpm')
if len(sys.argv) == 2: if len(sys.argv) == 2:
Version = sys.argv[1] Version = sys.argv[1]
specfile = "rdiff-backup.spec" specfile = "rdiff-backup.spec"
print "Using specfile %s" % specfile fedora_specfile = "rdiff-backup.spec-fedora"
print "Using specfiles %s, %s" % (specfile, fedora_specfile)
else: else:
print "Syntax: %s version_number" % sys.argv[0] print "Syntax: %s version_number" % sys.argv[0]
sys.exit(1) sys.exit(1)
base = "rdiff-backup-%s" % (Version,) base = "rdiff-backup-%s" % (Version,)
tarfile = base + ".tar.gz" tarfile = base + ".tar.gz"
rpmbase = base + "-0.fdr.4" # Fedora suffix, with release number 4 rpmbase = base + "-1"
i386_rpm = rpmbase + ".i386.rpm" i386_rpm = rpmbase + ".i386.rpm"
source_rpm = rpmbase + ".src.rpm" source_rpm = rpmbase + ".src.rpm"
fedora_rpmbase = base + "-0.fdr.1"
fedora_i386_rpm = fedora_rpmbase + ".i386.rpm"
fedora_source_rpm = fedora_rpmbase + ".src.rpm"
# These assume the rpm root directory $HOME/rpm. The # These assume the rpm root directory $HOME/rpm. The
# nonstandard location allows for building by non-root user. # nonstandard location allows for building by non-root user.
assert not os.system("cp %s %s/SOURCES" % (tarfile, rpmroot)) assert not os.system("cp %s %s/SOURCES" % (tarfile, rpmroot))
#assert not os.system("rpm -ba --sign -vv --target i386 " + specfile)
assert not os.system("rpmbuild -ba -v --sign " + specfile) assert not os.system("rpmbuild -ba -v --sign " + specfile)
assert not os.system("mv %s/RPMS/i386/%s ." % (rpmroot, i386_rpm)) assert not os.system("mv %s/RPMS/i386/%s ." % (rpmroot, i386_rpm))
assert not os.system("mv %s/SRPMS/%s ." % (rpmroot, source_rpm)) assert not os.system("mv %s/SRPMS/%s ." % (rpmroot, source_rpm))
assert not os.system("rpmbuild -ba -v --sign " + fedora_specfile)
assert not os.system("mv %s/RPMS/i386/%s ." % (rpmroot, fedora_i386_rpm))
assert not os.system("mv %s/SRPMS/%s ." % (rpmroot, fedora_source_rpm))
%define PYTHON_NAME %((rpm -q --quiet python2 && echo python2) || echo python) %define PYTHON_VERSION %(python -c 'import sys; sys.stdout.write(".".join(map(str,sys.version_info[:2])))')
%define NEXT_PYTHON_VERSION %(python -c 'import sys; sys.stdout.write(str(sys.version_info[0])); sys.stdout.write("."); sys.stdout.write(str(sys.version_info[1]+1))')
Version: $version Version: $version
Summary: Convenient and transparent local/remote incremental mirror/backup Summary: Convenient and transparent local/remote incremental mirror/backup
Name: rdiff-backup Name: rdiff-backup
Release: 0.fdr.3 Release: 1
Epoch: 0 Epoch: 0
URL: http://rdiff-backup.stanford.edu/ URL: http://rdiff-backup.stanford.edu/
Source: http://rdiff-backup.stanford.edu/OLD/%{version}/%{name}-%{version}.tar.gz Source: http://rdiff-backup.stanford.edu/OLD/%{version}/%{name}-%{version}.tar.gz
License: GPL License: GPL
Group: Applications/Archiving Group: Applications/Archiving
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: librsync >= 0.9.6, %{PYTHON_NAME} >= 2.2 Requires: python >= %{PYTHON_VERSION}, python < %{NEXT_PYTHON_VERSION}
BuildPrereq: %{PYTHON_NAME}-devel >= 2.2, librsync-devel >= 0.9.6 BuildPrereq: python-devel >= 2.2, librsync-devel >= 0.9.6
%description %description
rdiff-backup is a script, written in Python, that backs up one rdiff-backup is a script, written in Python, that backs up one
...@@ -29,22 +30,26 @@ differences from the previous backup will be transmitted. ...@@ -29,22 +30,26 @@ differences from the previous backup will be transmitted.
%setup -q %setup -q
%build %build
%{PYTHON_NAME} setup.py build python setup.py build
%install %install
%{PYTHON_NAME} setup.py install --prefix=$RPM_BUILD_ROOT/usr python setup.py install --root $RPM_BUILD_ROOT
%clean %clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%files %files
%defattr(-,root,root) %defattr(-,root,root)
%{_bindir}/rdiff-backup %{_bindir}/rdiff-backup
%{_mandir}/man1/rdiff-backup* %{_mandir}/man1/rdiff-backup*
%{_libdir}/ %{_libdir}/python%{PYTHON_VERSION}/site-packages/rdiff_backup
%doc CHANGELOG COPYING FAQ.html README %doc CHANGELOG COPYING FAQ.html examples.html README
%changelog %changelog
* Thu Sep 11 2003 Ben Escoto <bescoto@stanford.edu> - 0.12.4-1
- Removed code that selected between python2 and python; I think
everyone calls it python now.
* Thu Aug 8 2003 Ben Escoto <bescoto@stanford.edu> * Thu Aug 8 2003 Ben Escoto <bescoto@stanford.edu>
- Set librsync >= 0.9.6, because rsync.h renamed to librsync.h - Set librsync >= 0.9.6, because rsync.h renamed to librsync.h
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment