From patchwork Sun Oct 28 09:27:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 40 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id CA5E41672F; Sun, 28 Oct 2018 09:28:40 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) by mira.cbaines.net (Postfix) with ESMTPS id 6A07D1672F for ; Sun, 28 Oct 2018 09:28:40 +0000 (GMT) Received: from localhost ([::1]:39411 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gGhN9-0005yP-Nm for patchwork@mira.cbaines.net; Sun, 28 Oct 2018 05:28:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gGhMh-0005jz-Gv for guix-patches@gnu.org; Sun, 28 Oct 2018 05:28:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gGhMd-0004h2-NI for guix-patches@gnu.org; Sun, 28 Oct 2018 05:28:11 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:42449) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gGhMb-0004fG-1S for guix-patches@gnu.org; Sun, 28 Oct 2018 05:28:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gGhMa-0000bW-U2 for guix-patches@gnu.org; Sun, 28 Oct 2018 05:28:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#33185] [PATCH 6/7] gnu: Add patchwork. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 28 Oct 2018 09:28:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33185 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 33185@debbugs.gnu.org Received: via spool by 33185-submit@debbugs.gnu.org id=B33185.15407188322217 (code B ref 33185); Sun, 28 Oct 2018 09:28:04 +0000 Received: (at 33185) by debbugs.gnu.org; 28 Oct 2018 09:27:12 +0000 Received: from localhost ([127.0.0.1]:46700 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGhLj-0000Za-SU for submit@debbugs.gnu.org; Sun, 28 Oct 2018 05:27:12 -0400 Received: from li622-129.members.linode.com ([212.71.249.129]:44458 helo=mira.cbaines.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGhLc-0000Ye-Pi for 33185@debbugs.gnu.org; Sun, 28 Oct 2018 05:27:05 -0400 Received: by mira.cbaines.net (Postfix, from userid 113) id 6319016753; Sun, 28 Oct 2018 09:27:04 +0000 (GMT) Received: from localhost (127.103.9.51.dyn.plus.net [51.9.103.127]) by mira.cbaines.net (Postfix) with ESMTPSA id 355A416758 for <33185@debbugs.gnu.org>; Sun, 28 Oct 2018 09:27:03 +0000 (GMT) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 07d34f8f for <33185@debbugs.gnu.org>; Sun, 28 Oct 2018 09:27:02 +0000 (UTC) From: Christopher Baines Date: Sun, 28 Oct 2018 09:27:01 +0000 Message-Id: <20181028092702.22549-6-mail@cbaines.net> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181028092702.22549-1-mail@cbaines.net> References: <20181028092702.22549-1-mail@cbaines.net> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches --- gnu/packages/patchutils.scm | 95 +++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/gnu/packages/patchutils.scm b/gnu/packages/patchutils.scm index 688e62cdc..7dabda9ee 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,96 @@ 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")) + (copy-recursively "htdocs" + (string-append + out "/share/patchwork/htdocs")) + (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-django-filter" ,python-django-filter) + ("python-djangorestframework" ,python-djangorestframework) + ("python-django-debug-toolbar" ,python-django-debug-toolbar))) + (synopsis "") + (description "") + (home-page "") + (license "")))