Bug 1695139 - Review Request: xonsh - A general purpose, Python-ish shell
Summary: Review Request: xonsh - A general purpose, Python-ish shell
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Miro Hrončok
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-04-02 14:46 UTC by Carmen Bianca Bakker
Modified: 2019-04-15 05:25 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2019-04-15 05:25:01 UTC
Type: ---
Embargoed:
mhroncok: fedora-review+


Attachments (Terms of Use)
licensecheck output (20.62 KB, text/plain)
2019-04-08 11:37 UTC, Miro Hrončok
no flags Details

Description Carmen Bianca Bakker 2019-04-02 14:46:00 UTC
Spec URL: https://gitlab.com/uploads/-/system/temp/03fb0edbb85fdc4c4e8be03e839e0c1b/xonsh.spec
SRPM URL: https://kojipkgs.fedoraproject.org//work/tasks/9285/33889285/xonsh-0.8.12-1.fc30.src.rpm
Description: xonsh is a Python-powered, cross-platform, Unix-gazing shell language and command prompt. The language is a superset of Python 3.4+ with additional shell primitives. xonsh (pronounced *conch*) is meant for the daily use of experts and novices alike.
Fedora Account System Username: carmenbianca

A working build can be found here: https://koji.fedoraproject.org/koji/taskinfo?taskID=33889284

The requirements for this package are only available on Fedora 30.

This is a submission for a package that was previously orphaned and retired. 

I am not currently sponsored, but I'd like to maintain this package.

Comment 1 Miro Hrončok 2019-04-02 14:53:00 UTC
I can work on both sponsoring you and reviewing this.

Comment 2 Miro Hrončok 2019-04-02 15:01:59 UTC
> # Don't use py3_build because it doesn't work

How? Define doesn't work.



> %prep
> # Remove bundled egg-info
> rm -rf xonsh.egg-info
> 
> %autosetup -n %{name}-%{version}

Removing anything before %setup or %autosetup makes no sense. It doesn't abort the build because rm -f doesn't fail on missing file, but it has no meaning.


> %{python3_sitelib}/xonsh
> %{python3_sitelib}/xontrib
> %{python3_sitelib}/xonsh-%{version}-py?.?.egg-info

Please add trialing slashes for directories, see https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/message/BJPQFQ2TORLZOWQRZ6DGWUIA4T5AS63A/



Note: Since this package tries to use setuptools if they are present, you better BR python3-setuptools directly in case it is not automatically transitively pulled by python3-devel, in order to make the build more deterministic. See also https://src.fedoraproject.org/rpms/python3/blob/master/f/python3.spec#_402 (line 402).

Comment 3 Carmen Bianca Bakker 2019-04-03 10:24:10 UTC
Thanks for the quick review.

(In reply to Miro Hrončok from comment #2)
> > # Don't use py3_build because it doesn't work
> 
> How? Define doesn't work.

I could add the explanation to the specfile, but it's basically as follows.  py3_build is defined as such:

carmen@carmen-thinkpad ~ $ rpm --showrc | grep -A4 py3_build
-13: py3_build	%{expand:\
  CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\
  %{__python3} %{py_setup} %{?py_setup_args} build --executable="%{__python3} %{py3_shbang_opts}" %{?*}
  sleep 1
}

Note the `--executable` flag. This becomes `/usr/bin/python3 -s`. xonsh takes this and rewrites the shebangs in its script files (e.g., /usr/bin/xonsh) using this executable. This becomes:

#!/usr/bin/python3 -s -u

Which, when executed, fails.  I could alter %{py3_shbang_opts}, but frankly I don't know how to do that.

> > %prep
> > # Remove bundled egg-info
> > rm -rf xonsh.egg-info
> > 
> > %autosetup -n %{name}-%{version}
> 
> Removing anything before %setup or %autosetup makes no sense. It doesn't
> abort the build because rm -f doesn't fail on missing file, but it has no
> meaning.

Agreed and removed. It's a leftover from the previous maintainer.

> > %{python3_sitelib}/xonsh
> > %{python3_sitelib}/xontrib
> > %{python3_sitelib}/xonsh-%{version}-py?.?.egg-info
> 
> Please add trialing slashes for directories, see
> https://lists.fedoraproject.org/archives/list/python-devel@lists.
> fedoraproject.org/message/BJPQFQ2TORLZOWQRZ6DGWUIA4T5AS63A/
> 
> 
> 
> Note: Since this package tries to use setuptools if they are present, you
> better BR python3-setuptools directly in case it is not automatically
> transitively pulled by python3-devel, in order to make the build more
> deterministic. See also
> https://src.fedoraproject.org/rpms/python3/blob/master/f/python3.spec#_402
> (line 402).

Done and done.

Spec URL: https://gitlab.com/snippets/1842176/raw
SRPM URL: https://kojipkgs.fedoraproject.org//work/tasks/1411/33911411/xonsh-0.8.12-1.fc31.src.rpm

Comment 4 Miro Hrončok 2019-04-03 10:51:20 UTC
(In reply to Carmen Bianca Bakker from comment #3)
> ...
> Note the `--executable` flag. This becomes `/usr/bin/python3 -s`. xonsh
> takes this and rewrites the shebangs in its script files (e.g.,
> /usr/bin/xonsh) using this executable. This becomes:
> 
> #!/usr/bin/python3 -s -u
> 
> Which, when executed, fails.  I could alter %{py3_shbang_opts}, but frankly
> I don't know how to do that.

Oh, so this is basically bz1335203.

I recommend doing this: use %py3_build and run this after:

pathfix.py -pni "%{__python3} %{py3_shbang_opts}u" %{buildroot}%{_bindir}/*

That way you get a manual workaround but you also make sure that both flags (u and s) are applied. You should probably add a comment with link to bz1335203.

Comment 5 Miro Hrončok 2019-04-03 10:53:36 UTC
> URL:            http://xon.sh

Please, use https, it works for this URL.

> %{python3_sitelib}/xonsh
> %{python3_sitelib}/xontrib

I'd recomend adding trailing slashes here as well. It makes the spec more readable (anyone can see those are directories).

---

I'll run automatic checks.

Comment 6 Miro Hrončok 2019-04-03 14:43:53 UTC
FedoraReview is scanning sources with licensecheck for a couple hours now. I'll let it run a while longer...

Comment 7 Carmen Bianca Bakker 2019-04-03 14:55:45 UTC
I'm running into the same problem currently. I inspected the directory and there doesn't appear to be anything strange in there. I killed the licensecheck program, and the review finished just fine.

Will address other concerns soon.

Comment 8 Miro Hrončok 2019-04-03 15:09:38 UTC
$ licensecheck -r . 
...
./xonsh/main.py: *No copyright* UNKNOWN
./xonsh/openpy.py: UNKNOWN
./xonsh/parser.py: *No copyright* UNKNOWN
(hangs here)


Apparently, next file in raw is xonsh-0.8.12/xonsh/parser_table.py and it has very long lines (33k chars). I guess this is a licensecheck bug.

Comment 9 Miro Hrončok 2019-04-03 15:20:39 UTC
https://bugzilla.redhat.com/show_bug.cgi?id=1695680

Comment 10 Miro Hrončok 2019-04-03 15:45:55 UTC
Package Review
==============

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


Issues:
=======

xonsh.noarch: E: wrong-script-interpreter /usr/lib/python3.7/site-packages/xonsh/xoreutils/_which.py /usr/bin/env python
xonsh.noarch: E: non-executable-script /usr/lib/python3.7/site-packages/xonsh/xoreutils/_which.py 644 /usr/bin/env python

(drop the shebang)

Upstream tests are not run in %check (there is no %check).


The SRPM spec and posted spec are not identical.
I'm not sure what was build as part of the automated check.
This is actually FedoraReview not recognizing the weird spec link.
Could you please repost the spec to an URL that ends with /xonsh.spec ?

===== 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.
[x]: License field in the package spec file matches the actual license.
[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
[x]: Package uses nothing in %doc for runtime.
[x]: Package consistently uses macros (instead of hard-coded directory
     names).
[x]: Package is named according to the Package Naming Guidelines.
[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.
[x]: Requires correct, justified where necessary.
[x]: Spec file is legible and written in American English.
[-]: Package contains systemd file(s) if in need.
[x]: 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.
[x]: Package complies to the Packaging Guidelines
[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 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.
[x]: A package which is used by another package via an egg interface should
     provide egg info.
[x]: 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:
[-]: 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.
[?]: Latest version is packaged.
[x]: Package does not include license text files separate from upstream.
[-]: Description and summary sections in the package spec file contains
     translations for supported Non-English languages, if available.
[x]: 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]: Sources can be downloaded from URI in Source: tag
[x]: SourceX is a working URL.
[x]: Spec use %global instead of %define unless justified.

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

Generic:
[!]: Spec file according to URL is the same as in SRPM.
     Note: Spec file as given by url is not the same as in SRPM (see
     attached diff).
     See: (this test has no URL)
[x]: Rpmlint is run on all installed packages.
     Note: There are rpmlint messages (see attachment).


Rpmlint
-------
Checking: xonsh-0.8.12-1.fc31.noarch.rpm
          xonsh-0.8.12-1.fc31.src.rpm
xonsh.noarch: W: spelling-error Summary(en_US) ish -> is, sh, dish
xonsh.noarch: W: spelling-error %description -l en_US superset -> super set, super-set, supersede
xonsh.noarch: E: wrong-script-interpreter /usr/lib/python3.7/site-packages/xonsh/xoreutils/_which.py /usr/bin/env python
xonsh.noarch: E: non-executable-script /usr/lib/python3.7/site-packages/xonsh/xoreutils/_which.py 644 /usr/bin/env python
xonsh.noarch: W: no-manual-page-for-binary xon.sh
xonsh.noarch: W: no-manual-page-for-binary xonsh
xonsh.noarch: W: no-manual-page-for-binary xonsh-cat
xonsh.src: W: spelling-error Summary(en_US) ish -> is, sh, dish
xonsh.src: W: spelling-error %description -l en_US superset -> super set, super-set, supersede
xonsh.src: W: strange-permission xonsh-0.8.12.tar.gz 600
xonsh.src: W: strange-permission xonsh.spec 600
2 packages and 0 specfiles checked; 2 errors, 9 warnings.




Rpmlint (installed packages)
----------------------------

xonsh.noarch: W: spelling-error Summary(en_US) ish -> is, sh, dish
xonsh.noarch: W: spelling-error %description -l en_US superset -> super set, super-set, supersede
xonsh.noarch: W: invalid-url URL: http://xon.sh <urlopen error [Errno -2] Name or service not known>
xonsh.noarch: E: wrong-script-interpreter /usr/lib/python3.7/site-packages/xonsh/xoreutils/_which.py /usr/bin/env python
xonsh.noarch: E: non-executable-script /usr/lib/python3.7/site-packages/xonsh/xoreutils/_which.py 644 /usr/bin/env python
xonsh.noarch: W: no-manual-page-for-binary xon.sh
xonsh.noarch: W: no-manual-page-for-binary xonsh
xonsh.noarch: W: no-manual-page-for-binary xonsh-cat
1 packages and 0 specfiles checked; 2 errors, 6 warnings.



Source checksums
----------------
https://files.pythonhosted.org/packages/source/x/xonsh/xonsh-0.8.12.tar.gz :
  CHECKSUM(SHA256) this package     : a528af1900c7eae2a007644721b9b2182051f0555ebd90dc1c2114e8a82fd2b6
  CHECKSUM(SHA256) upstream package : a528af1900c7eae2a007644721b9b2182051f0555ebd90dc1c2114e8a82fd2b6


Requires
--------
xonsh (rpmlib, GLIBC filtered):
    /usr/bin/python3
    /usr/bin/sh
    python(abi)
    python3-distro
    python3-ply
    python3-prompt-toolkit
    python3-pygments
    python3-setproctitle



Provides
--------
xonsh:
    python3.7dist(xonsh)
    python3dist(xonsh)
    xonsh



Diff spec file in url and in SRPM
---------------------------------
--- /home/churchyard/rpmbuild/FedoraReview/1695139-xonsh/srpm/xonsh.spec	2019-04-03 13:30:03.529683238 +0200
+++ /home/churchyard/rpmbuild/FedoraReview/1695139-xonsh/srpm-unpacked/xonsh.spec	2019-04-03 12:01:31.000000000 +0200
@@ -10,4 +10,5 @@
 
 BuildRequires:  python3-devel
+BuildRequires:  python3-setuptools
 BuildRequires:  python3-ply
 Requires:       python3-ply
@@ -25,12 +26,8 @@
 
 %prep
-# Remove bundled egg-info
-rm -rf xonsh.egg-info
-
 %autosetup -n %{name}-%{version}
 
-
 %build
-# Don't use py3_build because it doesn't work
+# Don't use py3_build because it doesn't work.
 %{__python3} setup.py build
 
@@ -46,5 +43,5 @@
 %{python3_sitelib}/xonsh
 %{python3_sitelib}/xontrib
-%{python3_sitelib}/xonsh-%{version}-py?.?.egg-info
+%{python3_sitelib}/xonsh-%{version}-py?.?.egg-info/
 
 %changelog


Generated by fedora-review 0.7.0 (fed5495) last change: 2019-03-17
Command line :try-fedora-review -b 1695139 -m fedora-rawhide-x86_64
Buildroot used: fedora-rawhide-x86_64
Active plugins: Shell-api, Generic, Python
Disabled plugins: Java, Perl, R, Haskell, SugarActivity, fonts, C/C++, Ocaml, PHP, Ruby
Disabled flags: EPEL6, EPEL7, DISTTAG, BATCH, EXARCH

Comment 11 Carmen Bianca Bakker 2019-04-03 16:16:36 UTC
I've updated the spec to improve the following things:

- Use https link for xon.sh.
- Use py3_dist in Requires.
- Use py3_build and fix the shebangs with pathfix.py.
- Remove the shebang of _which.py.
- Run the tests.
- Add trailing /s to directories.

Not all of the tests pass, so I've ignored them for the sake of getting a passing build. The tests only fail inside of the mock environment. Not really sure how to address this.

Spec URL: https://gitlab.com/uploads/-/system/temp/157a4482b32712ad0bdd2646c9d19792/xonsh.spec
SRPM URL: https://kojipkgs.fedoraproject.org//work/tasks/1475/33921475/xonsh-0.8.12-1.fc31.src.rpm

Comment 12 Carmen Bianca Bakker 2019-04-06 14:11:06 UTC
Updated the spec again to get rid of duplicate *PYTEST.pyc files in __pycache__.

Spec URL: https://gitlab.com/uploads/-/system/temp/ca1f0014127015fd67722ab4a79da0d5/xonsh.spec
SRPM URL: https://kojipkgs.fedoraproject.org//work/tasks/674/34000674/xonsh-0.8.12-1.fc31.src.rpm

Comment 13 Miro Hrončok 2019-04-07 18:06:29 UTC
> The tests only fail inside of the mock environment. Not really sure how to address this.

Try exporting custom PATH and MANPATH form some of the failing tests to actually see the executables and manpages.

For tests that fail due to missing internet connection, feel free to keep them disabled. If you really want to get fancy, do a %bcond_with internet (see python-sphinx as an example).

I appreciate the ignored breakdown in comment.

I see you ignore entire files. If you only want to skip some of the tests, examine -k option of pytest. It can do bool operations, e.g. -k "not (remote or web or (slow and tedious))".

Comment 14 Carmen Bianca Bakker 2019-04-07 20:49:58 UTC
I found the problem(s):

- The tests very specifically need to be run within a xonsh shell using the `py.test-3` command. Calling `py.test-3` from bash or calling `python3 -m pytest` from xonsh results in failing tests.

- There is an error in `%{_bindir}/xon.sh`.

- The tests in the tarball are incomplete. i.e., files are missing.

I have submitted merge requests upstream for the last two bullet points:

- https://github.com/xonsh/xonsh/pull/3068

- https://github.com/xonsh/xonsh/pull/3069

This is a WIP specfile that doesn't currently build because of failing tests, but would run if upstream released those fixes (I think): https://gitlab.com/snippets/1844781

Should we wait for upstream to release the fixes?

Comment 15 Miro Hrončok 2019-04-08 05:49:32 UTC
Nice work!

> Should we wait for upstream to release the fixes?

Nah, just keep them in mind so you can unignore some tests when the changes are merged and released.

Also, you should be able to use github tagged tarball to workaround missing files.

Comment 17 Carmen Bianca Bakker 2019-04-08 08:40:56 UTC
The suggested link gives the same tarball. I found the correct link that gives a tarball of the full copy of the git repo, and used that for this release.

I also finally got the thing to work. Some steps:

- BuildRequires git and man-db
- Alter PATH to include %{buildroot}%{_bindir} for the test
- Use tarball of the full copy of the git repo (as stated above)

I've also added a little cleanup of some generated *PYTEST.pyc files.

One test keeps non-deterministically failing, however, and that is test_main.  I have disabled that test for now, and will file an upstream bug report about that.

Spec URL: https://gitlab.com/uploads/-/system/temp/f2b13a6204fca6e2cc8fd4eb57fde734/xonsh.spec
SRPM URL: https://kojipkgs.fedoraproject.org//work/tasks/5786/34045786/xonsh-0.8.12-1.fc31.src.rpm

Comment 18 Carmen Bianca Bakker 2019-04-08 09:10:21 UTC
https://github.com/xonsh/xonsh/issues/3070

Comment 19 Miro Hrončok 2019-04-08 09:27:08 UTC
Setting PYTHONDONTWRITEBYTECODE=1 during tests might eliminate the need for the cleanup.

Comment 20 Carmen Bianca Bakker 2019-04-08 09:55:20 UTC
You're right.  Added that variable and removed the cleanup.

Also finally figured out a way to not have to struggle with those URLs anymore. The below URLs should stay up-to-date with any further changes, but I'm fairly confident that the package is looking good.

Spec URL: https://carmenbianca.fedorapeople.org/review/xonsh.spec
SRPM URL: https://carmenbianca.fedorapeople.org/review/xonsh-0.8.12-1.fc31.src.rpm

Comment 21 Miro Hrončok 2019-04-08 11:28:43 UTC
Running final check by FedoraReview.

Comment 22 Miro Hrončok 2019-04-08 11:30:08 UTC
Do you have some reviews done by you? If not, I recommend to do that. To sponsor you, I should be able to tell if you can do that.
I've been impressed by the packaging work here so far, so sponsoring shouldn't be hard.

Comment 23 Miro Hrončok 2019-04-08 11:37:52 UTC
Created attachment 1553558 [details]
licensecheck output

The new tarball made it trough licensecheck. There are some MIT (Expat) files apparently. Could you check?

Comment 24 Carmen Bianca Bakker 2019-04-08 12:07:14 UTC
I did a review here: https://bugzilla.redhat.com/show_bug.cgi?id=1653201

The two files detected as MIT contain reused code from different projects, with attribution.  I have updated the License: thingamajig to account for those files.

Comment 25 Miro Hrončok 2019-04-08 12:53:28 UTC
Package APPROVED. And you are sponsored, feel free to ping me when in need for help! For xonsh specifically I suggest adding the @python-sig group as a co-maintainer.

Comment 26 Carmen Bianca Bakker 2019-04-08 13:04:24 UTC
Thanks! I'll make sure to do that.  Thank you very much for your time and help with the review :)

Comment 27 Miro Hrončok 2019-04-10 16:42:35 UTC
I see https://bodhi.fedoraproject.org/updates/FEDORA-2019-0b46e5934f

If you add this bugzilla number to that update, bodhi will eventually close this.

Comment 28 Fedora Update System 2019-04-14 08:34:04 UTC
xonsh-0.8.12-1.fc30 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-0b46e5934f

Comment 29 Fedora Update System 2019-04-15 00:02:18 UTC
xonsh-0.8.12-1.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, 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.