diff mbox

[Branch,~linaro-image-tools/linaro-image-tools/trunk] Rev 575: Skip symlink-ed or invalid debian package file. (LP: #1065826)

Message ID 20121012142116.15300.40775.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Fathi Boudra Oct. 12, 2012, 2:21 p.m. UTC
Merge authors:
  Fathi Boudra (fboudra)
Related merge proposals:
  https://code.launchpad.net/~fboudra/linaro-image-tools/bug-1065826/+merge/129410
  proposed by: Fathi Boudra (fboudra)
------------------------------------------------------------
revno: 575 [merge]
committer: Fathi Boudra <fathi.boudra@linaro.org>
branch nick: linaro-image-tools
timestamp: Fri 2012-10-12 17:20:25 +0300
message:
  Skip symlink-ed or invalid debian package file. (LP: #1065826)
modified:
  linaro_image_tools/hwpack/builder.py


--
lp:linaro-image-tools
https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk

You are subscribed to branch lp:linaro-image-tools.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'linaro_image_tools/hwpack/builder.py'
--- linaro_image_tools/hwpack/builder.py	2012-10-11 09:24:36 +0000
+++ linaro_image_tools/hwpack/builder.py	2012-10-12 12:31:22 +0000
@@ -28,6 +28,7 @@ 
 from glob import iglob
 
 from debian.debfile import DebFile
+from debian.arfile import ArError
 
 from linaro_image_tools import cmd_runner
 
@@ -337,11 +338,21 @@ 
                                                       'build-info')
                         build_info_available = 0
                         for deb_pkg in self.packages:
-                            # Extract Build-Info attribute from debian control
                             deb_pkg_file_path = deb_pkg.filepath
-                            deb_control = \
+                            if os.path.islink(deb_pkg_file_path):
+                                # Skip symlink-ed debian package file
+                                # e.g. fetched package with dummy information
+                                continue
+                            try:
+                                # Extract Build-Info attribute from debian
+                                # control
+                                deb_control = \
                                 DebFile(deb_pkg_file_path).control.debcontrol()
-                            build_info = deb_control.get('Build-Info')
+                                build_info = deb_control.get('Build-Info')
+                            except ArError:
+                                # Skip invalid debian package file
+                                # e.g. fetched package with dummy information
+                                continue
                             if build_info is not None:
                                 build_info_available += 1
                                 # Extract debian packages with build