Use OPI on openSUSE Slowroll

canute
1 min readSep 28, 2023

--

If you are getting —

opi Traceback (most recent call last): File "/bin/opi", line 79, in <module> binaries.extend(opi.search_published_binary('openSUSE', args.query))
File "/usr/lib/python3.11/site-packages/opi/__init__.py", line 317, in search_published_binary distribution = get_distribution(prefix=(obs_instance != 'openSUSE'))
File "/usr/lib/python3.11/site-packages/opi/__init__.py", line 78, in get_distribution return project
UnboundLocalError: cannot access local variable 'project' where it is not associated with a value

Solution :

  1. Edit /usr/lib/python3.11/site-packages/opi/__init__.py with root privilege
  2. Go to line 60 or near where you see def get_distribution
  3. Replace the code paragraph :
def get_distribution(prefix=False, use_releasever_variable=False):
os_release = get_os_release()
name = os_release['NAME']
version = os_release.get('VERSION') # VERSION is not set for TW
if version:
# strip prerelease suffix (eg. ' Alpha')
version = version.split(' ', 1)[0]
if name == 'openSUSE Tumbleweed' or name == 'openSUSE MicroOS':
project = 'openSUSE:Factory'
elif name == 'openSUSE Leap':
if use_releasever_variable:
project = 'openSUSE:Leap:$releasever'
else:
project = 'openSUSE:Leap:' + version
elif name.startswith('SLE'):
project = 'SLE' + version
if prefix:
project = 'openSUSE.org:' + project
return project

with

def get_distribution(prefix=False, use_releasever_variable=False):
return 'openSUSE:Factory' if not prefix else 'openSUSE.org:openSUSE:Factory'

4. Save the file and done ! :)

--

--

No responses yet