File pip-pop.spec of Package pip-pop-0.1.4

#
# spec file for SUSE CAP buildpack dependency
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.



Name:           pip-pop-0.1.4
Version:        0.1.4
Release:        1
Summary:        This is a dependency used in SUSE CAP buildpacks
License:        MIT
Group:          Cloud/Platform/scf
Url:            https://github.com/djoyahoy/pip-pop
Source0:        https://github.com/cloudfoundry/pip-pop/archive/v0.1.4.tar.gz
# KISS: docopt is not receiving any updates lately (last tag is 4 years ago)
# so we chosen to not generate a _service file with obs-binary-builder, as
# previously was vendored with the python-buildpack
# https://github.com/cloudfoundry/python-buildpack/commit/47c40ce086ee10287c28719fde3647f152a16b35#diff-ebe308d3b3e798df4e9120c8535d16d8
Source1:        https://github.com/docopt/docopt/archive/0.6.2.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:	python-setuptools

# BEGIN shared macros for all dependency packages
BuildRequires: aaa_stack_build_requires

%if 0%{?suse_version} == 1315
%define stack sle12
%else
%define stack sle15
%endif

%define otherdir %{_topdir}/OTHER
%define prefix_path /app/vendor/%{name}
%define destdir /tmp/%{name}
%define dependencydir %{destdir}%{prefix_path}
# END shared macros


%description

%prep
mkdir -p %{destdir}
cp %{SOURCE0} %{destdir}/

%build
TARBALL=%{otherdir}/%{name}.tar.gz
pushd %{destdir}/
	mkdir build
	tar xvf v%{version}.tar.gz -C build
	rm -rf v%{version}.tar.gz
	pushd build/%{name}
	python setup.py sdist
	mv dist/%{name}.tar.gz ../../
	popd
	rm -rf build

	mkdir build
	tar xvf %{SOURCE1} -C build
	pushd build/docopt-0.6.2
	python setup.py sdist
	mv dist/docopt-0.6.2.tar.gz ../../
	popd
	rm -rf build

	# The upstream binary-builder is using `cp -r` which has the same effect
	# as the --hard-dereference flag here.
	# (https://github.com/cloudfoundry/binary-builder/blob/master/lib/archive_recipe.rb#L20)
	tar czf ${TARBALL} --hard-dereference * --owner=0 --group=0
popd

CHECKSUM=`sha256sum ${TARBALL}`
NEW_TARBALL=%{otherdir}/%{name}-${CHECKSUM:0:8}.tar.gz
mv ${TARBALL} ${NEW_TARBALL}
pushd $(dirname ${NEW_TARBALL})
sha256sum $(basename ${NEW_TARBALL}) > ${NEW_TARBALL}.sha256
popd

%files
%defattr(-,root,root)

%changelog

openSUSE Build Service is sponsored by