guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 0/1] Go importer


From: Rouby Pierre-Antoine
Subject: [PATCH 0/1] Go importer
Date: Thu, 26 Apr 2018 18:22:38 +0200

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]