Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1982135 - tito build fails with ImportError: No module named request
Summary: tito build fails with ImportError: No module named request
Keywords:
Status: MODIFIED
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: tito
Version: epel7
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Kadlčík
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-07-14 09:56 UTC by Pavol Babinčák
Modified: 2021-07-15 08:24 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Pavol Babinčák 2021-07-14 09:56:05 UTC
Description of problem:
tito build cannot be used on RHEL 7 machine which has python2 interpreter

Version-Release number of selected component (if applicable):
tito-0.6.18-1.el7

How reproducible:
Always

Steps to Reproduce:
0. $ podman run --rm -ti rhel7 bash   
# yum-config-manager --enable rhel-7-server-optional-rpms > /dev/null
# yum-config-manager --enable rhel-7-server-extras-rpms > /dev/null
# yum --quiet -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
1. Install tito: yum --quiet -y install tito
2. Take any configured project, e.g. tito repo itself: git clone https://github.com/rpm-software-management/tito && cd ./tito
3. Try to create a tarball: tito build --offline --tgz

Actual results:
Creating output directory: /tmp/tito
Traceback (most recent call last):
  File "/usr/bin/tito", line 9, in <module>
    load_entry_point('tito==0.6.18', 'console_scripts', 'tito')()
  File "/usr/lib/python2.7/site-packages/tito/cli.py", line 910, in main
    CLI().main(sys.argv[1:])
  File "/usr/lib/python2.7/site-packages/tito/cli.py", line 209, in main
    return module.main(argv)
  File "/usr/lib/python2.7/site-packages/tito/cli.py", line 391, in main
    builder_class=self.options.builder, **kwargs)
  File "/usr/lib/python2.7/site-packages/tito/common.py", line 161, in create_builder
    "builder"))
  File "/usr/lib/python2.7/site-packages/tito/common.py", line 976, in get_class_by_name
    mod = __import__(module, globals(), locals(), [class_name])
  File "/usr/lib/python2.7/site-packages/tito/builder/__init__.py", line 6, in <module>
    from tito.builder.main import \
  File "/usr/lib/python2.7/site-packages/tito/builder/main.py", line 24, in <module>
    import urllib.request
ImportError: No module named request


Expected results:
No error, e.g.:

Building package [tito-0.6.18-1]
Wrote: /tmp/tito/tito-0.6.18.tar.gz


Additional info:

I believe this bug was introduced with https://github.com/rpm-software-management/tito/commit/5de167e0ff134fa682ccac55f511ce04877c1707 which uses python3-only import.

Comment 1 Jakub Kadlčík 2021-07-14 22:17:43 UTC
Thank you for the report Pavol and for taking the time to point out the source of the problem.

I had a little difficulty with the reproducer, so I modified it slightly.

$ docker run -it centos:7 bash
# yum install epel-release
# yum install tito 
# git clone https://github.com/rpm-software-management/tito && cd ./tito
# tito build --offline --tgz

The proposed fix is here: https://github.com/rpm-software-management/tito/pull/409

Comment 2 Pavol Babinčák 2021-07-15 08:24:16 UTC
(In reply to Jakub Kadlčík from comment #1)
> Thank you for the report Pavol and for taking the time to point out the
> source of the problem.

No worries! I guess I should've written that I have run those commands on already subscribed RHEL 8 machine.

I guess you might have run into issue with that - subscription manager is disabled in containers in that case but one could use yum-config-manager to enable repositories.


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