flatpak-builder-tools icon indicating copy to clipboard operation
flatpak-builder-tools copied to clipboard

[go] generator assumes github structure (domain, user, repo) for URLs, breaks for gopkg.in

Open muelli opened this issue 6 years ago • 0 comments

syncthing seems to depend on libraries not hosted on github.

Trying to follow the README, I have produced this manifest:

---
app-id: me.kozec.syncthingtk

runtime: org.gnome.Platform
runtime-version: '3.34'
sdk: org.gnome.Sdk
sdk-extensions:
  - org.freedesktop.Sdk.Extension.golang

command: syncthing-gtk
rename-desktop-file: syncthing-gtk.desktop
rename-icon: syncthing-gtk

finish-args:
  # Wayland
  - --socket=wayland
  # Fallback X11 + XShm access
  - --socket=fallback-x11
  - --share=ipc
  # Folders for syncing can be anywhere
  - --filesystem=host
  # Network access for sync
  - --share=network
  # System tray icon
  - --talk-name=org.kde.StatusNotifierWatcher

# Cleanup after the python modules
cleanup:
  - /include
  - /lib/pkgconfig

modules:
  - name: syncthing
    buildsystem: simple
    build-options:
        env:
            GOBIN: /app/bin
        build-args:
            - --share=network

    build-commands:
      - |
        . /usr/lib/sdk/golang/enable.sh
        export GOPATH=$PWD/go
        go get github.com/syncthing/syncthing/cmd/syncthing

after running, i.e. flatpak-builder --user --install --ccache --keep-build-dirs --force-clean -v --repo=/var/tmp/fb.repo fpbuilder me.kozec.syncthingtk2.yaml, I execute the generator:

$ ~/vcs/flatpak-builder-tools/go-get/flatpak-go-get-generator.py .flatpak-builder/build/syncthing/go/
Traceback (most recent call last):
  File "/home/muelli/vcs/flatpak-builder-tools/go-get/flatpak-go-get-generator.py", line 84, in <module>
    main()
  File "/home/muelli/vcs/flatpak-builder-tools/go-get/flatpak-go-get-generator.py", line 74, in main
    source_list = sources(args.build_dir)
  File "/home/muelli/vcs/flatpak-builder-tools/go-get/flatpak-go-get-generator.py", line 60, in sources
    return list(map(repo_source, repo_paths(build_dir)))
  File "/home/muelli/vcs/flatpak-builder-tools/go-get/flatpak-go-get-generator.py", line 56, in repo_source
    source_object = {'type': 'git', 'url': remote_url(repo_path), 'commit': current_commit(repo_path), 'dest': dest_path}
  File "/home/muelli/vcs/flatpak-builder-tools/go-get/flatpak-go-get-generator.py", line 51, in remote_url
    cwd=repo_path).decode('ascii').strip()
  File "/usr/lib/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.6/subprocess.py", line 423, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
NotADirectoryError: [Errno 20] Not a directory: PosixPath('.flatpak-builder/build/syncthing/go/src/gopkg.in/ldap.v2/.gitignore')

The code seems to assume that there is a certain number of levels, i.e. https://github.com/flatpak/flatpak-builder-tools/blob/1198988cba336b5fbe732a0dca11dab105f73467/go-get/flatpak-go-get-generator.py#L34-L38

muelli avatar Dec 04 '19 21:12 muelli