Commits

Anonymous committed ccbe4e0

More packaging fixes

Comments (0)

Files changed (7)

build-tools/README

 This is a simple RPM build infrastructure for Transifex. It currently builds 
 two packages: 
-- transifex: this includes the core transifex software and brings in django 
+- transifex: this includes the core transifex software and brings in Django 
 and mercurial as a dependency
 - transifex-extras: this is essentially a meta-package that brings git, cvs, 
-svn and pysvn as a dependency. In the future it may also bring in p4python and
-polib
+pysvn, and bzrtools as a dependency. In the future it may also bring in
+p4python
 
 Usage: 
 	$ ./build.sh <version>
 	rpmbuild must be present in your system
 
 Output: 
-	1 RPMs and 1 SRPMs for each package built (4 total)
-
-Future work: 
-- create a package for transifex-docs
-- create a package for transifex-modules (django_auth_openid etc.) that will 
-contain python modules required for transifex to run
-
+	2 RPMs and 1 SRPM

build-tools/SPECS/transifex.spec.in

+Name:       transifex
+Version:    [[version]]
+Release:    1%{?dist}
+Summary:    A system for distributed translation submissions
+
+Group:      Applications/Internet
+License:    GPLv2
+URL:        http://transifex.org/
+Source0:    transifex-[[version]].tar.gz
+BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildArch:  noarch
+
+BuildRequires:  python-sphinx
+Requires:   Django django-authopenid django-contact-form django-evolution
+Requires:   django-notification django-pagination django-tagging
+Requires:   python-markdown python-polib python-pygments
+Requires:   mercurial
+Requires:   intltool >= 0.40.5
+
+%description
+Transifex is a web-system that facilitates the process of submitting
+translations in remote and disparate version control systems (VCS).
+
+%package extras
+Summary:    Additional support for Transifex
+Requires:   transifex = %{version}
+Requires:   cvs pysvn bzrtools git
+
+%description extras
+This package adds extra options to Transifex.
+
+%prep
+%setup -q
+
+%build
+cd docs
+make html
+
+%install
+rm -rf $RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT/%{_datadir}/%{name}
+find -mindepth 1 -maxdepth 1 -type d \( \( -name .hg -o \
+    -name build-tools -o -name docs \) -prune -o -print \) | \
+    xargs cp -a -t $RPM_BUILD_ROOT/%{_datadir}/%{name}
+cp -a *.py $RPM_BUILD_ROOT/%{_datadir}/%{name}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root,-)
+%doc LICENSE README docs/_build/html
+%dir %{_datadir}/%{name}
+%{_datadir}/%{name}/__init__.py
+%{_datadir}/%{name}/__init__.py[co]
+%{_datadir}/%{name}/manage.py
+%{_datadir}/%{name}/manage.py[co]
+%{_datadir}/%{name}/settings*.py
+%{_datadir}/%{name}/settings*.py[co]
+%{_datadir}/%{name}/urls.py
+%{_datadir}/%{name}/urls.py[co]
+%{_datadir}/%{name}/actionlog
+%{_datadir}/%{name}/languages
+%{_datadir}/%{name}/projects
+%{_datadir}/%{name}/releases
+%{_datadir}/%{name}/repowatch
+%{_datadir}/%{name}/simplelock
+%{_datadir}/%{name}/site_media
+%{_datadir}/%{name}/templates
+%{_datadir}/%{name}/transifex
+%{_datadir}/%{name}/translations
+%{_datadir}/%{name}/txcollections
+%dir %{_datadir}/%{name}/vcs
+%{_datadir}/%{name}/vcs/*.py
+%{_datadir}/%{name}/vcs/*.py[co]
+%dir %{_datadir}/%{name}/vcs/lib
+%{_datadir}/%{name}/vcs/lib/*.py
+%{_datadir}/%{name}/vcs/lib/*.py[co]
+%dir %{_datadir}/%{name}/vcs/lib/support
+%{_datadir}/%{name}/vcs/lib/support/__init__.py
+%{_datadir}/%{name}/vcs/lib/support/__init__.py[co]
+%{_datadir}/%{name}/vcs/lib/support/commands.py
+%{_datadir}/%{name}/vcs/lib/support/commands.py[co]
+%dir %{_datadir}/%{name}/vcs/lib/types
+%{_datadir}/%{name}/vcs/lib/types/__init__.py
+%{_datadir}/%{name}/vcs/lib/types/__init__.py[co]
+%{_datadir}/%{name}/vcs/lib/types/dummy.py
+%{_datadir}/%{name}/vcs/lib/types/dummy.py[co]
+%{_datadir}/%{name}/vcs/lib/types/hg.py
+%{_datadir}/%{name}/vcs/lib/types/hg.py[co]
+%{_datadir}/%{name}/vcs/management/
+%{_datadir}/%{name}/vcs/tests/
+
+%files extras
+%defattr(-,root,root,-)
+%{_datadir}/%{name}/vcs/lib/support/cvs.py
+%{_datadir}/%{name}/vcs/lib/support/cvs.py[co]
+%{_datadir}/%{name}/vcs/lib/types/cvs.py
+%{_datadir}/%{name}/vcs/lib/types/cvs.py[co]
+%{_datadir}/%{name}/vcs/lib/types/svn.py
+%{_datadir}/%{name}/vcs/lib/types/svn.py[co]
+%{_datadir}/%{name}/vcs/lib/types/bzr.py
+%{_datadir}/%{name}/vcs/lib/types/bzr.py[co]
+%{_datadir}/%{name}/vcs/lib/support/git.py
+%{_datadir}/%{name}/vcs/lib/support/git.py[co]
+%{_datadir}/%{name}/vcs/lib/types/git.py
+%{_datadir}/%{name}/vcs/lib/types/git.py[co]
+
+%changelog

build-tools/build.sh

 #!/bin/bash
 
-which rpmbuild >& /dev/null
-if [ ! "$?" = "0" ]; then
+repo="http://code.transifex.org/index.cgi/mainline/"
+
+if ! which rpmbuild &> /dev/null ; then
 	echo "rpmbuild is not installed in your system; exiting"
 	exit 1
 fi
 	exit 1
 fi
 
-export REPO='http://code.transifex.org/index.cgi/mainline'
-export RPMBUILDROOT=`rpmbuild --showrc | grep _topdir | grep -v '{_topdir}' | awk '{print $3}'`
+rootdir="$(mktemp -d -p $PWD -t txbuild-XXXXXXXX)"
 
-if [ "$RPMBUILDROOT" = "" ]; then
-	echo "The RPM _topdir build directory does not seem to be specified; please make sure it's set"
-	echo "For instance you can add '%_topdir      /var/tmp/rpmbuild' in ~/.rpmmacros"
-	exit 1
-fi
+for dir in BUILD BUILDROOT RPMS SOURCES SPECS SRPMS; do
+	if [ ! -d "$rootdir/$dir" ]; then
+		mkdir -p "$rootdir/$dir"
+	fi
+done
 
-echo "Cleaning up"
+echo "applying version $1 to spec file"
+sed -e "s/\[\[version\]\]/$1/g" SPECS/transifex.spec.in > "$rootdir"/SPECS/transifex.spec
+echo "checking out latest code; please wait"
+hg clone $repo "$rootdir"/SOURCES/transifex-$1
 
-pushd transifex-core
-./build.sh $1
+pushd "$rootdir"/SOURCES
+echo "bundling ..."
+tar cfz transifex-$1.tar.gz transifex-$1
+rm -rf transifex-$1
 popd
-for file in `find $RPMBUILDROOT -name 'transifex*rpm'`; do cp $file . ; done
 
-pushd transifex-extras
-./build.sh $1
-popd
-for file in `find $RPMBUILDROOT -name 'transifex*rpm'`; do cp $file . ; done
+rpmbuild --define "_builddir $rootdir/BUILD" \
+	--define "_buildrootdir $rootdir/BUILDROOT" \
+	--define "_rpmdir $rootdir/RPMS" \
+	--define "_sourcedir $rootdir/SOURCES" \
+	--define "_srcrpmdir $rootdir/SRPMS" \
+	--define "_build_name_fmt %%{name}-%%{version}-%%{release}.%%{arch}.rpm" \
+	-bb --nodeps "$rootdir"/SPECS/transifex.spec
+
+rpmbuild --define "_builddir $rootdir/BUILD" \
+	--define "_buildrootdir $rootdir/BUILDROOT" \
+	--define "_rpmdir $rootdir/RPMS" \
+	--define "_sourcedir $rootdir/SOURCES" \
+	--define "_srcrpmdir $rootdir/SRPMS" \
+	--define "_build_name_fmt %%{name}-%%{version}-%%{release}.%%{arch}.rpm" \
+	--define "dist %{nil}" \
+	-bs --nodeps "$rootdir"/SPECS/transifex.spec
+
+find "$rootdir" -name '*.rpm' -exec cp {} . \;
+rm -rf "$rootdir"

build-tools/transifex-core/SPECS/transifex.spec.in

-%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
-%{!?pyver: %define pyver %(%{__python} -c "import sys ; print sys.version[:3]")}
-
-Name:		transifex
-Version:	[[version]]
-Release:	1%{?dist}
-Summary:	A system for distributed translation submissions
-
-Group:		Applications/Internet
-License:	GPLv2
-URL:		http://transifex.org/
-Source0:	transifex-[[version]].tar.gz
-BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildArch:	noarch
-
-# BuildRequires:	
-Requires:	Django python-pygments mercurial
-
-%description
-Transifex is a web-system that facilitates the process of submitting
-translations in remote and disparate version control systems (VCS).
-
-%prep
-%setup -q
-
-%build
-
-%install
-rm -rf $RPM_BUILD_ROOT
-# make install DESTDIR=$RPM_BUILD_ROOT
-#make DESTDIR=$RPM_BUILD_ROOT install
-# std place fedora-infrastructure deployes tg code
-mkdir -p $RPM_BUILD_ROOT/srv/transifex
-mkdir -p $RPM_BUILD_ROOT/var/lib/transifex/scratchdir
-find * | cpio -p -dum $RPM_BUILD_ROOT/srv/transifex
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-
-%files
-%defattr(-,root,root,-)
-/var/lib/transifex
-%attr(-,apache,apache) /var/lib/transifex/scratchdir
-/srv/%{name}
-
-%changelog
-

build-tools/transifex-core/build.sh

-#!/bin/bash
-
-if ! which rpmbuild &> /dev/null ; then
-	echo "rpmbuild is not installed in your system; exiting"
-	exit 1
-fi
-
-if [ ! "$#" = "1" ]; then
-	echo "This script requires a single argument specifying the package version to build"
-	echo "i.e. ./build.sh 1.2.3 for building version 1.2.3"
-	exit 1
-fi
-
-if [ "$RPMBUILDROOT" = "" ]; then
-        echo "RPMBUILDROOT seems uninitialized; are you sure you are not running this script directly?"
-	exit 1
-fi
-
-echo "Cleaning up"
-
-for dir in BUILD BUILDROOT RPMS SOURCES SRPMS; do
-	if [ ! -d $dir ]; then
-		mkdir $dir
-	else
-		rm -rf $dir/*
-	fi
-done
-
-echo "applying version $1 to spec file"
-cat SPECS/transifex.spec.in | sed -e "s/\[\[version\]\]/$1/g" > SPECS/transifex.spec
-echo "checking out latest code; please wait"
-hg clone $REPO SOURCES/transifex-$1
-rm -rf SOURCES/transifex-$1/build-tools
-pushd SOURCES
-
-echo "bundling ..."
-tar cfz transifex-$1.tar.gz transifex-$1
-rm -rf transifex-$1
-pwd
-popd
-
-echo "setting up staging directory"
-if [ ! -d $RPMBUILDROOT ]; then
-	echo "creating staging directory"
-	mkdir $RPMBUILDROOT
-else
-	rm -rf $RPMBUILDROOT
-	mkdir $RPMBUILDROOT
-fi
-
-find . | cpio -p -dum -v $RPMBUILDROOT
-
-pushd $RPMBUILDROOT
-
-rpmbuild -ba --clean --nodeps SPECS/transifex.spec
-popd
-

build-tools/transifex-extras/SPECS/transifex-extras.spec.in

-%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
-%{!?pyver: %define pyver %(%{__python} -c "import sys ; print sys.version[:3]")}
-
-Name:		transifex-extras
-Version:	[[version]]
-Release:	1%{?dist}
-Summary:	Extra packets to unleash full Transifex functionality
-
-Group:		Applications/Internet
-License:	GPLv2
-URL:		http://transifex.org/
-Source0:	transifex-extras-[[version]].tar.gz
-BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildArch:	noarch
-
-# BuildRequires:	
-Requires:	transifex git cvs svn pysvn gettext intltool
-# Requires:	we may want to add p4python and polib in the future
-
-%description
-Transifex is a web-system that facilitates the process of submitting
-translations in remote and disparate version control systems (VCS). 
-This metapackage pulls in packages not needed for transifex-core but
-enabling additional functionality
-
-%prep
-%setup -q
-
-%build
-
-%install
-rm -rf $RPM_BUILD_ROOT
-# make install DESTDIR=$RPM_BUILD_ROOT
-#make DESTDIR=$RPM_BUILD_ROOT install
-# std place fedora-infrastructure deployes tg code
-mkdir -p $RPM_BUILD_ROOT/%{python_sitelib}
-find * | cpio -p -dum $RPM_BUILD_ROOT/%{python_sitelib}/%{name}
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-
-%files
-%defattr(-,root,root,-)
-/%{python_sitelib}/%{name}/*
-
-
-%changelog
-

build-tools/transifex-extras/build.sh

-#!/bin/bash
-
-if ! which rpmbuild &> /dev/null ; then
-	echo "rpmbuild is not installed in your system; exiting"
-	exit 1
-fi
-
-if [ ! "$#" = "1" ]; then
-	echo "This script requires a single argument specifying the package version to build"
-	echo "i.e. ./build.sh 1.2.3 for building version 1.2.3"
-	exit 1
-fi
-
-if [ "$RPMBUILDROOT" = "" ]; then
-	echo "RPMBUILDROOT seems uninitialized; are you sure you are not running this script directly?"
-	exit 1
-fi
-
-
-echo "Cleaning up"
-
-for dir in BUILD BUILDROOT RPMS SOURCES SRPMS; do
-	if [ ! -d $dir ]; then
-		mkdir $dir
-	else
-		rm -rf $dir/*
-	fi
-done
-
-
-echo "applying version $1 to spec file"
-cat SPECS/transifex-extras.spec.in | sed -e "s/\[\[version\]\]/$1/g" > SPECS/transifex-extras.spec
-echo "checking out latest code; please wait"
-mkdir -p SOURCES/transifex-extras-$1 >& /dev/null
-touch SOURCES/transifex-extras-$1/transifex-extras-installed
-pushd SOURCES
-
-echo "bundling ..."
-tar cfz transifex-extras-$1.tar.gz transifex-extras-$1
-rm -rf transifex-extras-$1
-pwd
-popd
-
-echo "setting up staging directory"
-if [ ! -d $RPMBUILDROOT ]; then
-	echo "creating staging directory"
-	mkdir $RPMBUILDROOT
-else
-	rm -rf $RPMBUILDROOT
-	mkdir $RPMBUILDROOT
-fi
-
-find . | cpio -p -dum -v $RPMBUILDROOT
-
-pushd $RPMBUILDROOT
-rpmbuild -ba --clean --nodeps SPECS/transifex-extras.spec
-popd
-