Sync from SUSE:SLFO:Main mdevctl revision 6e55b79384793737e1f7abb56dc8cb07

This commit is contained in:
Adrian Schröter 2024-05-03 16:44:16 +02:00
commit e1e14774de
8 changed files with 294 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

25
_service Normal file
View File

@ -0,0 +1,25 @@
<services>
<service name="tar_scm" mode="disabled">
<param name="filename">mdevctl</param>
<param name="revision">v1.3.0</param>
<param name="scm">git</param>
<param name="submodules">disable</param>
<param name="url">https://github.com/mdevctl/mdevctl</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="versionrewrite-pattern">v(.*)</param>
<param name="changesgenerate">enable</param>
</service>
<service name="recompress" mode="disabled">
<param name="file">*.tar</param>
<param name="compression">xz</param>
</service>
<service name="set_version" mode="disabled"/>
<service name="cargo_vendor" mode="disabled">
<param name="srcdir">mdevctl-1.3.0</param>
<param name="compression">zst</param>
<param name="update">true</param>
</service>
<service name="cargo_audit" mode="disabled">
<param name="srcdir">mdevctl-1.3.0</param>
</service>
</services>

4
_servicedata Normal file
View File

@ -0,0 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/mdevctl/mdevctl</param>
<param name="changesrevision">54db334d834017e0f97641a0172ca91358d4cf59</param></service></servicedata>

5
cargo_config Normal file
View File

@ -0,0 +1,5 @@
[source.crates-io]
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "vendor"

BIN
mdevctl-1.3.0.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

151
mdevctl.changes Normal file
View File

@ -0,0 +1,151 @@
-------------------------------------------------------------------
Mon Feb 12 17:54:05 UTC 2024 - James Fehlig <jfehlig@suse.com>
- Add /usr/lib/mdevctl/scripts.d/{callouts,notifiers} directories
-------------------------------------------------------------------
Wed Jan 24 14:05:47 UTC 2024 - jfehlig@suse.com
- Update to version 1.3.0 (jsc#PED-4981):
* tests: add tests for live and defined support
* doc: document live support and its options
* cli: add live and defined parameters to modify command
* callouts: add callout live event support
* main: refactor jsonfile loading
* main: refactor getting active devices
* tests: add callout versioning tests
* callouts: add warning for unknown supported actions and events
* callouts: prevent repeating unsuccessful script searches
* callouts: add versioning on callout scripts
* callouts: make callout method reusable
* callouts: add a check_result_fn to invoke_first_matching_script
* Fix new clippy warnings
* Cargo.toml: move tempfile to dev-dependencies
* main: assemble active devices without overwriting
* mdevctl.spec.in: Add systemd as build requirement
* callout: ignore broken pipe on stdin
* cli: improve lsmdev help
* callouts: set script in callout on success only
* main: fix file open error being suppressed
* Fix clippy warning for useless vec
* callouts: replace negated check and improve msgs
* callouts: improve debug messages in get_attributes
* callouts: match code format in Display for Event and Action
* tests/callouts: make scripts cross distro compliant
* actions: update release action to newer versions
* Bump clap to 4.0
* Bump env_logger dependency to 0.9.0
* Fix deprecated github actions
* cli: change modify parameter relationships
* tests: use printf over echo
* tests: add callout constructor panic tests
* callouts: add MDev to callout struct
* callouts: Move stdin generation from Callout::invoke_script()
* callouts: Add a Callout argument to the invoke callback function
* callouts: Reuse Callout::callout() for get_attributes()
* callouts: Return Output from Callout::callout()
* callouts: Remove Callout::callout_dir()
* callouts: Move self.script invocation to callout()
* callouts: make Callout::invoke() a method
* mdev: provide better error message for invalid attr index
* mdev: change attribute index arguments to usize
* cli: adjust help text for modify option addattr
* modify: ensure required parameter is given
* trim trailing null from callout script get-attributes output
* Add --force option for commands that have callouts
* Bump 'nix' dependency
* tests: test 'stop' with callouts
* tests: remove stray debug prints during fork
* tests: make test failure reports more obvious
* Bump version to 1.3.0
* undefine: report error if device is not undefined
* modify: add jsonfile optional parameter
* cli: add cli tests
* cli: fix clap deprecations warnings
* tests: fix test_modify() when auto and manual are both set
* Fix panic on modify delattr with invalid index
* Active attributes (#71)
* clippy: remove needless borrows
* mdevctl.rst: align use of term state
* Add tests for callout dir priority
* Add system callout script dir outside /etc.
* Add ability to set env root with env variable
* Rename Environment::persist_base() to config_base()
* Update github checkout action
* Relax 'nix' dependency version requirement
* callouts: remove return value from Callout::notify()
* callouts: remove separate is_dir() check in notify()
* callouts: filter and map iterator in notifier loop
* Update uuid version
* tests: verify that callout scripts are executed in order
* callouts: make sure scripts are sorted
* callouts: simplify loop through callout dir
* callouts: Remove call to count() on callout dir entries
* Fix new clippy warnings
* Fix intermittent callout failure during test
* rpm: set debug env vars when running tests in rpm build
* Add python3-docutils to rpm BuildRequires
-------------------------------------------------------------------
Sun Dec 11 18:19:52 UTC 2022 - dmueller@suse.com
- Update to version 1.2.0:
* Port CLI to clap v3
* start: provide useful hint for parent with wrong case
* tests: Add ability to test error messages
* tests: extract function for checking pass/fail expectations
* MDev::create() does not need to be public
* Fix new clippy warning
-------------------------------------------------------------------
Mon Mar 14 19:32:53 UTC 2022 - James Fehlig <jfehlig@suse.com>
- spec: BuildRequires python3-docutils instead of all python
flavors of the docutils module
-------------------------------------------------------------------
Fri Mar 11 17:23:03 UTC 2022 - James Fehlig <jfehlig@suse.com>
- spec: Add /etc/mdevctl.d/scripts.d directory to %files
-------------------------------------------------------------------
Thu Mar 10 11:26:24 UTC 2022 - ptesarik@suse.com
- Update to version v1.1.0 (jsc#SLE-18449):
* use imported std::env for CARGO_PKG_VERSION in build.rs directly
* fix build.rs to allow specify exact path or name of the rst2man
* Don't call unnecessary to_string()
* Report a useful error when /etc/mdevctl.d doesn't exist
* Handle FS permissions problems for defined devices
* Fix needless borrow warning from clippy
* tests: read stdin in callout test scripts
* Report root error when a callout can't be executed
* Don't emit warning for files in /etc/mdevctl.d/scripts.d
* env: add function to get base scripts directory
-------------------------------------------------------------------
Thu Jul 08 17:38:58 UTC 2021 - jfehlig@suse.com
- Update to version 0.81:
* Automatic version commit for tag 0.81
* Fix define from jsonfile
-------------------------------------------------------------------
Tue Dec 08 23:31:30 UTC 2020 - jfehlig@suse.com
- Update to version 0.78:
* Automatic version commit for tag 0.78
* use standard bash path
* avoid other tags spilling into the .spec changelog
* mdevctl: fix cleanup on error when creating and removing mdev
* version support
* Fix attributes getting applied via start-parent-mdevs
* mdevctl: fix cleanup on error when writing to attribute
* Remove never used 'available' option
* Fix attribute validation
jsc#SLE-15861, bsc#1179770
-------------------------------------------------------------------
Wed Jul 1 20:06:28 UTC 2020 - James Fehlig <jfehlig@suse.com>
- Initial packaging of mdevctl utility

80
mdevctl.spec Normal file
View File

@ -0,0 +1,80 @@
#
# spec file for package mdevctl
#
# Copyright (c) 2024 SUSE LLC
#
# 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.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: mdevctl
Version: 1.3.0
Release: 0
Summary: Mediated device management and persistence utility
License: LGPL-2.1-or-later
URL: https://github.com/mdevctl/mdevctl
Source0: %{name}-%{version}.tar.xz
Source1: vendor.tar.zst
Source2: cargo_config
BuildRequires: cargo
BuildRequires: python3-docutils
BuildRequires: rust
BuildRequires: zstd
BuildRequires: pkgconfig(udev)
%description
mdevctl is a utility for managing and persisting devices in the mediated device
framework of the Linux kernel. Mediated devices are sub-devices of a parent
device (e.g. a vGPU) which can be dynamically created and potentially used by
drivers like vfio-mdev for assignment to virtual machines.
%prep
%autosetup -p1
%setup -q -D -T -a 1
mkdir -p cargo-home
cat >cargo-home/config <<EOF
[source.crates-io]
registry = 'https://github.com/rust-lang/crates.io-index'
replace-with = 'vendored-sources'
[source.vendored-sources]
directory = './vendor'
EOF
%build
export CARGO_HOME=$PWD/cargo-home
cargo build --release %{?_smp_mflags}
%install
%make_install
%check
export MDEVCTL_LOG=debug RUST_BACKTRACE=full
export CARGO_HOME=$PWD/cargo-home
cargo test
%files
%license COPYING
%doc README.md
%{_sbindir}/mdevctl
%{_sbindir}/lsmdev
%{_udevrulesdir}/60-mdevctl.rules
%dir %{_sysconfdir}/mdevctl.d
%dir %{_prefix}/lib/mdevctl
%dir %{_prefix}/lib/mdevctl/scripts.d
%dir %{_prefix}/lib/mdevctl/scripts.d/callouts
%dir %{_prefix}/lib/mdevctl/scripts.d/notifiers
%{_mandir}/man8/mdevctl.8%{?ext_man}
%{_mandir}/man8/lsmdev.8%{?ext_man}
%{_datadir}/bash-completion/completions/mdevctl
%{_datadir}/bash-completion/completions/lsmdev
%changelog

BIN
vendor.tar.zst (Stored with Git LFS) Normal file

Binary file not shown.