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:
parent
40553ff958
commit
f54e06b612
@ -22,6 +22,7 @@ class PkgInfo(object):
|
|||||||
self.release = release
|
self.release = release
|
||||||
self.name = name
|
self.name = name
|
||||||
self.final = final
|
self.final = final
|
||||||
|
self.full_version = self.canonical_version + '-' + self.release
|
||||||
|
|
||||||
def save_config(self, filename):
|
def save_config(self, filename):
|
||||||
"""
|
"""
|
||||||
@ -44,6 +45,6 @@ class PkgInfo(object):
|
|||||||
###
|
###
|
||||||
### Change the Package version here
|
### 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
|
__version__ = _pkginfo.pretty_version
|
||||||
__canonical_version__ = _pkginfo.canonical_version
|
__canonical_version__ = _pkginfo.canonical_version
|
||||||
|
@ -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
|
%define _confdir %{_sysconfdir}/swift
|
||||||
|
|
||||||
# The following values are provided by passing the following arguments
|
# The following values are provided by passing the following arguments
|
||||||
@ -29,10 +13,10 @@ Name : %{_name}
|
|||||||
Version : %{_version}
|
Version : %{_version}
|
||||||
Release : %{_release}%{?dist}
|
Release : %{_release}%{?dist}
|
||||||
Group : Application/File
|
Group : Application/File
|
||||||
Vendor : Red Hat, Inc.
|
URL : http://launchpad.net/gluster-swift
|
||||||
|
Vendor : Fedora Project
|
||||||
Source0 : %{_name}-%{_version}-%{_release}.tar.gz
|
Source0 : %{_name}-%{_version}-%{_release}.tar.gz
|
||||||
Packager : gluster-users@gluster.org
|
License : ASL 2.0
|
||||||
License : Apache
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
BuildRequires: python
|
BuildRequires: python
|
||||||
BuildRequires: python-setuptools
|
BuildRequires: python-setuptools
|
||||||
@ -44,6 +28,7 @@ Requires : openstack-swift-account = 1.10.0
|
|||||||
Requires : openstack-swift-container = 1.10.0
|
Requires : openstack-swift-container = 1.10.0
|
||||||
Requires : openstack-swift-object = 1.10.0
|
Requires : openstack-swift-object = 1.10.0
|
||||||
Requires : openstack-swift-proxy = 1.10.0
|
Requires : openstack-swift-proxy = 1.10.0
|
||||||
|
Requires : glusterfs-api >= 3.4.1
|
||||||
Obsoletes: glusterfs-swift-plugin
|
Obsoletes: glusterfs-swift-plugin
|
||||||
Obsoletes: glusterfs-swift
|
Obsoletes: glusterfs-swift
|
||||||
Obsoletes: glusterfs-ufo
|
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.
|
where accounts are mapped one-to-one to gluster volumes.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q -n gluster_swift-%{_version}
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%{__python} setup.py build
|
%{__python} setup.py build
|
||||||
@ -73,20 +58,16 @@ rm -rf %{buildroot}
|
|||||||
mkdir -p %{buildroot}/%{_confdir}/
|
mkdir -p %{buildroot}/%{_confdir}/
|
||||||
cp -r etc/* %{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
|
# Remove tests
|
||||||
%{__rm} -rf %{buildroot}/%{python_sitelib}/test
|
%{__rm} -rf %{buildroot}/%{python_sitelib}/test
|
||||||
|
|
||||||
%clean
|
# Remove files provided by glusterfs-api
|
||||||
rm -rf %{buildroot}
|
%{__rm} -rf %{buildroot}/%{python_sitelib}/gluster/__init__.p*
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
%{python_sitelib}/gluster
|
%{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-gen-builders
|
||||||
%{_bindir}/gluster-swift-print-metadata
|
%{_bindir}/gluster-swift-print-metadata
|
||||||
%{_bindir}/swauth-add-account
|
%{_bindir}/swauth-add-account
|
||||||
@ -99,12 +80,12 @@ rm -rf %{buildroot}
|
|||||||
%{_bindir}/swauth-set-account-service
|
%{_bindir}/swauth-set-account-service
|
||||||
|
|
||||||
%dir %{_confdir}
|
%dir %{_confdir}
|
||||||
%config %{_confdir}/account-server.conf-gluster
|
%config(noreplace) %{_confdir}/account-server.conf-gluster
|
||||||
%config %{_confdir}/container-server.conf-gluster
|
%config(noreplace) %{_confdir}/container-server.conf-gluster
|
||||||
%config %{_confdir}/object-server.conf-gluster
|
%config(noreplace) %{_confdir}/object-server.conf-gluster
|
||||||
%config %{_confdir}/swift.conf-gluster
|
%config(noreplace) %{_confdir}/swift.conf-gluster
|
||||||
%config %{_confdir}/proxy-server.conf-gluster
|
%config(noreplace) %{_confdir}/proxy-server.conf-gluster
|
||||||
%config %{_confdir}/fs.conf-gluster
|
%config(noreplace) %{_confdir}/fs.conf-gluster
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Mon Oct 28 2013 Luis Pabon <lpabon@redhat.com> - 1.10.1-0
|
* Mon Oct 28 2013 Luis Pabon <lpabon@redhat.com> - 1.10.1-0
|
||||||
|
125
makerpm.sh
125
makerpm.sh
@ -2,84 +2,94 @@
|
|||||||
|
|
||||||
# Simple script to create RPMs for G4S
|
# Simple script to create RPMs for G4S
|
||||||
|
|
||||||
|
## RPM NAME
|
||||||
|
RPMNAME=glusterfs-openstack-swift
|
||||||
|
|
||||||
cleanup()
|
cleanup()
|
||||||
{
|
{
|
||||||
rm -rf ${RPMBUILDDIR} > /dev/null 2>&1
|
rm -rf ${RPMBUILDDIR} > /dev/null 2>&1
|
||||||
rm -f ${PKGCONFIG} > /dev/null 2>&1
|
rm -f ${PKGCONFIG} > /dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
fail()
|
fail()
|
||||||
{
|
{
|
||||||
cleanup
|
cleanup
|
||||||
echo $1
|
echo $1
|
||||||
exit $2
|
exit $2
|
||||||
}
|
}
|
||||||
|
|
||||||
create_dir()
|
create_dir()
|
||||||
{
|
{
|
||||||
if [ ! -d "$1" ] ; then
|
if [ ! -d "$1" ] ; then
|
||||||
mkdir -p "$1"
|
mkdir -p "$1"
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
fail "Unable to create dir $1" $?
|
fail "Unable to create dir $1" $?
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
gittotar()
|
gittotar()
|
||||||
{
|
{
|
||||||
# Only archives committed changes
|
# Only archives committed changes
|
||||||
gitarchive_dir="${RPMBUILDDIR}/gitarchive"
|
gitarchive_dir="${RPMBUILDDIR}/gitarchive"
|
||||||
specfile="${gitarchive_dir}/${SRCTAR_DIR}/${PKG_NAME}.spec"
|
specfile="${gitarchive_dir}/${SRCTAR_DIR}/${RPMNAME}.spec"
|
||||||
create_dir "${gitarchive_dir}"
|
create_dir "${gitarchive_dir}"
|
||||||
|
|
||||||
# Export the current commited git changes to a directory
|
# Export the current commited git changes to a directory
|
||||||
git archive --format=tar --prefix=${SRCTAR_DIR}/ HEAD | (cd ${gitarchive_dir} && tar xf -)
|
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}
|
||||||
|
|
||||||
# Create a new spec file with the current package version information
|
# Now create a tar file
|
||||||
sed -e "s#__PKG_RELEASE__#${PKG_RELEASE}#" \
|
( cd ${gitarchive_dir} && tar cf - ${SRCTAR_DIR} | gzip -c > ${SRCTAR} )
|
||||||
-e "s#__PKG_NAME__#${PKG_NAME}#" \
|
if [ $? -ne 0 -o \! -s ${SRCTAR} ] ; then
|
||||||
-e "s#__PKG_VERSION__#${PKG_VERSION}#" \
|
fail "Unable to create git archive" $?
|
||||||
${specfile} > ${specfile}.new
|
fi
|
||||||
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()
|
prep()
|
||||||
{
|
{
|
||||||
rm -rf ${RPMBUILDDIR} > /dev/null 2>&1
|
rm -rf ${RPMBUILDDIR} > /dev/null 2>&1
|
||||||
create_dir ${RPMBUILDDIR}
|
create_dir ${RPMBUILDDIR}
|
||||||
|
|
||||||
# Create a tar file out of the current committed changes
|
# Create a tar file out of the current committed changes
|
||||||
gittotar
|
gittotar
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
create_rpm()
|
create_rpm()
|
||||||
{
|
{
|
||||||
# Create the rpm
|
# Create the rpm
|
||||||
# _topdir Notifies rpmbuild the location of the root directory
|
# _topdir Notifies rpmbuild the location of the root directory
|
||||||
# containing the RPM information
|
# containing the RPM information
|
||||||
# _release Allows Jenkins to setup the version using the
|
# _release Allows Jenkins to setup the version using the
|
||||||
# build number
|
# build number
|
||||||
rpmbuild --define "_topdir ${RPMBUILDDIR}" \
|
rpmbuild --define "_topdir ${RPMBUILDDIR}" \
|
||||||
-ta ${SRCTAR}
|
-ta ${SRCTAR}
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
fail "Unable to create rpm" $?
|
fail "Unable to create rpm" $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Move the rpms to the root directory
|
# Move the rpms to the root directory
|
||||||
mv ${RPMBUILDDIR_RPMS}/noarch/*rpm ${BUILDDIR}
|
mv ${RPMBUILDDIR_RPMS}/noarch/*rpm ${BUILDDIR}
|
||||||
mv ${RPMBUILDDIR_SRPMS}/*rpm ${BUILDDIR}
|
mv ${RPMBUILDDIR_SRPMS}/*rpm ${BUILDDIR}
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
fail "Unable to move rpm to ${BUILDDIR}" $?
|
fail "Unable to move rpm to ${BUILDDIR}" $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "RPMS are now available in ${BUILDDIR}"
|
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 #####################
|
################## MAIN #####################
|
||||||
@ -88,19 +98,19 @@ create_rpm()
|
|||||||
PKGCONFIG=${PWD}/pkgconfig.in
|
PKGCONFIG=${PWD}/pkgconfig.in
|
||||||
env python pkgconfig.py
|
env python pkgconfig.py
|
||||||
if [ ! -f "${PKGCONFIG}" ] ; then
|
if [ ! -f "${PKGCONFIG}" ] ; then
|
||||||
fail "Unable to create package information file ${PKGCONFIG}" 1
|
fail "Unable to create package information file ${PKGCONFIG}" 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get package version information
|
# Get package version information
|
||||||
. ${PKGCONFIG}
|
. ${PKGCONFIG}
|
||||||
if [ -z "${NAME}" ] ; then
|
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
|
fi
|
||||||
if [ -z "${VERSION}" ] ; then
|
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
|
fi
|
||||||
if [ -z "${RELEASE}" ] ; then
|
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
|
fi
|
||||||
|
|
||||||
PKG_NAME=$NAME
|
PKG_NAME=$NAME
|
||||||
@ -113,19 +123,20 @@ PKG_VERSION=$VERSION
|
|||||||
# a default value
|
# a default value
|
||||||
#
|
#
|
||||||
if [ -z "$PKG_RELEASE" ] ; then
|
if [ -z "$PKG_RELEASE" ] ; then
|
||||||
PKG_RELEASE="${RELEASE}"
|
PKG_RELEASE="${RELEASE}"
|
||||||
else
|
else
|
||||||
PKG_RELEASE="${RELEASE}.${PKG_RELEASE}"
|
PKG_RELEASE="${RELEASE}.${PKG_RELEASE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BUILDDIR=$PWD/build
|
BUILDDIR=$PWD/build
|
||||||
RPMBUILDDIR=${BUILDDIR}/rpmbuild
|
RPMBUILDDIR=${BUILDDIR}/rpmbuild
|
||||||
RPMBUILDDIR_RPMS=${RPMBUILDDIR}/RPMS
|
RPMBUILDDIR_RPMS=${RPMBUILDDIR}/RPMS
|
||||||
RPMBUILDDIR_SRPMS=${RPMBUILDDIR}/SRPMS
|
RPMBUILDDIR_SRPMS=${RPMBUILDDIR}/SRPMS
|
||||||
SRCNAME=${PKG_NAME}-${PKG_VERSION}-${PKG_RELEASE}
|
SRCNAME=${RPMNAME}-${PKG_VERSION}-${PKG_RELEASE}
|
||||||
SRCTAR_DIR=${PKG_NAME}-${PKG_VERSION}
|
SRCTAR_DIR=${PKG_NAME}-${PKG_VERSION}
|
||||||
SRCTAR=${RPMBUILDDIR}/${SRCNAME}.tar.gz
|
SRCTAR=${RPMBUILDDIR}/${SRCNAME}.tar.gz
|
||||||
|
|
||||||
prep
|
prep
|
||||||
|
create_src
|
||||||
create_rpm
|
create_rpm
|
||||||
cleanup
|
cleanup
|
||||||
|
12
setup.py
12
setup.py
@ -15,21 +15,17 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
from gluster.swift import _pkginfo
|
||||||
from gluster.swift import __canonical_version__ as version
|
|
||||||
|
|
||||||
|
|
||||||
name = 'gluster_swift'
|
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name=name,
|
name=_pkginfo.name,
|
||||||
version=version,
|
version=_pkginfo.full_version,
|
||||||
description='Gluster For Swift',
|
description='Gluster For Swift',
|
||||||
license='Apache License (2.0)',
|
license='Apache License (2.0)',
|
||||||
author='Red Hat, Inc.',
|
author='Red Hat, Inc.',
|
||||||
author_email='gluster-users@gluster.org',
|
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']),
|
packages=find_packages(exclude=['test', 'bin']),
|
||||||
test_suite='nose.collector',
|
test_suite='nose.collector',
|
||||||
classifiers=[
|
classifiers=[
|
||||||
|
Loading…
Reference in New Issue
Block a user