[Patchew-devel] [PATCH] tester: use different lock files for each instance

Paolo Bonzini posted 1 patch 42 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/patchew next tags/patchew/20190208180816.4199-1-pbonzini@redhat.com
patchew-cli | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

[Patchew-devel] [PATCH] tester: use different lock files for each instance

Posted by Paolo Bonzini 42 weeks ago
This allows installing multiple tester instances under the same user

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 patchew-cli | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/patchew-cli b/patchew-cli
index b2d0bbb..d79c76f 100755
--- a/patchew-cli
+++ b/patchew-cli
@@ -609,8 +609,8 @@ class TesterCommand(SubCommand):
                     shutil.rmtree(wd)
             return True
 
-    def _check_singleton(self):
-        lockfile = os.path.expanduser("~/.patchew-tester.lock")
+    def _check_singleton(self, name):
+        lockfile = os.path.expanduser("~/.%s.lock" % name)
         self._lockfile = open(lockfile, "w+")
         try:
             fcntl.flock(self._lockfile, fcntl.LOCK_EX | fcntl.LOCK_NB)
@@ -632,7 +632,7 @@ class TesterCommand(SubCommand):
                 print(i)
             return 0
         if args.singleton:
-            self._check_singleton()
+            self._check_singleton(args.name or "patchew-tester")
         subprocess.check_output(["git", "version"])
         count = 0
         cap_refresh = 10
-- 
2.20.1

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel

Re: [Patchew-devel] [PATCH] tester: use different lock files for each instance

Posted by Philippe Mathieu-Daudé 42 weeks ago
On 2/8/19 7:08 PM, Paolo Bonzini wrote:
> This allows installing multiple tester instances under the same user
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  patchew-cli | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/patchew-cli b/patchew-cli
> index b2d0bbb..d79c76f 100755
> --- a/patchew-cli
> +++ b/patchew-cli
> @@ -609,8 +609,8 @@ class TesterCommand(SubCommand):
>                      shutil.rmtree(wd)
>              return True
>  
> -    def _check_singleton(self):
> -        lockfile = os.path.expanduser("~/.patchew-tester.lock")
> +    def _check_singleton(self, name):
> +        lockfile = os.path.expanduser("~/.%s.lock" % name)
>          self._lockfile = open(lockfile, "w+")
>          try:
>              fcntl.flock(self._lockfile, fcntl.LOCK_EX | fcntl.LOCK_NB)
> @@ -632,7 +632,7 @@ class TesterCommand(SubCommand):
>                  print(i)
>              return 0
>          if args.singleton:
> -            self._check_singleton()
> +            self._check_singleton(args.name or "patchew-tester")
>          subprocess.check_output(["git", "version"])
>          count = 0
>          cap_refresh = 10
> 

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel