GNU bug report logs - #33185
[PATCH 0/7] Add patchwork package and service.

Previous Next

Package: guix-patches;

Reported by: Christopher Baines <mail <at> cbaines.net>

Date: Sun, 28 Oct 2018 09:22:01 UTC

Severity: normal

Tags: patch

Done: Christopher Baines <mail <at> cbaines.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Christopher Baines <mail <at> cbaines.net>
To: 33185 <at> debbugs.gnu.org
Subject: [bug#33185] [PATCH v2 2/2] services: Add patchwork.
Date: Tue, 22 Jan 2019 22:40:52 +0000
[Message part 1 (text/plain, inline)]
Christopher Baines <mail <at> cbaines.net> writes:

> +(define (patchwork-django-admin-gexp patchwork settings-module)
> +  #~(lambda command
> +      (let ((pid (primitive-fork))
> +            (user (getpwnam "httpd")))
> +        (if (eq? pid 0)
> +            (dynamic-wind
> +              (const #t)
> +              (lambda ()
> +                (setgid (passwd:gid user))
> +                (setuid (passwd:uid user))
> +
> +                (setenv "DJANGO_SETTINGS_MODULE" "guix.patchwork.settings")
> +                (setenv "PYTHONPATH" #$settings-module)
> +                (primitive-exit
> +                 (if (zero?
> +                      (apply system*
> +                             #$(file-append patchwork "/bin/patchwork-admin")
> +                             command))
> +                     0
> +                     1)))
> +              (lambda ()
> +                (primitive-exit 1)))
> +            (zero? (cdr (waitpid pid)))))))
> +
> +(define (patchwork-django-admin-action patchwork settings-module)
> +  (shepherd-action
> +   (name 'django-admin)
> +   (documentation
> +    "Run a django admin command for patchwork")
> +   (procedure (patchwork-django-admin-gexp patchwork settings-module))))

It would be really useful to provide an easy way of accessing the Django
admin utilities. I think Shepherd actions might be a good way of doing
this, but I haven't got it working yet... I think something goes wrong
when it forks, so I might need to try different approaches to change
user.
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 5 years and 358 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.