unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 0/1] Go importer
@ 2018-04-26 16:22 Rouby Pierre-Antoine
  2018-04-27  7:45 ` [PATCH 1/1] import: Add gopkg importer Rouby Pierre-Antoine
  2018-05-02 20:04 ` [PATCH 0/1] Go importer Leo Famulari
  0 siblings, 2 replies; 11+ messages in thread
From: Rouby Pierre-Antoine @ 2018-04-26 16:22 UTC (permalink / raw)
  To: guix-devel

Hi Guix !

This patch is a importer for go packages, it's use git repository and the
'Gopkg.toml' file (https://golang.github.io/dep/docs/Gopkg.toml.html).

Example with totally random package in Go language ;)
---Start-----------------------------------------------------------------------
$ guix import gopkg \
    https://gitlab.com/ContinuousEvolution/continuous-evolution.git \
    0.8.1

(define-public go-github-com-fsouza-go-dockerclient
  (let ((commit "master") (revision "0"))
    (package
      (name "go-github-com-fsouza-go-dockerclient")
      (version (git-version "0.0.0" revision commit))
      (source
        (origin
          (method git-fetch)
          (uri (git-reference
                 (url "https://github.com/fsouza/go-dockerclient.git")
                 (commit commit)))
          (file-name (git-file-name name version))
          (sha256
            (base32
              "0viwysdg5i9dgdazks9wx0f93180j72x3cq9fx2synaqvqa7ldr4"))))
      (build-system go-build-system)
      (arguments
        '(#:import-path
          "github.com/fsouza/go-dockerclient"))
      (native-inputs `())
      (home-page
        "https://github.com/fsouza/go-dockerclient")
      (synopsis "XXX")
      (description "XXX")
      (license #f))))

(define-public go-github-com-sirupsen-logrus
  (let ((commit "v1.0.4") (revision "0"))
    (package
      (name "go-github-com-sirupsen-logrus")
      (version (git-version "0.0.0" revision commit))
      (source
        (origin
          (method git-fetch)
          (uri (git-reference
                 (url "https://github.com/sirupsen/logrus.git")
                 (commit commit)))
          (file-name (git-file-name name version))
          (sha256
            (base32
              "0s8s8wvshmh7cb2f4fqnibqrpxahbaydyvskn3xsrl7z2a5wwajz"))))
      (build-system go-build-system)
      (arguments
        '(#:import-path "github.com/sirupsen/logrus"))
      (native-inputs `())
      (home-page "https://github.com/sirupsen/logrus")
      (synopsis "XXX")
      (description "XXX")
      (license #f))))

(define-public go-github-com-heroku-docker-registry-client
  (let ((commit "master") (revision "0"))
    (package
      (name "go-github-com-heroku-docker-registry-client")
      (version (git-version "0.0.0" revision commit))
      (source
        (origin
          (method git-fetch)
          (uri (git-reference
                 (url "https://github.com/heroku/docker-registry-client.git")
                 (commit commit)))
          (file-name (git-file-name name version))
          (sha256
            (base32
              "0db2wdgizhg71hn3f3zvan3knb8yglr0njd3mh1jn70ab7277hll"))))
      (build-system go-build-system)
      (arguments
        '(#:import-path
          "github.com/heroku/docker-registry-client"))
      (native-inputs `())
      (home-page
        "https://github.com/heroku/docker-registry-client")
      (synopsis "XXX")
      (description "XXX")
      (license #f))))

(define-public go-github-com-blang-semver
  (let ((commit "3.5.1") (revision "0"))
    (package
      (name "go-github-com-blang-semver")
      (version (git-version "0.0.0" revision commit))
      (source
        (origin
          (method git-fetch)
          (uri (git-reference
                 (url "https://github.com/blang/semver.git")
                 (commit commit)))
          (file-name (git-file-name name version))
          (sha256
            (base32
              "19pli07y5592g4dyjyj0jq5rn548vc3fz0qg3624vm1j5828p1c2"))))
      (build-system go-build-system)
      (arguments
        '(#:import-path "github.com/blang/semver"))
      (native-inputs `())
      (home-page "https://github.com/blang/semver")
      (synopsis "XXX")
      (description "XXX")
      (license #f))))

(define-public go-github-com-pelletier-go-toml
  (let ((commit "1.0.1") (revision "0"))
    (package
      (name "go-github-com-pelletier-go-toml")
      (version (git-version "0.0.0" revision commit))
      (source
        (origin
          (method git-fetch)
          (uri (git-reference
                 (url "https://github.com/pelletier/go-toml.git")
                 (commit commit)))
          (file-name (git-file-name name version))
          (sha256
            (base32
              "1n8na0yg90gm0rpifmzrby5r385vvd62cdam3ls7ssy02bjvfw15"))))
      (build-system go-build-system)
      (arguments
        '(#:import-path "github.com/pelletier/go-toml"))
      (native-inputs `())
      (home-page
        "https://github.com/pelletier/go-toml")
      (synopsis "XXX")
      (description "XXX")
      (license #f))))

(define-public go-gitlab-com-continuousevolution-continuous-evolution
  (let ((commit "0.8.1") (revision "0"))
    (package
      (name "go-gitlab-com-continuousevolution-continuous-evolution")
      (version (git-version "0.0.0" revision commit))
      (source
        (origin
          (method git-fetch)
          (uri (git-reference
                 (url "https://gitlab.com/ContinuousEvolution/continuous-evolution.git")
                 (commit commit)))
          (file-name (git-file-name name version))
          (sha256
            (base32
              "1bnr0hz36afvrb1cdnaasrvvvf1zfnf59d0m3pbdsy49md2q17q7"))))
      (build-system go-build-system)
      (arguments
        '(#:import-path
          "gitlab.com/ContinuousEvolution/continuous-evolution"))
      (native-inputs
        `(("go-github-com-fsouza-go-dockerclient"
           ,go-github-com-fsouza-go-dockerclient)
          ("go-github-com-sirupsen-logrus"
           ,go-github-com-sirupsen-logrus)
          ("go-github-com-heroku-docker-registry-client"
           ,go-github-com-heroku-docker-registry-client)
          ("go-github-com-blang-semver"
           ,go-github-com-blang-semver)
          ("go-github-com-pelletier-go-toml"
           ,go-github-com-pelletier-go-toml)))
      (home-page
        "https://gitlab.com/ContinuousEvolution/continuous-evolution")
      (synopsis "XXX")
      (description "XXX")
      (license #f))))

---end-------------------------------------------------------------------------

I start to work on this patch to help me to create Guix package for
'gitlab-runner' (https://gitlab.com/gitlab-org/gitlab-runner/). But at this
point the patch it's not totally functional.

It's able to create the package and the package for each dependencies defined
in 'Gopkg.toml'.

The code operation is not so difficult:
 1 - Clone the repository
 2 - Read the 'toml' file while dependence definition are found
 2.1 - Get pieces of information on dependence
 2.2 - Create package and add dependence in list of dependencies
 2.3 - Clone dependence and get the repository hash
 2.4 - Continue to point 2
 3 - Create principal the package and get the repository hash
 4 - Return all packages

But at this time it's contains lot of HACK, for example we skip the 'k8s.io'
'golang.org' and 'cloud.google.com' URLs, because the name cannot be parse to
URL also simply than 'GitHub' or 'GitLab' URLs.

Some interrogation:
 1 - Not totally sure the 'toml' file is the best solution. Very reliable ?
 2 - Someone have an idea of how to get 'k8s.io', 'golang.org' and
 'cloud.google.com' dependencies ?
 3 - Other comment ?

Pierre-Antoine Rouby

Rouby Pierre-Antoine (1):
  import: Add gopkg importer.

 Makefile.am                   |   1 +
 guix/import/gopkg.scm         | 294 ++++++++++++++++++++++++++++++++++
 guix/scripts/import.scm       |   2 +-
 guix/scripts/import/gopkg.scm |  99 ++++++++++++
 4 files changed, 395 insertions(+), 1 deletion(-)
 create mode 100644 guix/import/gopkg.scm
 create mode 100644 guix/scripts/import/gopkg.scm

-- 
2.17.0

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-07-26 14:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-26 16:22 [PATCH 0/1] Go importer Rouby Pierre-Antoine
2018-04-27  7:45 ` [PATCH 1/1] import: Add gopkg importer Rouby Pierre-Antoine
2018-05-02 20:04 ` [PATCH 0/1] Go importer Leo Famulari
2018-06-04  8:18   ` Pierre-Antoine Rouby
2018-07-11 19:04     ` Leo Famulari
2018-07-18 13:11       ` Pierre-Antoine Rouby
2018-07-18 17:07         ` Leo Famulari
2018-07-19  6:56           ` Pierre-Antoine Rouby
2018-07-19 21:38             ` Leo Famulari
2018-07-25  8:48               ` Pierre-Antoine Rouby
2018-07-26 14:12                 ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).