Bug 1825456 - Review Request: libvirt-test-API - Python based regression tests for libvirt API
Summary: Review Request: libvirt-test-API - Python based regression tests for libvirt API
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-04-18 08:18 UTC by lnie
Modified: 2020-07-15 01:11 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2020-07-15 01:11:22 UTC
Type: ---
Embargoed:
rjones: fedora-review+


Attachments (Terms of Use)

Description lnie 2020-04-18 08:18:37 UTC
Spec URL:https://download.copr.fedorainfracloud.org/results/lnie/libvirt-test-API/fedora-31-x86_64/01340912-libvirt-test-api/libvirt-test-api.spec
SRPM URL:https://download.copr.fedorainfracloud.org/results/lnie/libvirt-test-API/fedora-31-x86_64/01340912-libvirt-test-api/libvirt-test-api-1.0-1.fc31.src.rpm
Description: libvirt-test-API is designed to test the functionality of libvirt
through Python bindings of libvirt API. It supports writing cases by using the Python language. It supports testing for KVM and
Xen either paravirt (for which only Fedora and Red Hat Enterprise
Linux guests are currently supported) as well as fully virtualized
guests.

Fedora Account System Username:lnie

Comment 2 Richard W.M. Jones 2020-06-05 13:20:35 UTC
Some general comments on the spec file:

(1) There are some typos / formatting issues in the very first # comment
at the top of the file.  It would be better reformatted as:

# Disable the shebangs checks on scripts that currently don't
# define a Python version. The point here is that these scripts
# will be copied to guest VM instances, which may be running
# operating systems that can have either Python 2 or Python 3,
# but it's impossible to know for sure at packaging time.

(2) In the section %if %{with_python3} ... %else ... %endif that
defines BuildRequires and Requires, it is better to factor out the
common BRs/Rs, ie:

BuildRequires: mock

%if %{with_python3}
BuildRequires: python3-devel
BuildRequires: python3-lxml
BuildRequires: python3-pytest
BuildRequires: python3-setuptools
BuildRequires: python3-six
BuildRequires: python3-attrs
BuildRequires: python3-libvirt
BuildRequires: python3-pexpect

Requires: qemu-img
Requires: python3-six
Requires: python3-lxml
Requires: python3-libvirt
%else
BuildRequires: python2-devel
BuildRequires: python2-pytest
BuildRequires: python2-setuptools
BuildRequires: python2-attrs
BuildRequires: python-six
BuildRequires: python2-pexpect

Requires: python-six
Requires: python-lxml
%endif

Requires: libvirt
Requires: qemu-kvm
Requires: virt-install

(3) Is it really the case that qemu-img is only required if using
Python 3, or is that a mistake revealed by the refactoring?

(4) Whitespace in:

%if 0%{?rhel} && 0%{?rhel} < 8
Requires: libvirt-python
%endif

(5) The %files section should also be refactored.  You can see that
it's much clearer afterwards:

%files
%doc README.md
%license LICENSE
%{_bindir}/%{name}
%if %{with_python2}
%{python2_sitelib}/libvirt_test_api*
%{python2_sitelib}/libvirttestapi*
%endif
%if %{with_python3}
%{python3_sitelib}/libvirt_test_api*
%{python3_sitelib}/libvirttestapi*
%endif
%{_datadir}/libvirt-test-api*

I'll do a formal review in a minute.

Comment 3 Richard W.M. Jones 2020-06-05 14:03:41 UTC
Package Review
==============

Legend:
[x] = Pass, [!] = Fail, [-] = Not applicable, [?] = Not evaluated
[ ] = Manual review needed



===== MUST items =====

Generic:
[x]: Package is licensed with an open-source compatible license and meets
     other legal requirements as defined in the legal section of Packaging
     Guidelines.

License if GPLv2+ and upstream includes a license file.

[x]: License field in the package spec file matches the actual license.
     Note: Checking patched sources after %prep for licenses. Licenses
     found: "Unknown or generated", "GNU Lesser General Public License",
     "GNU General Public License (v2 or later)", "GPL (v2 or later)". 414
     files have unknown license. Detailed output of licensecheck in
     /var/tmp/1825456-libvirt-test-api/licensecheck.txt

The vast majority of files have correct licenses in them, and
the ones which don't are things like documentation, conf, XML
where adding a license is hard.

[x]: Package contains no bundled libraries without FPC exception.
[x]: Changelog in prescribed format.
[x]: Sources contain only permissible code or content.
[-]: Package contains desktop file if it is a GUI application.
[-]: Development files must be in a -devel package

Not really applicable because this isn't a library.

[-]: Package uses nothing in %doc for runtime.
[x]: Package consistently uses macros (instead of hard-coded directory
     names).
[ ]: Package is named according to the Package Naming Guidelines.

I started a thread on devel list which should appear here:
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/2020/6/

[x]: Package does not generate any conflict.
[x]: Package obeys FHS, except libexecdir and /usr/target.
[-]: If the package is a rename of another package, proper Obsoletes and
     Provides are present.
[ ]: Requires correct, justified where necessary.

Requires: qemu-img may be missing.

[x]: Spec file is legible and written in American English.
[-]: Package contains systemd file(s) if in need.
[-]: Package is not known to require an ExcludeArch tag.
[-]: Large documentation must go in a -doc subpackage. Large could be size
     (~1MB) or number of files.
     Note: Documentation size is 10240 bytes in 1 files.

There is documentation supplied upstream but it is not packaged.

[ ]: Package complies to the Packaging Guidelines

Unclear on whether Python packaging guidelines apply.  See
thread on devel list.

[x]: Package successfully compiles and builds into binary rpms on at least
     one supported primary architecture.
[x]: Package installs properly.
[x]: Rpmlint is run on all rpms the build produces.
     Note: There are rpmlint messages (see attachment).
[x]: If (and only if) the source package includes the text of the
     license(s) in its own file, then that file, containing the text of the
     license(s) for the package is included in %license.
[x]: Package requires other packages for directories it uses.
[x]: Package must own all directories that it creates.
[x]: Package does not own files or directories owned by other packages.
[x]: Package uses either %{buildroot} or $RPM_BUILD_ROOT
[x]: Package does not run rm -rf %{buildroot} (or $RPM_BUILD_ROOT) at the
     beginning of %install.
[x]: Macros in Summary, %description expandable at SRPM build time.
[x]: Dist tag is present.
[x]: Package does not contain duplicates in %files.
[x]: Permissions on files are set properly.
[x]: Package must not depend on deprecated() packages.
[x]: Package use %makeinstall only when make install DESTDIR=... doesn't
     work.
[x]: Package is named using only allowed ASCII characters.
[x]: Package does not use a name that already exists.
[x]: Package is not relocatable.
[x]: Sources used to build the package match the upstream source, as
     provided in the spec URL.
[x]: Spec file name must match the spec package %{name}, in the format
     %{name}.spec.
[x]: File names are valid UTF-8.
[x]: Packages must not store files under /srv, /opt or /usr/local

Python:
[x]: Python eggs must not download any dependencies during the build
     process.
[-]: A package which is used by another package via an egg interface should
     provide egg info.
[ ]: Package meets the Packaging Guidelines::Python
[x]: Package contains BR: python2-devel or python3-devel
[x]: Packages MUST NOT have dependencies (either build-time or runtime) on
     packages named with the unversioned python- prefix unless no properly
     versioned package exists. Dependencies on Python packages instead MUST
     use names beginning with python2- or python3- as appropriate.
[x]: Python packages must not contain %{pythonX_site(lib|arch)}/* in %files
[x]: Binary eggs must be removed in %prep

===== SHOULD items =====

Generic:
[!]: Sources can be downloaded from URI in Source: tag
     Note: Could not download Source0: https://gitlab.com/libvirt/libvirt-
     test-API/-/archive/1.0/libvirt-test-api-1.0.tar.gz
     See: https://docs.fedoraproject.org/en-US/packaging-
     guidelines/SourceURL/

The source URL is indeed wrong - please fix it.

[x]: If the source package does not include license text(s) as a separate
     file from upstream, the packager SHOULD query upstream to include it.
[x]: Final provides and requires are sane (see attachments).
[?]: Package functions as described.
[x]: Latest version is packaged.

Yes, 1.0 is packaged which is the latest release.

[x]: Package does not include license text files separate from upstream.
[-]: SourceX tarball generation or download is documented.
[-]: Sources are verified with gpgverify first in %prep if upstream
     publishes signatures.
     Note: gpgverify is not used.
[-]: Description and summary sections in the package spec file contains
     translations for supported Non-English languages, if available.
[-]: Package should compile and build into binary rpms on all supported
     architectures.
[-]: %check is present and all tests pass.
[ ]: Packages should try to preserve timestamps of original installed
     files.
[x]: Reviewer should test that the package builds in mock.
[x]: Buildroot is not present
[x]: Package has no %clean section with rm -rf %{buildroot} (or
     $RPM_BUILD_ROOT)
[x]: No file requires outside of /etc, /bin, /sbin, /usr/bin, /usr/sbin.
[x]: Packager, Vendor, PreReq, Copyright tags should not be in spec file
[x]: SourceX is a working URL.
[x]: Spec use %global instead of %define unless justified.

===== EXTRA items =====

Generic:
[x]: Rpmlint is run on all installed packages.
     Note: There are rpmlint messages (see attachment).
[x]: Spec file according to URL is the same as in SRPM.


Rpmlint
-------
Checking: libvirt-test-api-1.0-1.fc33.noarch.rpm
          libvirt-test-api-1.0-1.fc33.src.rpm
libvirt-test-api.noarch: W: spelling-error %description -l en_US paravirt -> parasite
libvirt-test-api.noarch: W: spelling-error %description -l en_US virtualized -> ritualized, visualized, actualized
libvirt-test-api.noarch: W: no-manual-page-for-binary libvirt-test-api
libvirt-test-api.src: W: spelling-error %description -l en_US paravirt -> parasite
libvirt-test-api.src: W: spelling-error %description -l en_US virtualized -> ritualized, visualized, actualized
2 packages and 0 specfiles checked; 0 errors, 5 warnings.




Rpmlint (installed packages)
----------------------------
libvirt-test-api.noarch: W: spelling-error %description -l en_US paravirt -> parasite
libvirt-test-api.noarch: W: spelling-error %description -l en_US virtualized -> ritualized, visualized, actualized
libvirt-test-api.noarch: W: invalid-url URL: https://gitlab.com/libvirt/libvirt-test-API <urlopen error [Errno -2] Name or service not known>
libvirt-test-api.noarch: W: no-manual-page-for-binary libvirt-test-api
1 packages and 0 specfiles checked; 0 errors, 4 warnings.


I believe you can ignore all these rpmlint warnings, except
the one about invalid-url which has already been noted in the
review above.


Requires
--------
libvirt-test-api (rpmlib, GLIBC filtered):
    /usr/bin/python
    /usr/bin/python3
    libvirt
    python(abi)
    python3-libvirt
    python3-lxml
    python3-six
    python3.9dist(attrs)
    python3.9dist(lxml)
    python3.9dist(pexpect)
    python3.9dist(setuptools)
    qemu-img
    qemu-kvm
    virt-install



Provides
--------
libvirt-test-api:
    libvirt-test-api
    python3.9dist(libvirt-test-api)
    python3dist(libvirt-test-api)



Generated by fedora-review 0.7.5 (5fa5b7e) last change: 2020-02-16
Command line :/usr/bin/fedora-review -b 1825456
Buildroot used: fedora-rawhide-x86_64
Active plugins: Shell-api, Python, Generic
Disabled plugins: fonts, SugarActivity, PHP, Ocaml, C/C++, Java, Haskell, Perl, R
Disabled flags: EPEL6, EPEL7, DISTTAG, BATCH, EXARCH

Comment 4 Richard W.M. Jones 2020-06-05 15:16:22 UTC
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/2IXDR32RWPKHZWA43HVHBZFL5FHHBKNH/

Please fix the other things while we're waiting for a
response from the Fedora community.

Comment 5 Miro Hrončok 2020-06-05 16:20:35 UTC
%check
%if %{with_python3}
%{__python3} setup.py test
%else
%{__python2} setup.py test
%endif

%build
%if %{with_python3}
%py3_build
%else
%py2_build
%endif

%install
%if %{with_python3}
%py3_install
%else
%py2_install
%endif

...

%files
%if %{with_python2}
%{python2_sitelib}/libvirt_test_api*
%{python2_sitelib}/libvirttestapi*
%endif
%if %{with_python3}
%{python3_sitelib}/libvirt_test_api*
%{python3_sitelib}/libvirttestapi*
%endif





What about:



%if %{with_python3}
%global __python %{__python3}
%else
%global __python %{__python2}
%endif

...

%check
%{__python} setup.py test

%build
%py_build

%install
%py_install

...

%files
%{python_sitelib}/libvirt_test_api*
%{python_sitelib}/libvirttestapi*

Comment 6 Richard W.M. Jones 2020-06-06 06:56:57 UTC
Lili, could you please also see Miro's question here:
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/3UL6WXFP4JHUJRH6BUT5XSWLKTTDT5XE/

Comment 7 lnie 2020-06-06 15:14:38 UTC
>In the section %if %{with_python3} ... %else ... %endif that defines BuildRequires and Requires,
> it is better to factor out the common BRs/Rs,

  yeah,much clearer now,thanks.

>Is it really the case that qemu-img is only required if using
>Python 3, or is that a mistake revealed by the refactoring?

Sorry,I shouldn't overlook python2 part even if we don't use it in Fedora,
won't make this kind of mistake again.



>There is documentation supplied upstream but it is not packaged.
 You mean I should package the pdf ,right?

>The source URL is indeed wrong - please fix it.

 I can wget https://gitlab.com/libvirt/libvirt-test-API/-/archive/1.0/libvirt-test-api-1.0.tar.gz manually,
 and I can open https://gitlab.com/libvirt/libvirt-test-API successfully,will try to work it out.

> Please fix the other things while we're waiting for a
> response from the Fedora community.
  Sure,thanks a lot for your review:)


> Lili, could you please also see Miro's question here:
> https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/3UL6WXFP4JHUJRH6BUT5XSWLKTTDT5XE/
  Sure thing,replied.

Comment 8 lnie 2020-06-06 15:16:51 UTC
(In reply to Miro Hrončok from comment #5)
 
> What about:
> 
> 
> 
> %if %{with_python3}
> %global __python %{__python3}
> %else
> %global __python %{__python2}
> %endif
> 
> ...
> 
> %check
> %{__python} setup.py test
> 
> %build
> %py_build
> 
> %install
> %py_install
> 
> ...
> 
> %files
> %{python_sitelib}/libvirt_test_api*
> %{python_sitelib}/libvirttestapi*

Will update the spec file accordingly,thanks for your review.

Comment 9 Richard W.M. Jones 2020-06-08 08:28:20 UTC
(In reply to lnie from comment #7)
> >There is documentation supplied upstream but it is not packaged.
>  You mean I should package the pdf ,right?

What is the license of the PDF file?  In any case it's up to you whether
or not to package this file.  If packaged it should go into a -doc subpackage
because it's quite large.
https://docs.fedoraproject.org/en-US/packaging-guidelines/#_documentation

> >The source URL is indeed wrong - please fix it.
> 
>  I can wget
> https://gitlab.com/libvirt/libvirt-test-API/-/archive/1.0/libvirt-test-api-1.
> 0.tar.gz manually,
>  and I can open https://gitlab.com/libvirt/libvirt-test-API
> successfully,will try to work it out.

Weirdly it works now, but didn't when I tried it on Friday.

Comment 10 lnie 2020-06-09 07:41:29 UTC
Hi Richard,

> What is the license of the PDF file?

GFDL.

> Weirdly it works now, but didn't when I tried it on Friday.

I also have seen the URL error when I ran fedora-review on this package,and I thought it is a wrong alert.
I have tried several times yesterday and today,it works all the time,so there is no need for me to change it,right?

Comment 11 Richard W.M. Jones 2020-06-09 08:32:00 UTC
(In reply to lnie from comment #10)
> Hi Richard,
> 
> > What is the license of the PDF file?
> 
> GFDL.

That's a "good license" (https://fedoraproject.org/wiki/Licensing:Main#Good_Licenses_2)
This means if you want to you could package this file in a separate
-doc package, but that's optional.

> > Weirdly it works now, but didn't when I tried it on Friday.
> 
> I also have seen the URL error when I ran fedora-review on this package,and
> I thought it is a wrong alert.
> I have tried several times yesterday and today,it works all the time,so
> there is no need for me to change it,right?

No need to change this as the URL now seems correct.  May have been
a temporary server problem.

Comment 13 Richard W.M. Jones 2020-06-17 09:39:22 UTC
Nearly there, we're getting into nitpicking now:

(1) Please fix the whitespace in:

Requires:libvirt-python

(2) BuildRequires: mock is listed twice.

(3) It would be nice if the %check section came after the %install section.
This reflects the order in which rpmbuild runs the sections: %prep -> %build -> %install -> %check

(4) You said in your answer to Miro here:
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/IVTYKIOMCQPMW5SJZZ7LKUQ5SMVIULEM/
that you would update the doc.  Does this package include the updated
documentation with this change?

Comment 15 Richard W.M. Jones 2020-06-17 16:30:00 UTC
I was chatting with Miro on IRC and he thinks the Requires: /usr/bin/python
which is generated may be incorrect.  (I don't really know).

17:25 < mhroncok> rwmjones: the /usr/bin/python require is generated by the "template" files
17:26 < mhroncok> rwmjones: hence I suppose the runtime requirement should not be generated by them, as they will not be executed on the system where 
                  the package is installed
17:27 < mhroncok> rwmjones: the filter will make them be not considered when generating the requires

There is a way to filter out the require, but I'm not very clear if
someone installing libvirt-test-api would require /usr/bin/python
in order to use the package at all, or if it's optional.

Comment 16 lnie 2020-06-18 03:45:54 UTC
Hi Richard,

(In reply to Richard W.M. Jones from comment #15)
> I was chatting with Miro on IRC and he thinks the Requires: /usr/bin/python
> which is generated may be incorrect.  (I don't really know).
> 
> 17:25 < mhroncok> rwmjones: the /usr/bin/python require is generated by the
> "template" files
> 17:26 < mhroncok> rwmjones: hence I suppose the runtime requirement should
> not be generated by them, as they will not be executed on the system where 
>                   the package is installed
> 17:27 < mhroncok> rwmjones: the filter will make them be not considered when
> generating the requires
> 
> There is a way to filter out the require, but I'm not very clear if
> someone installing libvirt-test-api would require /usr/bin/python
> in order to use the package at all, or if it's optional.

 /usr/bin/python requires is generated by jenkins.py and virtlab.py in excute  dir.
 jenkins.py is used by virt-QE to work with libvirt-ci,and virt-QE also use virtlab.py frequently.

Comment 17 Richard W.M. Jones 2020-06-18 08:13:35 UTC
**Package is APPROVED by rjones**

Comment 18 Gwyn Ciesla 2020-06-18 15:45:54 UTC
(fedscm-admin):  The Pagure repository was created at https://src.fedoraproject.org/rpms/libvirt-test-API

Comment 19 Fedora Update System 2020-07-06 02:30:48 UTC
FEDORA-2020-aeb83bf598 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-aeb83bf598

Comment 20 Fedora Update System 2020-07-07 01:13:47 UTC
FEDORA-2020-aeb83bf598 has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf install --enablerepo=updates-testing --advisory=FEDORA-2020-aeb83bf598 \*`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-aeb83bf598

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 21 Fedora Update System 2020-07-15 01:11:22 UTC
FEDORA-2020-aeb83bf598 has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.