Merge lp:~mvo/pkgme-devportal/raise-on-unsupported-architectures into lp:pkgme-devportal

Proposed by Michael Vogt
Status: Merged
Approved by: James Westby
Approved revision: 64
Merged at revision: 63
Proposed branch: lp:~mvo/pkgme-devportal/raise-on-unsupported-architectures
Merge into: lp:pkgme-devportal
Prerequisite: lp:~mvo/pkgme-devportal/i386-only-for-now
Diff against target: 77 lines (+16/-4)
3 files modified
acceptance/data/bundled_lib/Makefile (+3/-3)
acceptance/data/gtk/Makefile (+1/-1)
devportalbinary/binary.py (+12/-0)
To merge this branch: bzr merge lp:~mvo/pkgme-devportal/raise-on-unsupported-architectures
Reviewer Review Type Date Requested Status
Jonathan Lange Approve
Review via email: mp+115716@code.launchpad.net

Commit message

Raise an error if a binary is for a non-supported architecture.

Description of the change

This simply fails early it it detect architecture is not what we support. Not sure if that is the right place or if it should instead go into a different function. It also makes mixed native i386/native amd64 tarballs fail currently which is not what we want. But those mixed tarballs fail currently anyway so there is no regression.

To post a comment you must log in.
Revision history for this message
Jonathan Lange (jml) wrote :

I'm OK with this.

review: Approve
Revision history for this message
ISD Branch Mangler (isd-branches-mangler) wrote :

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'acceptance/data/bundled_lib/Makefile'
2--- acceptance/data/bundled_lib/Makefile 2012-07-16 18:13:36 +0000
3+++ acceptance/data/bundled_lib/Makefile 2012-07-24 16:22:19 +0000
4@@ -2,10 +2,10 @@
5 all: libtest.so uselib
6
7 uselib: libtest.so
8- gcc -o $@ $@.c -L. -ltest
9+ gcc -o $@ $@.c -m32 -L. -ltest
10
11 libtest.so: libtest.c
12- gcc -shared -fPIC -o $@ $<
13+ gcc -shared -m32 -fPIC -o $@ $<
14
15 clean:
16- rm *~ *.o *.so uselib
17\ No newline at end of file
18+ rm *~ *.o *.so uselib
19
20=== modified file 'acceptance/data/bundled_lib/libtest.so'
21Binary files acceptance/data/bundled_lib/libtest.so 2012-07-18 10:08:31 +0000 and acceptance/data/bundled_lib/libtest.so 2012-07-24 16:22:19 +0000 differ
22=== modified file 'acceptance/data/bundled_lib/uselib'
23Binary files acceptance/data/bundled_lib/uselib 2012-07-18 10:05:58 +0000 and acceptance/data/bundled_lib/uselib 2012-07-24 16:22:19 +0000 differ
24=== modified file 'acceptance/data/gtk/Makefile'
25--- acceptance/data/gtk/Makefile 2011-11-15 17:27:30 +0000
26+++ acceptance/data/gtk/Makefile 2012-07-24 16:22:19 +0000
27@@ -1,3 +1,3 @@
28-CFLAGS=`pkg-config --cflags gtk+-2.0`
29+CFLAGS=`pkg-config --cflags gtk+-2.0` -m32
30
31 all: test_gtk
32
33=== modified file 'acceptance/data/gtk/test_gtk'
34Binary files acceptance/data/gtk/test_gtk 2011-11-15 17:27:30 +0000 and acceptance/data/gtk/test_gtk 2012-07-24 16:22:19 +0000 differ
35=== modified file 'devportalbinary/binary.py'
36--- devportalbinary/binary.py 2012-07-24 15:05:27 +0000
37+++ devportalbinary/binary.py 2012-07-24 16:22:19 +0000
38@@ -71,6 +71,10 @@
39 """Raised when we do not know which dependency to add."""
40
41
42+class UnsupportedArchitecture(PkgmeError):
43+ """Raised when we find a unsupported architecture."""
44+
45+
46 def guess_executable(package_name, executables):
47 """
48 From a list of executables, guess which one is likely to be the main
49@@ -130,6 +134,7 @@
50 binary_paths = list(binary_paths)
51 if not binary_paths:
52 raise NoBinariesFound()
53+ conf = load_configuration()
54 cmd = [OBJDUMP, '-f', '-p'] + binary_paths
55 output = run_subprocess(cmd)
56 libraries = {}
57@@ -144,6 +149,13 @@
58 libraries[current_binary] = []
59 if line.startswith(' NEEDED'):
60 libraries[current_binary].append(line.split()[1])
61+ elif line.startswith('architecture: '):
62+ # so... i386 is reported as "i386"
63+ # *but* amd64 as "i386:x86-64"
64+ architecture = line.partition(":")[2].partition(",")[0].strip()
65+ if architecture not in conf.options.architectures_supported:
66+ raise UnsupportedArchitecture(
67+ "Can not handle '%s'" % architecture)
68 last_line_was_blank = this_line_blank
69 return libraries
70
71
72=== modified file 'devportalbinary/tests/data/bundled_library/libtest.so'
73Binary files devportalbinary/tests/data/bundled_library/libtest.so 2012-07-17 08:48:57 +0000 and devportalbinary/tests/data/bundled_library/libtest.so 2012-07-24 16:22:19 +0000 differ
74=== modified file 'devportalbinary/tests/data/bundled_library/uselib'
75Binary files devportalbinary/tests/data/bundled_library/uselib 2012-07-17 08:48:57 +0000 and devportalbinary/tests/data/bundled_library/uselib 2012-07-24 16:22:19 +0000 differ
76=== modified file 'devportalbinary/tests/data/hello/hello'
77Binary files devportalbinary/tests/data/hello/hello 2011-12-22 22:41:37 +0000 and devportalbinary/tests/data/hello/hello 2012-07-24 16:22:19 +0000 differ

Subscribers

People subscribed via source and target branches