unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] create and set temporary home directory
@ 2011-04-18 17:41 Florian Friesdorf
  2011-04-18 17:57 ` notmuch via nix/nixpkgs (was: Re: [PATCH] create and set temporary home directory) Florian Friesdorf
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Florian Friesdorf @ 2011-04-18 17:41 UTC (permalink / raw)
  To: notmuch


My first patch send to the list, not sure whether done properly.

In the master branch in test/emacs two tests access the build users home
directory, so does emacs_deliver_message in the crypto branch.

I think the tests should not touch the build user's home directory. The
patch creates a directory in the temporary test directory and sets home
accordingly.

In case of a non-existent home directory, the tests are failing without
this patch.

---
 test/test-lib.sh |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index 9581ead..43dae21 100755
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -923,6 +923,13 @@ rm -fr "$test" || {
 	exit 1
 }
 
+# A temporary home directory is needed by at least:
+# - emacs/"Sending a message via (fake) SMTP"
+# - emacs/"Reply within emacs"
+# - crypto/emacs_deliver_message
+export HOME="${TMP_DIRECTORY}/home"
+mkdir -p "${HOME}"
+
 MAIL_DIR="${TMP_DIRECTORY}/mail"
 export GNUPGHOME="${TMP_DIRECTORY}/gnupg"
 export NOTMUCH_CONFIG="${TMP_DIRECTORY}/notmuch-config"
-- 
1.7.4.4





-- 
Florian Friesdorf <flo@chaoflow.net>
  GPG FPR: 7A13 5EEE 1421 9FC2 108D  BAAF 38F8 99A3 0C45 F083
Jabber/XMPP: flo@chaoflow.net
IRC: chaoflow on freenode,ircnet,blafasel,OFTC

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

* notmuch via nix/nixpkgs (was: Re: [PATCH] create and set temporary home directory)
  2011-04-18 17:41 [PATCH] create and set temporary home directory Florian Friesdorf
@ 2011-04-18 17:57 ` Florian Friesdorf
  2011-05-06  9:09 ` [PATCH] create and set temporary home directory Florian Friesdorf
  2011-05-06 21:06 ` Carl Worth
  2 siblings, 0 replies; 8+ messages in thread
From: Florian Friesdorf @ 2011-04-18 17:57 UTC (permalink / raw)
  To: notmuch


[-- Attachment #1.1: Type: text/plain, Size: 1207 bytes --]

On Mon, 18 Apr 2011 19:41:39 +0200, Florian Friesdorf <flo@chaoflow.net> wrote:
> 
> In case of a non-existent home directory, the tests are failing without
> this patch.

As asked for by jrollins on irc, more info on my build environment:

I use nixos [1] which uses the nix package manager [2] and nixpkgs
package collection [3].

nix and nixpkgs can be used independent of nixos on top of many
operating systems [4]. Packages installed via nix are fully isolated
From the rest of the system.

Package builds are described via nix expressions (see example for
notmuch attached). The build happens fully isolated.

Some big differences of nixos to other systems:
- no /usr, instead profiles (system, default, user)
- everything in /nix/store and linked into profiles
- atomic changes
- easy rollback to old version
- each profile fully isolated of other profiles
- possible to have dedicated profiles, i.e. isolated environments, for
development

For more info, see [1], freenode #nixos and I'm happy to answer
questions.

regards
florian


[1] http://nixos.org/
[2] http://nixos.org/nix/
[3] http://nixos.org/nixpkgs/
[4] http://hydra.nixos.org/release/nix/nix-0.16


[-- Attachment #1.2: default.nix --]
[-- Type: application/octet-stream, Size: 3042 bytes --]

{ fetchgit, stdenv, bash, emacs, glib, gmime, gnupg1, pkgconfig, talloc, xapian }:

stdenv.mkDerivation rec {
  name = "notmuch-0.5-cfl7";

  src = fetchgit {
    url = "git://github.com/chaoflow/notmuch";
    rev = "cfl7";
    sha256 = "d0096e312ad1d2c278d22377b273aae117ccc8de3605575fd23306e244157263";
  };

  buildInputs = [ bash emacs glib gmime gnupg1 pkgconfig talloc xapian ];

  patchPhase = ''
    substituteInPlace "test/author-order" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/basic" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/crypto" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/dump-restore" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/emacs" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/emacs-large-search-buffer" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/encoding" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/from-guessing" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/json" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/long-id" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/maildir-sync" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/new" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/notmuch-test" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/raw" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/reply" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/search" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/search-by-folder" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/search-insufficient-from-quoting" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/search-output" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/search-position-overlap-bug" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/test-lib.sh" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/test-verbose" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/thread-naming" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/thread-order" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
    substituteInPlace "test/uuencode" \
      --replace "#!/bin/bash" "#!${bash}/bin/bash"
  '';

  postBuild = ''
    make test
  '';

  meta = {
    description = "Notmuch -- The mail indexer";

    longDescription = "";

    license = "GPLv3";

    maintainers = [ stdenv.lib.maintainers.chaoflow ];
    platforms = stdenv.lib.platforms.gnu;  # arbitrary choice
  };
}

[-- Attachment #1.3: Type: text/plain, Size: 187 bytes --]


-- 
Florian Friesdorf <flo@chaoflow.net>
  GPG FPR: 7A13 5EEE 1421 9FC2 108D  BAAF 38F8 99A3 0C45 F083
Jabber/XMPP: flo@chaoflow.net
IRC: chaoflow on freenode,ircnet,blafasel,OFTC

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

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

* Re: [PATCH] create and set temporary home directory
  2011-04-18 17:41 [PATCH] create and set temporary home directory Florian Friesdorf
  2011-04-18 17:57 ` notmuch via nix/nixpkgs (was: Re: [PATCH] create and set temporary home directory) Florian Friesdorf
@ 2011-05-06  9:09 ` Florian Friesdorf
  2011-05-06 19:47   ` Jameson Graef Rollins
  2011-05-06 21:06 ` Carl Worth
  2 siblings, 1 reply; 8+ messages in thread
From: Florian Friesdorf @ 2011-05-06  9:09 UTC (permalink / raw)
  To: jrollins; +Cc: notmuch

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


Hi Jamie,

any chance of getting this patch into 0.6?

It would enable me to run the tests for the nixos package without
patching.

You could pull it from:
git://github.com/chaoflow/notmuch.git

branch: for-review/test-fixes
commit: d8842075b1ff6f008e60aced5f4e0b4d7ac79515

regards

On Mon, 18 Apr 2011 19:41:39 +0200, Florian Friesdorf <flo@chaoflow.net> wrote:
> 
> My first patch send to the list, not sure whether done properly.
> 
> In the master branch in test/emacs two tests access the build users home
> directory, so does emacs_deliver_message in the crypto branch.
> 
> I think the tests should not touch the build user's home directory. The
> patch creates a directory in the temporary test directory and sets home
> accordingly.
> 
> In case of a non-existent home directory, the tests are failing without
> this patch.
> 
> ---
>  test/test-lib.sh |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/test/test-lib.sh b/test/test-lib.sh
> index 9581ead..43dae21 100755
> --- a/test/test-lib.sh
> +++ b/test/test-lib.sh
> @@ -923,6 +923,13 @@ rm -fr "$test" || {
>  	exit 1
>  }
>  
> +# A temporary home directory is needed by at least:
> +# - emacs/"Sending a message via (fake) SMTP"
> +# - emacs/"Reply within emacs"
> +# - crypto/emacs_deliver_message
> +export HOME="${TMP_DIRECTORY}/home"
> +mkdir -p "${HOME}"
> +
>  MAIL_DIR="${TMP_DIRECTORY}/mail"
>  export GNUPGHOME="${TMP_DIRECTORY}/gnupg"
>  export NOTMUCH_CONFIG="${TMP_DIRECTORY}/notmuch-config"
> -- 
> 1.7.4.4
> 
> 
> 
> 
> 
> -- 
> Florian Friesdorf <flo@chaoflow.net>
>   GPG FPR: 7A13 5EEE 1421 9FC2 108D  BAAF 38F8 99A3 0C45 F083
> Jabber/XMPP: flo@chaoflow.net
> IRC: chaoflow on freenode,ircnet,blafasel,OFTC
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

-- 
Florian Friesdorf <flo@chaoflow.net>
  GPG FPR: 7A13 5EEE 1421 9FC2 108D  BAAF 38F8 99A3 0C45 F083
Jabber/XMPP: flo@chaoflow.net
IRC: chaoflow on freenode,ircnet,blafasel,OFTC

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

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

* Re: [PATCH] create and set temporary home directory
  2011-05-06  9:09 ` [PATCH] create and set temporary home directory Florian Friesdorf
@ 2011-05-06 19:47   ` Jameson Graef Rollins
  2011-05-06 20:11     ` Florian Friesdorf
  0 siblings, 1 reply; 8+ messages in thread
From: Jameson Graef Rollins @ 2011-05-06 19:47 UTC (permalink / raw)
  To: Florian Friesdorf; +Cc: notmuch

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

On Fri, 06 May 2011 11:09:19 +0200, Florian Friesdorf <flo@chaoflow.net> wrote:
> any chance of getting this patch into 0.6?

Hi, Florian.  Yes, I have included this patch in the
release-candidate/0.6 branch.

jamie.

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

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

* Re: [PATCH] create and set temporary home directory
  2011-05-06 19:47   ` Jameson Graef Rollins
@ 2011-05-06 20:11     ` Florian Friesdorf
  0 siblings, 0 replies; 8+ messages in thread
From: Florian Friesdorf @ 2011-05-06 20:11 UTC (permalink / raw)
  To: Jameson Graef Rollins; +Cc: notmuch

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

On Fri, 06 May 2011 12:47:35 -0700, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> On Fri, 06 May 2011 11:09:19 +0200, Florian Friesdorf <flo@chaoflow.net> wrote:
> > any chance of getting this patch into 0.6?
> 
> Hi, Florian.  Yes, I have included this patch in the
> release-candidate/0.6 branch.

great! all tests pass now on nixos.

-- 
Florian Friesdorf <flo@chaoflow.net>
  GPG FPR: 7A13 5EEE 1421 9FC2 108D  BAAF 38F8 99A3 0C45 F083
Jabber/XMPP: flo@chaoflow.net
IRC: chaoflow on freenode,ircnet,blafasel,OFTC

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

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

* Re: [PATCH] create and set temporary home directory
  2011-04-18 17:41 [PATCH] create and set temporary home directory Florian Friesdorf
  2011-04-18 17:57 ` notmuch via nix/nixpkgs (was: Re: [PATCH] create and set temporary home directory) Florian Friesdorf
  2011-05-06  9:09 ` [PATCH] create and set temporary home directory Florian Friesdorf
@ 2011-05-06 21:06 ` Carl Worth
  2011-05-06 21:56   ` Florian Friesdorf
  2011-05-06 23:30   ` patch submission guide (was Re: [PATCH] create and set temporary home directory) Florian Friesdorf
  2 siblings, 2 replies; 8+ messages in thread
From: Carl Worth @ 2011-05-06 21:06 UTC (permalink / raw)
  To: Florian Friesdorf, notmuch

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

On Mon, 18 Apr 2011 19:41:39 +0200, Florian Friesdorf <flo@chaoflow.net> wrote:
> My first patch send to the list, not sure whether done properly.

Just fine, Florian. Thanks for the contribution!

One small thing you might do differently in the future is to tweak the
email message to read exactly like a commit message. For example, a
sentence like the above "not sure whether done properly" is fine in an
email message, but doesn't make sense in the commit message.

> I think the tests should not touch the build user's home directory. The
> patch creates a directory in the temporary test directory and sets home
> accordingly.

Similarly, everything in a commit message is known to be your opinion,
so you should omit phrases like "I think". Instead, you should describe
what the commit actually does, and then describe why it does that.

Finally, this little separator with three dashes:

> ---
>  test/test-lib.sh |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)

Is what lets git know where your commit message ends. Anything you
include after that (And before the patch itself) will be ignored by
git. So that's the perfect place to put a sentence like "My first
patch---not sure whether done properly".

So with all of the above points taken together, your email might have
read something like what I've provided below.

I applied this patch last week, and would have pushed it, except that
just after applying it, I also tried cleaning up some of this part of
the code. And in the process it seems I managed to get the test suite to
run "rm -rf ${HOME}" with my actual home directory (oops!).

Fortunately, I was able to recover from most of that with my dirvish
backups. But then I was also on vacation for several days.

Anyway, I'm excited to see the release candidate branch that jrollins is
putting together now. Hopefully I'll find some good way to collaborate
with the work he is doing.

-Carl

From: Florian Friesdorf <flo@chaoflow.net>, notmuch@notmuchmail.org
Subject: [PATCH] Create and set temporary home directory
To: notmuch@notmuchmail.org

Create and set temporary home directory
    
Within test/emacs two tests access the build users home
directory. These tests fail in case of a non-existent home directory.
    
Fix these tests to not touch the build user's home directory. Instead,
create a directory in the temporary test directory and set HOME
accordingly.

---

This is my first patch sent to the list. I'm not sure whether I've done
it properly.

 test/test-lib.sh |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
...

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

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

* Re: [PATCH] create and set temporary home directory
  2011-05-06 21:06 ` Carl Worth
@ 2011-05-06 21:56   ` Florian Friesdorf
  2011-05-06 23:30   ` patch submission guide (was Re: [PATCH] create and set temporary home directory) Florian Friesdorf
  1 sibling, 0 replies; 8+ messages in thread
From: Florian Friesdorf @ 2011-05-06 21:56 UTC (permalink / raw)
  To: Carl Worth, notmuch

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

On Fri, 06 May 2011 14:06:22 -0700, Carl Worth <cworth@cworth.org> wrote:
(..)

thx for all the suggestions - mail marked and will reread before the
next patch.

-- 
Florian Friesdorf <flo@chaoflow.net>
  GPG FPR: 7A13 5EEE 1421 9FC2 108D  BAAF 38F8 99A3 0C45 F083
Jabber/XMPP: flo@chaoflow.net
IRC: chaoflow on freenode,ircnet,blafasel,OFTC

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

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

* patch submission guide (was Re: [PATCH] create and set temporary home directory)
  2011-05-06 21:06 ` Carl Worth
  2011-05-06 21:56   ` Florian Friesdorf
@ 2011-05-06 23:30   ` Florian Friesdorf
  1 sibling, 0 replies; 8+ messages in thread
From: Florian Friesdorf @ 2011-05-06 23:30 UTC (permalink / raw)
  To: Carl Worth, notmuch

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


Hi Carl,

On Fri, 06 May 2011 14:06:22 -0700, Carl Worth <cworth@cworth.org> wrote:
> On Mon, 18 Apr 2011 19:41:39 +0200, Florian Friesdorf <flo@chaoflow.net> wrote:
> > My first patch send to the list, not sure whether done properly.
> 
> Just fine, Florian. Thanks for the contribution!
> 
> One small thing you might do differently in the future is to tweak the
> email message to read exactly like a commit message. For example, a
> sentence like the above "not sure whether done properly" is fine in an
> email message, but doesn't make sense in the commit message.
> 
> > I think the tests should not touch the build user's home directory. The
> > patch creates a directory in the temporary test directory and sets home
> > accordingly.
> 
> Similarly, everything in a commit message is known to be your opinion,
> so you should omit phrases like "I think". Instead, you should describe
> what the commit actually does, and then describe why it does that.

That text was intended as a comment (cover letter according to what I
just learned) and the commit message itself was intended to be more to
the point.

> Finally, this little separator with three dashes:
> 
> > ---
> >  test/test-lib.sh |    7 +++++++
> >  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> Is what lets git know where your commit message ends. Anything you
> include after that (And before the patch itself) will be ignored by
> git. So that's the perfect place to put a sentence like "My first
> patch---not sure whether done properly".

I now sent a patch with a cover letter using only git (search
--format=sanitized_text):

git format-patch --cover-letter <COMMIT>^
git send-email 000*

If everything is correct, I would conclude this into a short howto on
notmuchmail.org. So please, if there is still room for improvement, let
me know.

Do we prefer sendemail.chainreplyto or the new shallow format for patch
series [1]?

Should people who have a public git repository use it to publish their
patches (in addition to sending them here / instead of)?

I have seen (amdragon I think) the concept of
for-review/... branches. Would that be a best practice?

> I applied this patch last week, and would have pushed it, except that
> just after applying it, I also tried cleaning up some of this part of
> the code. And in the process it seems I managed to get the test suite to
> run "rm -rf ${HOME}" with my actual home directory (oops!).

I got a bit afraid, shouldnt my patch prevent that? I cannot imagine it
caused it.

[1] https://felipec.wordpress.com/2009/10/25/git-send-email-tricks/

regards
florian
-- 
Florian Friesdorf <flo@chaoflow.net>
  GPG FPR: 7A13 5EEE 1421 9FC2 108D  BAAF 38F8 99A3 0C45 F083
Jabber/XMPP: flo@chaoflow.net
IRC: chaoflow on freenode,ircnet,blafasel,OFTC

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

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

end of thread, other threads:[~2011-05-06 23:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-18 17:41 [PATCH] create and set temporary home directory Florian Friesdorf
2011-04-18 17:57 ` notmuch via nix/nixpkgs (was: Re: [PATCH] create and set temporary home directory) Florian Friesdorf
2011-05-06  9:09 ` [PATCH] create and set temporary home directory Florian Friesdorf
2011-05-06 19:47   ` Jameson Graef Rollins
2011-05-06 20:11     ` Florian Friesdorf
2011-05-06 21:06 ` Carl Worth
2011-05-06 21:56   ` Florian Friesdorf
2011-05-06 23:30   ` patch submission guide (was Re: [PATCH] create and set temporary home directory) Florian Friesdorf

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).