Stanislav Ochotnicky 911930c
%if 0%{?fedora}
Stanislav Ochotnicky 911930c
%global with_python3 1
Stanislav Ochotnicky 911930c
%else
Stanislav Ochotnicky 911930c
%{!?__python2: %global __python2 /usr/bin/python2}
Stanislav Ochotnicky 911930c
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
Stanislav Ochotnicky 911930c
%endif
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
# upstream has no support now, some dependencies are missing
Stanislav Ochotnicky 911930c
%global with_python3 0
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
Name:           pdc-client
bliu bf361d8
Version:        1.0.0
bliu fcb4618
Release:        2%{?dist}
bliu fcb4618
Summary:        Console client for interacting with Product Definition Center
bliu fcb4618
Group:          Development/Libraries
Stanislav Ochotnicky 911930c
License:        MIT
Stanislav Ochotnicky 911930c
URL:            https://github.com/product-definition-center/pdc-client
Stanislav Ochotnicky 911930c
BuildArch:      noarch
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
Source0:        https://pypi.python.org/packages/source/p/pdc-client/pdc-client-%{version}.tar.gz
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
BuildRequires:  python2-devel
Stanislav Ochotnicky 911930c
BuildRequires:  python-setuptools
Stanislav Ochotnicky 911930c
BuildRequires:  python-nose
Stanislav Ochotnicky 911930c
BuildRequires:  pytest
Stanislav Ochotnicky 911930c
BuildRequires:  python-requests
Stanislav Ochotnicky 911930c
BuildRequires:  python-requests-kerberos
Stanislav Ochotnicky 911930c
BuildRequires:  python-mock
Stanislav Ochotnicky 911930c
BuildRequires:  python2-beanbag
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
%if 0%{?with_python3}
Stanislav Ochotnicky 911930c
BuildRequires:  python3-devel
Stanislav Ochotnicky 911930c
BuildRequires:  python3-setuptools
Stanislav Ochotnicky 911930c
BuildRequires:  python3-nose
Stanislav Ochotnicky 911930c
BuildRequires:  python3-pytest
Stanislav Ochotnicky 911930c
BuildRequires:  python3-requests
Stanislav Ochotnicky 911930c
BuildRequires:  python3-requests-kerberos
Stanislav Ochotnicky 911930c
BuildRequires:  python3-mock
Stanislav Ochotnicky 911930c
BuildRequires:  python3-beanbag
Stanislav Ochotnicky 911930c
%endif # if with_python3
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
# default to v2 since py3 doesnt' exist really
Stanislav Ochotnicky 911930c
Requires:  python2-pdc-client = %{version}-%{release}
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
%description
Stanislav Ochotnicky 911930c
This client package contains two separate Product Definition Center clients and
Stanislav Ochotnicky 911930c
API module. Both clients contain extensive built-in help. Just run the
Stanislav Ochotnicky 911930c
executable with -h or --help argument.
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
1. pdc_client
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
This is a very simple client. Essentially this is just a little more convenient
Stanislav Ochotnicky 911930c
than using curl manually. Each invocation of this client obtains a token and
Stanislav Ochotnicky 911930c
then performs a single request.
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
This client is not meant for direct usage, but just as a helper for integrating
Stanislav Ochotnicky 911930c
with PDC from languages where it might be easier than performing the network
Stanislav Ochotnicky 911930c
requests manually.
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
2. pdc
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
This is much more user friendly user interface. A single invocation can perform
Stanislav Ochotnicky 911930c
multiple requests depending on what subcommand you used.
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
The pdc client supports Bash completion if argcomplete Python package is
Stanislav Ochotnicky 911930c
installed.
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
3. Python API (pdc_client)
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
When writing a client code interfacing with PDC server, you might find
Stanislav Ochotnicky 911930c
pdc_client module handy. It provides access to the configuration defined above
Stanislav Ochotnicky 911930c
and automates obtaining authorization token.
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
%package -n python2-pdc-client
Stanislav Ochotnicky 911930c
Summary:    Python 2 client library for Product Definition Center
Stanislav Ochotnicky 911930c
%{?python_provide:%python_provide python2-pdc-client}
Stanislav Ochotnicky 911930c
Requires:  python2-beanbag
Stanislav Ochotnicky 911930c
Requires:  python-requests-kerberos
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
%description -n python2-pdc-client
Stanislav Ochotnicky 911930c
This is a python module for interacting with Product Definition Center
Stanislav Ochotnicky 911930c
programatically. It can handle common authentication and configuration of PDC
Stanislav Ochotnicky 911930c
server connections
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 77ff6b9
Stanislav Ochotnicky 77ff6b9
%if 0%{?with_python3}
Stanislav Ochotnicky 911930c
%package -n python3-pdc-client
Stanislav Ochotnicky 911930c
Summary:    Python 3 client library for Product Definition Center
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
%{?python_provide:%python_provide python3-pdc-client}
Stanislav Ochotnicky 911930c
Requires:  python3-beanbag
Stanislav Ochotnicky 911930c
Requires:  python3-requests-kerberos
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
%description -n python3-pdc-client
Stanislav Ochotnicky 911930c
This is a python module for interacting with Product Definition Center
Stanislav Ochotnicky 911930c
programatically. It can handle common authentication and configuration of PDC
Stanislav Ochotnicky 911930c
server connections
Stanislav Ochotnicky 77ff6b9
%endif # with_python3
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
%prep
Stanislav Ochotnicky 911930c
%setup -q -n pdc-client-%{version}
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
%if 0%{?with_python3}
Stanislav Ochotnicky 911930c
rm -rf %{py3dir}
Stanislav Ochotnicky 911930c
cp -a . %{py3dir}
Stanislav Ochotnicky 911930c
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
Stanislav Ochotnicky 911930c
%endif # with_python3
bliu fcb4618
find -name 'test_helper*'  -delete
Stanislav Ochotnicky 911930c
find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python}|'
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
%build
Stanislav Ochotnicky 911930c
%py2_build
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
%if 0%{?with_python3}
Stanislav Ochotnicky 911930c
%py3_build
Stanislav Ochotnicky 911930c
%endif # with_python3
Stanislav Ochotnicky 911930c
bliu fcb4618
%check
bliu fcb4618
%{__python2} setup.py nosetests || exit 1
bliu fcb4618
bliu fcb4618
%if 0%{?with_python3}
bliu fcb4618
pushd %{py3dir}
bliu fcb4618
%{__python3} setup.py nosetests || exit 1
bliu fcb4618
popd
bliu fcb4618
%endif # with_python3
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
%install
Stanislav Ochotnicky 911930c
%py2_install
Stanislav Ochotnicky 911930c
%if 0%{?with_python3}
Stanislav Ochotnicky 911930c
py3_install
Stanislav Ochotnicky 911930c
%endif # with_python3
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
mkdir -p %{buildroot}/%{_mandir}/man1
Stanislav Ochotnicky 911930c
cp docs/pdc_client.1 %{buildroot}/%{_mandir}/man1/
Stanislav Ochotnicky 911930c
bliu fcb4618
# Move all plugins in upstream to /usr/share/pdc-client/
bliu fcb4618
mkdir -p %{buildroot}/%{_datadir}/pdc-client/plugins
bliu fcb4618
cp pdc_client/plugins/*  %{buildroot}/%{_datadir}/pdc-client/plugins
bliu fcb4618
Stanislav Ochotnicky 911930c
mkdir -p %{buildroot}/%{_sysconfdir}/bash_completion.d/
Stanislav Ochotnicky 911930c
cp pdc.bash %{buildroot}/%{_sysconfdir}/bash_completion.d/
Stanislav Ochotnicky 911930c
bliu fcb4618
mkdir -p %{buildroot}/%{_sysconfdir}/pdc.d
bliu fcb4618
cat > %{buildroot}/%{_sysconfdir}/pdc.d/fedora.json << EOF
Stanislav Ochotnicky 911930c
{
Stanislav Ochotnicky 911930c
    "dev": {
Stanislav Ochotnicky 911930c
        "host": "https://pdc.fedoraproject.org/rest_api/v1/",
Stanislav Ochotnicky 911930c
        "develop": false,
Stanislav Ochotnicky 911930c
        "insecure": false
Stanislav Ochotnicky 911930c
    }
Stanislav Ochotnicky 911930c
}
Stanislav Ochotnicky 911930c
EOF
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
%files
Stanislav Ochotnicky 911930c
%doc README.markdown
Stanislav Ochotnicky 911930c
%{_mandir}/man1/pdc_client.1*
Stanislav Ochotnicky 911930c
%{_sysconfdir}/bash_completion.d
bliu fcb4618
%dir %{_sysconfdir}/pdc.d
bliu fcb4618
%config(noreplace) %{_sysconfdir}/pdc.d/fedora.json
Stanislav Ochotnicky 911930c
%{_bindir}/pdc
Stanislav Ochotnicky 911930c
%{_bindir}/pdc_client
bliu fcb4618
%{_datadir}/pdc-client/plugins/*
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
%files -n python2-pdc-client
Stanislav Ochotnicky 911930c
%doc README.markdown
Stanislav Ochotnicky 911930c
%license LICENSE
Stanislav Ochotnicky 911930c
%{python_sitelib}/pdc_client*
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
%if 0%{?with_python3}
Stanislav Ochotnicky 911930c
%files -n python3-pdc-client
Stanislav Ochotnicky 911930c
%doc README.markdown
Stanislav Ochotnicky 911930c
%license LICENSE
Stanislav Ochotnicky 911930c
%{python3_sitelib}/pdc_client*
Stanislav Ochotnicky 911930c
%endif # with_python3
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
Stanislav Ochotnicky 911930c
%changelog
bliu fcb4618
* Sun Jul 17 2016 bliu <bliu@redhat.com> 1.0.0-2
bliu fcb4618
- new package built with tito
Stanislav Ochotnicky 853c2eb
bliu fcb4618
* Sun Jul 17 2016 bliu <bliu@redhat.com> 1.0.0-2
bliu fcb4618
- new package built with tito
Stanislav Ochotnicky 649cf6d
bliu fcb4618
* Mon Jul 11 2016 bliu <bliu@redhat.com> 1.0.0-2
bliu fcb4618
- new package built with tito
Stanislav Ochotnicky 911930c
bliu fcb4618
* Thu May 05 2016 bliu <bliu@redhat.com> 0.9.0-3
bliu fcb4618
- Change filtering arguments's underscore to minus to be consistent.
bliu fcb4618
  (ycheng@redhat.com)
bliu fcb4618
- Modify compose-tree-locations in client because API url changed.
bliu fcb4618
  (ycheng@redhat.com)
bliu fcb4618
- Add support for repo manipulation into pdc client (ycheng@redhat.com)
bliu fcb4618
bliu fcb4618
* Fri Feb 26 2016 bliu <bliu@redhat.com> 0.9.0-1
bliu fcb4618
- Add headers in result for pdc client output. (ycheng@redhat.com)
bliu fcb4618
- Add pdc client project page and PyPI release docomentation.
bliu fcb4618
  (ycheng@redhat.com)
bliu fcb4618
- Update the error info (bliu@redhat.com)
bliu fcb4618
- Update the more detail info (bliu@redhat.com)
bliu fcb4618
- Add error info when input irregular or illegal para (bliu@redhat.com)
bliu fcb4618
- Let pdc client handle pdc warning header (ycheng@redhat.com)
bliu fcb4618
- Pypi setup (sochotnicky@redhat.com)
bliu fcb4618
- Fix release component update logging type (sochotnicky@redhat.com)
bliu fcb4618
bliu fcb4618
* Wed Jan 13 2016 bliu <bliu@redhat.com> 0.2.0-3
bliu fcb4618
- PATCH on build-image-rtt-tests with build_nvr/format (bliu@redhat.com)
bliu fcb4618
- Add beanbag required version. (xchu@redhat.com)
bliu fcb4618
- Add header for build image in new pdc client output (ycheng@redhat.com)
bliu fcb4618
- Add tests for permission list. (xchu@redhat.com)
bliu fcb4618
- Add test for build-image detail. (xchu@redhat.com)
bliu fcb4618
- Add support for compose-tree-locations. (chuzhang@redhat.com)
bliu fcb4618
- Add head in result when running build_image_rtt_tests (bliu@redhat.com)
bliu fcb4618
- Use new get_paged method instead of deprecated one. (ycheng@redhat.com)
bliu fcb4618
- Pdc client add support for build-image-rtt-tests (bliu@redhat.com)
bliu fcb4618
- Add support for compose-image-rtt-tests in pdc client (ycheng@redhat.com)
bliu fcb4618
- Make mocked endpoints possibly callable. (rbean@redhat.com)
bliu fcb4618
- Add help message for 'active' filter. (xchu@redhat.com)
bliu fcb4618
- Enable page_size in new pdc client (bliu@redhat.com)
bliu fcb4618
bliu fcb4618
* Wed Jan 13 2016 bliu <bliu@redhat.com> 0.2.0-2
bliu fcb4618
bliu fcb4618
* Fri Dec 04 2015 Xiangyang Chu <xchu@redhat.com> 0.2.0-1
bliu fcb4618
- Add python 2.6 check. (xchu@redhat.com)
bliu fcb4618
- Fix spec URL (rbean@redhat.com)
bliu fcb4618
- Allow PDCClient to be configured with arguments. (rbean@redhat.com)
bliu fcb4618
- Imporvements on new `pdc` client.
bliu fcb4618
* Fri Sep 11 2015 Xiangyang Chu <xychu2008@gmail.com> 0.1.0-1
bliu fcb4618
- new package built with tito