Update RPM spec file

Update the RPM file with the comments from submittal spec
file to the Fedora Project. This update also differntiates
between the project name 'gluster-swift' and the Fedora
distribution name 'glusterfs-openstack-swift'.  This simple
changes makes it less confusing when downloading the source
on http://launchpad.net/gluster-swift .

For more information on the Fedora Project submittal status
please see: https://bugzilla.redhat.com/show_bug.cgi?id=1003089

This fix also creates a tar.gz source file so that Jenkins
can archive it.  This can be used for distributions other
than RPM based systems.

Change-Id: Ia9b85d53cf576a7754aaa018396adb70cb0f2855
Signed-off-by: Luis Pabon <lpabon@redhat.com>
Reviewed-on: http://review.gluster.org/6261
Reviewed-by: Thiago Da Silva <thiago@redhat.com>
Tested-by: Thiago Da Silva <thiago@redhat.com>
This commit is contained in:
Luis Pabon 2013-11-13 16:01:40 -05:00
parent 40553ff958
commit f54e06b612
4 changed files with 88 additions and 99 deletions

View File

@ -22,6 +22,7 @@ class PkgInfo(object):
self.release = release
self.name = name
self.final = final
self.full_version = self.canonical_version + '-' + self.release
def save_config(self, filename):
"""
@ -44,6 +45,6 @@ class PkgInfo(object):
###
### Change the Package version here
###
_pkginfo = PkgInfo('1.10.1', '0', 'glusterfs-openstack-swift', False)
_pkginfo = PkgInfo('1.10.1', '0', 'gluster_swift', False)
__version__ = _pkginfo.pretty_version
__canonical_version__ = _pkginfo.canonical_version

View File

@ -1,19 +1,3 @@
############################################################################################################
# Command to build rpms.#
# $ rpmbuild -ta %{name}-%{version}-%{release}.tar.gz #
############################################################################################################
# Setting up the environment. #
# * Create a directory %{name}-%{version} under $HOME/rpmbuild/SOURCES #
# * Copy the contents of gluster directory into $HOME/rpmbuild/SOURCES/%{name}-%{version} #
# * tar zcvf %{name}-%{version}-%{release}.tar.gz $HOME/rpmbuild/SOURCES/%{name}-%{version} %{name}.spec #
# For more information refer #
# http://fedoraproject.org/wiki/How_to_create_an_RPM_package #
############################################################################################################
%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5)
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%endif
%define _confdir %{_sysconfdir}/swift
# The following values are provided by passing the following arguments
@ -29,10 +13,10 @@ Name : %{_name}
Version : %{_version}
Release : %{_release}%{?dist}
Group : Application/File
Vendor : Red Hat, Inc.
URL : http://launchpad.net/gluster-swift
Vendor : Fedora Project
Source0 : %{_name}-%{_version}-%{_release}.tar.gz
Packager : gluster-users@gluster.org
License : Apache
License : ASL 2.0
BuildArch: noarch
BuildRequires: python
BuildRequires: python-setuptools
@ -44,6 +28,7 @@ Requires : openstack-swift-account = 1.10.0
Requires : openstack-swift-container = 1.10.0
Requires : openstack-swift-object = 1.10.0
Requires : openstack-swift-proxy = 1.10.0
Requires : glusterfs-api >= 3.4.1
Obsoletes: glusterfs-swift-plugin
Obsoletes: glusterfs-swift
Obsoletes: glusterfs-ufo
@ -60,7 +45,7 @@ objects in files, containers are maintained as top-level directories of volumes,
where accounts are mapped one-to-one to gluster volumes.
%prep
%setup -q
%setup -q -n gluster_swift-%{_version}
%build
%{__python} setup.py build
@ -73,20 +58,16 @@ rm -rf %{buildroot}
mkdir -p %{buildroot}/%{_confdir}/
cp -r etc/* %{buildroot}/%{_confdir}/
mkdir -p %{buildroot}/%{_bindir}/
cp bin/gluster-swift-gen-builders %{buildroot}/%{_bindir}/
cp bin/gluster-swift-print-metadata %{buildroot}/%{_bindir}/
# Remove tests
%{__rm} -rf %{buildroot}/%{python_sitelib}/test
%clean
rm -rf %{buildroot}
# Remove files provided by glusterfs-api
%{__rm} -rf %{buildroot}/%{python_sitelib}/gluster/__init__.p*
%files
%defattr(-,root,root)
%{python_sitelib}/gluster
%{python_sitelib}/gluster_swift-%{version}-*.egg-info
%{python_sitelib}/gluster_swift-%{_version}_*.egg-info
%{_bindir}/gluster-swift-gen-builders
%{_bindir}/gluster-swift-print-metadata
%{_bindir}/swauth-add-account
@ -99,12 +80,12 @@ rm -rf %{buildroot}
%{_bindir}/swauth-set-account-service
%dir %{_confdir}
%config %{_confdir}/account-server.conf-gluster
%config %{_confdir}/container-server.conf-gluster
%config %{_confdir}/object-server.conf-gluster
%config %{_confdir}/swift.conf-gluster
%config %{_confdir}/proxy-server.conf-gluster
%config %{_confdir}/fs.conf-gluster
%config(noreplace) %{_confdir}/account-server.conf-gluster
%config(noreplace) %{_confdir}/container-server.conf-gluster
%config(noreplace) %{_confdir}/object-server.conf-gluster
%config(noreplace) %{_confdir}/swift.conf-gluster
%config(noreplace) %{_confdir}/proxy-server.conf-gluster
%config(noreplace) %{_confdir}/fs.conf-gluster
%changelog
* Mon Oct 28 2013 Luis Pabon <lpabon@redhat.com> - 1.10.1-0

View File

@ -2,6 +2,9 @@
# Simple script to create RPMs for G4S
## RPM NAME
RPMNAME=glusterfs-openstack-swift
cleanup()
{
rm -rf ${RPMBUILDDIR} > /dev/null 2>&1
@ -29,15 +32,14 @@ gittotar()
{
# Only archives committed changes
gitarchive_dir="${RPMBUILDDIR}/gitarchive"
specfile="${gitarchive_dir}/${SRCTAR_DIR}/${PKG_NAME}.spec"
specfile="${gitarchive_dir}/${SRCTAR_DIR}/${RPMNAME}.spec"
create_dir "${gitarchive_dir}"
# Export the current commited git changes to a directory
git archive --format=tar --prefix=${SRCTAR_DIR}/ HEAD | (cd ${gitarchive_dir} && tar xf -)
# Create a new spec file with the current package version information
sed -e "s#__PKG_RELEASE__#${PKG_RELEASE}#" \
-e "s#__PKG_NAME__#${PKG_NAME}#" \
-e "s#__PKG_NAME__#${RPMNAME}#" \
-e "s#__PKG_VERSION__#${PKG_VERSION}#" \
${specfile} > ${specfile}.new
mv ${specfile}.new ${specfile}
@ -82,6 +84,14 @@ create_rpm()
echo "RPMS are now available in ${BUILDDIR}"
}
create_src()
{
python setup.py sdist --format=gztar --dist-dir=${BUILDDIR}
if [ $? -ne 0 ] ; then
fail "Unable to create source archive"
fi
}
################## MAIN #####################
# Create a config file with the package information
@ -122,10 +132,11 @@ BUILDDIR=$PWD/build
RPMBUILDDIR=${BUILDDIR}/rpmbuild
RPMBUILDDIR_RPMS=${RPMBUILDDIR}/RPMS
RPMBUILDDIR_SRPMS=${RPMBUILDDIR}/SRPMS
SRCNAME=${PKG_NAME}-${PKG_VERSION}-${PKG_RELEASE}
SRCNAME=${RPMNAME}-${PKG_VERSION}-${PKG_RELEASE}
SRCTAR_DIR=${PKG_NAME}-${PKG_VERSION}
SRCTAR=${RPMBUILDDIR}/${SRCNAME}.tar.gz
prep
create_src
create_rpm
cleanup

View File

@ -15,21 +15,17 @@
# limitations under the License.
from setuptools import setup, find_packages
from gluster.swift import __canonical_version__ as version
name = 'gluster_swift'
from gluster.swift import _pkginfo
setup(
name=name,
version=version,
name=_pkginfo.name,
version=_pkginfo.full_version,
description='Gluster For Swift',
license='Apache License (2.0)',
author='Red Hat, Inc.',
author_email='gluster-users@gluster.org',
url='https://forge.gluster.org/gluster-swift',
url='http://launchpad.net/gluster-swift',
packages=find_packages(exclude=['test', 'bin']),
test_suite='nose.collector',
classifiers=[