Debian / dh-make-golang

Automatically creates Debian packaging for Go packages
BSD 3-Clause "New" or "Revised" License
375 stars 76 forks source link

Add support for GitLab #150

Open etanot opened 3 years ago

etanot commented 3 years ago

Type: Feature request

Description

When I was trying to pack Gitlab's labkit library, I get following warning messages:

2020/12/28 16:15:45 Could not determine description for "gitlab.com/gitlab-org/labkit": "gitlab.com/gitlab-org/labkit" is not on GitHub
2020/12/28 16:15:46 Could not determine long description for "gitlab.com/gitlab-org/labkit": "gitlab.com/gitlab-org/labkit" is not on GitHub
2020/12/28 16:15:47 Could not determine license for "gitlab.com/gitlab-org/labkit": "gitlab.com/gitlab-org/labkit" is not on GitHub
2020/12/28 16:15:47 Could not determine copyright for "gitlab.com/gitlab-org/labkit": "gitlab.com/gitlab-org/labkit" is not on GitHub
2020/12/28 16:15:49 debian/watch: Unable to resolve gitlab.com/gitlab-org/labkit to github.com, skipping
2020/12/28 16:15:49 debian/upstream/metadata: Unable to resolve gitlab.com/gitlab-org/labkit to github.com, skipping
2020/12/28 16:15:50 Could not determine license for "gitlab.com/gitlab-org/labkit": "gitlab.com/gitlab-org/labkit" is not on GitHub
2020/12/28 16:15:50 Could not determine author for "gitlab.com/gitlab-org/labkit": "gitlab.com/gitlab-org/labkit" is not on GitHub
2020/12/28 16:15:51 Could not determine description for "gitlab.com/gitlab-org/labkit": "gitlab.com/gitlab-org/labkit" is not on GitHub
2020/12/28 16:15:52 Could not determine long description for "gitlab.com/gitlab-org/labkit": "gitlab.com/gitlab-org/labkit" is not on GitHub
2020/12/28 16:15:52 Done!

It would be nice, if dh-make-golang also has support for Gitlab, just like it has for Github.

anthonyfok commented 2 years ago

Something like this seems to work with golang-github-xanzy-go-gitlab-dev (0.22.2-1) (though outdated):

var gitLab *gitlab.Client

func main() {
    gitLab = gitlab.NewClient(nil, "")
    gitLab.SetBaseURL("https://salsa.debian.org/api/v4")
    opt := &gitlab.ListProjectsOptions{Search: gitlab.String("golang-golang-x-sys")}
    projects, _, err := gitLab.Projects.ListProjects(opt)
    if err == nil {
        fmt.Println(projects)
    }
}

Worth experimenting bit by bit.

anthonyfok commented 2 years ago

Sample debian/watch file:

version=4
opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%@PACKAGE@-$1.tar.gz%,\
      uversionmangle=s/(\d)[_\.\-\+]?(RC|rc|pre|dev|beta|alpha)[.]?(\d*)$/$1~$2$3/" \
  https://salsa.debian.org/mdosch/xmppsrv/-/tags \
  archive/v?@ANY_VERSION@/xmppsrv-v?\d\S*\.tar\.gz debian