Update to 0.28.6

Resolves: rhbz#2143866
This commit is contained in:
Martin Pitt 2022-11-24 09:12:10 +01:00
parent 0308a273df
commit 5f0cc0826f
9 changed files with 186 additions and 201 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

13
.gitignore vendored
View File

@ -16,3 +16,16 @@
/python-dbusmock-0.17.tar.gz
/python-dbusmock-0.18.3.tar.gz
/python-dbusmock-0.22.0.tar.gz
/python-dbusmock-0.23.0.tar.gz
/python-dbusmock-0.25.0.tar.gz
/python-dbusmock-0.26.1.tar.gz
/python-dbusmock-0.27.0.tar.gz
/python-dbusmock-0.27.3.tar.gz
/python-dbusmock-0.27.4.tar.gz
/python-dbusmock-0.27.5.tar.gz
/python-dbusmock-0.28.0.tar.gz
/python-dbusmock-0.28.1.tar.gz
/python-dbusmock-0.28.2.tar.gz
/python-dbusmock-0.28.3.tar.gz
/python-dbusmock-0.28.4.tar.gz
/python-dbusmock-0.28.6.tar.gz

3
README.packit Normal file
View File

@ -0,0 +1,3 @@
This repository is maintained by packit.
https://packit.dev/
The file was generated using packit 0.60.0.

View File

@ -1,189 +0,0 @@
From 9bf4215782517c21ac40e7bfca9e3a43b1b31c5e Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Tue, 16 Feb 2021 14:39:47 +0100
Subject: [PATCH 1/3] bluez: Implement Pair() method on the Device interface
Tested successfully against gnome-bluetooth. Note that pairing does not
currently use agents at all, and always succeeds.
---
dbusmock/templates/bluez5.py | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/dbusmock/templates/bluez5.py b/dbusmock/templates/bluez5.py
index 75e8dcf..5d9676b 100644
--- a/dbusmock/templates/bluez5.py
+++ b/dbusmock/templates/bluez5.py
@@ -18,6 +18,7 @@ This supports BlueZ 5 only.
__author__ = 'Philip Withnall'
__copyright__ = '(c) 2013 Collabora Ltd.'
+import os
import dbus
from dbusmock import OBJECT_MANAGER_IFACE, mockobject
@@ -123,6 +124,18 @@ def AddAdapter(self, device_name, system_name):
return path
+@dbus.service.method(DEVICE_IFACE,
+ in_signature='', out_signature='')
+def Pair(device):
+ if device.paired:
+ raise dbus.exceptions.DBusException(
+ 'Device already paired',
+ name='org.bluez.Error.AlreadyExists')
+ device_address = device.props[DEVICE_IFACE]['Address']
+ adapter_device_name = os.path.basename(device.props[DEVICE_IFACE]['Adapter'])
+ device.PairDevice(adapter_device_name, device_address)
+
+
@dbus.service.method(BLUEZ_MOCK_IFACE,
in_signature='sss', out_signature='s')
def AddDevice(self, adapter_device_name, device_address, alias):
@@ -171,8 +184,10 @@ def AddDevice(self, adapter_device_name, device_address, alias):
('ConnectProfile', 's', '', ''),
('Disconnect', '', '', ''),
('DisconnectProfile', 's', '', ''),
- ('Pair', '', '', ''),
+ ('Pair', '', '', Pair),
])
+ device = mockobject.objects[path]
+ device.paired = False
manager = mockobject.objects['/']
manager.EmitSignal(OBJECT_MANAGER_IFACE, 'InterfacesAdded',
@@ -214,6 +229,7 @@ def PairDevice(_self, adapter_device_name, device_address, class_=5898764):
name=BLUEZ_MOCK_IFACE + '.NoSuchDevice')
device = mockobject.objects[device_path]
+ device.paired = True
# Based off pairing with an Android phone.
uuids = [
--
2.30.2
From 2454e9fbfa9d0da3042c51d1a3241b9940a6f1c0 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Wed, 17 Feb 2021 16:11:17 +0100
Subject: [PATCH 2/3] tests: Fix bluez server never being closed down
The same variable was used to store the obex server's process
information so it was closed, and the bluez server's information was
lost.
---
tests/test_bluez5.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tests/test_bluez5.py b/tests/test_bluez5.py
index b40950f..cbbc0f7 100644
--- a/tests/test_bluez5.py
+++ b/tests/test_bluez5.py
@@ -205,7 +205,7 @@ class TestBlueZObex(dbusmock.DBusTestCase):
self.dbusmock_bluez = dbus.Interface(self.obj_bluez, 'org.bluez.Mock')
# obexd
- (self.p_mock, self.obj_obex) = self.spawn_server_template(
+ (self.p_mock_obex, self.obj_obex) = self.spawn_server_template(
'bluez5-obex', {}, stdout=subprocess.PIPE)
self.dbusmock = dbus.Interface(self.obj_obex, dbusmock.MOCK_IFACE)
self.dbusmock_obex = dbus.Interface(self.obj_obex,
@@ -216,6 +216,10 @@ class TestBlueZObex(dbusmock.DBusTestCase):
self.p_mock.terminate()
self.p_mock.wait()
+ self.p_mock_obex.stdout.close()
+ self.p_mock_obex.terminate()
+ self.p_mock_obex.wait()
+
def test_everything(self):
# Set up an adapter and device.
adapter_name = 'hci0'
--
2.30.2
From 49f493784cf288c95bb90870c8e3a603c64865d3 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Wed, 17 Feb 2021 16:10:08 +0100
Subject: [PATCH 3/3] bluez: Implement the AgentManager1 interface methods
The pairing agent still doesn't call into those, but this is good enough
to register and unregister a pairing agent in gnome-bluetooth's test
suite.
---
dbusmock/templates/bluez5.py | 55 ++++++++++++++++++++++++++++++++++--
1 file changed, 52 insertions(+), 3 deletions(-)
diff --git a/dbusmock/templates/bluez5.py b/dbusmock/templates/bluez5.py
index 5d9676b..6a2f85a 100644
--- a/dbusmock/templates/bluez5.py
+++ b/dbusmock/templates/bluez5.py
@@ -37,11 +37,60 @@ NETWORK_SERVER_IFACE = 'org.bluez.Network1'
DEVICE_IFACE = 'org.bluez.Device1'
+@dbus.service.method(AGENT_MANAGER_IFACE,
+ in_signature='os', out_signature='')
+def RegisterAgent(manager, agent_path, capability):
+ all_caps = ['DisplayOnly', 'DisplayYesNo', 'KeyboardOnly',
+ 'NoInputNoOutput', 'KeyboardDisplay']
+
+ if agent_path in manager.agent_paths:
+ raise dbus.exceptions.DBusException(
+ 'Another agent is already registered ' + manager.agent_path,
+ name='org.bluez.Error.AlreadyExists')
+
+ if capability not in all_caps:
+ raise dbus.exceptions.DBusException(
+ 'Unsupported capability ' + capability,
+ name='org.bluez.Error.InvalidArguments')
+
+ if not manager.default_agent:
+ manager.default_agent = agent_path
+ manager.agent_paths += [agent_path]
+ manager.capabilities[agent_path] = capability
+
+
+@dbus.service.method(AGENT_MANAGER_IFACE,
+ in_signature='o', out_signature='')
+def UnregisterAgent(manager, agent_path):
+ if agent_path not in manager.agent_paths:
+ raise dbus.exceptions.DBusException(
+ 'Agent not registered ' + agent_path,
+ name='org.bluez.Error.DoesNotExist')
+
+ manager.agent_paths.remove(agent_path)
+ del manager.capabilities[agent_path]
+ if manager.default_agent == agent_path:
+ if len(manager.agent_paths) > 0:
+ manager.default_agent = manager.agent_paths[-1]
+ else:
+ manager.default_agent = None
+
+
+@dbus.service.method(AGENT_MANAGER_IFACE,
+ in_signature='o', out_signature='')
+def RequestDefaultAgent(manager, agent_path):
+ if agent_path not in manager.agent_paths:
+ raise dbus.exceptions.DBusException(
+ 'Agent not registered ' + agent_path,
+ name='org.bluez.Error.DoesNotExist')
+ manager.default_agent = agent_path
+
+
def load(mock, _parameters):
mock.AddObject('/org/bluez', AGENT_MANAGER_IFACE, {}, [
- ('RegisterAgent', 'os', '', ''),
- ('RequestDefaultAgent', 'o', '', ''),
- ('UnregisterAgent', 'o', '', ''),
+ ('RegisterAgent', 'os', '', RegisterAgent),
+ ('RequestDefaultAgent', 'o', '', RequestDefaultAgent),
+ ('UnregisterAgent', 'o', '', UnregisterAgent),
])
bluez = mockobject.objects['/org/bluez']
--
2.30.2

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_stable
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}

43
packit.yaml Normal file
View File

@ -0,0 +1,43 @@
# See the documentation for more information:
# https://packit.dev/docs/configuration/
upstream_project_url: https://github.com/martinpitt/python-dbusmock
# HACK: should work without, but propose_downstream fails; https://github.com/packit/packit-service/issues/1511
specfile_path: packaging/python-dbusmock.spec
issue_repository: https://github.com/martinpitt/python-dbusmock
copy_upstream_release_description: true
upstream_package_name: python-dbusmock
downstream_package_name: python-dbusmock
actions:
create-archive:
- ./setup.py sdist
# spec and tarball need to be in the same directory
- sh -c 'mv dist/*.tar.* packaging; ls packaging/python-dbusmock-*.tar.*'
srpm_build_deps:
- python3-setuptools
- python3-setuptools_scm
jobs:
- job: tests
trigger: pull_request
targets:
- fedora-all
- centos-stream-8-x86_64
- centos-stream-9-x86_64
- job: propose_downstream
trigger: release
dist_git_branches:
- fedora-all
- job: koji_build
trigger: commit
dist_git_branches:
- fedora-all
- job: bodhi_update
trigger: commit
dist_git_branches:
# rawhide updates are created automatically
- fedora-branched

5
plans/upstream.fmf Normal file
View File

@ -0,0 +1,5 @@
discover:
how: fmf
dist-git-source: true
execute:
how: tmt

View File

@ -1,8 +1,8 @@
%global modname dbusmock
Name: python-%{modname}
Version: 0.22.0
Release: 5%{?dist}
Version: 0.28.6
Release: 1%{?dist}
Summary: Mock D-Bus objects
License: LGPLv3+
@ -18,9 +18,6 @@ BuildRequires: python3-gobject
BuildRequires: dbus-x11
BuildRequires: upower
# https://github.com/martinpitt/python-dbusmock/pull/66
Patch0: bluez-agent-template.patch
%global _description\
With this program/Python library you can easily create mock objects on\
D-Bus. This is useful for writing tests for software which talks to\
@ -50,16 +47,122 @@ rm -rf python-%{modname}.egg-info
%{__python3} -m unittest -v
%files -n python3-dbusmock
%doc README.rst COPYING
%doc README.md COPYING
%{python3_sitelib}/*%{modname}*
%changelog
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 0.22.0-5
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Wed Oct 12 2022 Packit <hello@packit.dev> - 0.28.6-1
<!-- generated by eloquent/github-release-action -->
<!-- original source:
- Fix generated _version.py in release tarball (#164)
-->
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 0.22.0-4
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
<ul>
<li>Fix generated _version.py in release tarball (#164)</li>
</ul>
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.28.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Tue Jul 19 2022 Packit <hello@packit.dev> - 0.28.4-1
<!-- generated by eloquent/github-release-action -->
<!-- original source:
- setup.py: Fix ModuleNotFoundError
- ofono template: Fix conversion to f-strings (Debian #1015286)
- Ship FMF tests in release tarballs
-->
<ul>
<li>setup.py: Fix ModuleNotFoundError</li>
<li>ofono template: Fix conversion to f-strings (Debian #1015286)</li>
<li>Ship FMF tests in release tarballs</li>
</ul>
* Sun Jul 17 2022 Packit <hello@packit.dev> - 0.28.3-1
<!-- generated by eloquent/github-release-action -->
<!-- original source:
- Bring back dbusmock.__version__
-->
<ul>
<li>Bring back dbusmock.<strong>version</strong>
</li>
</ul>
* Sat Jul 16 2022 Packit <hello@packit.dev> - 0.28.2-1
<!-- generated by eloquent/github-release-action -->
<!-- original source:
- Dynamically compute version with setuptools-scm
- tests: Adjust to libnotify 0.8 (Debian #1015068)
- tests: Only run pylint on current Fedora release
-->
<ul>
<li>Dynamically compute version with setuptools-scm</li>
<li>tests: Adjust to libnotify 0.8 (Debian #1015068)</li>
<li>tests: Only run pylint on current Fedora release</li>
</ul>
* Tue Jun 28 2022 Packit <hello@packit.dev> - 0.28.1-1
- Again works on RHEL/CentOS 8 (0.27 broke there), now in CI
- Avoid glib GI dependency for main dbusmock, for running in virtualenv (thanks Allison Karlitskaya)
* Sun Jun 19 2022 Packit <hello@packit.dev> - 0.28.0-1
- Drop unmaintained and broken accountsservice template
- testcase: Throw an error when spawning a well-known name that exists (thanks Benjamin Berg)
- mockobject: Allow sending signals with extra details (thanks Peter Hutterer)
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 0.27.5-2
- Rebuilt for Python 3.11
* Tue Apr 05 2022 Packit <hello@packit.dev> - 0.27.5-1
- bluez and accountsservice templates: Drop default arguments from D-Bus methods (thanks Simon McVittie)
* Mon Apr 04 2022 Packit <hello@packit.dev> - 0.27.4-1
- Fix D-Bus signature detection regression from 0.27.0 (thanks Peter Hutterer) (#118)
* Tue Mar 22 2022 Packit Service <user-cont-team+packit-service@redhat.com> - 0.27.3-1
- packit: Fix file name to sync
* Tue Mar 22 2022 Packit Service <user-cont-team+packit-service@redhat.com> - 0.27.0-1
- Do not register standard session service directories, add API to enable selected services (thanks Benjamin Berg)
- Log static method calls from templates (thanks Peter Hutterer)
* Fri Feb 25 2022 Packit Service <user-cont-team+packit-service@redhat.com> - 0.26.1-1
- Fix README content type to Markdown, to fix releasing to PyPi
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.25.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Sat Dec 25 2021 Packit Service <user-cont-team+packit-service@redhat.com> - 0.25.0-1
- bluez template: Implement adapter discovery, connect, disconnect, and removal
(thanks Bastien Nocera)
- Fix changing array properties (thanks Jonas Ådahl)
- Fix CLI upower tests (thanks Marco Trevisan)
- Add testing and Fedora updating through packit
* Tue Jul 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.23.0-2
- Second attempt - Rebuilt for
https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Mon Jun 14 2021 Bastien Nocera <bnocera@redhat.com> - 0.23.0-1
+ python-dbusmock-0.23.0-1
- Update to 0.23.0
* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 0.22.0-4
- Rebuilt for Python 3.10
* Mon Mar 22 2021 Bastien Nocera <bnocera@redhat.com> - 0.22.0-3
+ python-dbusmock-0.22.0-3

View File

@ -1 +1 @@
SHA512 (python-dbusmock-0.22.0.tar.gz) = 2c3430f4178a16acc376ce582f4a1a9bbe8b917efcd7eee58dab85ee3addf60ba355ae9e7b318ec2cdf7ca771183c37d16520a1e5bcab8414c66e2d2a36d26fe
SHA512 (python-dbusmock-0.28.6.tar.gz) = 1efc1a42fc5cc56d683f0f4d022877020f15d81a557c54f47619c704ca2f67716c1fbdb890f987d01f78b7786528a71de8dbfe84228baa41351eb751fc4cce61