all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christopher Baines <mail@cbaines.net>
To: 33185@debbugs.gnu.org
Subject: [bug#33185] [PATCH 6/7] gnu: Add patchwork.
Date: Sun,  4 Nov 2018 10:44:54 +0000	[thread overview]
Message-ID: <20181104104455.3527-6-mail@cbaines.net> (raw)
In-Reply-To: <20181104104455.3527-1-mail@cbaines.net>

---
 gnu/packages/patchutils.scm | 103 ++++++++++++++++++++++++++++++++++++
 1 file changed, 103 insertions(+)

diff --git a/gnu/packages/patchutils.scm b/gnu/packages/patchutils.scm
index 688e62cdc..0981cbc08 100644
--- a/gnu/packages/patchutils.scm
+++ b/gnu/packages/patchutils.scm
@@ -29,6 +29,8 @@
   #:use-module (gnu packages ed)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
+  #:use-module (gnu packages databases)
+  #:use-module (gnu packages django)
   #:use-module (gnu packages file)
   #:use-module (gnu packages gawk)
   #:use-module (gnu packages gettext)
@@ -240,3 +242,104 @@ hexadecimal and ASCII (or EBCDIC).  It can also display two files at once, and
 highlight the differences between them.  It works well with large files (up to 4
 GiB).")
     (license gpl2+)))
+
+(define-public patchwork
+  (package
+    (name "patchwork")
+    (version "2.1.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://github.com/getpatchwork/patchwork/archive/v"
+                    version ".tar.gz"))
+              (sha256
+               (base32
+                "1q4i46gwwxvr8gjj983r8aacfsssp062dzi29ha7zba380fsxayy"))
+              (file-name (string-append name "-" version))))
+    (build-system python-build-system)
+    (arguments
+     `(;; TODO: Tests require a running database
+       #:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (delete 'build)
+         (add-after 'unpack 'patch-wsgi.py
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (substitute* "patchwork/wsgi.py"
+               (("import os")
+                (string-append
+                 "import os, sys
+
+sys.path.extend('" (string-append (getenv "PYTHONPATH") ":" (site-packages inputs outputs)) "'.split(':'))"))
+               (("'patchwork\\.settings\\.production'")
+                "os.getenv('DJANGO_SETTINGS_MODULE', 'guix.patchwork.settings')"))))
+         (replace 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             (or (not tests?)
+                 (begin
+                   (setenv "DJANGO_SETTINGS_MODULE" "patchwork.settings.dev")
+                   (invoke
+                    "python" "-Wonce" "./manage.py" "test" "--noinput")
+                   #t))))
+         (replace 'install
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (for-each (lambda (directory)
+                           (copy-recursively
+                            directory
+                            (string-append (site-packages inputs outputs)
+                                           "/" directory)))
+                         '("patchwork"
+                           "templates"))
+               (delete-file-recursively (string-append
+                                    (site-packages inputs outputs)
+                                    "patchwork/tests"))
+               (let ((static-root
+                      (string-append out "/share/patchwork/htdocs")))
+                 (mkdir-p static-root)
+                 (copy-file "patchwork/settings/production.example.py"
+                            "patchwork/settings/assets.py")
+                 (setenv "DJANGO_SECRET_KEY" "dummyvalue")
+                 (setenv "DJANGO_SETTINGS_MODULE" "patchwork.settings.assets")
+                 (setenv "STATIC_ROOT" static-root)
+                 (invoke "./manage.py" "collectstatic" "--no-input"))
+
+               (copy-recursively "lib"
+                                 (string-append
+                                  out "/share/doc/" ,name "-" ,version)))
+             #t))
+         (add-after 'install 'install-patchwork-admin
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out")))
+               (mkdir-p (string-append out "/bin"))
+               (call-with-output-file (string-append out "/bin/patchwork-admin")
+                 (lambda (port)
+                   (display "#!/usr/bin/env python3
+import os, sys
+
+if __name__ == \"__main__\":
+    os.environ.setdefault(
+      \"DJANGO_SETTINGS_MODULE\",
+      \"guix.patchwork.settings\"
+    )
+
+    from django.core.management import execute_from_command_line
+
+    execute_from_command_line(sys.argv)" port)))
+               (chmod (string-append out "/bin/patchwork-admin") #o555))
+             #t)))))
+    (inputs
+     `(("python-wrapper" ,python-wrapper)))
+    (propagated-inputs
+     `(("python-django" ,python-django)
+       ;; TODO: Make this configurable
+       ("python-psycopg2" ,python-psycopg2)
+       ("python-mysqlclient" ,python-mysqlclient)
+       ("python-django-filter" ,python-django-filter)
+       ("python-djangorestframework" ,python-djangorestframework)
+       ("python-django-debug-toolbar" ,python-django-debug-toolbar)))
+    (synopsis "")
+    (description "")
+    (home-page "")
+    (license "")))
-- 
2.18.0

  parent reply	other threads:[~2018-11-04 10:45 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-28  9:21 [bug#33185] [PATCH 0/7] Add patchwork package and service Christopher Baines
2018-10-28  9:26 ` [bug#33185] [PATCH 1/7] gnu: Add python-jsmin Christopher Baines
2018-10-28  9:26   ` [bug#33185] [PATCH 2/7] gnu: Add python-slimit Christopher Baines
2018-11-19 16:30     ` Ludovic Courtès
2018-11-20 19:58       ` Christopher Baines
2018-10-28  9:26   ` [bug#33185] [PATCH 3/7] gnu: Add python-django-pipeline Christopher Baines
2018-11-19 16:30     ` Ludovic Courtès
2018-10-28  9:26   ` [bug#33185] [PATCH 4/7] gnu: Add python-django-jinja Christopher Baines
2018-10-28  9:27   ` [bug#33185] [PATCH 5/7] gnu: Add python-django-debug-toolbar Christopher Baines
2018-10-28  9:27   ` [bug#33185] [PATCH 6/7] gnu: Add patchwork Christopher Baines
2018-10-28  9:27   ` [bug#33185] [PATCH 7/7] services: " Christopher Baines
2018-11-19 16:29   ` [bug#33185] [PATCH 1/7] gnu: Add python-jsmin Ludovic Courtès
2018-11-04 10:44 ` Christopher Baines
2018-11-04 10:44   ` [bug#33185] [PATCH 2/7] gnu: Add python-slimit Christopher Baines
2018-11-04 10:44   ` [bug#33185] [PATCH 3/7] gnu: Add python-django-pipeline Christopher Baines
2018-11-04 10:44   ` [bug#33185] [PATCH 4/7] gnu: Add python-django-jinja Christopher Baines
2018-11-19 16:33     ` Ludovic Courtès
2018-11-20 20:02       ` Christopher Baines
2018-11-04 10:44   ` [bug#33185] [PATCH 5/7] gnu: Add python-django-debug-toolbar Christopher Baines
2018-11-19 16:33     ` Ludovic Courtès
2018-11-20 20:03       ` Christopher Baines
2018-11-04 10:44   ` Christopher Baines [this message]
2018-11-04 19:09     ` [bug#33185] [PATCH 6/7] gnu: Add patchwork swedebugia
2019-01-22 22:36       ` Christopher Baines
2018-11-19 16:37     ` Ludovic Courtès
2019-01-22 22:31       ` Christopher Baines
2018-11-04 10:44   ` [bug#33185] [PATCH 7/7] services: " Christopher Baines
2018-11-04 19:10     ` swedebugia
2018-11-19 16:42       ` Ludovic Courtès
2018-11-20 18:22         ` Christopher Baines
2018-11-20 18:06       ` Christopher Baines
2019-01-22 22:09 ` [bug#33185] [PATCH v2 1/2] gnu: " Christopher Baines
2019-01-22 22:09   ` [bug#33185] [PATCH v2 2/2] services: " Christopher Baines
2019-01-22 22:40     ` Christopher Baines
2019-01-23  9:28   ` [bug#33185] [PATCH v2 1/2] gnu: " Ricardo Wurmus
2019-01-25 21:04     ` Christopher Baines
2019-01-25 21:00 ` [bug#33185] [PATCH v3 " Christopher Baines
2019-01-25 21:00   ` [bug#33185] [PATCH v3 2/2] services: " Christopher Baines
2019-05-03 19:16 ` [bug#33185] [PATCH 0/7] Add patchwork package and service Christopher Baines
2019-05-03 19:30   ` [bug#33185] [PATCH 1/3] services: Add getmail Christopher Baines
2019-05-03 19:30     ` [bug#33185] [PATCH 2/3] gnu: Add patchwork Christopher Baines
2019-05-03 19:30     ` [bug#33185] [PATCH 3/3] services: " Christopher Baines
2019-05-31 19:43   ` bug#33185: [PATCH 0/7] Add patchwork package and service Christopher Baines

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181104104455.3527-6-mail@cbaines.net \
    --to=mail@cbaines.net \
    --cc=33185@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.