From 9cae97215665ca7e6e69cab99286cdec3b2f2054 Mon Sep 17 00:00:00 2001 From: astokes Date: Fri, 19 Dec 2008 13:43:41 +0000 Subject: attempting to fix build process to be more sane git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@545 ef72aa8b-4018-0410-8976-d6e080ef94d8 --- src/MANIFEST.in | 9 +++++ src/Makefile | 106 +++++++++++++++++--------------------------------------- src/setup.py | 11 +++++- src/sos.spec | 17 +++++---- 4 files changed, 59 insertions(+), 84 deletions(-) create mode 100644 src/MANIFEST.in diff --git a/src/MANIFEST.in b/src/MANIFEST.in new file mode 100644 index 00000000..6755b997 --- /dev/null +++ b/src/MANIFEST.in @@ -0,0 +1,9 @@ +recursive-include locale *.mo +recursive-include extras * +include sosreport* +include README +include LICENSE +include READ.rh-upload-core +include TODO +include rhsupport.pub +include sos.conf \ No newline at end of file diff --git a/src/Makefile b/src/Makefile index 031ffa9f..fae3f476 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2,74 +2,48 @@ # Makefile for sos system support tools # -NAME = sos +NAME = sos VERSION = $(shell awk '/^%define version / { print $$3 }' sos.spec) RELEASE = $(shell awk '/^%define release / { print $$3 }' sos.spec) REPO = http://svn.fedorahosted.org/svn/sos -SVNTAG = r$(subst .,-,$(VERSION))_$(RELEASE) +SVNTAG = r$(subst .,-,$(VERSION))_$(RELEASE) SRCDIR = $(PWD) -TOPDIR = $(PWD)/build/rpm-$(NAME)-$(VERSION) +# Needs to be changed to reflect +# your rpm development tree. +TOPDIR = $(HOME)/redhat/$(NAME) +TMPDIR = /tmp/$(NAME)-$(VERSION) +MANPAGE = $(PWD)/sosreport.1 +SOURCE1 = $(PWD)/sos.conf +SOURCE2 = $(PWD)/sosreport.1.gz +SOURCE3 = $(PWD)/gpgkeys/rhsupport.pub all: -.PHONY: tag-release tarball release install version clean +.PHONY: tarball install clean rpm -diff-tag: - svn diff $(REPO)/trunk/src $(REPO)/tags/$(SVNTAG) - -tag: - @if ( svn list $(REPO)/tags/$(SVNTAG)/Makefile &> /dev/null ); then \ - echo "The repository already contains a tag for version $(VERSION)"; \ - exit 1; \ - fi - @svn copy $(REPO)/trunk/src $(REPO)/tags/$(SVNTAG) \ - -m "Tagging the $(SVNTAG) release of the sos project" - @echo "Tagged as $(SVNTAG)" - -tag-force: - @echo svn del $(REPO)/tags/$(SVNTAG) - @echo make diff-tag - -tarball: clean - @echo "Creating an archive from HEAD of development" - @rm -rf /tmp/$(NAME) - @svn export -q $(REPO)/trunk/src /tmp/$(NAME) \ - || echo GRRRrrrrr -- ignore [export aborted] - @mv /tmp/$(NAME) /tmp/$(NAME)-$(VERSION) - @cd /tmp; tar --bzip2 -cSpf $(NAME)-$(VERSION).tar.bz2 $(NAME)-$(VERSION) - @rm -rf /tmp/$(NAME)-$(VERSION) - @mv /tmp/$(NAME)-$(VERSION).tar.bz2 . - @echo " " - @echo "The final archive is ./$(NAME)-$(VERSION).tar.bz2." - -release: clean - @if ( ! svn list $(REPO)/tags/$(SVNTAG)/Makefile &> /dev/null ); then \ - echo "There is no tag in the repository for this version, must be tagged before release"; \ - exit 1; \ - fi - @echo "Creating an archive from tag $(SVNTAG)" - @rm -rf /tmp/$(NAME) - @svn export -q $(REPO)/tags/$(SVNTAG) /tmp/$(NAME) \ - || echo GRRRrrrrr -- ignore [export aborted] - @mv /tmp/$(NAME) /tmp/$(NAME)-$(VERSION) - @cd /tmp; tar --bzip2 -cSpf $(NAME)-$(VERSION).tar.bz2 $(NAME)-$(VERSION) - @rm -rf /tmp/$(NAME)-$(VERSION) - @cp /tmp/$(NAME)-$(VERSION).tar.bz2 . - @rm -f /tmp/$(NAME)-$(VERSION).tar.bz2 +tarball: clean mo gpgkey + @echo "Build Archive" + @test -f $(SOURCE2) || gzip -c $(MANPAGE) > $(SOURCE2) + @mkdir $(TMPDIR) + @python setup.py sdist -d $(TMPDIR) + @cp {$(SOURCE1),$(SOURCE2),$(SOURCE3)} $(TMPDIR) + @mkdir $(PWD)/dist + @mv $(TMPDIR)/* $(PWD)/dist @echo " " - @echo "The final archive is ./$(NAME)-$(VERSION).tar.bz2." + @echo "The final archive is $(PWD)/dist/" install:mo gpgkey python setup.py install @rm -rf build/lib -version: - @echo "The version is $(NAME)-$(VERSION)" - clean: - @rm -fv *~ .*~ changenew ChangeLog.old $(NAME)-$(VERSION).tar.bz2 sosreport.1.gz gpgkeys/rhsupport.* - @rm -rfv build/* + @rm -fv *~ .*~ changenew ChangeLog.old $(NAME)-$(VERSION).tar.gz + @rm -rfv {dist,build} + @rm -rf MANIFEST + @rm -rfv $(TMPDIR) + @rm -rf {$(SOURCE2),$(SOURCE3)} +# TODO: This needs work internal-rpm: gpgkey @test -f sos-internal.spec @mkdir -p $(TOPDIR)/SOURCES $(TOPDIR)/SRPMS $(TOPDIR)/RPMS $(TOPDIR)/BUILD $(SRCDIR)/dist @@ -88,36 +62,20 @@ internal-rpm: gpgkey @mv $(TOPDIR)/RPMS/noarch/$(NAME)-internal-*.rpm $(TOPDIR)/SRPMS/$(NAME)-internal-*.rpm dist/ cp gpgkeys/rhsupport.key dist/ -rpm: mo gpgkey - @mkdir -p $(TOPDIR)/SOURCES $(TOPDIR)/SRPMS $(TOPDIR)/RPMS $(TOPDIR)/BUILD $(SRCDIR)/dist - - cp gpgkeys/rhsupport.pub $(TOPDIR)/SOURCES - +rpm: tarball + @test -d $(TOPDIR) || mkdir -p $(TOPDIR) + @mv dist/* $(TOPDIR) @test -f sos.spec - -# this builds an RPM from the current working copy - @cd $(TOPDIR)/BUILD ; \ - rm -rf $(NAME)-$(VERSION) ; \ - ln -s $(SRCDIR) $(NAME)-$(VERSION) ; \ - tar --gzip --exclude=.svn --exclude=svn-commit.tmp --exclude=$(NAME)-$(VERSION)/build --exclude=$(NAME)-$(VERSION)/dist \ - --exclude gpgkeys/rhsupport.pub --exclude gpgkeys/rhsupport.key \ - -chSpf $(TOPDIR)/SOURCES/$(NAME)-$(VERSION).tar.gz $(NAME)-$(VERSION) ; \ - rm -f $(NAME)-$(VERSION) - -# this builds an RPM from HEAD -# @rm -rf $(TOPDIR)/BUILD/$(NAME)-$(VERSION) -# @svn export -q $(REPO)/trunk/src $(TOPDIR)/BUILD/$(NAME)-$(VERSION) -# @cd $(TOPDIR)/BUILD ; tar --gzip -cSpf $(TOPDIR)/SOURCES/$(NAME)-$(VERSION).tar.gz $(NAME)-$(VERSION); rm -rf $(NAME)-$(VERSION) - - rpmbuild -ba --define="_topdir $(TOPDIR)" sos.spec - @mv $(TOPDIR)/RPMS/noarch/$(NAME)-$(VERSION)*.rpm $(TOPDIR)/SRPMS/$(NAME)-$(VERSION)*.rpm $(TOPDIR)/SOURCES/$(NAME)-$(VERSION).tar.gz dist/ + rpmbuild -ba sos.spec pot: python tools/pygettext.py -o locale/sos.pot sosreport lib/sos/policyredhat.py mo: + @echo "Generating mo files" find locale/*/LC_MESSAGES -name sos.po -exec python tools/msgfmt.py {} \; gpgkey: + @echo "Building gpg key" @test -f gpgkeys/rhsupport.pub && echo "GPG key already exists." || \ gpg --batch --gen-key gpgkeys/gpg.template diff --git a/src/setup.py b/src/setup.py index d34ae6c8..55125d8d 100644 --- a/src/setup.py +++ b/src/setup.py @@ -6,10 +6,19 @@ from distutils.core import setup setup( name = 'sos', + version = '1.8', + author = 'Adam Stokes', + author_email = 'ajs@redhat.com', + url = 'http://fedorahosted.org/sos', + description = 'SOS - son of sysreport', packages = ['sos', 'sos.plugins'], scripts = [], package_dir = {'': 'lib',}, - data_files = [ ('/etc', [ 'sos.conf']), ('/usr/sbin', ['sosreport', 'extras/sysreport/sysreport.legacy']), ('/usr/bin', ['extras/rh-upload-core']), ('/usr/share/sysreport', ['extras/sysreport/text.xsl', 'extras/sysreport/functions', 'extras/sysreport/sysreport-fdisk']), ('/usr/share/man/man1', ['sosreport.1']), + data_files = [ ('/etc', [ 'sos.conf']), + ('/usr/sbin', ['sosreport', 'extras/sysreport/sysreport.legacy']), + ('/usr/bin', ['extras/rh-upload-core']), + ('/usr/share/sysreport', ['extras/sysreport/text.xsl', 'extras/sysreport/functions', 'extras/sysreport/sysreport-fdisk']), + ('/usr/share/man/man1', ['sosreport.1.gz']), ('/usr/share/locale/af/LC_MESSAGES', ['locale/af/LC_MESSAGES/sos.mo']), ('/usr/share/locale/am/LC_MESSAGES', ['locale/am/LC_MESSAGES/sos.mo']), ('/usr/share/locale/ar/LC_MESSAGES', ['locale/ar/LC_MESSAGES/sos.mo']), diff --git a/src/sos.spec b/src/sos.spec index f686e698..891426ce 100644 --- a/src/sos.spec +++ b/src/sos.spec @@ -2,7 +2,7 @@ %define name sos %define version 1.8 -%define release 3 +%define release 4 %define _localedir %_datadir/locale @@ -11,12 +11,11 @@ Name: %{name} Version: %{version} Release: %{release}%{?dist} Group: Application/Tools -Source0: %{name}-%{version}.tar.bz2 -Source1: rhsupport.pub +Source0: %{name}-%{version}.tar.gz License: GPL BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot BuildArch: noarch -Url: https://hosted.fedoraproject.org/projects/sos +Url: http://fedorahosted.org/sos BuildRequires: python-devel Requires: libxml2-python Provides: sysreport = 1.4.3-13 @@ -32,12 +31,12 @@ support technicians and developers. %setup -q %build -python setup.py build +%{__python} setup.py build %install rm -rf ${RPM_BUILD_ROOT} -install -D -m644 %{SOURCE1} ${RPM_BUILD_ROOT}/usr/share/sos/rhsupport.pub -python setup.py install --optimize 1 --root=$RPM_BUILD_ROOT +#install -D -m644 rhsupport.pub ${RPM_BUILD_ROOT}/usr/share/sos/rhsupport.pub +%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT ln -s /usr/sbin/sosreport $RPM_BUILD_ROOT/usr/sbin/sysreport %clean @@ -52,10 +51,10 @@ rm -rf ${RPM_BUILD_ROOT} /usr/sbin/sysreport.legacy /usr/share/sysreport %{python_sitelib}/sos/ -%{_mandir}/man1/sosreport.1* +%{_mandir}/man1/sosreport.1.gz %{_localedir}/*/LC_MESSAGES/sos.mo %doc README README.rh-upload-core TODO LICENSE ChangeLog -%config /etc/sos.conf +%config %{_sysconfdir}/sos.conf %changelog * Thu Oct 23 2008 Adam Stokes - 1.8-1 -- cgit