summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gluster/swift/__init__.py3
-rw-r--r--glusterfs-openstack-swift.spec47
-rw-r--r--makerpm.sh133
-rw-r--r--setup.py12
4 files changed, 92 insertions, 103 deletions
diff --git a/gluster/swift/__init__.py b/gluster/swift/__init__.py
index 8861ba6..9e7d4cf 100644
--- a/gluster/swift/__init__.py
+++ b/gluster/swift/__init__.py
@@ -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.0', '0', 'glusterfs-openstack-swift', False)
+_pkginfo = PkgInfo('1.10.1', '0', 'gluster_swift', False)
__version__ = _pkginfo.pretty_version
__canonical_version__ = _pkginfo.canonical_version
diff --git a/glusterfs-openstack-swift.spec b/glusterfs-openstack-swift.spec
index 96d898e..6006e6c 100644
--- a/glusterfs-openstack-swift.spec
+++ b/glusterfs-openstack-swift.spec
@@ -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.0-0
diff --git a/makerpm.sh b/makerpm.sh
index b00d5d7..591190a 100644
--- a/makerpm.sh
+++ b/makerpm.sh
@@ -2,84 +2,94 @@
# Simple script to create RPMs for G4S
+## RPM NAME
+RPMNAME=glusterfs-openstack-swift
+
cleanup()
{
- rm -rf ${RPMBUILDDIR} > /dev/null 2>&1
- rm -f ${PKGCONFIG} > /dev/null 2>&1
+ rm -rf ${RPMBUILDDIR} > /dev/null 2>&1
+ rm -f ${PKGCONFIG} > /dev/null 2>&1
}
fail()
{
- cleanup
- echo $1
- exit $2
+ cleanup
+ echo $1
+ exit $2
}
create_dir()
{
- if [ ! -d "$1" ] ; then
- mkdir -p "$1"
- if [ $? -ne 0 ] ; then
- fail "Unable to create dir $1" $?
- fi
- fi
+ if [ ! -d "$1" ] ; then
+ mkdir -p "$1"
+ if [ $? -ne 0 ] ; then
+ fail "Unable to create dir $1" $?
+ fi
+ fi
}
gittotar()
{
- # Only archives committed changes
- gitarchive_dir="${RPMBUILDDIR}/gitarchive"
- specfile="${gitarchive_dir}/${SRCTAR_DIR}/${PKG_NAME}.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_VERSION__#${PKG_VERSION}#" \
- ${specfile} > ${specfile}.new
- mv ${specfile}.new ${specfile}
-
- # Now create a tar file
- ( cd ${gitarchive_dir} && tar cf - ${SRCTAR_DIR} | gzip -c > ${SRCTAR} )
- if [ $? -ne 0 -o \! -s ${SRCTAR} ] ; then
- fail "Unable to create git archive" $?
- fi
+ # Only archives committed changes
+ gitarchive_dir="${RPMBUILDDIR}/gitarchive"
+ 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__#${RPMNAME}#" \
+ -e "s#__PKG_VERSION__#${PKG_VERSION}#" \
+ ${specfile} > ${specfile}.new
+ mv ${specfile}.new ${specfile}
+
+ # Now create a tar file
+ ( cd ${gitarchive_dir} && tar cf - ${SRCTAR_DIR} | gzip -c > ${SRCTAR} )
+ if [ $? -ne 0 -o \! -s ${SRCTAR} ] ; then
+ fail "Unable to create git archive" $?
+ fi
}
prep()
{
- rm -rf ${RPMBUILDDIR} > /dev/null 2>&1
- create_dir ${RPMBUILDDIR}
+ rm -rf ${RPMBUILDDIR} > /dev/null 2>&1
+ create_dir ${RPMBUILDDIR}
- # Create a tar file out of the current committed changes
- gittotar
+ # Create a tar file out of the current committed changes
+ gittotar
}
create_rpm()
{
- # Create the rpm
- # _topdir Notifies rpmbuild the location of the root directory
- # containing the RPM information
- # _release Allows Jenkins to setup the version using the
- # build number
- rpmbuild --define "_topdir ${RPMBUILDDIR}" \
- -ta ${SRCTAR}
- if [ $? -ne 0 ] ; then
- fail "Unable to create rpm" $?
- fi
-
- # Move the rpms to the root directory
- mv ${RPMBUILDDIR_RPMS}/noarch/*rpm ${BUILDDIR}
- mv ${RPMBUILDDIR_SRPMS}/*rpm ${BUILDDIR}
- if [ $? -ne 0 ] ; then
- fail "Unable to move rpm to ${BUILDDIR}" $?
- fi
-
- echo "RPMS are now available in ${BUILDDIR}"
+ # Create the rpm
+ # _topdir Notifies rpmbuild the location of the root directory
+ # containing the RPM information
+ # _release Allows Jenkins to setup the version using the
+ # build number
+ rpmbuild --define "_topdir ${RPMBUILDDIR}" \
+ -ta ${SRCTAR}
+ if [ $? -ne 0 ] ; then
+ fail "Unable to create rpm" $?
+ fi
+
+ # Move the rpms to the root directory
+ mv ${RPMBUILDDIR_RPMS}/noarch/*rpm ${BUILDDIR}
+ mv ${RPMBUILDDIR_SRPMS}/*rpm ${BUILDDIR}
+ if [ $? -ne 0 ] ; then
+ fail "Unable to move rpm to ${BUILDDIR}" $?
+ fi
+
+ 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 #####################
@@ -88,19 +98,19 @@ create_rpm()
PKGCONFIG=${PWD}/pkgconfig.in
env python pkgconfig.py
if [ ! -f "${PKGCONFIG}" ] ; then
- fail "Unable to create package information file ${PKGCONFIG}" 1
+ fail "Unable to create package information file ${PKGCONFIG}" 1
fi
# Get package version information
. ${PKGCONFIG}
if [ -z "${NAME}" ] ; then
- fail "Unable to read the package name from the file created by pkgconfig.py" 1
+ fail "Unable to read the package name from the file created by pkgconfig.py" 1
fi
if [ -z "${VERSION}" ] ; then
- fail "Unable to read the package version from the file created by pkgconfig.py" 1
+ fail "Unable to read the package version from the file created by pkgconfig.py" 1
fi
if [ -z "${RELEASE}" ] ; then
- fail "Unable to read the package version from the file created by pkgconfig.py" 1
+ fail "Unable to read the package version from the file created by pkgconfig.py" 1
fi
PKG_NAME=$NAME
@@ -113,19 +123,20 @@ PKG_VERSION=$VERSION
# a default value
#
if [ -z "$PKG_RELEASE" ] ; then
- PKG_RELEASE="${RELEASE}"
+ PKG_RELEASE="${RELEASE}"
else
- PKG_RELEASE="${RELEASE}.${PKG_RELEASE}"
+ PKG_RELEASE="${RELEASE}.${PKG_RELEASE}"
fi
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
diff --git a/setup.py b/setup.py
index 488f98f..f42961d 100644
--- a/setup.py
+++ b/setup.py
@@ -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=[