Blob Blame History Raw
%if 0%{?fedora} || 0%{?rhel} >= 8
%global with_python3 1
%else
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib2: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
%endif

Name:           python-bugzilla
Version:        2.1.0
Release:        1%{?dist}
Summary:        python2 library for interacting with Bugzilla

License:        GPLv2+
URL:            https://github.com/python-bugzilla/python-bugzilla
Source0:        https://github.com/python-bugzilla/python-bugzilla/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
BuildArch:      noarch

BuildRequires: python2-devel
BuildRequires: python-requests
BuildRequires: python-setuptools
%if 0%{?el6}
BuildRequires: python-argparse
%endif

%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-requests
BuildRequires: python3-setuptools
%endif # if with_python3

Requires: python-requests
Requires: python-magic
%if 0%{?el6}
Requires: python-argparse
%endif
# This dep is for back compat, so that installing python-bugzilla continues
# to give the cli tool
Requires: python-bugzilla-cli


%description
python-bugzilla is a python 2 library for interacting with bugzilla instances
over XML-RPC.


%if 0%{?with_python3}
%package -n python3-bugzilla
Summary: python 3 library for interacting with Bugzilla
Requires: python3-requests
Requires: python3-magic

%description -n python3-bugzilla
python3-bugzilla is a python 3 library for interacting with bugzilla instances
over XML-RPC.
%endif # if with_python3


%package cli
Summary: Command line tool for interacting with Bugzilla
%if 0%{?with_python3}
Requires: python3-bugzilla = %{version}-%{release}
%else
Requires: python-bugzilla = %{version}-%{release}
%endif

%description cli
This package includes the 'bugzilla' command-line tool for interacting with bugzilla. Uses the python-bugzilla API



%prep
%setup -q

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif # with_python3



%build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3

%{__python2} setup.py build



%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
rm %{buildroot}/usr/bin/bugzilla
popd
%endif # with_python3

%{__python2} setup.py install -O1 --skip-build --root %{buildroot}

# Replace '#!/usr/bin/env python' with '#!/usr/bin/python2'
# The format is ideal for upstream, but not a distro. See:
# https://fedoraproject.org/wiki/Features/SystemPythonExecutablesUseSystemPython
%if 0%{?with_python3}
%global python_env_path %{__python3}
%else
%global python_env_path %{__python2}
%endif
for f in $(find %{buildroot} -type f -executable -print); do
    sed -i "1 s|^#!/usr/bin/.*|#!%{python_env_path}|" $f || :
done



%check
%{__python2} setup.py test



%files
%doc COPYING README.md NEWS.md
%{python2_sitelib}/*

%if 0%{?with_python3}
%files -n python3-bugzilla
%doc COPYING README.md NEWS.md
%{python3_sitelib}/*
%endif # with_python3

%files cli
%{_bindir}/bugzilla
%{_mandir}/man1/bugzilla.1.gz


%changelog
* Thu Mar 30 2017 Cole Robinson <crobinso@redhat.com> - 2.1.0-1
- Rebased to version 2.1.0
- Support for bugzilla 5 API Keys (Dustin J. Mitchell)
- bugzillarc can be used to set default URL for the cli tool
- Revive update_flags wrapper
- Bug fixes and minor improvements

* Wed Feb 08 2017 Cole Robinson <crobinso@redhat.com> - 2.0.0-1
- Rebased to version 2.0.0
- Several fixes for use with bugzilla 5
- This release contains several smallish API breaks:
- Bugzilla.bug_autorefresh now defaults to False
- Credentials are now cached in ~/.cache/python-bugzilla/
- bin/bugzilla was converted to argparse
- bugzilla query --boolean_chart option is removed
- Unify command line flags across sub commands

* Tue Sep 22 2015 Cole Robinson <crobinso@redhat.com> - 1.2.2-1
- Rebased to version 1.2.2
- Fix requests usage when ndg-httpsclient is installed (bz #1247158)
- Fix errors with non-ascii usernames (bz #1264848)

* Fri May 22 2015 Cole Robinson <crobinso@redhat.com> - 1.2.1-1
- Rebased to version 1.2.1
- bin/bugzilla: Add --ensure-logged-in option
- Fix get_products with bugzilla.redhat.com
- A few other minor improvements

* Wed Apr 08 2015 Cole Robinson <crobinso@redhat.com> - 1.2.0-1
- Rebased to version 1.2.0
- Add bugzilla new/query/modify --field flag (Arun Babu Neelicattu)
- API support for ExternalBugs (Arun Babu Neelicattu, Brian Bouterse)
- Add new/modify --alias support (Adam Williamson)
- Bugzilla.logged_in now returns live state (Arun Babu Neelicattu)
- Fix getbugs API with latest Bugzilla releases

* Sun Jun 01 2014 Cole Robinson <crobinso@redhat.com> - 1.1.0-1
- Rebased to version 1.1.0
- Support for bugzilla tokens (Arun Babu Nelicattu)
- bugzilla: Add query/modify --tags
- bugzilla --login: Allow to login and run a command in one shot
- bugzilla --no-cache-credentials: Don't use or save cached credentials
  when using the CLI
- Show bugzilla errors when login fails
- Don't pull down attachments in bug.refresh(), need to get
  bug.attachments manually
- Add Bugzilla bug_autorefresh parameter.

* Tue Mar 25 2014 Cole Robinson <crobinso@redhat.com> - 1.0.0-1
- Rebased to version 1.0.0
- Python 3 support (Arun Babu Neelicattu)
- Port to python-requests (Arun Babu Neelicattu)
- bugzilla: new: Add --keywords, --assigned_to, --qa_contact (Lon
  Hohberger)
- bugzilla: query: Add --quicksearch, --savedsearch
- bugzilla: query: Support saved searches with --from-url
- bugzilla: --sub-component support for all relevant commands

* Wed Jun 19 2013 Cole Robinson <crobinso@redhat.com> - 0.9.0-1
- Rebased to version 0.9.0
- bugzilla: modify: add --dependson (Don Zickus)
- bugzilla: new: add --groups option (Paul Frields)
- bugzilla: modify: Allow setting nearly every bug parameter
- NovellBugzilla implementation removed, can't get it to work
- Gracefully handle private bugs (bz #963979)
- Raise error if python-magic is needed (bz #951572)
- CVE-2013-2191: Add SSL host and cert validation (bz #975962, bz #951594)

* Mon Mar 04 2013 Cole Robinson <crobinso@redhat.com> - 0.8.0-2
- Don't upload scrambled attachments (bz #915318)

* Fri Feb 15 2013 Cole Robinson <crobinso@redhat.com> - 0.8.0-1
- Rebased to version 0.8.0
- Drop most usage of non-upstream RH Bugzilla API
- Test suite improvements, nearly complete code coverage
- Fix all open bug reports and RFEs

* Thu Jun 14 2012 Cole Robinson <crobinso@redhat.com> - 0.7.0-1
- Rebased to version 0.7.0
- Fix querying with latest Red Hat bugzilla
- Bugzilla 4 API support
- Improve querying non-RH bugzilla instances

* Tue Mar 2 2010 Will Woods <wwoods@redhat.com> - 0.6.0-1
- New version 0.6, with lots of improvements and fixes.
- Library: add NovellBugzilla implementation
- Library: use standardized LWPCookieJar by default
- Library: implement unicode(bug), fix Bug.__str__ unicode handling
- Library: make Bug class pickle-friendly
- Library: add flag info helper methods to Bug class
- Library: handle problems with missing fields in User class
- CLI: --oneline formatting tweaks and dramatic speed improvements
- CLI: add support for modifying private, status, assignee, flags, cc, fixed_in
- CLI: improve query: allow multiple flags, flag negation, handle booleans
- CLI: make --cc work when creating bugs
- CLI: new --raw output style
- CLI: special output format fields for flag and whiteboard
- CLI: fix broken --cc and -p flags
- CLI: fix problem where bz comments default to being private
- CLI: improve 'info --product' output
- CLI: handle socket/network failure cleanly
- CLI: allow adding comments when updating whiteboards

* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Tue Apr 14 2009 Will Woods <wwoods@redhat.com> - 0.5.1-2
- Fix missing util.py

* Thu Apr 9 2009 Will Woods <wwoods@redhat.com> - 0.5.1-1
- CLI: fix unicode handling
- CLI: add --from-url flag, which parses a bugzilla query.cgi URL
- CLI: fix showing aliases
- CLI: add --comment, --private, --status, --assignee, --flag, --cc for update
- CLI: fix --target_milestone

* Wed Mar 25 2009 Will Woods <wwoods@redhat.com> - 0.5-1
- Fix problem where login wasn't saving the cookies to a file 
- Fix openattachment (bug #487673)
- Update version number for 0.5 final

* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5-0.rc1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Thu Feb 12 2009 Will Woods <wwoods@redhat.com> 0.5-0.rc1
- Improve cookie handling
- Add User class and associated Bugzilla methods (in Bugzilla 3.4)
- Add {add,edit,get}component methods
- Fix getbugs() so a single invalid bug ID won't abort the whole request
- CLI: fix -c <component>

* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 0.4-0.rc4.1
- Rebuild for Python 2.6

* Wed Oct 15 2008 Will Woods <wwoods@redhat.com> 0.4-0.rc4
- CLI: fix traceback with --full (Don Zickus)
- CLI: add --oneline (Don Zickus)
- CLI: speedup when querying bugs by ID (Don Zickus)
- CLI: add --bztype
- CLI: --bug_status defaults to ALL
- Fix addcc()/deletecc()
- RHBugzilla3: raise useful error on getbug(unreadable_bug_id)
- Add adduser() (Jon Stanley)

* Wed Oct  8 2008 Will Woods <wwoods@redhat.com> 0.4-0.rc3
- Add updateperms() - patch courtesy of Jon Stanley
- Fix attachfile() for RHBugzilla3
- Actually install man page. Whoops.

* Thu Sep 18 2008 Will Woods <wwoods@redhat.com> 0.4-0.rc2
- Auto-generated man page with much more info
- Fix _attachfile()

* Thu Sep  4 2008 Will Woods <wwoods@redhat.com> 0.4-0.rc1
- Update to python-bugzilla 0.4-rc1
- We now support upstream Bugzilla 3.x and Red Hat's Bugzilla 3.x instance
- library saves login cookie in ~/.bugzillacookies
- new 'bugzilla login' command to get a login cookie

* Sat Jan 12 2008 Will Woods <wwoods@redhat.com> 0.3-1
- Update to python-bugzilla 0.3 
- 'modify' works in the commandline-util
- add Bug.close() and Bug.setstatus()

* Thu Dec 13 2007 Will Woods <wwoods@redhat.com> 0.2-4
- use _bindir instead of /usr/bin and proper BR for setuptools

* Tue Dec 11 2007 Will Woods <wwoods@redhat.com> 0.2-3
- Fix a couple of things rpmlint complained about

* Tue Dec 11 2007 Will Woods <wwoods@redhat.com> 0.2-2
- Add docs

* Wed Oct 10 2007 Will Woods <wwoods@redhat.com> 0.2-1
- Initial packaging.