← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~twom/launchpad-buildd/close-directory-tar into lp:launchpad-buildd

 

Tom Wardill has proposed merging lp:~twom/launchpad-buildd/close-directory-tar into lp:launchpad-buildd.

Commit message:
Always close the directory tar if we have one

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~twom/launchpad-buildd/close-directory-tar/+merge/381975

The last tar that was created was closed. This lead to a corrupt file being created.
Cause it to always be closed if it's been opened.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~twom/launchpad-buildd/close-directory-tar into lp:launchpad-buildd.
=== modified file 'debian/changelog'
--- debian/changelog	2020-04-01 14:03:06 +0000
+++ debian/changelog	2020-04-09 07:52:26 +0000
@@ -1,6 +1,12 @@
+launchpad-buildd (189) UNRELEASED; urgency=medium
+
+  * Fix closing tar files in OCI builds
+
+ -- Tom Wardill <tom.wardill@xxxxxxxxxxxxx>  Wed, 08 Apr 2020 16:50:47 +0000
+
 launchpad-buildd (188) xenial; urgency=medium
 
-  * Fix cwd for OCI builds, allows Dockerfile parameter. 
+  * Fix cwd for OCI builds, allows Dockerfile parameter.
 
  -- Tom Wardill <tom.wardill@xxxxxxxxxxxxx>  Wed, 01 Apr 2020 14:02:00 +0000
 

=== modified file 'lpbuildd/oci.py'
--- lpbuildd/oci.py	2020-02-26 10:52:29 +0000
+++ lpbuildd/oci.py	2020-04-09 07:52:26 +0000
@@ -189,6 +189,9 @@
                     tar.extract(file, extract_path)
         except Exception as e:
             print(e)
+        finally:
+            if directory_tar is not None:
+                directory_tar.close()
 
         # We need these mapping files
         sha_directory = tempfile.mkdtemp()