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 17 forks source link

Service fails to find go.mod for certgen #50

Open kastl-ars opened 1 month ago

kastl-ars commented 1 month ago

Another instance of the service not finding the go.mod file:

https://github.com/minio/certgen/tree/v1.3.0

Running source_service 'go_modules' ...
INFO:obs-service-go_modules:Running OBS Source Service: obs-service-go_modules
INFO:obs-service-go_modules:Autodetecting archive since no archive param provided in _service
DEBUG:obs-service-go_modules:Trying to find archive name with pattern certgen*.tar.gz
DEBUG:obs-service-go_modules:Trying to find archive name with pattern certgen*.tar.xz
DEBUG:obs-service-go_modules:Trying to find archive name with pattern certgen*.tar.zst
DEBUG:obs-service-go_modules:Trying to find archive name with pattern certgen*.tar.lz
DEBUG:obs-service-go_modules:Trying to find archive name with pattern certgen*.tar.bz2
DEBUG:obs-service-go_modules:Trying to find archive name with pattern certgen*.obscpio
INFO:obs-service-go_modules:Archive autodetected at /XXX/certgen/certgen-1.3.0.obscpio
INFO:obs-service-go_modules:Using archive certgen-1.3.0.obscpio
INFO:obs-service-go_modules:Extracting certgen-1.3.0.obscpio to /tmp/tmpvu5q022p
INFO:obs-service-go_modules:Switching to /tmp/tmpvu5q022p
ERROR:obs-service-go_modules:File go.mod not found under /tmp/tmpvu5q022p/certgen
Aborting: service call failed:  /usr/lib/obs/service/go_modules --basename certgen --subdir ./ --outdir /XXX/certgen/tmphyblrqfd.go_modules.service

The basename was incorrectly detected as certgen/.github, but even with setting the basename and the subdir it still fails.

  <service name="go_modules" mode="manual">
    <param name="basename">certgen</param>
    <param name="subdir">./</param>
  </service>
johanneskastl commented 1 month ago

Hmmm, seems like the basename_from_archive function looks for only directories within the tarball. And it only finds one: .github.

If I change the order, in which the functions are being called, then the basename detection seems to work:

            args.basename                                                                                                                   
            or basename_from_archive_name(archive)                                                                                          
            or basename_from_archive(archive)                                                                                               
        )
johanneskastl commented 1 month ago

The changes from #51 seem to do the trick in this case, at least it then leads to #52... :-)

(Manually setting the basename also works, but the service should be smart enough IMHO)