all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [Patch v2] daemon: Set ownership of kept build directories to the calling user.
@ 2016-11-17 11:30 Hartmut Goebel
  2016-11-21 14:13 ` Ludovic Courtès
  0 siblings, 1 reply; 56+ messages in thread
From: Hartmut Goebel @ 2016-11-17 11:30 UTC (permalink / raw)
  To: guix-devel

Fixes <http://bugs.gnu.org/15890>.

* nix/libstore/globals.hh (Settings) Add clientUid and clientGid.
* nix/nix-daemon/nix-daemon.cc (pdaemonLoop] Store UID and GID of the
  caller in settings.
* nix/libstore/build.cc (_chown): New function.
  (DerivationGoal::deleteTmpDir): Use it, change ownership of build
  directory if it is kept.
---
 nix/libstore/build.cc        | 24 ++++++++++++++++++++++++
 nix/libstore/globals.hh      |  6 ++++++
 nix/nix-daemon/nix-daemon.cc | 13 +++++++++++++
 3 files changed, 43 insertions(+)

diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index ae78e65..b49fb95 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -2609,6 +2609,23 @@ void DerivationGoal::closeLogFile()
 }
 
 
+static void _chown(const Path & path, uid_t uid, gid_t gid)
+{
+    checkInterrupt();
+
+    printMsg(lvlVomit, format("%1%") % path);
+
+    if (chown(path.c_str(), uid, gid) == -1) {
+	throw SysError(format("change owner and group of `%1%'") % path);
+    }
+    struct stat st = lstat(path);
+    if (S_ISDIR(st.st_mode)) {
+        for (auto & i : readDirectory(path))
+            _chown(path + "/" + i.name, uid, gid);
+    }
+}
+
+
 void DerivationGoal::deleteTmpDir(bool force)
 {
     if (tmpDir != "") {
@@ -2617,6 +2634,13 @@ void DerivationGoal::deleteTmpDir(bool force)
                 format("note: keeping build directory `%2%'")
                 % drvPath % tmpDir);
             chmod(tmpDir.c_str(), 0755);
+            // Change the ownership if clientUid is set. Never change the
+            // ownership to "root" for security reasons. So zero is used as
+            // marker for unset.
+            if (settings.clientUid != 0) {
+                _chown(tmpDir, settings.clientUid,
+                       settings.clientGid != 0 ? settings.clientGid : -1);
+            }
         }
         else
             deletePath(tmpDir);
diff --git a/nix/libstore/globals.hh b/nix/libstore/globals.hh
index 8c07e36..dc6a004 100644
--- a/nix/libstore/globals.hh
+++ b/nix/libstore/globals.hh
@@ -70,6 +70,12 @@ struct Settings {
        subgoal of the same goal) fails. */
     bool keepGoing;
 
+    /* User and groud id of the client issuing the buld request.  Used to set
+       the owner and group of the keept temporary directories of failed
+       builds. */
+    uid_t clientUid;
+    gid_t clientGid;
+
     /* Whether, if we cannot realise the known closure corresponding
        to a derivation, we should try to normalise the derivation
        instead. */
diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc
index 35c284f..e900a7d 100644
--- a/nix/nix-daemon/nix-daemon.cc
+++ b/nix/nix-daemon/nix-daemon.cc
@@ -950,6 +950,19 @@ static void daemonLoop()
                     strncpy(argvSaved[1], processName.c_str(), strlen(argvSaved[1]));
                 }
 
+#if defined(SO_PEERCRED)
+                /* Store the client's user and group for this connection. This
+                   has to be done in the forked process since it is per
+                   connection. */
+                settings.clientUid = cred.uid;
+                settings.clientGid = cred.gid;
+#else
+                /* Setting these to zero means: do not change, esp. do not
+                   change to "root". */
+                settings.clientUid = 0;
+                settings.clientGid = 0;
+#endif
+
                 /* Handle the connection. */
                 from.fd = remote;
                 to.fd = remote;
-- 
2.7.4

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

* Re: [Patch v2] daemon: Set ownership of kept build directories to the calling user.
  2016-11-17 11:30 [Patch v2] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
@ 2016-11-21 14:13 ` Ludovic Courtès
  2016-11-21 14:18   ` Hartmut Goebel
                     ` (2 more replies)
  0 siblings, 3 replies; 56+ messages in thread
From: Ludovic Courtès @ 2016-11-21 14:13 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: guix-devel

Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

> Fixes <http://bugs.gnu.org/15890>.
>
> * nix/libstore/globals.hh (Settings) Add clientUid and clientGid.
> * nix/nix-daemon/nix-daemon.cc (pdaemonLoop] Store UID and GID of the
>   caller in settings.
> * nix/libstore/build.cc (_chown): New function.
>   (DerivationGoal::deleteTmpDir): Use it, change ownership of build
>   directory if it is kept.

[...]

> +static void _chown(const Path & path, uid_t uid, gid_t gid)
> +{
> +    checkInterrupt();
> +
> +    printMsg(lvlVomit, format("%1%") % path);
> +
> +    if (chown(path.c_str(), uid, gid) == -1) {

I think this should use ‘lchown’.

> --- a/nix/libstore/globals.hh
> +++ b/nix/libstore/globals.hh
> @@ -70,6 +70,12 @@ struct Settings {
>         subgoal of the same goal) fails. */
>      bool keepGoing;
>  
> +    /* User and groud id of the client issuing the buld request.  Used to set
> +       the owner and group of the keept temporary directories of failed
> +       builds. */
> +    uid_t clientUid;
> +    gid_t clientGid;

I don’t like the idea of passing those via the big ‘Settings’
singleton.

Could we instead pass them via the ‘LocalStore’ constructor, with their
default values taken from ‘getuid’ and ‘getgid’ (rather than 0)?  WDYT?

Thank you!

Ludo’.

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

* Re: [Patch v2] daemon: Set ownership of kept build directories to the calling user.
  2016-11-21 14:13 ` Ludovic Courtès
@ 2016-11-21 14:18   ` Hartmut Goebel
  2016-11-27 21:04     ` Ludovic Courtès
  2016-11-21 17:36   ` Hartmut Goebel
  2016-11-21 18:29   ` Hartmut Goebel
  2 siblings, 1 reply; 56+ messages in thread
From: Hartmut Goebel @ 2016-11-21 14:18 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Am 21.11.2016 um 15:13 schrieb Ludovic Courtès:
> I don’t like the idea of passing those via the big ‘Settings’
> singleton.

Well, the Settings are already used to pass options like --keep-going to
the build process. So the "Singleton" is mutable per-process anyway.
This is why I've put these here, too.

But if you prefer passing them around, I'll try to implement this.

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |

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

* Re: [Patch v2] daemon: Set ownership of kept build directories to the calling user.
  2016-11-21 14:13 ` Ludovic Courtès
  2016-11-21 14:18   ` Hartmut Goebel
@ 2016-11-21 17:36   ` Hartmut Goebel
  2016-11-21 18:29   ` Hartmut Goebel
  2 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2016-11-21 17:36 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Am 21.11.2016 um 15:13 schrieb Ludovic Courtès:
> Could we instead pass them via the ‘LocalStore’ constructor, with their
> default values taken from ‘getuid’ and ‘getgid’ (rather than 0)?  WDYT?

Regarding the default values: I'm using zero as "not set" marker here.
The files will already have owner and group from ‘getuid’ and ‘getgid’,
so there is no need to change them. Or did I miss something?

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |

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

* Re: [Patch v2] daemon: Set ownership of kept build directories to the calling user.
  2016-11-21 14:13 ` Ludovic Courtès
  2016-11-21 14:18   ` Hartmut Goebel
  2016-11-21 17:36   ` Hartmut Goebel
@ 2016-11-21 18:29   ` Hartmut Goebel
  2 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2016-11-21 18:29 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Am 21.11.2016 um 15:13 schrieb Ludovic Courtès:
> Could we instead pass them via the ‘LocalStore’ constructor,

I started implementing this, but adding clientUid/Gid as a attribute
(property) of 'LocalStore' feels wrong. The LocalStore is about the
store: files being there, querying and such. Even "build" is a bit of a
misfit IMO.

Okay, probably you mean, passing to the ‘LocalStore’ constructor and
then forward them to the goals. Which means changing
`makeDerevationGoal', which is used quite some time. From there you
would need to pass it onto the 'DerivationGoal' constructor. These are
quite some changes for the rare case of building, and only if the build
failed and only if the user passed --keep-failed.

I have the impression, that 'Settings' have been introduced exactly to
save passing around such information. "keep-failed" is passed to
'deleteTmpDir()' exactly this way (via Settings). Which means if passing
clientUid/Gid via constructors,  we would have two different ways of
passing information used in the same small function - which would be
inconsistent.

Thus said, I'm in strong favour of using Settings.

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |

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

* Re: [Patch v2] daemon: Set ownership of kept build directories to the calling user.
  2016-11-21 14:18   ` Hartmut Goebel
@ 2016-11-27 21:04     ` Ludovic Courtès
  2016-11-28 21:31       ` Hartmut Goebel
  0 siblings, 1 reply; 56+ messages in thread
From: Ludovic Courtès @ 2016-11-27 21:04 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: guix-devel

Hi!

Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

> Am 21.11.2016 um 15:13 schrieb Ludovic Courtès:
>> I don’t like the idea of passing those via the big ‘Settings’
>> singleton.
>
> Well, the Settings are already used to pass options like --keep-going to
> the build process. So the "Singleton" is mutable per-process anyway.
> This is why I've put these here, too.

Good point.  This and your other message have convinced me!

> Am 21.11.2016 um 15:13 schrieb Ludovic Courtès:
>> Could we instead pass them via the ‘LocalStore’ constructor, with their
>> default values taken from ‘getuid’ and ‘getgid’ (rather than 0)?  WDYT?
>
> Regarding the default values: I'm using zero as "not set" marker here.
> The files will already have owner and group from ‘getuid’ and ‘getgid’,
> so there is no need to change them. Or did I miss something?

The problem is that 0 also means “root”, so I’d prefer a different value
to denote that “unset” status, -1 if you want, and explicit checks (and
a comment explaining that ‘clientUid’ and ‘clientGid’ can be either a
valid UID/GID or -1, in which case blablabla).

How does that sound?

Thanks, and sorry for the delay!

Ludo’.

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

* Re: [Patch v2] daemon: Set ownership of kept build directories to the calling user.
  2016-11-27 21:04     ` Ludovic Courtès
@ 2016-11-28 21:31       ` Hartmut Goebel
  2016-12-01  0:01         ` Danny Milosavljevic
  0 siblings, 1 reply; 56+ messages in thread
From: Hartmut Goebel @ 2016-11-28 21:31 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Am 27.11.2016 um 22:04 schrieb Ludovic Courtès:
> The problem is that 0 also means “root”, so I’d prefer a different value
> to denote that “unset” status, -1 if you want, and explicit checks (and
> a comment explaining that ‘clientUid’ and ‘clientGid’ can be either a
> valid UID/GID or -1, in which case blablabla).
>
> How does that sound?

This basically sounds reasonable.

I just need some C programming hint: uid_t is an unsigned int, so
comparing with -1 raises a warning (which IMO is the same as en error).
And casting uid_t to unisgned int might return the same uid as "nobody".
How can I solve this?

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |

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

* Re: [Patch v2] daemon: Set ownership of kept build directories to the calling user.
  2016-11-28 21:31       ` Hartmut Goebel
@ 2016-12-01  0:01         ` Danny Milosavljevic
  2016-12-05 20:46           ` [PATCH v3] " Hartmut Goebel
  2016-12-05 20:51           ` [Patch v2] " Hartmut Goebel
  0 siblings, 2 replies; 56+ messages in thread
From: Danny Milosavljevic @ 2016-12-01  0:01 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: guix-devel

Hi Hartmut,

On Mon, 28 Nov 2016 22:31:44 +0100
Hartmut Goebel <h.goebel@crazy-compilers.com> wrote:
> I just need some C programming hint: uid_t is an unsigned int, so
> comparing with -1 raises a warning (which IMO is the same as en error).

The system call handler in the Linux kernel does this, among other things:

#define low2highuid(uid) ((uid) == (old_uid_t)-1 ? (uid_t)-1 : (uid_t)(uid))

So I'd say to compare with (uid_t)-1 would be fine

    if (settings.clientUid != (uid_t) -1) {
        ...
    }

... since they do something like it in Linux anyway - which is the one implementing the chown operation in the first place :)

> And casting uid_t to unisgned int might return the same uid as "nobody".

What do you mean? uid_t is __uid_t - which in turn is implementation-defined - but yes, it is unsigned. On Linux it changed size multiple time until now where it is 32 bit unsigned.

On GuixSD, user "nobody" has uid 65534. That's one less than the maximum value for 16 bit (!) uids (the maximum is hopefully invalid as uid since chown needs it as a flag).

(-1) in two-complement 16 bit integral encoding (which is technically not guaranteed to be used in C) would be 65535.

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

* [PATCH v3] daemon: Set ownership of kept build directories to the calling user.
  2016-12-01  0:01         ` Danny Milosavljevic
@ 2016-12-05 20:46           ` Hartmut Goebel
  2016-12-06 15:08             ` Ludovic Courtès
  2016-12-06 20:41             ` [PATCH v3] daemon: Set ownership of kept build directories to the calling user Danny Milosavljevic
  2016-12-05 20:51           ` [Patch v2] " Hartmut Goebel
  1 sibling, 2 replies; 56+ messages in thread
From: Hartmut Goebel @ 2016-12-05 20:46 UTC (permalink / raw)
  To: guix-devel

Fixes <http://bugs.gnu.org/15890>.

* nix/libstore/globals.hh (Settings) Add clientUid and clientGid.
* nix/nix-daemon/nix-daemon.cc (daemonLoop] Store UID and GID of the
  caller in settings.
* nix/libstore/build.cc (_chown): New function.
  (DerivationGoal::deleteTmpDir): Use it, change ownership of build
  directory if it is kept and the new owner is not root.
---
 nix/libstore/build.cc        | 23 +++++++++++++++++++++++
 nix/libstore/globals.hh      |  6 ++++++
 nix/nix-daemon/nix-daemon.cc | 12 ++++++++++++
 3 files changed, 41 insertions(+)

diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index 889ee3d..44ff11c 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -2631,6 +2631,23 @@ void DerivationGoal::closeLogFile()
 }
 
 
+static void _chown(const Path & path, uid_t uid, gid_t gid)
+{
+    checkInterrupt();
+
+    printMsg(lvlVomit, format("%1%") % path);
+
+    if (lchown(path.c_str(), uid, gid) == -1) {
+	throw SysError(format("change owner and group of `%1%'") % path);
+    }
+    struct stat st = lstat(path);
+    if (S_ISDIR(st.st_mode)) {
+        for (auto & i : readDirectory(path))
+            _chown(path + "/" + i.name, uid, gid);
+    }
+}
+
+
 void DerivationGoal::deleteTmpDir(bool force)
 {
     if (tmpDir != "") {
@@ -2639,6 +2656,12 @@ void DerivationGoal::deleteTmpDir(bool force)
                 format("note: keeping build directory `%2%'")
                 % drvPath % tmpDir);
             chmod(tmpDir.c_str(), 0755);
+            // Change the ownership if clientUid is set. Never change the
+            // ownership or the group to "root" for security reasons.
+            if (settings.clientUid != (uid_t) -1 && settings.clientUid != 0) {
+                _chown(tmpDir, settings.clientUid,
+                       settings.clientGid != 0 ? settings.clientGid : -1);
+            }
         }
         else
             deletePath(tmpDir);
diff --git a/nix/libstore/globals.hh b/nix/libstore/globals.hh
index 8c07e36..dc6a004 100644
--- a/nix/libstore/globals.hh
+++ b/nix/libstore/globals.hh
@@ -70,6 +70,12 @@ struct Settings {
        subgoal of the same goal) fails. */
     bool keepGoing;
 
+    /* User and groud id of the client issuing the buld request.  Used to set
+       the owner and group of the keept temporary directories of failed
+       builds. */
+    uid_t clientUid;
+    gid_t clientGid;
+
     /* Whether, if we cannot realise the known closure corresponding
        to a derivation, we should try to normalise the derivation
        instead. */
diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc
index 682f9a2..6f88e5b 100644
--- a/nix/nix-daemon/nix-daemon.cc
+++ b/nix/nix-daemon/nix-daemon.cc
@@ -960,6 +960,18 @@ static void daemonLoop()
                     strncpy(argvSaved[1], processName.c_str(), strlen(argvSaved[1]));
                 }
 
+#if defined(SO_PEERCRED)
+                /* Store the client's user and group for this connection. This
+                   has to be done in the forked process since it is per
+                   connection. */
+                settings.clientUid = cred.uid;
+                settings.clientGid = cred.gid;
+#else
+                /* Setting these to -1 means: do not change */
+                settings.clientUid = -1;
+                settings.clientGid = -1;
+#endif
+
                 /* Handle the connection. */
                 from.fd = remote;
                 to.fd = remote;
-- 
2.7.4

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

* Re: [Patch v2] daemon: Set ownership of kept build directories to the calling user.
  2016-12-01  0:01         ` Danny Milosavljevic
  2016-12-05 20:46           ` [PATCH v3] " Hartmut Goebel
@ 2016-12-05 20:51           ` Hartmut Goebel
  1 sibling, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2016-12-05 20:51 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

Am 01.12.2016 um 01:01 schrieb Danny Milosavljevic:
> So I'd say to compare with (uid_t)-1 would be fine
>
>     if (settings.clientUid != (uid_t) -1) {
>         ...
>     }

Thanks for this tip, Danny. This made it work and I just posted the
updated patch.

> > And casting uid_t to unisgned int might return the same uid as "nobody".
> [...]
>
> (-1) in two-complement 16 bit integral encoding (which is technically not guaranteed to be used in C) would be 65535.

Ahh, well, yes. I'm not quite good on bit operations, esp. on
representations of negative numbers. Thanks to doing this right.

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |

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

* Re: [PATCH v3] daemon: Set ownership of kept build directories to the calling user.
  2016-12-05 20:46           ` [PATCH v3] " Hartmut Goebel
@ 2016-12-06 15:08             ` Ludovic Courtès
  2016-12-08 12:12               ` Hartmut Goebel
  2016-12-06 20:41             ` [PATCH v3] daemon: Set ownership of kept build directories to the calling user Danny Milosavljevic
  1 sibling, 1 reply; 56+ messages in thread
From: Ludovic Courtès @ 2016-12-06 15:08 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: guix-devel

Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

> Fixes <http://bugs.gnu.org/15890>.
>
> * nix/libstore/globals.hh (Settings) Add clientUid and clientGid.
> * nix/nix-daemon/nix-daemon.cc (daemonLoop] Store UID and GID of the
>   caller in settings.
> * nix/libstore/build.cc (_chown): New function.
>   (DerivationGoal::deleteTmpDir): Use it, change ownership of build
>   directory if it is kept and the new owner is not root.

[...]

> +static void _chown(const Path & path, uid_t uid, gid_t gid)
> +{
> +    checkInterrupt();
> +
> +    printMsg(lvlVomit, format("%1%") % path);

Please remove this line (we wouldn’t be able to track where the message
comes from).

> +    /* User and groud id of the client issuing the buld request.  Used to set
                                                       ^^
Typo.  Also:

  … issuing the build request, or -1 if the UID and GID are not known.

> +       the owner and group of the keept temporary directories of failed
                                      ^^
Typo.

If you have checked that it works as intended, please push with these
changes and email the commit ID to 15890-done@debbugs.gnu.org.

Thank you!

Ludo’.

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

* Re: [PATCH v3] daemon: Set ownership of kept build directories to the calling user.
  2016-12-05 20:46           ` [PATCH v3] " Hartmut Goebel
  2016-12-06 15:08             ` Ludovic Courtès
@ 2016-12-06 20:41             ` Danny Milosavljevic
  2016-12-08 12:16               ` Hartmut Goebel
  1 sibling, 1 reply; 56+ messages in thread
From: Danny Milosavljevic @ 2016-12-06 20:41 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: guix-devel

Hi Hartmut,

> +#if defined(SO_PEERCRED)
...
> +#else
> +                /* Setting these to -1 means: do not change */
> +                settings.clientUid = -1;
> +                settings.clientGid = -1;
> +#endif

I think you also have to cast them there, so

               settings.clientUid = (uid_t) -1;
               settings.clientGid = (gid_t) -1;

The reason is because (-1) is a signed integer and clientUid isn't - and neither is clientGid.

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

* Re: [PATCH v3] daemon: Set ownership of kept build directories to the calling user.
  2016-12-06 15:08             ` Ludovic Courtès
@ 2016-12-08 12:12               ` Hartmut Goebel
  2016-12-08 12:14                 ` [PATCH v4] " Hartmut Goebel
                                   ` (2 more replies)
  0 siblings, 3 replies; 56+ messages in thread
From: Hartmut Goebel @ 2016-12-08 12:12 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Am 06.12.2016 um 16:08 schrieb Ludovic Courtès:
> If you have checked that it works as intended, please push with these
> changes and email the commit ID to 15890-done@debbugs.gnu.org.

I can only verify that it worked with revision 6634180 "gnu: guile-ssh:
Update to 0.10.2.", but not with current master.

Starting with 21531ad "offload: Use Guile-SSH instead of GNU lsh" I get
errors, which I could not work around:

guix: offload: command not found
Try `guix --help' for more information.
guix build: error: build failed: unexpected EOF reading a line

So, although I'm confident the code is correct, I can not verify with
current master. Thus I'm posting a new version of the patch asking you
to test and push.

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |

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

* [PATCH v4] daemon: Set ownership of kept build directories to the calling user.
  2016-12-08 12:12               ` Hartmut Goebel
@ 2016-12-08 12:14                 ` Hartmut Goebel
  2016-12-09 14:23                   ` Ludovic Courtès
  2016-12-09 14:22                 ` [PATCH v3] " Ludovic Courtès
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
  2 siblings, 1 reply; 56+ messages in thread
From: Hartmut Goebel @ 2016-12-08 12:14 UTC (permalink / raw)
  To: guix-devel

Fixes <http://bugs.gnu.org/15890>.

* nix/libstore/globals.hh (Settings) Add clientUid and clientGid.
* nix/nix-daemon/nix-daemon.cc (daemonLoop] Store UID and GID of the
  caller in settings.
* nix/libstore/build.cc (_chown): New function.
  (DerivationGoal::deleteTmpDir): Use it, change ownership of build
  directory if it is kept and the new owner is not root.
---
 nix/libstore/build.cc        | 21 +++++++++++++++++++++
 nix/libstore/globals.hh      |  6 ++++++
 nix/nix-daemon/nix-daemon.cc | 12 ++++++++++++
 3 files changed, 39 insertions(+)

diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index 889ee3d..e823001 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -2631,6 +2631,21 @@ void DerivationGoal::closeLogFile()
 }
 
 
+static void _chown(const Path & path, uid_t uid, gid_t gid)
+{
+    checkInterrupt();
+
+    if (lchown(path.c_str(), uid, gid) == -1) {
+	throw SysError(format("change owner and group of `%1%'") % path);
+    }
+    struct stat st = lstat(path);
+    if (S_ISDIR(st.st_mode)) {
+        for (auto & i : readDirectory(path))
+            _chown(path + "/" + i.name, uid, gid);
+    }
+}
+
+
 void DerivationGoal::deleteTmpDir(bool force)
 {
     if (tmpDir != "") {
@@ -2639,6 +2654,12 @@ void DerivationGoal::deleteTmpDir(bool force)
                 format("note: keeping build directory `%2%'")
                 % drvPath % tmpDir);
             chmod(tmpDir.c_str(), 0755);
+            // Change the ownership if clientUid is set. Never change the
+            // ownership or the group to "root" for security reasons.
+            if (settings.clientUid != (uid_t) -1 && settings.clientUid != 0) {
+                _chown(tmpDir, settings.clientUid,
+                       settings.clientGid != 0 ? settings.clientGid : -1);
+            }
         }
         else
             deletePath(tmpDir);
diff --git a/nix/libstore/globals.hh b/nix/libstore/globals.hh
index 8c07e36..7beb1a5 100644
--- a/nix/libstore/globals.hh
+++ b/nix/libstore/globals.hh
@@ -70,6 +70,12 @@ struct Settings {
        subgoal of the same goal) fails. */
     bool keepGoing;
 
+    /* User and groud id of the client issuing the build request.  Used to set
+       the owner and group of the kept temporary directories of failed
+       builds. */
+    uid_t clientUid;
+    gid_t clientGid;
+
     /* Whether, if we cannot realise the known closure corresponding
        to a derivation, we should try to normalise the derivation
        instead. */
diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc
index 682f9a2..47b67d5 100644
--- a/nix/nix-daemon/nix-daemon.cc
+++ b/nix/nix-daemon/nix-daemon.cc
@@ -960,6 +960,18 @@ static void daemonLoop()
                     strncpy(argvSaved[1], processName.c_str(), strlen(argvSaved[1]));
                 }
 
+#if defined(SO_PEERCRED)
+                /* Store the client's user and group for this connection. This
+                   has to be done in the forked process since it is per
+                   connection. */
+                settings.clientUid = cred.uid;
+                settings.clientGid = cred.gid;
+#else
+                /* Setting these to -1 means: do not change */
+                settings.clientUid = (uid_t) -1;
+                settings.clientGid = (gid_t) -1;
+#endif
+
                 /* Handle the connection. */
                 from.fd = remote;
                 to.fd = remote;
-- 
2.7.4

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

* Re: [PATCH v3] daemon: Set ownership of kept build directories to the calling user.
  2016-12-06 20:41             ` [PATCH v3] daemon: Set ownership of kept build directories to the calling user Danny Milosavljevic
@ 2016-12-08 12:16               ` Hartmut Goebel
  0 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2016-12-08 12:16 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

Am 06.12.2016 um 21:41 schrieb Danny Milosavljevic:
> I think you also have to cast them there, so
>
>                settings.clientUid = (uid_t) -1;
>                settings.clientGid = (gid_t) -1;

Thanks, I changes this accordingly.

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |

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

* Re: [PATCH v3] daemon: Set ownership of kept build directories to the calling user.
  2016-12-08 12:12               ` Hartmut Goebel
  2016-12-08 12:14                 ` [PATCH v4] " Hartmut Goebel
@ 2016-12-09 14:22                 ` Ludovic Courtès
  2016-12-09 15:50                   ` Guile-SSH found at configure-time but not at run-time Hartmut Goebel
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
  2 siblings, 1 reply; 56+ messages in thread
From: Ludovic Courtès @ 2016-12-09 14:22 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: guix-devel

Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

> Am 06.12.2016 um 16:08 schrieb Ludovic Courtès:
>> If you have checked that it works as intended, please push with these
>> changes and email the commit ID to 15890-done@debbugs.gnu.org.
>
> I can only verify that it worked with revision 6634180 "gnu: guile-ssh:
> Update to 0.10.2.", but not with current master.
>
> Starting with 21531ad "offload: Use Guile-SSH instead of GNU lsh" I get
> errors, which I could not work around:
>
> guix: offload: command not found
> Try `guix --help' for more information.
> guix build: error: build failed: unexpected EOF reading a line

You need to install Guile-SSH to fix this (Guile-SSH was found at
configure-time but not at run-time, leading to this error.)

Ludo’.

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

* Re: [PATCH v4] daemon: Set ownership of kept build directories to the calling user.
  2016-12-08 12:14                 ` [PATCH v4] " Hartmut Goebel
@ 2016-12-09 14:23                   ` Ludovic Courtès
  2016-12-09 14:47                     ` Hartmut Goebel
  0 siblings, 1 reply; 56+ messages in thread
From: Ludovic Courtès @ 2016-12-09 14:23 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: guix-devel

Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

> Fixes <http://bugs.gnu.org/15890>.
>
> * nix/libstore/globals.hh (Settings) Add clientUid and clientGid.
> * nix/nix-daemon/nix-daemon.cc (daemonLoop] Store UID and GID of the
>   caller in settings.
> * nix/libstore/build.cc (_chown): New function.
>   (DerivationGoal::deleteTmpDir): Use it, change ownership of build
>   directory if it is kept and the new owner is not root.

OK, please push.

Thank you!

Ludo’.

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

* Re: [PATCH v4] daemon: Set ownership of kept build directories to the calling user.
  2016-12-09 14:23                   ` Ludovic Courtès
@ 2016-12-09 14:47                     ` Hartmut Goebel
  0 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2016-12-09 14:47 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Am 09.12.2016 um 15:23 schrieb Ludovic Courtès:
> OK, please push.
Done. Thanks for testing.

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |

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

* Guile-SSH found at configure-time but not at run-time
  2016-12-09 14:22                 ` [PATCH v3] " Ludovic Courtès
@ 2016-12-09 15:50                   ` Hartmut Goebel
  2016-12-09 20:35                     ` Ludovic Courtès
  0 siblings, 1 reply; 56+ messages in thread
From: Hartmut Goebel @ 2016-12-09 15:50 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Am 09.12.2016 um 15:22 schrieb Ludovic Courtès:
> You need to install Guile-SSH to fix this (Guile-SSH was found at
> configure-time but not at run-time, leading to this error.)

I wonder how this can happen. I'm running within "guix environment guix".

Maybe I need to run within "./pre-inst guix environment guix"?

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |

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

* Re: Guile-SSH found at configure-time but not at run-time
  2016-12-09 15:50                   ` Guile-SSH found at configure-time but not at run-time Hartmut Goebel
@ 2016-12-09 20:35                     ` Ludovic Courtès
  0 siblings, 0 replies; 56+ messages in thread
From: Ludovic Courtès @ 2016-12-09 20:35 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: guix-devel

Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

> Am 09.12.2016 um 15:22 schrieb Ludovic Courtès:
>> You need to install Guile-SSH to fix this (Guile-SSH was found at
>> configure-time but not at run-time, leading to this error.)
>
> I wonder how this can happen. I'm running within "guix environment guix".

In ‘guix environment guix’, Guile-SSH is definitely going to be found;
you can confirm this by looking at ‘config.log’.

However, if you type “make install” from there, then it may be the case
that Guile-SSH is no longer visible in the installed environment.

HTH!

Ludo’.

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

* Re: [PATCH v4] daemon: Set ownership of kept build directories to the calling user.
@ 2016-12-23 11:18 Vincent Legoll
  2016-12-23 13:33 ` John Darrington
  0 siblings, 1 reply; 56+ messages in thread
From: Vincent Legoll @ 2016-12-23 11:18 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: guix-devel

Hello,

+            // Change the ownership if clientUid is set. Never change the
+            // ownership or the group to "root" for security reasons.
+            if (settings.clientUid != (uid_t) -1 && settings.clientUid != 0) {

Is "0" a magical value that don't need casting or am I missing something ?

-- 
Vincent Legoll

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

* Re: [PATCH v4] daemon: Set ownership of kept build directories to the calling user.
  2016-12-23 11:18 [PATCH v4] " Vincent Legoll
@ 2016-12-23 13:33 ` John Darrington
  2016-12-23 21:15   ` Danny Milosavljevic
  0 siblings, 1 reply; 56+ messages in thread
From: John Darrington @ 2016-12-23 13:33 UTC (permalink / raw)
  To: Vincent Legoll; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 762 bytes --]

On Fri, Dec 23, 2016 at 12:18:11PM +0100, Vincent Legoll wrote:
     Hello,
     
     +            // Change the ownership if clientUid is set. Never change the
     +            // ownership or the group to "root" for security reasons.
     +            if (settings.clientUid != (uid_t) -1 && settings.clientUid != 0) {
     
     Is "0" a magical value that don't need casting or am I missing something ?
     
Presumably clientUid is an unsigned integral type.  Hence -1 does need a cast, whereas
0 does not.

J'

-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: [PATCH v4] daemon: Set ownership of kept build directories to the calling user.
  2016-12-23 13:33 ` John Darrington
@ 2016-12-23 21:15   ` Danny Milosavljevic
  2016-12-24 12:34     ` Hartmut Goebel
  0 siblings, 1 reply; 56+ messages in thread
From: Danny Milosavljevic @ 2016-12-23 21:15 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel, Vincent Legoll

On Fri, 23 Dec 2016 14:33:31 +0100
John Darrington <john@darrington.wattle.id.au> wrote:

> On Fri, Dec 23, 2016 at 12:18:11PM +0100, Vincent Legoll wrote:
>      Hello,
>      
>      +            // Change the ownership if clientUid is set. Never change the
>      +            // ownership or the group to "root" for security reasons.
>      +            if (settings.clientUid != (uid_t) -1 && settings.clientUid != 0) {
>      
>      Is "0" a magical value that don't need casting or am I missing something ?
>      
> Presumably clientUid is an unsigned integral type.  Hence -1 does need a cast, whereas
> 0 does not.

Technically I agree. If it was my code I'd cast it regardless.

Also, why use the magical value 0 for gid? Why not likewise (gid_t) -1 ?

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

* Re: [PATCH v4] daemon: Set ownership of kept build directories to the calling user.
  2016-12-23 21:15   ` Danny Milosavljevic
@ 2016-12-24 12:34     ` Hartmut Goebel
  2016-12-25 23:34       ` Danny Milosavljevic
  0 siblings, 1 reply; 56+ messages in thread
From: Hartmut Goebel @ 2016-12-24 12:34 UTC (permalink / raw)
  To: guix-devel

Am 23.12.2016 um 22:15 schrieb Danny Milosavljevic:
> Also, why use the magical value 0 for gid? Why not likewise (gid_t) -1 ?

The "magic value" for gid is -1, too, as you can see in
nix/nix-daemon/nix-daemon.cc.

gid 0 is not used as a magic value. As you can read in the comment, the
test just prohibits changing the group to "root":

    settings.clientGid != 0 ? settings.clientGid : -1

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |

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

* Re: [PATCH v4] daemon: Set ownership of kept build directories to the calling user.
  2016-12-24 12:34     ` Hartmut Goebel
@ 2016-12-25 23:34       ` Danny Milosavljevic
  0 siblings, 0 replies; 56+ messages in thread
From: Danny Milosavljevic @ 2016-12-25 23:34 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: guix-devel

Hi,

On Sat, 24 Dec 2016 13:34:16 +0100
Hartmut Goebel <h.goebel@crazy-compilers.com> wrote:

> The "magic value" for gid is -1, too, as you can see in
> nix/nix-daemon/nix-daemon.cc.
> 
> gid 0 is not used as a magic value. As you can read in the comment, the
> test just prohibits changing the group to "root":
> 
>     settings.clientGid != 0 ? settings.clientGid : -1

Ah, ok then.

Sorry for the noise...

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

* [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user.
  2016-12-08 12:12               ` Hartmut Goebel
  2016-12-08 12:14                 ` [PATCH v4] " Hartmut Goebel
  2016-12-09 14:22                 ` [PATCH v3] " Ludovic Courtès
@ 2019-07-11 20:26                 ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH] gc: Add option --keep-going Hartmut Goebel
                                     ` (29 more replies)
  2 siblings, 30 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

Fixes <http://bugs.gnu.org/15890>.

* nix/libstore/globals.hh (Settings) Add clientUid and clientGid.
* nix/nix-daemon/nix-daemon.cc (daemonLoop] Store UID and GID of the
  caller in settings.
* nix/libstore/build.cc (_chown): New function.
  (DerivationGoal::deleteTmpDir): Use it, change ownership of build
  directory if it is kept and the new owner is not root.
---
 nix/libstore/build.cc        | 21 +++++++++++++++++++++
 nix/libstore/globals.hh      |  6 ++++++
 nix/nix-daemon/nix-daemon.cc | 12 ++++++++++++
 3 files changed, 39 insertions(+)

diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index 889ee3d..e823001 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -2631,6 +2631,21 @@ void DerivationGoal::closeLogFile()
 }
 
 
+static void _chown(const Path & path, uid_t uid, gid_t gid)
+{
+    checkInterrupt();
+
+    if (lchown(path.c_str(), uid, gid) == -1) {
+	throw SysError(format("change owner and group of `%1%'") % path);
+    }
+    struct stat st = lstat(path);
+    if (S_ISDIR(st.st_mode)) {
+        for (auto & i : readDirectory(path))
+            _chown(path + "/" + i.name, uid, gid);
+    }
+}
+
+
 void DerivationGoal::deleteTmpDir(bool force)
 {
     if (tmpDir != "") {
@@ -2639,6 +2654,12 @@ void DerivationGoal::deleteTmpDir(bool force)
                 format("note: keeping build directory `%2%'")
                 % drvPath % tmpDir);
             chmod(tmpDir.c_str(), 0755);
+            // Change the ownership if clientUid is set. Never change the
+            // ownership or the group to "root" for security reasons.
+            if (settings.clientUid != (uid_t) -1 && settings.clientUid != 0) {
+                _chown(tmpDir, settings.clientUid,
+                       settings.clientGid != 0 ? settings.clientGid : -1);
+            }
         }
         else
             deletePath(tmpDir);
diff --git a/nix/libstore/globals.hh b/nix/libstore/globals.hh
index 8c07e36..7beb1a5 100644
--- a/nix/libstore/globals.hh
+++ b/nix/libstore/globals.hh
@@ -70,6 +70,12 @@ struct Settings {
        subgoal of the same goal) fails. */
     bool keepGoing;
 
+    /* User and groud id of the client issuing the build request.  Used to set
+       the owner and group of the kept temporary directories of failed
+       builds. */
+    uid_t clientUid;
+    gid_t clientGid;
+
     /* Whether, if we cannot realise the known closure corresponding
        to a derivation, we should try to normalise the derivation
        instead. */
diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc
index 682f9a2..47b67d5 100644
--- a/nix/nix-daemon/nix-daemon.cc
+++ b/nix/nix-daemon/nix-daemon.cc
@@ -960,6 +960,18 @@ static void daemonLoop()
                     strncpy(argvSaved[1], processName.c_str(), strlen(argvSaved[1]));
                 }
 
+#if defined(SO_PEERCRED)
+                /* Store the client's user and group for this connection. This
+                   has to be done in the forked process since it is per
+                   connection. */
+                settings.clientUid = cred.uid;
+                settings.clientGid = cred.gid;
+#else
+                /* Setting these to -1 means: do not change */
+                settings.clientUid = (uid_t) -1;
+                settings.clientGid = (gid_t) -1;
+#endif
+
                 /* Handle the connection. */
                 from.fd = remote;
                 to.fd = remote;
-- 
2.7.4

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

* [bug#36605] [PATCH] gc: Add option --keep-going.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH] gnu: Add anonip Hartmut Goebel
                                     ` (28 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

* guix/scripts/gc.scm (show-help, %options): Add option -k/--keep-going.
  (guix-gc): Pass value off option --keep-going on to delete-paths.
* guix/store.scm (%protocol-version): Increment to 17.
  (delete-paths) New key-word parameter `keep-going?`, pass it on to
  run-rc.
  (run-gc): New key-word parameter `keep-going?`, send value of
  keep-going? to the daemon.
* nix/libstore/store-api.hh (GCOptions): Add boolean keepGoing.
* nix/libstore/worker-protocol.hh (PROTOCOL_VERSION) Increment to 17.
* nix/nix-daemon/nix-daemon.cc (performOp)[wopCollectGarbage] Read
  keepGoing.
* nix/libstore/gc.cc (LocalStore::collectGarbage) If keepGoing is true
  print an error message instead of throwing an error.
* doc/guix.texi (Invoking guix gc): Document option --keep-going.
---
 doc/guix.texi                   |  8 +++++++-
 guix/scripts/gc.scm             |  9 ++++++++-
 guix/store.scm                  | 12 ++++++++----
 nix/libstore/gc.cc              |  7 ++++++-
 nix/libstore/store-api.hh       |  3 +++
 nix/libstore/worker-protocol.hh |  2 +-
 nix/nix-daemon/nix-daemon.cc    |  2 ++
 7 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index a3eba58..b8362d6 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -2098,7 +2098,13 @@ nothing and exit immediately.
 @itemx -d
 Attempt to delete all the store files and directories specified as
 arguments.  This fails if some of the files are not in the store, or if
-they are still live.
+they are still live (with behaviour can be changed with
+@option{--keep-going}).
+
+@item --keep-going
+@itemx -k
+Keep going when @option{--delete} is given and some of the store files
+and directories specified as arguments fail to re removed.
 
 @item --list-failures
 List store items corresponding to cached build failures.
diff --git a/guix/scripts/gc.scm b/guix/scripts/gc.scm
index bdfee43..778e9a7 100644
--- a/guix/scripts/gc.scm
+++ b/guix/scripts/gc.scm
@@ -72,6 +72,9 @@ Invoke the garbage collector.\n"))
       --clear-failures   remove PATHS from the set of cached failures"))
   (newline)
   (display (_ "
+  -k, --keep-going       keep going when some of th pathes can not be deleted"))
+  (newline)
+  (display (_ "
   -h, --help             display this help and exit"))
   (display (_ "
   -V, --version          display version information and exit"))
@@ -107,6 +110,9 @@ Invoke the garbage collector.\n"))
                 (lambda (opt name arg result)
                   (alist-cons 'action 'delete
                               (alist-delete 'action result))))
+        (option '(#\k "keep-going") #f #f
+                (lambda (opt name arg result)
+                  (alist-cons 'keep-going? #t result)))
         (option '("optimize") #f #f
                 (lambda (opt name arg result)
                   (alist-cons 'action 'optimize
@@ -228,7 +234,8 @@ Invoke the garbage collector.\n"))
              (let-values (((paths freed) (collect-garbage store)))
               (info (_ "freed ~h bytes~%") freed))))))
         ((delete)
-         (delete-paths store (map direct-store-path paths)))
+         (delete-paths store (map direct-store-path paths)
+                       #:keep-going? (assoc-ref opts 'keep-going?)))
         ((list-references)
          (list-relatives references))
         ((list-requisites)
diff --git a/guix/store.scm b/guix/store.scm
index 2023875..4276db4 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -137,7 +137,7 @@
             direct-store-path
             log-file))
 
-(define %protocol-version #x110)
+(define %protocol-version #x111)
 
 (define %worker-magic-1 #x6e697863)               ; "nixc"
 (define %worker-magic-2 #x6478696f)               ; "dxio"
@@ -938,7 +938,7 @@ is not an atomic operation.)  When CHECK-CONTENTS? is true, check the contents
 of store items; this can take a lot of time."
       (not (verify store check-contents? repair?)))))
 
-(define (run-gc server action to-delete min-freed)
+(define* (run-gc server action to-delete min-freed #:key (keep-going? #f))
   "Perform the garbage-collector operation ACTION, one of the
 `gc-action' values.  When ACTION is `delete-specific', the TO-DELETE is
 the list of store paths to delete.  IGNORE-LIVENESS? should always be
@@ -956,6 +956,8 @@ and the number of bytes freed."
       ;; Obsolete `use-atime' and `max-atime' parameters.
       (write-int 0 s)
       (write-int 0 s))
+    (when (>= (nix-server-minor-version server) 17)
+      (write-arg boolean keep-going? s))
 
     ;; Loop until the server is done sending error output.
     (let loop ((done? (process-stderr server)))
@@ -993,12 +995,14 @@ then collect at least MIN-FREED bytes.  Return the paths that were
 collected, and the number of bytes freed."
   (run-gc server (gc-action delete-dead) '() min-freed))
 
-(define* (delete-paths server paths #:optional (min-freed (%long-long-max)))
+(define* (delete-paths server paths #:optional (min-freed (%long-long-max))
+                       #:key (keep-going? #f))
   "Delete PATHS from the store at SERVER, if they are no longer
 referenced.  If MIN-FREED is non-zero, then stop after at least
 MIN-FREED bytes have been collected.  Return the paths that were
 collected, and the number of bytes freed."
-  (run-gc server (gc-action delete-specific) paths min-freed))
+  (run-gc server (gc-action delete-specific) paths min-freed
+          #:keep-going? keep-going?))
 
 (define (import-paths server port)
   "Import the set of store paths read from PORT into SERVER's store.  An error
diff --git a/nix/libstore/gc.cc b/nix/libstore/gc.cc
index 72eff52..6f2d8f7 100644
--- a/nix/libstore/gc.cc
+++ b/nix/libstore/gc.cc
@@ -662,8 +662,13 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
         foreach (PathSet::iterator, i, options.pathsToDelete) {
             assertStorePath(*i);
             tryToDelete(state, *i);
-            if (state.dead.find(*i) == state.dead.end())
+            if (state.dead.find(*i) == state.dead.end()) {
+              if (options.keepGoing) {
+                printMsg(lvlError, format("cannot delete path `%1%' since it is still alive") % *i);
+              } else {
                 throw Error(format("cannot delete path `%1%' since it is still alive") % *i);
+              }
+            }
         }
 
     } else if (options.maxFreed > 0) {
diff --git a/nix/libstore/store-api.hh b/nix/libstore/store-api.hh
index fa78d59..8b0f521 100644
--- a/nix/libstore/store-api.hh
+++ b/nix/libstore/store-api.hh
@@ -50,6 +50,9 @@ struct GCOptions
     /* Stop after at least `maxFreed' bytes have been freed. */
     unsigned long long maxFreed;
 
+    /* keep going even if some of the paths can not be collected */
+    bool keepGoing;
+
     GCOptions();
 };
 
diff --git a/nix/libstore/worker-protocol.hh b/nix/libstore/worker-protocol.hh
index 99c1ee2..8faf193 100644
--- a/nix/libstore/worker-protocol.hh
+++ b/nix/libstore/worker-protocol.hh
@@ -6,7 +6,7 @@ namespace nix {
 #define WORKER_MAGIC_1 0x6e697863
 #define WORKER_MAGIC_2 0x6478696f
 
-#define PROTOCOL_VERSION 0x110
+#define PROTOCOL_VERSION 0x111
 #define GET_PROTOCOL_MAJOR(x) ((x) & 0xff00)
 #define GET_PROTOCOL_MINOR(x) ((x) & 0x00ff)
 
diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc
index a1fce25..b04cece 100644
--- a/nix/nix-daemon/nix-daemon.cc
+++ b/nix/nix-daemon/nix-daemon.cc
@@ -526,6 +526,8 @@ static void performOp(bool trusted, unsigned int clientVersion,
             readInt(from);
             readInt(from);
         }
+        if (GET_PROTOCOL_MINOR(clientVersion) >= 17)
+	  options.keepGoing = readInt(from) != 0;
 
         GCResults results;
 
-- 
2.7.4

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

* [bug#36605] [PATCH] gnu: Add anonip.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH] gc: Add option --keep-going Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH] gnu: Add dtrx Hartmut Goebel
                                     ` (27 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

* gnu/packages/web.scm (anonip): New variable.
---
 gnu/packages/web.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index 124cc93e68..386564206e 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -33,6 +33,7 @@
 ;;; Copyright © 2019 Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;;; Copyright © 2019 Brendan Tildesley <mail@brendan.scot>
 ;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
+;;; Copyright © 2019 Hartmut Goebel <h.goebel@crazy-compilers.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -6498,3 +6499,34 @@ update an existing mirrored site, and resume interrupted downloads.
 
 HTTrack is fully configurable, and has an integrated help system.")
     (license license:gpl3+)))
+
+(define-public anonip
+  (package
+    (name "anonip")
+    (version "1.0.0")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "anonip" version))
+              (sha256
+               (base32
+                "0ckn9nnfhpdnz8b92q8pkysdqj6pdh71ckfqvfj0z01cq0hzbhd2"))))
+    (build-system python-build-system)
+    (inputs
+     `(("python-3" ,python-3)))
+    (home-page
+     "https://github.com/DigitaleGesellschaft/Anonip")
+    (synopsis
+     "Anonymize IP-addresses in log-files")
+    (description
+     "Anonip masks the last bits of IPv4 and IPv6 addresses in log-files.
+That way most of the relevant information is preserved, while the IP-address
+does not match a particular individuum anymore.
+
+Depending on your webserver software, the log entries may directly get piped
+to Anonip or read via a FIFO (named pipe).  Thus the unmasked IP addresses
+will never be written to any file.
+
+It's also possible to rewrite existing log files.
+
+Anonip can also be uses as a Python module in your own Python application.")
+    (license license:bsd-3)))
-- 
2.13.7

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

* [bug#36605] [PATCH] gnu: Add dtrx.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH] gc: Add option --keep-going Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH] gnu: Add anonip Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH] gnu: Add php-hello-world Hartmut Goebel
                                     ` (26 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

* gnu/packages/compression.scm (dtrx): New variable.
---
 gnu/packages/compression.scm | 50 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm
index ae6710b25..0d9a6bfcf 100644
--- a/gnu/packages/compression.scm
+++ b/gnu/packages/compression.scm
@@ -20,6 +20,7 @@
 ;;; Copyright © 2017 Stefan Reichör <stefan@xsteve.at>
 ;;; Copyright © 2017 Petter <petter@mykolab.ch>
 ;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
+;;; Copyright © 2018 Hartmut Goebel <h.goebel@crazy-compilers.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -53,10 +54,12 @@
   #:use-module (gnu packages backup)
   #:use-module (gnu packages base)
   #:use-module (gnu packages check)
+  #:use-module (gnu packages cpio)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages file)
   #:use-module (gnu packages java)
   #:use-module (gnu packages maths)
+  #:use-module (gnu packages package-management)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages perl-check)
   #:use-module (gnu packages pkg-config)
@@ -2051,3 +2054,50 @@ faster by plzip, unless the @code{-b} option was used: lzip usually produces
 single-member files which can't be decompressed in parallel.")
     (license (list license:bsd-2        ; arg_parser.{cc,h}
                    license:gpl2+))))    ; everything else
+
+
+(define-public dtrx
+  (package
+    (name "dtrx")
+    (version "7.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://brettcsmith.org/2007/"
+                           "dtrx/dtrx-" version ".tar.gz"))
+       (sha256
+        (base32 "15yf4n27zbhvv0byfv3i89wl5zn6jc2wbc69lk5a3m6rx54gx6hw"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:python ,python-2))
+    (inputs
+     `(("binutils" ,binutils) ; ar
+       ("bzip2" ,bzip2) ; bzcat
+       ("cabextract" ,cabextract)
+       ("cpio" ,cpio) ; cpio
+       ("gzip" ,gzip) ; zcat
+       ;; ("lha" ,lha) missing in guix
+       ("p7zip" ,p7zip) ; 7z
+       ("rpm" ,rpm) ; rpm2cpio
+       ("tar" ,tar)
+       ;; ("unrar" ,unrar) ; abandoned upstream
+       ("unshield" ,unshield)
+       ("unzip" ,unzip)
+       ("xz" ,xz))) ; lzcat, xzcat
+    (home-page "http://www.brettcsmith.org/2007/dtrx/")
+    (synopsis "Intelligently extract multiple archive types")
+    (description "@command{dtrx} extracts archives in a number of different
+formats, so you don't have to remember the flags for each archive command.
+Just use the same command for all your archive files, and they'll never
+frustrate you again.
+
+In addition to providing one command to handle many different archive types,
+@command{dtrx} also aids the user by extracting contents consistently.  By
+default, everything will be written to a dedicated directory that’s named
+after the archive.  dtrx will also change the permissions to ensure that the
+owner can read and write all those files.
+
+It currently supports tar, zip (including self-extracting .exe files), cpio,
+rpm, deb, gem, 7z, cab, rar, and InstallShield files.  It can also decompress
+files compressed with gzip, bzip2, lzma, xz, or compress.")
+    (license license:gpl3+)))
-- 
2.13.6

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

* [bug#36605] [PATCH] gnu: Add php-hello-world.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (2 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH] gnu: Add dtrx Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH] gnu: Add python-gunicorn and python2-gunicorn Hartmut Goebel
                                     ` (25 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

* gnu/packages/php.scm (php-hello-world): New variable.
---
 gnu/packages/php.scm | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/gnu/packages/php.scm b/gnu/packages/php.scm
index 9ccbede..f860f88 100644
--- a/gnu/packages/php.scm
+++ b/gnu/packages/php.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -48,6 +49,7 @@
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system trivial)
   #:use-module ((guix licenses) #:prefix license:))
 
 ;; This fixes PHP bugs 73155 and 73159. Remove when gd
@@ -332,3 +334,38 @@ systems, web content management systems and web frameworks." )
               license:lgpl2.1+                              ; ext/bcmath/libbcmath
               license:bsd-2                                 ; ext/fileinfo/libmagic
               license:expat))))                             ; ext/date/lib
+
+(define-public php-hello-world
+  (package
+    (name "php-hello-world")
+    (version "0.1")
+    (source #f)
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils))
+         (let* ((out       (assoc-ref %outputs "out"))
+                (php       (assoc-ref %build-inputs "php"))
+                (index.php (string-append out "/index.php")))
+           (mkdir-p out)
+           (call-with-output-file index.php
+             (lambda (p)
+               (format p "<html>
+ <head><title>PHP test page: Hello, Guix!</title></head>
+ <body>
+ <?php echo '<h1>Hello, Guix!</h1>'; ?>
+ <p>Today is: <?php echo date('Y-m-d'); ?></p>
+ </body>
+</html>~%")))
+           (chmod index.php #o555)))))
+    (inputs
+     `(("php" ,php)))
+    (synopsis "Hello, PHP world: An example PHP package")
+    (description
+     "PHP Hello World creates a simple HTML page saying \"Hello, Guix!\" and
+the current date.  It serves as an example to be used in Guix PHP packages or
+services.")
+    (home-page "http://php.net/manual/en/tutorial.firstpage.php")
+    (license license:gpl3+)))
-- 
2.7.4

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

* [bug#36605] [PATCH] gnu: Add python-gunicorn and python2-gunicorn.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (3 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH] gnu: Add php-hello-world Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 0/2] Updated patches for gunicorn Hartmut Goebel
                                     ` (24 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

* gnu/packages/web.scm (python-gunicorn, python2-gunicorn): New
  variables.
---
 gnu/packages/web.scm | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index 20c7d12..e639d28 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -3633,3 +3633,51 @@ provides a unix command line interface to a variety of popular www search engine
 and similar services.")
     (home-page "https://surfraw.alioth.debian.org/")
     (license l:public-domain)))
+
+(define-public python-gunicorn
+  (package
+    (name "python-gunicorn")
+    (version "19.6.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "gunicorn" version))
+       (sha256
+        (base32
+         "065n5z91607q4l8wncqkz297cdcb60cz8wnyxy88wk4as4b6jgw1"))))
+    (build-system python-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-before 'check 'remove-requirements
+           ; setup.py reads test-requirements from a file which is
+           ; pinning to other versions then guix provides. This also
+           ; enforces optional packages like pytst-cov. So clean the
+           ; list.
+           (lambda _
+             (substitute* "requirements_test.txt"
+               ((".*") "")))))))
+    (native-inputs
+     `(("python-pytest" ,python-pytest)
+       ;("python-pytest-cov" ,python-pytest-cov) ; optional
+       ("python-setuptools" ,python-setuptools)))
+    (home-page "http://gunicorn.org/")
+    (synopsis "Python WSGI HTTP Server for UNIX")
+    (description "Gunicorn ‘Green Unicorn’ is a Python WSGI HTTP
+Server for UNIX.  It’s a pre-fork worker model ported from Ruby’s
+Unicorn project.  The Gunicorn server is broadly compatible with
+various web frameworks, simply implemented, light on server resources,
+and fairly speedy.")
+  (license license:expat)
+  (properties `((python2-variant . ,(delay python2-gunicorn))))))
+
+(define-public python2-gunicorn
+  (let ((base (package-with-python2
+               (strip-python2-variant python-gunicorn))))
+    ; Note: byte-compiling gunicorn/workers/_gaiohttp.py with Python 2
+    ; fails, but this module will be available for Python 3 only
+    ; anyway.
+    (package
+      (inherit base)
+      (native-inputs `(("python2-mock" ,python2-mock)
+                       ,@(package-native-inputs base))))))
-- 
2.7.4

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

* [bug#36605] [PATCH 0/2] Updated patches for gunicorn
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (4 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH] gnu: Add python-gunicorn and python2-gunicorn Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 1/2] gnu: Add gunicorn and gunicorn-python2 Hartmut Goebel
                                     ` (23 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

As discussed, I updated some comments. Additionally I added building teh
documentation (2nd patch).

Hartmut Goebel (2):
  gnu: Add gunicorn and gunicorn-python2.
  gnu: Build documentation for gunicorn and gunicorn-python2.

 gnu/packages/web.scm | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)

-- 
2.7.4

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

* [bug#36605] [PATCH 1/2] gnu: Add gunicorn and gunicorn-python2.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (5 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 0/2] Updated patches for gunicorn Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 2/2] gnu: Build documentation for " Hartmut Goebel
                                     ` (22 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

* gnu/packages/web.scm (gunicorn, gunicorn-python2): New variables.
---
 gnu/packages/web.scm | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index b9c201d..3841c6b 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -14,6 +14,7 @@
 ;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
 ;;; Copyright © 2016 Clément Lassieur <clement@lassieur.org>
 ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
+;;; Copyright © 2016 Hartmut Goebel <g.goebel@crazy-compilers.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -41,6 +42,7 @@
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system glib-or-gtk)
   #:use-module (guix build-system perl)
+  #:use-module (guix build-system python)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system r)
   #:use-module (guix build-system trivial)
@@ -3633,3 +3635,56 @@ provides a unix command line interface to a variety of popular www search engine
 and similar services.")
     (home-page "https://surfraw.alioth.debian.org/")
     (license l:public-domain)))
+
+(define-public gunicorn
+  (package
+    (name "gunicorn")
+    (version "19.6.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "gunicorn" version))
+       (sha256
+        (base32
+         "065n5z91607q4l8wncqkz297cdcb60cz8wnyxy88wk4as4b6jgw1"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'check 'remove-requirements
+           ; setup.py reads test-requirements from a file which is
+           ; pinning to other versions then guix provides. This also
+           ; enforces optional packages like pytst-cov. So clean the
+           ; list.
+           (lambda _
+             (substitute* "requirements_test.txt"
+               ((".*") "")))))))
+    (native-inputs
+     `(("python-setuptools" ,python-setuptools)
+       ; optional test-requirement pytest-cov used only when running
+       ; setup.y with `test --cov`
+       ("python-pytest" ,python-pytest)))
+    (home-page "http://gunicorn.org/")
+    (synopsis "Python WSGI HTTP Server for UNIX")
+    (description "Gunicorn ‘Green Unicorn’ is a Python WSGI HTTP
+Server for UNIX.  It’s a pre-fork worker model ported from Ruby’s
+Unicorn project.  The Gunicorn server is broadly compatible with
+various web frameworks, simply implemented, light on server resources,
+and fairly speedy.")
+  (license l:expat)
+  (properties `((python2-variant . ,(delay gunicorn-python2))))))
+
+(define-public gunicorn-python2
+  (let ((base (package-with-python2
+               (strip-python2-variant gunicorn))))
+    ; Note: byte-compiling gunicorn/workers/_gaiohttp.py with Python 2 raises
+    ; a syntax error, since this is a Python-3-only module. This does not
+    ; matter since that module is not imported in Python 2 anyway.
+    (package
+      (inherit base)
+      (name "gunicorn-python2")
+      (description (string-append (package-description base) "
+
+Use this package if your application is implemented in Python 2."))
+      (native-inputs `(("python2-mock" ,python2-mock)
+                       ,@(package-native-inputs base))))))
-- 
2.7.4

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

* [bug#36605] [PATCH 2/2] gnu: Build documentation for gunicorn and gunicorn-python2.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (6 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 1/2] gnu: Add gunicorn and gunicorn-python2 Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 0/3] Emhancements to the ant-build-system Hartmut Goebel
                                     ` (21 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

* gnu/packages/web.scm (gunicorn): Add build and install documentation
  (html, info, examples).
---
 gnu/packages/web.scm | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index 3841c6b..e04cce0 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -3648,6 +3648,7 @@ and similar services.")
         (base32
          "065n5z91607q4l8wncqkz297cdcb60cz8wnyxy88wk4as4b6jgw1"))))
     (build-system python-build-system)
+    (outputs '("out" "doc"))
     (arguments
      `(#:phases
        (modify-phases %standard-phases
@@ -3658,12 +3659,36 @@ and similar services.")
            ; list.
            (lambda _
              (substitute* "requirements_test.txt"
-               ((".*") "")))))))
+               ((".*") ""))))
+         (add-after 'build 'build-doc
+           (lambda _
+             (zero? (system* "make" "-C" "docs" "PAPER=a4"
+                             "html" "info"))
+             (delete-file "docs/build/texinfo/Makefile")
+             (delete-file "docs/build/texinfo/Gunicorn.texi")))
+        (add-after 'install 'install-doc
+          (lambda* (#:key outputs #:allow-other-keys)
+            (let* ((doc (string-append (assoc-ref outputs "doc")
+                                       "/share/doc/" ,name "-" ,version))
+                   (html (string-append doc "/html"))
+                   (info (string-append doc "/info"))
+                   (examples (string-append doc "/examples")))
+              (mkdir-p html)
+              (mkdir-p info)
+              (mkdir-p examples)
+              (copy-recursively "docs/build/html" html)
+              (copy-recursively "docs/build/texinfo" info)
+              (copy-recursively "examples" examples)
+              (for-each (lambda (file)
+                          (copy-file file (string-append doc "/" file)))
+                        '("README.rst" "NOTICE" "LICENSE" "THANKS"))))))))
     (native-inputs
      `(("python-setuptools" ,python-setuptools)
        ; optional test-requirement pytest-cov used only when running
        ; setup.y with `test --cov`
-       ("python-pytest" ,python-pytest)))
+       ("python-pytest" ,python-pytest)
+       ("python-sphinx" ,python-sphinx)
+       ("texinfo" ,texinfo)))
     (home-page "http://gunicorn.org/")
     (synopsis "Python WSGI HTTP Server for UNIX")
     (description "Gunicorn ‘Green Unicorn’ is a Python WSGI HTTP
-- 
2.7.4

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

* [bug#36605] [PATCH 0/3] Emhancements to the ant-build-system
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (7 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 2/2] gnu: Build documentation for " Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 1/3] guix: ant-build-system: put dummy project-name into default build.xml Hartmut Goebel
                                     ` (20 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

Enclosed please find two minor enhancments to the ant-build-system and a
small clean-up resulting from these.

Hartmut Goebel (3):
  guix: ant-build-system: put dummy project-name into default build.xml.
  guix: ant-build-system: add empty `tests` target to default build.xml.
  gnu: Remove now useless #:tests? #f from java-packages.

 gnu/packages/java.scm           | 7 ++-----
 guix/build/ant-build-system.scm | 4 +++-
 2 files changed, 5 insertions(+), 6 deletions(-)

-- 
2.7.4

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

* [bug#36605] [PATCH 1/3] guix: ant-build-system: put dummy project-name into default build.xml.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (8 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 0/3] Emhancements to the ant-build-system Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 2/3] guix: ant-build-system: add empty `tests` target to " Hartmut Goebel
                                     ` (19 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

Without this, ant reported error messages like
Target "tests" does not exist in the project "null".
Simple using the jar-name is a good compromise.

* guix/build/ant-build-system.scm (default-build.xml): Add attribute
  to sxml expression.
---
 guix/build/ant-build-system.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/guix/build/ant-build-system.scm b/guix/build/ant-build-system.scm
index 00a4a46..fe7bae5 100644
--- a/guix/build/ant-build-system.scm
+++ b/guix/build/ant-build-system.scm
@@ -40,7 +40,8 @@
   (call-with-output-file "build.xml"
     (lambda (port)
       (sxml->xml
-       `(project (@ (basedir "."))
+       `(project (@ (basedir ".")
+                    (name ,jar-name))
                  (property (@ (name "classes.dir")
                               (value "${basedir}/build/classes")))
                  (property (@ (name "jar.dir")
-- 
2.7.4

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

* [bug#36605] [PATCH 2/3] guix: ant-build-system: add empty `tests` target to default build.xml.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (9 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 1/3] guix: ant-build-system: put dummy project-name into default build.xml Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 3/3] gnu: Remove now useless #:tests? #f from java-packages Hartmut Goebel
                                     ` (18 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

This avoids the need to set #:tests? #f whenever using #:jar-name
(and thus using the default build.xml).

* guix/build/ant-build-system.scm (default-build.xml): Add attribute
  to sxml expression.
---
 guix/build/ant-build-system.scm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/guix/build/ant-build-system.scm b/guix/build/ant-build-system.scm
index fe7bae5..2cc6bb9 100644
--- a/guix/build/ant-build-system.scm
+++ b/guix/build/ant-build-system.scm
@@ -70,6 +70,7 @@
                                (arg (@ (line ,(string-append "-cf ${jar.dir}/" jar-name
                                                              " -C ${classes.dir} ."))))))
 
+                 (target (@ (name "tests")))
                  (target (@ (name "install"))
                          (copy (@ (todir "${dist.dir}"))
                                (fileset (@ (dir "${jar.dir}"))
-- 
2.7.4

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

* [bug#36605] [PATCH 3/3] gnu: Remove now useless #:tests? #f from java-packages.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (10 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 2/3] guix: ant-build-system: add empty `tests` target to " Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 00/12] Java build-system and some packages Hartmut Goebel
                                     ` (17 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

With the last commit, when #:jar-name is given, a dummy test-target
always exists.

* gnu/packages/java.scm (java-junit, java-swt, java-xz): Remove
  build-argument `#:tests?'.
---
 gnu/packages/java.scm | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 7387235..e8d09dd 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -84,7 +84,6 @@
     (build-system ant-build-system)
     (arguments
      `(#:jar-name "swt.jar"
-       #:tests? #f ; no "check" target
        #:phases
        (modify-phases %standard-phases
          (replace 'unpack
@@ -1054,8 +1053,7 @@ build process and its dependencies, whereas Make uses Makefile format.")
        "0x6vn9dp9kxk83x2fp3394n95dk8fx9yg8jns9371iqsn0vy8ih1"))))
    (build-system ant-build-system)
    (arguments
-    `(#:tests? #f ; There are no tests to run.
-      #:jar-name ,(string-append "xz-" version  ".jar")
+    `(#:jar-name ,(string-append "xz-" version  ".jar")
       #:phases
       (modify-phases %standard-phases
         ;; The unpack phase enters the "maven" directory by accident.
@@ -1248,8 +1246,7 @@ testing frameworks, mocking libraries and UI validation rules.")
                   #t))))
     (build-system ant-build-system)
     (arguments
-     `(#:tests? #f ; no tests
-       #:jar-name "junit.jar"))
+     `(#:jar-name "junit.jar"))
     (inputs
      `(("java-hamcrest-core" ,java-hamcrest-core)))
     (home-page "http://junit.org/")
-- 
2.7.4

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

* [bug#36605] [PATCH 00/12] Java build-system and some packages
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (11 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 3/3] gnu: Remove now useless #:tests? #f from java-packages Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 01/12] guix: ant-bulild-sytem: allow specifying the source directory Hartmut Goebel
                                     ` (16 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

Enclosed please find some enhancemnets to the java/ant build-system and some
java packages.

For the changes to the build-systm I'd apprechiate ideas for better code.
There also is room for improovements, e.g. adding both a "test" (unsing junit)
and a "javadoc" target to the default build.xml. (I will noit implement this,
I'm done with Java).

Regarding the packages: Only very few packages have build.xml for ant. For the
others I'm only using a default build.xml to get the jar build. So not tests
nor javadocs. IMO it is important to have the java packages available at all.
After the enhancements described above are implemented, this should be fixed.

Hartmut Goebel (12):
  guix: ant-bulild-sytem: allow specifying the source directory.
  guix: ant-build-system: use abs path as basedir
  guix: Add java-utils.
  gnu: Add java-plexus-utils.
  gnu: Add java-plexus-interpolation.
  gnu: Add java-commons-cli.
  gnu: Add java-commons-codec.
  gnu: Add java-commons-daemon.
  gnu: Add java-commons-io.
  gnu: Add java-commons-lang.
  gnu: Add java-commons-lang3.
  gnu: Add java-commons-bcel.

 Makefile.am                     |   1 +
 doc/guix.texi                   |   3 +-
 gnu/packages/java.scm           | 332 ++++++++++++++++++++++++++++++++++++++++
 guix/build-system/ant.scm       |   4 +
 guix/build/ant-build-system.scm |  10 +-
 guix/build/java-utils.scm       |  52 +++++++
 6 files changed, 396 insertions(+), 6 deletions(-)
 create mode 100644 guix/build/java-utils.scm

-- 
2.7.4

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

* [bug#36605] [PATCH 01/12] guix: ant-bulild-sytem: allow specifying the source directory.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (12 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 00/12] Java build-system and some packages Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 02/12] guix: ant-build-system: use abs path as basedir Hartmut Goebel
                                     ` (15 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

* guix/build-system/ant.scm (ant-build) Add parameter src-dir.
* guix/build/ant-build-system.scm (default-build.xml): New parameter src-dir.
  (configure): pass src-dir on to default-build.xml.
* doc/guix.texi (Build Systems): Add description.
---
 doc/guix.texi                   | 3 ++-
 guix/build-system/ant.scm       | 2 ++
 guix/build/ant-build-system.scm | 8 ++++----
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index b6ca34a..19c70ad 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -2956,7 +2956,8 @@ parameters, respectively.
 When the original package does not provide a suitable Ant build file,
 the parameter @code{#:jar-name} can be used to generate a minimal Ant
 build file @file{build.xml} with tasks to build the specified jar
-archive.
+archive.  In this case the parameter @code{#:src-dir} can be used to
+specify the source sub-directory, defaulting to ``src''.
 
 The parameter @code{#:build-target} can be used to specify the Ant task
 that should be run during the @code{build} phase.  By default the
diff --git a/guix/build-system/ant.scm b/guix/build-system/ant.scm
index 550f92b..cd544ad 100644
--- a/guix/build-system/ant.scm
+++ b/guix/build-system/ant.scm
@@ -98,6 +98,7 @@
                     (make-flags ''())
                     (build-target "jar")
                     (jar-name #f)
+                    (src-dir "src")
                     (phases '(@ (guix build ant-build-system)
                                 %standard-phases))
                     (outputs '("out"))
@@ -126,6 +127,7 @@
                   #:test-target ,test-target
                   #:build-target ,build-target
                   #:jar-name ,jar-name
+                  #:src-dir ,src-dir
                   #:phases ,phases
                   #:outputs %outputs
                   #:search-paths ',(map search-path-specification->sexp
diff --git a/guix/build/ant-build-system.scm b/guix/build/ant-build-system.scm
index 2cc6bb9..651150d 100644
--- a/guix/build/ant-build-system.scm
+++ b/guix/build/ant-build-system.scm
@@ -35,7 +35,7 @@
 ;;
 ;; Code:
 
-(define (default-build.xml jar-name prefix)
+(define (default-build.xml src-dir jar-name prefix)
   "Create a simple build.xml with standard targets for Ant."
   (call-with-output-file "build.xml"
     (lambda (port)
@@ -59,7 +59,7 @@
                  (target (@ (name "compile"))
                          (mkdir (@ (dir "${classes.dir}")))
                          (javac (@ (includeantruntime "false")
-                                   (srcdir "src")
+                                   (srcdir ,src-dir)
                                    (destdir "${classes.dir}")
                                    (classpath (@ (refid "classpath"))))))
 
@@ -100,9 +100,9 @@ to the default GNU unpack strategy."
       ((assq-ref gnu:%standard-phases 'unpack) #:source source)))
 
 (define* (configure #:key inputs outputs (jar-name #f)
-                    #:allow-other-keys)
+                    (src-dir "src") #:allow-other-keys)
   (when jar-name
-    (default-build.xml jar-name
+    (default-build.xml src-dir jar-name
                        (string-append (assoc-ref outputs "out")
                                       "/share/java")))
   (setenv "JAVA_HOME" (assoc-ref inputs "jdk"))
-- 
2.7.4

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

* [bug#36605] [PATCH 02/12] guix: ant-build-system: use abs path as basedir
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (13 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 01/12] guix: ant-bulild-sytem: allow specifying the source directory Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 03/12] guix: Add java-utils Hartmut Goebel
                                     ` (14 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

This allows to chdir into some sub-project prior to building.

* guix/build/ant-build-system.scm (default-build.xml): Add parameter.
  (configure): Pass current directory as base-dir to default-build.xml.
---
 guix/build/ant-build-system.scm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/guix/build/ant-build-system.scm b/guix/build/ant-build-system.scm
index 651150d..f28182a 100644
--- a/guix/build/ant-build-system.scm
+++ b/guix/build/ant-build-system.scm
@@ -35,12 +35,12 @@
 ;;
 ;; Code:
 
-(define (default-build.xml src-dir jar-name prefix)
+(define (default-build.xml base-dir src-dir jar-name prefix)
   "Create a simple build.xml with standard targets for Ant."
   (call-with-output-file "build.xml"
     (lambda (port)
       (sxml->xml
-       `(project (@ (basedir ".")
+       `(project (@ (basedir ,base-dir)
                     (name ,jar-name))
                  (property (@ (name "classes.dir")
                               (value "${basedir}/build/classes")))
@@ -102,7 +102,7 @@ to the default GNU unpack strategy."
 (define* (configure #:key inputs outputs (jar-name #f)
                     (src-dir "src") #:allow-other-keys)
   (when jar-name
-    (default-build.xml src-dir jar-name
+    (default-build.xml (getcwd) src-dir jar-name
                        (string-append (assoc-ref outputs "out")
                                       "/share/java")))
   (setenv "JAVA_HOME" (assoc-ref inputs "jdk"))
-- 
2.7.4

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

* [bug#36605] [PATCH 03/12] guix: Add java-utils.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (14 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 02/12] guix: ant-build-system: use abs path as basedir Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 04/12] gnu: Add java-plexus-utils Hartmut Goebel
                                     ` (13 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

* guix/build/java-utils.scm: New file.
* guix/build-system/ant.scm: Use it.
* Makefile.am (MODULES): Add it.
---
 Makefile.am               |  1 +
 guix/build-system/ant.scm |  2 ++
 guix/build/java-utils.scm | 52 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 55 insertions(+)
 create mode 100644 guix/build/java-utils.scm

diff --git a/Makefile.am b/Makefile.am
index 1a34e0d..c711e48 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -86,6 +86,7 @@ MODULES =					\
   guix/build/emacs-build-system.scm		\
   guix/build/git.scm				\
   guix/build/hg.scm				\
+  guix/build/java-utils.scm			\
   guix/build/glib-or-gtk-build-system.scm	\
   guix/build/gnu-build-system.scm		\
   guix/build/gnu-dist.scm			\
diff --git a/guix/build-system/ant.scm b/guix/build-system/ant.scm
index cd544ad..b98a651 100644
--- a/guix/build-system/ant.scm
+++ b/guix/build-system/ant.scm
@@ -39,6 +39,7 @@
 (define %ant-build-system-modules
   ;; Build-side modules imported by default.
   `((guix build ant-build-system)
+    (guix build java-utils)
     (guix build syscalls)
     ,@%gnu-build-system-modules))
 
@@ -107,6 +108,7 @@
                     (guile #f)
                     (imported-modules %ant-build-system-modules)
                     (modules '((guix build ant-build-system)
+                               (guix build java-utils)
                                (guix build utils))))
   "Build SOURCE with INPUTS."
   (define builder
diff --git a/guix/build/java-utils.scm b/guix/build/java-utils.scm
new file mode 100644
index 0000000..1ca5b3d
--- /dev/null
+++ b/guix/build/java-utils.scm
@@ -0,0 +1,52 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+
+(define-module (guix build java-utils)
+  #:use-module (guix build utils)
+  #:export (ant-build-javadoc
+            install-jars
+            install-javadoc))
+
+(define (package-name-version store-dir)
+  ; copied from haskell-build-system.scm - seeking for a more general solution
+  "Given a store directory STORE-DIR return 'name-version' of the package."
+  (let* ((base (basename store-dir)))
+    (string-drop base
+                 (+ 1 (string-index base #\-)))))
+
+(define* (ant-build-javadoc #:key (target "javadoc") (make-flags '())
+                            #:allow-other-keys)
+  (zero? (apply system* `("ant" ,target ,@make-flags))))
+
+(define* (install-jars jars-dir)
+  "Helper for the case the build.xml does not include an install target."
+  (lambda* (#:key outputs #:allow-other-keys)
+    (let ((share (string-append (assoc-ref outputs "out")
+                                "/share/java")))
+      (for-each (lambda (f) (install-file f share))
+                (find-files jars-dir "\\.jar$")))))
+
+(define* (install-javadoc apidocs-dir)
+  "Helper to install the javadocs."
+  (lambda* (#:key outputs #:allow-other-keys)
+    (let* ((out (assoc-ref outputs "out"))
+           (docs (string-append (assoc-ref outputs "doc")
+                                "/share/doc/" (package-name-version out) "/")))
+      (mkdir-p docs)
+      (copy-recursively apidocs-dir docs))))
-- 
2.7.4

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

* [bug#36605] [PATCH 04/12] gnu: Add java-plexus-utils.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (15 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 03/12] guix: Add java-utils Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 05/12] gnu: Add java-plexus-interpolation Hartmut Goebel
                                     ` (12 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

* gnu/packages/java.scm (codehaus-plexus-url): New function.
  (java-plexus-utils): New variable.
---
 gnu/packages/java.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index e8d09dd..0dfd9fa 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -1256,3 +1256,35 @@ testing frameworks, mocking libraries and UI validation rules.")
 JUnit provides assertions for testing expected results, test fixtures for
 sharing common test data, and test runners for running tests.")
     (license license:epl1.0)))
+
+;
+; codehaus plexus
+;
+
+(define* (codehaus-plexus-url projname version)
+  (let ((projname (string-append "plexus-" projname)))
+    (string-append "https://github.com/codehaus-plexus/" projname
+                   "/archive/" projname "-" version ".tar.gz")))
+
+(define-public java-plexus-utils
+  (package
+    (name "java-plexus-utils")
+    (version "3.0.24")
+    (source (origin
+      (method url-fetch)
+      (uri (codehaus-plexus-url "utils" version))
+      (sha256
+       (base32 "1mlwpc6fms24slygv5yvi6fi9hcha2fh0v73p5znpi78bg36i2js"))))
+    (build-system ant-build-system)
+    ; todo: javadoc
+    (arguments
+     `(#:tests? #f ; todo: tests
+       #:jar-name (string-append "plexus-utils-" ,version ".jar")
+       #:src-dir "src/main"))
+    (native-inputs
+     `(("java-junit" ,java-junit)))
+    (home-page "http://codehaus-plexus.github.io/plexus-utils/")
+    (synopsis "Common utilities for the Plexus framework")
+    (description "Various Java utility classes to ease working with strings,
+files, command lines, XML and more.")
+    (license license:asl2.0)))
-- 
2.7.4

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

* [bug#36605] [PATCH 05/12] gnu: Add java-plexus-interpolation.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (16 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 04/12] gnu: Add java-plexus-utils Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 06/12] gnu: Add java-commons-cli Hartmut Goebel
                                     ` (11 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

* gnu/packages/java.scm (java-plexus-interplation): New variable.
---
 gnu/packages/java.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 0dfd9fa..3687c7e 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -1288,3 +1288,31 @@ sharing common test data, and test runners for running tests.")
     (description "Various Java utility classes to ease working with strings,
 files, command lines, XML and more.")
     (license license:asl2.0)))
+
+(define-public java-plexus-interpolation
+  (package
+    (name "java-plexus-interpolation")
+    (version "1.23")
+    (source (origin
+      (method url-fetch)
+      (uri (codehaus-plexus-url "interpolation" version))
+      (sha256 (base32 "1w79ljwk42ymrgy8kqxq4l82pgdj6287gabpfnpkyzbrnclsnfrp"))))
+    (build-system ant-build-system)
+    ; todo: javadoc
+    (arguments
+     `(#:tests? #f ; todo: tests
+       #:jar-name (string-append "plexus-interpolation-" ,version ".jar")
+       #:src-dir "src/main"))
+    (native-inputs
+     `(("java-junit" ,java-junit)))
+    (home-page "http://codehaus-plexus.github.io/plexus-interpolation/")
+    (synopsis "Java components for interpolating ${} strings and the like")
+    (description "Plexus interpolator is the outgrowth of multiple iterations
+of development focused on providing a more modular, flexible interpolation
+framework for the expression language style commonly seen in Maven, Plexus,
+and other related projects.
+
+It has its foundation in the org.codehaus.plexus.utils.interpolation package
+within plexus-utils, but has been separated in order to allow these two
+libraries to vary independently of one another.")
+    (license license:asl2.0)))
-- 
2.7.4

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

* [bug#36605] [PATCH 06/12] gnu: Add java-commons-cli.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (17 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 05/12] gnu: Add java-plexus-interpolation Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 07/12] gnu: Add java-commons-codec Hartmut Goebel
                                     ` (10 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

* gnu/packages/java.scm (appache-commons-url): New function.
  (java-commons-cli): New variable.
---
 gnu/packages/java.scm | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 3687c7e..a83423d 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -1316,3 +1316,51 @@ It has its foundation in the org.codehaus.plexus.utils.interpolation package
 within plexus-utils, but has been separated in order to allow these two
 libraries to vary independently of one another.")
     (license license:asl2.0)))
+
+;
+; apache commons
+;
+
+(define* (apache-commons-url projname version
+                             #:optional (basename
+                                         (string-append "commons-" projname)))
+  (string-append "mirror://apache/commons/" projname "/source/"
+                 basename "-" version "-src.tar.gz"))
+
+(define-public java-commons-cli
+  (package
+    (name "java-commons-cli")
+    (version "1.3.1")
+    (source (origin
+      (method url-fetch)
+      (uri (apache-commons-url "cli" version))
+      (sha256 (base32 "1fkjn552i12vp3xxk21ws4p70fi0lyjm004vzxsdaz7gdpgyxxyl"))))
+    (build-system ant-build-system)
+    ; todo: javadoc
+    (arguments
+     ; commons-cli does not provida a proper build.xml but seems to require
+     ; maven for building
+     `(#:jar-name (string-append "commons-cli-" ,version ".jar")
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'check))))
+    (native-inputs
+     `(("java-junit" ,java-junit)))
+    (home-page "http://commons.apache.org/cli/")
+    (synopsis "Command line arguments and options parsing library")
+    (description "The Apache Commons CLI library provides an API for parsing
+command line options passed to programs.  It's also able to print help messages
+detailing the options available for a command line tool.
+
+Commons CLI supports different types of options:
+
+@itemize
+@item POSIX like options (ie. tar -zxvf foo.tar.gz)
+@item GNU like long options (ie. du --human-readable --max-depth=1)
+@item Java like properties (ie. java -Djava.awt.headless=true Foo)
+@item Short options with value attached (ie. gcc -O2 foo.c)
+@item long options with single hyphen (ie. ant -projecthelp)
+@end itemize
+
+This is a part of the Apache Commons Project.")
+    (license license:asl2.0)))
-- 
2.7.4

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

* [bug#36605] [PATCH 07/12] gnu: Add java-commons-codec.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (18 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 06/12] gnu: Add java-commons-cli Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 08/12] gnu: Add java-commons-daemon Hartmut Goebel
                                     ` (9 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

* gnu/packages/java.scm (java-commons-codec): New variable.
---
 gnu/packages/java.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index a83423d..a5d3a25 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -1364,3 +1364,35 @@ Commons CLI supports different types of options:
 
 This is a part of the Apache Commons Project.")
     (license license:asl2.0)))
+
+(define-public java-commons-codec
+  (package
+    (name "java-commons-codec")
+    (version "1.10")
+    (source (origin
+      (method url-fetch)
+      (uri (apache-commons-url "codec" version))
+      (sha256 (base32 "1w9qg30y4s0x8gnmr2fgj4lyplfn788jqxbcz27lf5kbr6n8xr65"))))
+    (build-system ant-build-system)
+    (outputs '("out" "doc"))
+    (arguments
+     ; commons-cli does not provida a proper build.xml but seems to require
+     ; maven for building
+     `(#:test-target "test"
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'check) ; todo: need to pass junit to classpath
+         (add-after 'build 'build-javadoc ant-build-javadoc)
+         (replace 'install (install-jars "dist"))
+         (add-after 'install 'install-doc (install-javadoc "dist/docs/api")))))
+    (native-inputs
+     `(("java-junit" ,java-junit)))
+    (home-page "http://commons.apache.org/codec/")
+    (synopsis "Common encoders and decoders such as Base64, Hex, Phonetic and URLs")
+    (description "The codec package contains simple encoder and decoders for
+various formats such as Base64 and Hexadecimal.  In addition to these widely
+used encoders and decoders, the codec package also maintains a collection of
+phonetic encoding utilities.
+
+This is a part of the Apache Commons Project.")
+    (license license:asl2.0)))
-- 
2.7.4

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

* [bug#36605] [PATCH 08/12] gnu: Add java-commons-daemon.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (19 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 07/12] gnu: Add java-commons-codec Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 09/12] gnu: Add java-commons-io Hartmut Goebel
                                     ` (8 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

* gnu/packages/java.scm (java-commons-daemon): New variable.
---
 gnu/packages/java.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index a5d3a25..e200296 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -1396,3 +1396,35 @@ phonetic encoding utilities.
 
 This is a part of the Apache Commons Project.")
     (license license:asl2.0)))
+
+(define-public java-commons-daemon ; build, todo: verify results
+  (package    (name "java-commons-daemon")
+    (version "1.0.15")
+    (source (origin
+      (method url-fetch)
+      (uri (apache-commons-url "daemon" version))
+      (sha256
+       (base32 "0ci46kq8jpz084ccwq0mmkahcgsmh20ziclp2jf5i0djqv95gvhi"))))
+    (build-system ant-build-system)
+    (outputs '("out" "doc"))
+    (arguments
+     `(#:test-target "test"
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'build 'build-javadoc ant-build-javadoc)
+         (replace 'install (install-jars "dist"))
+         (add-after 'install 'install-doc (install-javadoc "dist/docs/api")))))
+    (native-inputs
+     `(("java-junit" ,java-junit)))
+    (home-page "http://commons.apache.org/daemon/")
+    (synopsis "Library to launch Java applications as daemons")
+    (description "The Daemon package from Apache Commons can be used to
+implement Java applications which can be launched as daemons.  For example the
+program will be notified about a shutdown so that it can perform cleanup tasks
+before its process of execution is destroyed by the operation system.
+
+This package contains the java library.  You will also need the actual binary
+for your architecture which is provided by the jsvc package.
+
+This is a part of the Apache Commons Project.")
+    (license license:asl2.0)))
-- 
2.7.4

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

* [bug#36605] [PATCH 09/12] gnu: Add java-commons-io.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (20 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 08/12] gnu: Add java-commons-daemon Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 10/12] gnu: Add java-commons-lang Hartmut Goebel
                                     ` (7 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

* gnu/packages/java.scm (java-commons-io): New variable.
---
 gnu/packages/java.scm | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index e200296..3af8cd0 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -1428,3 +1428,45 @@ for your architecture which is provided by the jsvc package.
 
 This is a part of the Apache Commons Project.")
     (license license:asl2.0)))
+
+(define-public java-commons-io
+  (package
+    (name "java-commons-io")
+    (version "2.5")
+    (source (origin
+      (method url-fetch)
+      (uri (apache-commons-url "io" version))
+      (sha256 (base32 "0q5y41jrcjvx9hzs47x5kdhnasdy6rm4bzqd2jxl02w717m7a7v3"))))
+    (build-system ant-build-system)
+    (outputs '("out" "doc"))
+    (arguments
+     `(#:test-target "test"
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'symlink-junit.jar
+           (lambda* (#:key source #:allow-other-keys)
+             ; the existance of this file is taken as indicator whether test
+             ; dependencis will to be downloaded.
+             (let ((junit (assoc-ref inputs "java-junit"))
+                   (junit-version "4.12")) ; from build.xml
+               (mkdir-p "lib")
+               (symlink (string-append junit "/share/java/junit.jar")
+                        (string-append "lib/junit-" junit-version ".jar")))))
+         (add-after 'build 'build-javadoc ant-build-javadoc)
+         (add-after 'configure 'patch-build.xml
+           (lambda* _
+             (substitute* "build.xml"
+               ; set current year to a fixed value, you may want to update
+               ; this when updating the package version
+               (("<format property=\"current.year\"[^>]+>")
+                "<format property=\"current.year\" pattern=\"2016\"/>"))))
+         (replace 'install (install-jars "target"))
+         (add-after 'install 'install-doc (install-javadoc "target/apidocs")))))
+    (native-inputs
+     `(("java-junit" ,java-junit)
+       ("java-hamcrest-core" ,java-hamcrest-core)))
+    (home-page "http://commons.apache.org/io/")
+    (synopsis "Common useful IO related classes")
+    (description "Commons-IO contains utility classes, stream implementations,
+file filters and endian classes.")
+    (license license:asl2.0)))
-- 
2.7.4

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

* [bug#36605] [PATCH 10/12] gnu: Add java-commons-lang.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (21 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 09/12] gnu: Add java-commons-io Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 11/12] gnu: Add java-commons-lang3 Hartmut Goebel
                                     ` (6 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

* gnu/packages/java.scm (java-commons-lang): New variables.
---
 gnu/packages/java.scm | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 3af8cd0..5a90d05 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -1470,3 +1470,51 @@ This is a part of the Apache Commons Project.")
     (description "Commons-IO contains utility classes, stream implementations,
 file filters and endian classes.")
     (license license:asl2.0)))
+
+(define-public java-commons-lang
+  (package
+    (name "java-commons-lang")
+    (version "2.6")
+    (source (origin
+      (method url-fetch)
+      (uri (apache-commons-url "lang" version))
+      (sha256 (base32 "1mxwagqadzx1b2al7i0z1v0r235aj2njdyijf02szq0vhmqrfiq5"))))
+    (build-system ant-build-system)
+    (outputs '("out" "doc"))
+    (arguments
+     `(#:test-target "test"
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'build 'build-javadoc ant-build-javadoc)
+         (add-before 'check 'fix-test-framework
+           (lambda _
+             ;; disable a failing test
+             (substitute* "src/test/java/org/apache/commons/lang/time/FastDateFormatTest.java"
+               (("public void testFormat\\(\\)")
+                "public void disabled_testFormat()"))
+             #t))
+         (replace 'install (install-jars "target"))
+         (add-after 'install 'install-doc (install-javadoc "target/apidocs")))))
+    (native-inputs
+     `(("java-junit" ,java-junit)))
+    (home-page "http://commons.apache.org/lang/")
+    (synopsis "Extension of the java.lang package")
+    (description "The Commons Lang components contains a set of Java classes
+that provide helper methods for standard Java classes, especially those found
+in the java.lang package in the Sun JDK.  The following classes are included:
+
+ * StringUtils - Helper for java.lang.String.
+ * CharSetUtils - Methods for dealing with CharSets, which are sets of
+   characters such as [a-z] and [abcdez].
+ * RandomStringUtils - Helper for creating randomised Strings.
+ * NumberUtils - Helper for java.lang.Number and its subclasses.
+ * NumberRange - A range of numbers with an upper and lower bound.
+ * ObjectUtils - Helper for java.lang.Object.
+ * SerializationUtils - Helper for serializing Objects.
+ * SystemUtils - Utility class defining the Java system properties.
+ * NestedException package - A sub-package for the creation of nested
+   exceptions.
+ * Enum package - A sub-package for the creation of enumerated types.
+ * Builder package - A sub-package for the creation of equals, hashCode,
+   compareTo and toString methods.")
+    (license license:asl2.0)))
-- 
2.7.4

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

* [bug#36605] [PATCH 11/12] gnu: Add java-commons-lang3.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (22 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 10/12] gnu: Add java-commons-lang Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 12/12] gnu: Add java-commons-bcel Hartmut Goebel
                                     ` (5 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

* gnu/packages/java.scm (java-commons-lang3): New variable.
---
 gnu/packages/java.scm | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 5a90d05..b7971a3 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -1518,3 +1518,55 @@ in the java.lang package in the Sun JDK.  The following classes are included:
  * Builder package - A sub-package for the creation of equals, hashCode,
    compareTo and toString methods.")
     (license license:asl2.0)))
+
+(define-public java-commons-lang3
+  (package
+    (name "java-commons-lang3")
+    (version "3.4")
+    (source (origin
+      (method url-fetch)
+      (uri (apache-commons-url "lang" version "commons-lang3"))
+      (sha256
+       (base32 "0xpshb9spjhplq5a7mr0y1bgfw8190ik4xj8f569xidfcki1d6kg"))))
+    (build-system ant-build-system)
+    (outputs '("out" "doc"))
+    (arguments
+     `(#:tests? #f
+       #:test-target "test" ; requirements are missing, see below
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'build 'build-javadoc ant-build-javadoc)
+         (replace 'install (install-jars "target"))
+         (add-after 'install 'install-doc (install-javadoc "target/apidocs")))))
+    ;(native-inputs
+    ; `(("java-junit" ,java-junit)))
+    ; todo: tests. Requier hamcrest, commons-io, easymock. jar paths need to
+    ; be written into a properties files. See buld.xml in the source.
+    (home-page "http://commons.apache.org/lang/")
+    (synopsis "Extension of the java.lang package (for Java 5+)")
+    (description "The Commons Lang components contains a set of Java classes
+that provide helper methods for standard Java classes, especially those found
+in the java.lang package in the JDK 5+.  The following classes are included:
+
+ * StringUtils - Helper for java.lang.String.
+ * CharSetUtils - Methods for dealing with CharSets, which are sets of
+   characters such as [a-z] and [abcdez].
+ * RandomStringUtils - Helper for creating randomised Strings.
+ * NumberUtils - Helper for java.lang.Number and its subclasses.
+ * NumberRange - A range of numbers with an upper and lower bound.
+ * ObjectUtils - Helper for java.lang.Object.
+ * SerializationUtils - Helper for serializing Objects.
+ * SystemUtils - Utility class defining the Java system properties.
+ * NestedException package - A sub-package for the creation of nested
+   exceptions.
+ * Enum package - A sub-package for the creation of enumerated types.
+ * Builder package - A sub-package for the creation of equals, hashCode,
+   compareTo and toString methods.
+
+Commons Lang 3.x use a different package (org.apache.commons.lang3) than the
+previous versions (Commonas Lang 1.x and 2.x, which use
+org.apache.commons.lang), allowing it to be used at the same time as an
+earlier version.
+
+Commons Lang 3.x is only compatible with JDK 1.5+ ")
+    (license license:asl2.0)))
-- 
2.7.4

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

* [bug#36605] [PATCH 12/12] gnu: Add java-commons-bcel.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (23 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 11/12] gnu: Add java-commons-lang3 Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 1/6] gnu: kcoreaddons: Enable test-suite Hartmut Goebel
                                     ` (4 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

* gnu/packages/java.scm (java-commons-bcel): New variable.
---
 gnu/packages/java.scm | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index b7971a3..b1e1ecc 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -1327,6 +1327,24 @@ libraries to vary independently of one another.")
   (string-append "mirror://apache/commons/" projname "/source/"
                  basename "-" version "-src.tar.gz"))
 
+(define-public java-commons-bcel
+  (package
+    (name "java-commons-bcel")
+    (version "6.0")
+    (source (origin
+      (method url-fetch)
+      (uri (apache-commons-url "bcel" version "bcel"))
+      (sha256 (base32 "0n39601zcj7ymjihfv53r260mf3n8kj6bqhxv90dw5sgc7qbjqxr"))))
+    (build-system ant-build-system)
+    ; todo: tests, javadoc
+    (arguments
+     `(#:jar-name (string-append "commons-bcel-" ,version ".jar")
+       #:src-dir "src/main"))
+    (home-page "http://commons.apache.org/bcel/")
+    (synopsis "Apache Commons Bytecode Engineering Library")
+    (description "")
+    (license license:asl2.0)))
+
 (define-public java-commons-cli
   (package
     (name "java-commons-cli")
-- 
2.7.4

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

* [bug#36605] [PATCH 1/6] gnu: kcoreaddons: Enable test-suite.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (24 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 12/12] gnu: Add java-commons-bcel Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 2/6] gnu: kirigami: " Hartmut Goebel
                                     ` (3 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

Enable running the tests and blacklist the one failing test.

* gnu/package/kde-frameworks.scm(kcoreaddons)[arguments]
  <#:tests?>: Remove. <#:phases>: Add phase 'blacklist-failing-test.
---
 gnu/packages/kde-frameworks.scm | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/kde-frameworks.scm b/gnu/packages/kde-frameworks.scm
index 5ab97c0b0..35e10015e 100644
--- a/gnu/packages/kde-frameworks.scm
+++ b/gnu/packages/kde-frameworks.scm
@@ -566,9 +566,16 @@ propagate their changes to their respective configuration files.")
     (inputs
      `(("qtbase" ,qtbase)))
     (arguments
-     `(#:tests? #f ; FIXME: Test failure caused by stout/stderr being interleaved.
-       #:phases
+     `(#:phases
        (modify-phases %standard-phases
+         (add-before 'check 'blacklist-failing-test
+           (lambda _
+             ;; Blacklist a failing test-function. FIXME: Make it pass.
+             ;; Test failure caused by stout/stderr being interleaved.
+             (with-output-to-file "autotests/BLACKLIST"
+               (lambda _
+                 (display "[test_channels]\n*\n")))
+             #t))
          (add-before 'check 'check-setup
            (lambda _
              (setenv "HOME" (getcwd))
-- 
2.13.7

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

* [bug#36605] [PATCH 2/6] gnu: kirigami: Enable test-suite.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (25 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 1/6] gnu: kcoreaddons: Enable test-suite Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 3/6] gnu: kpackage: " Hartmut Goebel
                                     ` (2 subsequent siblings)
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

The error which inhibited running the tests no longer occurs
in 5.49.0, although now no tests are found at all.  Since no tests
are found now, the phase 'check-setup can be removed, too,
and thus the 'arguments' at all.

* gnu/packages/kde-frameworks.scm(kirigami)[arguments]: Remove.
---
 gnu/packages/kde-frameworks.scm | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/gnu/packages/kde-frameworks.scm b/gnu/packages/kde-frameworks.scm
index 35e10015e..62cf49c57 100644
--- a/gnu/packages/kde-frameworks.scm
+++ b/gnu/packages/kde-frameworks.scm
@@ -804,19 +804,6 @@ or user activity.")
        ("qtsvg" ,qtsvg)
        ;; Run-time dependency
        ("qtgraphicaleffects" ,qtgraphicaleffects)))
-    (arguments
-     `(#:tests? #f ;; FIXME: Test suite is broken,
-       ;; see https://bugs.kde.org/show_bug.cgi?id=386456
-       ;; Note for when enabling the tests: The test-suite is meant to be run
-       ;; without prior installation, see
-       ;; https://cgit.kde.org/kirigami.git/commit/?id=24ad2c9
-       #:phases
-       (modify-phases %standard-phases
-         (add-before 'check 'check-setup
-           (lambda* (#:key outputs #:allow-other-keys)
-             ;; make Qt render "offscreen", required for tests
-             (setenv "QT_QPA_PLATFORM" "offscreen")
-             #t)))))
     (home-page "https://community.kde.org/Frameworks")
     (synopsis "QtQuick components for mobile user interfaces")
     (description "Kirigami is a set of high level QtQuick components looking
-- 
2.13.7

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

* [bug#36605] [PATCH 3/6] gnu: kpackage: Enable test-suite.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (26 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 2/6] gnu: kirigami: " Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 4/6] gnu: kemoticons: " Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 5/6] gnu: knewstuff: " Hartmut Goebel
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

* gnu/package/kde-frameworks.scm(kpackage)[arguments]
  <#:tests?>: Remove. <#:phases>: Add phase 'patch-tests.
---
 gnu/packages/kde-frameworks.scm | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/kde-frameworks.scm b/gnu/packages/kde-frameworks.scm
index 62cf49c57..07e30d4cf 100644
--- a/gnu/packages/kde-frameworks.scm
+++ b/gnu/packages/kde-frameworks.scm
@@ -1834,8 +1834,7 @@ covers feedback and persistent events.")
        ("ki18n" ,ki18n)
        ("qtbase" ,qtbase)))
     (arguments
-     `(#:tests? #f ; FIXME: 3/9 tests fail.
-       #:phases
+     `(#:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'patch
            (lambda _
@@ -1847,6 +1846,17 @@ covers feedback and persistent events.")
                (("^\\s*(QDirIterator it\\(.*, QDirIterator::Subdirectories)(\\);)" _ a b)
                 (string-append a " | QDirIterator::FollowSymlinks" b)))
              #t))
+         (add-after 'unpack 'patch-tests
+           (lambda _
+             ;; /bin/ls doesn't exist in the build-container use /etc/passwd
+             (substitute* "autotests/packagestructuretest.cpp"
+               (("(addDirectoryDefinition\\(\")bin(\".*\")bin(\".*\")bin\""
+                 _ a b c)
+                (string-append a "etc" b "etc" c "etc\""))
+               (("filePath\\(\"bin\", QStringLiteral\\(\"ls\"))")
+                "filePath(\"etc\", QStringLiteral(\"passwd\"))")
+               (("\"/bin/ls\"") "\"/etc/passwd\""))
+             #t))
          (add-before 'check 'check-setup
            (lambda _
              (setenv "HOME" (getcwd))
-- 
2.13.7

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

* [bug#36605] [PATCH 4/6] gnu: kemoticons: Enable test-suite.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (27 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 3/6] gnu: kpackage: " Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  2019-07-11 20:26                   ` [bug#36605] [PATCH 5/6] gnu: knewstuff: " Hartmut Goebel
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

Without anything changed the test-suite now passes, thus can be enabled.

* gnu/package/kde-frameworks.scm(kemoticons)[arguments]<#:tests?>: Remove.
---
 gnu/packages/kde-frameworks.scm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gnu/packages/kde-frameworks.scm b/gnu/packages/kde-frameworks.scm
index 07e30d4cf..079a8a75e 100644
--- a/gnu/packages/kde-frameworks.scm
+++ b/gnu/packages/kde-frameworks.scm
@@ -2423,8 +2423,7 @@ engine WebKit via QtWebKit.")
        ("kcoreaddons" ,kcoreaddons)
        ("qtbase" ,qtbase)))
     (arguments
-     `(#:tests? #f ; FIXME: 2/2 tests fail.
-       #:phases
+     `(#:phases
        (modify-phases %standard-phases
          (add-before 'check 'check-setup
            (lambda _
-- 
2.13.7

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

* [bug#36605] [PATCH 5/6] gnu: knewstuff: Enable test-suite.
  2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
                                     ` (28 preceding siblings ...)
  2019-07-11 20:26                   ` [bug#36605] [PATCH 4/6] gnu: kemoticons: " Hartmut Goebel
@ 2019-07-11 20:26                   ` Hartmut Goebel
  29 siblings, 0 replies; 56+ messages in thread
From: Hartmut Goebel @ 2019-07-11 20:26 UTC (permalink / raw)
  To: 36605

Without anything changed the test-suite now passes, thus can be enabled.

* gnu/package/kde-frameworks.scm(knewstuff)[arguments]<#:tests?>: Remove.
---
 gnu/packages/kde-frameworks.scm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gnu/packages/kde-frameworks.scm b/gnu/packages/kde-frameworks.scm
index 079a8a75e..45580cb5f 100644
--- a/gnu/packages/kde-frameworks.scm
+++ b/gnu/packages/kde-frameworks.scm
@@ -2727,8 +2727,7 @@ KIO enabled infrastructure.")
        ("solid" ,solid)
        ("sonnet" ,sonnet)))
     (arguments
-     `(#:tests? #f ; FIXME: 1/3 tests fail.
-       #:phases
+     `(#:phases
        (modify-phases %standard-phases
          (add-before 'check 'check-setup
            (lambda _ ; XDG_DATA_DIRS isn't set
-- 
2.13.7

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

end of thread, other threads:[~2019-07-11 20:37 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-17 11:30 [Patch v2] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
2016-11-21 14:13 ` Ludovic Courtès
2016-11-21 14:18   ` Hartmut Goebel
2016-11-27 21:04     ` Ludovic Courtès
2016-11-28 21:31       ` Hartmut Goebel
2016-12-01  0:01         ` Danny Milosavljevic
2016-12-05 20:46           ` [PATCH v3] " Hartmut Goebel
2016-12-06 15:08             ` Ludovic Courtès
2016-12-08 12:12               ` Hartmut Goebel
2016-12-08 12:14                 ` [PATCH v4] " Hartmut Goebel
2016-12-09 14:23                   ` Ludovic Courtès
2016-12-09 14:47                     ` Hartmut Goebel
2016-12-09 14:22                 ` [PATCH v3] " Ludovic Courtès
2016-12-09 15:50                   ` Guile-SSH found at configure-time but not at run-time Hartmut Goebel
2016-12-09 20:35                     ` Ludovic Courtès
2019-07-11 20:26                 ` [bug#36605] [PATCH v4] daemon: Set ownership of kept build directories to the calling user Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH] gc: Add option --keep-going Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH] gnu: Add anonip Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH] gnu: Add dtrx Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH] gnu: Add php-hello-world Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH] gnu: Add python-gunicorn and python2-gunicorn Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 0/2] Updated patches for gunicorn Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 1/2] gnu: Add gunicorn and gunicorn-python2 Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 2/2] gnu: Build documentation for " Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 0/3] Emhancements to the ant-build-system Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 1/3] guix: ant-build-system: put dummy project-name into default build.xml Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 2/3] guix: ant-build-system: add empty `tests` target to " Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 3/3] gnu: Remove now useless #:tests? #f from java-packages Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 00/12] Java build-system and some packages Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 01/12] guix: ant-bulild-sytem: allow specifying the source directory Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 02/12] guix: ant-build-system: use abs path as basedir Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 03/12] guix: Add java-utils Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 04/12] gnu: Add java-plexus-utils Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 05/12] gnu: Add java-plexus-interpolation Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 06/12] gnu: Add java-commons-cli Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 07/12] gnu: Add java-commons-codec Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 08/12] gnu: Add java-commons-daemon Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 09/12] gnu: Add java-commons-io Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 10/12] gnu: Add java-commons-lang Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 11/12] gnu: Add java-commons-lang3 Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 12/12] gnu: Add java-commons-bcel Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 1/6] gnu: kcoreaddons: Enable test-suite Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 2/6] gnu: kirigami: " Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 3/6] gnu: kpackage: " Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 4/6] gnu: kemoticons: " Hartmut Goebel
2019-07-11 20:26                   ` [bug#36605] [PATCH 5/6] gnu: knewstuff: " Hartmut Goebel
2016-12-06 20:41             ` [PATCH v3] daemon: Set ownership of kept build directories to the calling user Danny Milosavljevic
2016-12-08 12:16               ` Hartmut Goebel
2016-12-05 20:51           ` [Patch v2] " Hartmut Goebel
2016-11-21 17:36   ` Hartmut Goebel
2016-11-21 18:29   ` Hartmut Goebel
  -- strict thread matches above, loose matches on Subject: below --
2016-12-23 11:18 [PATCH v4] " Vincent Legoll
2016-12-23 13:33 ` John Darrington
2016-12-23 21:15   ` Danny Milosavljevic
2016-12-24 12:34     ` Hartmut Goebel
2016-12-25 23:34       ` Danny Milosavljevic

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.