Hello community,

here is the log from the commit of package withlock for openSUSE:Factory 
checked in at 2014-08-18 11:23:51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/withlock (Old)
 and      /work/SRC/openSUSE:Factory/.withlock.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "withlock"

Changes:
--------
--- /work/SRC/openSUSE:Factory/withlock/withlock.changes        2014-03-26 
16:42:15.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.withlock.new/withlock.changes   2014-08-18 
11:23:53.000000000 +0200
@@ -1,0 +2,10 @@
+Thu Aug 14 13:23:11 UTC 2014 - [email protected]
+
+- I wrote a patch got-lock.patch to fix the trouble with the got-lock variable.
+  I was testing the withlock and still had there the lock file after a
+  program already end with exit code 0. I have look on the code together
+  with our Python expert [email protected] and we found the got-lock variable
+  isn't marked ad global variable.I`ll send this to [email protected]
+  after we test it on our servers.
+
+-------------------------------------------------------------------

New:
----
  got-lock.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ withlock.spec ++++++
--- /var/tmp/diff_new_pack.5sESkQ/_old  2014-08-18 11:23:53.000000000 +0200
+++ /var/tmp/diff_new_pack.5sESkQ/_new  2014-08-18 11:23:53.000000000 +0200
@@ -26,6 +26,8 @@
 Requires:       python
 Source0:        http://mirrorbrain.org/files/releases/%{name}-%{version}.tar.gz
 Source1:        %name-README.SuSE
+# fixed trouble with not removed lock file bacuse got-lock was not global 
variable.
+Patch0:         got-lock.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildArch:      noarch
 
@@ -40,7 +42,9 @@
 
 %prep
 %setup
-#
+
+%patch0 -p1
+
 %build
 #
 %install

++++++ got-lock.patch ++++++
Index: withlock-0.3/withlock
===================================================================
--- withlock-0.3.orig/withlock
+++ withlock-0.3/withlock
@@ -64,12 +64,21 @@ for name in 'SIGBREAK', 'SIGHUP', 'SIGTE
     if num: signal.signal(num, catchterm)
 
 
-def cleanup(lockfile):
+def cleanup(lockfile, verbose):
+    global got_lock
+    if verbose:
+        sys.stderr.write('got_lock is set to: %r\n' % got_lock)
+
+    if verbose:
+        sys.stderr.write('removing lockfile: %r\n' % lockfile)
+
     if got_lock:
         try:
             os.unlink(lockfile)
         except:
             pass
+    else:
+        sys.stderr.write('the lockfile was not removed !\n')
 
 
 def main():
@@ -132,6 +141,7 @@ def main():
 
     lock = open(lockfile, 'w')
 
+    global got_lock
     while 1 + 1 == 2:
 
         try:
@@ -174,7 +184,7 @@ def main():
                             % lockfile)
 
 
-    atexit.register(cleanup, lockfile)
+    atexit.register(cleanup, lockfile, options.verbose)
     os.umask(prev_umask)
 
     import subprocess
@@ -184,10 +194,7 @@ def main():
 
     if options.verbose:
         sys.stderr.write('command terminated with exit code %s\n' % rc)
-
-    if options.verbose:
-        sys.stderr.write('removing lockfile\n')
-
+    
     sys.exit(rc)
 
 
-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to