openSUSE / obs-service-go_modules

OBS Source Service to download, verify, and vendor Go module dependency sources
GNU General Public License v2.0
19 stars 18 forks source link

UnboundLocalError: local variable 'version' referenced before assignment #12

Closed tacerus closed 3 years ago

tacerus commented 3 years ago

Hi,

I receive the following and could not find anything in the documentation and previous issues:

osc service disabledrun
INFO:obs-service-go_modules:Autodetecting archive since no archive param provided in _service
INFO:obs-service-go_modules:Archive autodetected at /mnt/veracrypt1/packaging/obs/home:crameleon/ssh-chat/ssh-chat-1.10.tar.gz
Traceback (most recent call last):
  File "/usr/lib/obs/service/go_modules", line 103, in <module>
    archive = args.archive or archive_autodetect()
  File "/usr/lib/obs/service/go_modules", line 93, in archive_autodetect
    if not version:
UnboundLocalError: local variable 'version' referenced before assignment
Aborting: service call failed:  /usr/lib/obs/service/go_modules --outdir /mnt/veracrypt1/packaging/obs/home:crameleon/ssh-chat/tmphwusi156.go_modules.service

I tried various _service file options and currently have the following:

<services>
  <service name="go_modules" mode="disabled">
  </service>
  <service name="set_version" mode="disabled">
    <param name="basename">ssh-chat</param>
  </service>
  <service name="recompress" mode="disabled">
    <param name="file">*.tar</param>
    <param name="compression">gz</param>
  </service>
</services>

The directory structure looks like this, where the .tar archive is one I can't remember creating myself:

.   .lock  _service      ssh-chat-1.10-0.1.x86_64.rpm  ssh-chat-1.10.tar.gz  v1.10.tar.gz
..  .osc   _servicedata  ssh-chat-1.10.tar             ssh-chat.spec

Would appreciate any help in using this service. Thank you.

tacerus commented 3 years ago

Manually specifying the archive file solved it, which is weird, because the exact same setup (without manually specifying it) worked just fine with a different package of mine. Maybe the "-" character in the filename caused confusion - I did not investigate it further.

_service:

<services>
  <service name="go_modules" mode="disabled">
  <param name="archive">ssh-chat-1.10.tar.gz</param>
  </service>
</services>

Thanks for the great project!