Skip to contentSkip to conversation

apt-native fixes

PATCH Applied Joshua Lock 2 participants 5 messages Jun 19, 2012 – Jun 21, 2012

lore
Share & tools
lore
#0 lore raw

cover apt-native fixes

With the toolchain provided on modern distros apt-native fails to compile, this series cherry-picks several patches from master which ensure that apt and apt-native can be built reliably.

Cheers,
Joshua

The following changes since commit 30c6ec403e1696b5fd94b92328ef9edec535a57a:

scripts/qemuimage-testlib: fix typos (2012-06-14 11:17:35 +0100)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib josh/edison
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=josh/edison

Richard Purdie (2):
apt: Fix locale header and hardcoded libname issues
apt: Fix parallel make race

Robert Yang (1):
apt 0.7.14: do_compile failed with gcc 4.7

 .../apt/apt-0.7.14/localefixes.patch               |   91 ++++++++++++++++++++
 .../recipes-devtools/apt/apt-0.7.14/makerace.patch |   23 +++++
 .../apt/apt-0.7.14/remove-redeclaration.patch      |   63 ++++++++++++++
 meta/recipes-devtools/apt/apt-native.inc           |    9 +-
 meta/recipes-devtools/apt/apt-native_0.7.14.bb     |    2 +-
 meta/recipes-devtools/apt/apt-package.inc          |    9 +-
 meta/recipes-devtools/apt/apt.inc                  |    3 +
 meta/recipes-devtools/apt/apt_0.7.14.bb            |    2 +-
 8 files changed, 192 insertions(+), 10 deletions(-)
 create mode 100644 meta/recipes-devtools/apt/apt-0.7.14/localefixes.patch
 create mode 100644 meta/recipes-devtools/apt/apt-0.7.14/makerace.patch
 create mode 100644 meta/recipes-devtools/apt/apt-0.7.14/remove-redeclaration.patch
Signature · 1 line
1.7.10.2
#1 lore raw

PATCH 1/3 apt: Fix locale header and hardcoded libname issues

From: Richard Purdie <[email protected]>

apt wasn't building on modern libc/compiler combinations due to missing header includes.

The libcpp version was also being hardcoded, this patch generates it dynamically to work on different host systems which no longer have this.

---
 .../apt/apt-0.7.14/localefixes.patch               |   91 ++++++++++++++++++++
 meta/recipes-devtools/apt/apt-native.inc           |    9 +-
 meta/recipes-devtools/apt/apt-native_0.7.14.bb     |    2 +-
 meta/recipes-devtools/apt/apt-package.inc          |    9 +-
 meta/recipes-devtools/apt/apt.inc                  |    1 +
 meta/recipes-devtools/apt/apt_0.7.14.bb            |    2 +-
 6 files changed, 104 insertions(+), 10 deletions(-)
 create mode 100644 meta/recipes-devtools/apt/apt-0.7.14/localefixes.patch
meta/recipes-devtools/apt/apt-0.7.14/localefixes.patch new file +91 -0
new file mode 100644
index 0000000..8025273
@@ -0,0 +1,91 @@
+Add in missing header includes to resolve compile failures with recent 
+compiler/glibc combinations.
+
+Upstream-Status: Inappropriate [Resolved upstream]
+
+RP 2011/11/23
+
+Index: apt-0.7.14/apt-pkg/init.cc
+===================================================================
+--- apt-0.7.14.orig/apt-pkg/init.cc	2011-11-23 22:48:53.544637868 +0000
++++ apt-0.7.14/apt-pkg/init.cc	2011-11-23 22:48:59.456638260 +0000
+@@ -16,6 +16,7 @@
+ #include <config.h>
+ #include <cstdlib>
+ #include <sys/stat.h>
++#include <locale>
+ 									/*}}}*/
+ 
+ #define Stringfy_(x) # x
+Index: apt-0.7.14/cmdline/apt-cache.cc
+===================================================================
+--- apt-0.7.14.orig/cmdline/apt-cache.cc	2011-11-23 22:53:29.048631067 +0000
++++ apt-0.7.14/cmdline/apt-cache.cc	2011-11-23 22:54:15.784616212 +0000
+@@ -32,6 +32,7 @@
+ #include <apti18n.h>
+ 
+ #include <locale.h>
++#include <locale>
+ #include <iostream>
+ #include <unistd.h>
+ #include <errno.h>
+Index: apt-0.7.14/cmdline/apt-cdrom.cc
+===================================================================
+--- apt-0.7.14.orig/cmdline/apt-cdrom.cc	2011-11-23 22:53:29.064631096 +0000
++++ apt-0.7.14/cmdline/apt-cdrom.cc	2011-11-23 22:53:57.616630261 +0000
+@@ -27,6 +27,7 @@
+ //#include "indexcopy.h"
+ 
+ #include <locale.h>
++#include <locale>
+ #include <iostream>
+ #include <fstream>
+ #include <vector>
+Index: apt-0.7.14/cmdline/apt-config.cc
+===================================================================
+--- apt-0.7.14.orig/cmdline/apt-config.cc	2011-11-23 22:50:16.796635352 +0000
++++ apt-0.7.14/cmdline/apt-config.cc	2011-11-23 22:50:25.640633906 +0000
+@@ -27,6 +27,7 @@
+ #include <locale.h>
+ #include <iostream>
+ #include <string>
++#include <locale>
+ 									/*}}}*/
+ using namespace std;
+ 
+Index: apt-0.7.14/cmdline/apt-extracttemplates.cc
+===================================================================
+--- apt-0.7.14.orig/cmdline/apt-extracttemplates.cc	2011-11-23 22:53:29.080631084 +0000
++++ apt-0.7.14/cmdline/apt-extracttemplates.cc	2011-11-23 22:53:38.304630439 +0000
+@@ -39,6 +39,7 @@
+ #include <config.h>
+ #include <apti18n.h>
+ #include "apt-extracttemplates.h"
++#include <locale>
+ 									/*}}}*/
+ 
+ using namespace std;
+Index: apt-0.7.14/cmdline/apt-get.cc
+===================================================================
+--- apt-0.7.14.orig/cmdline/apt-get.cc	2011-11-23 22:53:29.096631090 +0000
++++ apt-0.7.14/cmdline/apt-get.cc	2011-11-23 22:53:49.368629452 +0000
+@@ -48,6 +48,7 @@
+ 
+ #include <set>
+ #include <locale.h>
++#include <locale>
+ #include <langinfo.h>
+ #include <fstream>
+ #include <termios.h>
+Index: apt-0.7.14/cmdline/apt-sortpkgs.cc
+===================================================================
+--- apt-0.7.14.orig/cmdline/apt-sortpkgs.cc	2011-11-23 22:52:03.872640247 +0000
++++ apt-0.7.14/cmdline/apt-sortpkgs.cc	2011-11-23 22:52:10.880638611 +0000
+@@ -27,6 +27,7 @@
+ 
+ #include <locale.h>
+ #include <unistd.h>
++#include <locale>
+ 									/*}}}*/
+ 
+ using namespace std;
meta/recipes-devtools/apt/apt-native.inc +5 -4
index b16f99e..ddaeaf9 100644
@@ -40,10 +40,11 @@ do_install_base () {
 	install -m 0755 bin/apt-extracttemplates ${D}${bindir}/
 
 	eval `cat environment.mak | grep ^GLIBC_VER | sed -e's, = ,=,'`
-	oe_libinstall -so -C bin libapt-pkg$GLIBC_VER-6 ${D}${libdir}/
-	ln -sf libapt-pkg$GLIBC_VER-6.so ${D}${libdir}/libapt-pkg.so
-	oe_libinstall -so -C bin libapt-inst$GLIBC_VER-6 ${D}${libdir}/
-	ln -sf libapt-inst$GLIBC_VER-6.so ${D}${libdir}/libapt-inst.so
+	eval `cat environment.mak | grep ^LIBSTDCPP_VER | sed -e's, = ,=,'`
+	oe_libinstall -so -C bin libapt-pkg$GLIBC_VER$LIBSTDCPP_VER ${D}${libdir}/
+	ln -sf libapt-pkg$GLIBC_VER$LIBSTDCPP_VER.so ${D}${libdir}/libapt-pkg.so
+	oe_libinstall -so -C bin libapt-inst$GLIBC_VER$LIBSTDCPP_VER ${D}${libdir}/
+	ln -sf libapt-inst$GLIBC_VER$LIBSTDCPP_VER.so ${D}${libdir}/libapt-inst.so
 
 	install -d ${D}${libdir}/apt/methods
 	install -m 0755 bin/methods/* ${D}${libdir}/apt/methods/
meta/recipes-devtools/apt/apt-native_0.7.14.bb +1 -1
index c82d606..37368ac 100644
@@ -1,6 +1,6 @@
 require apt-native.inc
 
-PR = "r5"
+PR = "r6"
 
 SRC_URI += "file://nodoc.patch \
             file://noconfigure.patch \
meta/recipes-devtools/apt/apt-package.inc +5 -4
index 2e3be38..1909e3b 100644
@@ -78,10 +78,11 @@ do_install () {
 	install -m 0755 bin/apt-extracttemplates ${D}${bindir}/
 
 	eval `cat environment.mak | grep ^GLIBC_VER | sed -e's, = ,=,'`
-	oe_libinstall -so -C bin libapt-pkg$GLIBC_VER-6 ${D}${libdir}/
-	ln -sf libapt-pkg$GLIBC_VER-6.so ${D}${libdir}/libapt-pkg.so
-	oe_libinstall -so -C bin libapt-inst$GLIBC_VER-6 ${D}${libdir}/
-	ln -sf libapt-inst$GLIBC_VER-6.so ${D}${libdir}/libapt-inst.so
+	eval `cat environment.mak | grep ^LIBSTDCPP_VER | sed -e's, = ,=,'`
+	oe_libinstall -so -C bin libapt-pkg$GLIBC_VER$LIBSTDCPP_VER ${D}${libdir}/
+	ln -sf libapt-pkg$GLIBC_VER$LIBSTDCPP_VER.so ${D}${libdir}/libapt-pkg.so
+	oe_libinstall -so -C bin libapt-inst$GLIBC_VER$LIBSTDCPP_VER ${D}${libdir}/
+	ln -sf libapt-inst$GLIBC_VER$LIBSTDCPP_VER.so ${D}${libdir}/libapt-inst.so
 
 	install -d ${D}${libdir}/apt/methods
 	install -m 0755 bin/methods/* ${D}${libdir}/apt/methods/
meta/recipes-devtools/apt/apt.inc +1 -0
index 546683f..9d3268d 100644
@@ -5,6 +5,7 @@ SECTION = "base"
 SRC_URI = "${DEBIAN_MIRROR}/main/a/apt/apt_${PV}.tar.gz \
            file://no-ko-translation.patch \
            file://use-host.patch \
+           file://localefixes.patch \
            "
 
 inherit autotools gettext
meta/recipes-devtools/apt/apt_0.7.14.bb +1 -1
index 93eebe9..bd1116f 100644
@@ -3,7 +3,7 @@ RDEPENDS_${PN} = "dpkg"
 LIC_FILES_CHKSUM = "file://COPYING.GPL;md5=0636e73ff0215e8d672dc4c32c317bb3"
 require apt.inc
 
-PR = "r8"
+PR = "r9"
 
 SRC_URI += "file://nodoc.patch \
             file://includes-fix.patch "
Signature · 1 line
1.7.10.2
#2 lore raw

PATCH 2/3 apt: Fix parallel make race

In reply to Joshua Lock

From: Richard Purdie <[email protected]>

I was just going to turn off parallel make but ended up fixing this properly.

---
 .../recipes-devtools/apt/apt-0.7.14/makerace.patch |   23 ++++++++++++++++++++
 meta/recipes-devtools/apt/apt-native_0.7.14.bb     |    2 +-
 meta/recipes-devtools/apt/apt.inc                  |    1 +
 meta/recipes-devtools/apt/apt_0.7.14.bb            |    2 +-
 4 files changed, 26 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-devtools/apt/apt-0.7.14/makerace.patch
meta/recipes-devtools/apt/apt-0.7.14/makerace.patch new file +23 -0
new file mode 100644
index 0000000..403711f
@@ -0,0 +1,23 @@
+I was seeing various issues with parallel make, mainly due to to what was likely 
+partially installed headers. If you change into the source directory and
+"NOISY=1 make  ../obj/apt-pkg/sourcelist.opic" in apt-pkg, you'll see it 
+doesn't have any dependencies on the headers being installed. This patch
+fixes that so things build correctly.
+
+RP 2012/3/19
+
+Upstream-Status: Pending
+
+Index: apt-0.7.14/buildlib/library.mak
+===================================================================
+--- apt-0.7.14.orig/buildlib/library.mak
++++ apt-0.7.14/buildlib/library.mak
+@@ -61,7 +61,7 @@ $(LIB)/lib$(LIBRARY)$(LIBEXT).so.$(MAJOR
+ 
+ # Compilation rules
+ vpath %.cc $(SUBDIRS)
+-$(OBJ)/%.opic: %.cc
++$(OBJ)/%.opic: %.cc $($(LOCAL)-HEADERS)
+ 	echo Compiling $< to $@
+ 	$(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXFLAGS) $(PICFLAGS) -o $@ $<
+ 	$(DoDep)
meta/recipes-devtools/apt/apt-native_0.7.14.bb +1 -1
index 37368ac..ec3fd20 100644
@@ -1,6 +1,6 @@
 require apt-native.inc
 
-PR = "r6"
+PR = "r7"
 
 SRC_URI += "file://nodoc.patch \
             file://noconfigure.patch \
meta/recipes-devtools/apt/apt.inc +1 -0
index 9d3268d..61d9602 100644
@@ -6,6 +6,7 @@ SRC_URI = "${DEBIAN_MIRROR}/main/a/apt/apt_${PV}.tar.gz \
            file://no-ko-translation.patch \
            file://use-host.patch \
            file://localefixes.patch \
+           file://makerace.patch \
            "
 
 inherit autotools gettext
meta/recipes-devtools/apt/apt_0.7.14.bb +1 -1
index bd1116f..8464b7f 100644
@@ -3,7 +3,7 @@ RDEPENDS_${PN} = "dpkg"
 LIC_FILES_CHKSUM = "file://COPYING.GPL;md5=0636e73ff0215e8d672dc4c32c317bb3"
 require apt.inc
 
-PR = "r9"
+PR = "r10"
 
 SRC_URI += "file://nodoc.patch \
             file://includes-fix.patch "
Signature · 1 line
1.7.10.2
#3 lore raw

PATCH 3/3 apt 0.7.14: do_compile failed with gcc 4.7

In reply to Joshua Lock

From: Robert Yang <[email protected]>

apt do_compile failed with gcc 4.7:

deb/deblistparser.cc: In member function 'virtual short unsigned int debListParser::VersionHash()':
deb/deblistparser.cc:212:13: error: redeclaration of 'char* I' deb/deblistparser.cc:202:22: error: 'const char** I' previously declared here

Backport the patch from the upstream would fix the problem, both target and native apt need it.

[YOCTO #2488]

---
 .../apt/apt-0.7.14/remove-redeclaration.patch      |   63 ++++++++++++++++++++
 meta/recipes-devtools/apt/apt-native_0.7.14.bb     |    2 +-
 meta/recipes-devtools/apt/apt.inc                  |    1 +
 meta/recipes-devtools/apt/apt_0.7.14.bb            |    2 +-
 4 files changed, 66 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-devtools/apt/apt-0.7.14/remove-redeclaration.patch
meta/recipes-devtools/apt/apt-0.7.14/remove-redeclaration.patch new file +63 -0
new file mode 100644
index 0000000..8d7c891
@@ -0,0 +1,63 @@
+Fix build errors on gcc 4.7:
+
+deb/deblistparser.cc: In member function 'virtual short unsigned int debListParser::VersionHash()':
+deb/deblistparser.cc:212:13: error: redeclaration of 'char* I'
+deb/deblistparser.cc:202:22: error: 'const char** I' previously declared here
+
+Upstream-Status: Backport
+Signed-off-by: Robert Yang <[email protected]>
+---
+ apt-pkg/deb/deblistparser.cc |   10 +++++-----
+ cmdline/apt-get.cc           |    8 ++++----
+ 2 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
+--- a/apt-pkg/deb/deblistparser.cc
++++ b/apt-pkg/deb/deblistparser.cc
+@@ -209,18 +209,18 @@ unsigned short debListParser::VersionHash()
+       /* Strip out any spaces from the text, this undoes dpkgs reformatting
+          of certain fields. dpkg also has the rather interesting notion of
+          reformatting depends operators < -> <= */
+-      char *I = S;
++      char *J = S;
+       for (; Start != End; Start++)
+       {
+ 	 if (isspace(*Start) == 0)
+-	    *I++ = tolower(*Start);
++	    *J++ = tolower(*Start);
+ 	 if (*Start == '<' && Start[1] != '<' && Start[1] != '=')
+-	    *I++ = '=';
++	    *J++ = '=';
+ 	 if (*Start == '>' && Start[1] != '>' && Start[1] != '=')
+-	    *I++ = '=';
++	    *J++ = '=';
+       }
+ 
+-      Result = AddCRC16(Result,S,I - S);
++      Result = AddCRC16(Result,S,J - S);
+    }
+    
+    return Result;
+diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
+--- a/cmdline/apt-get.cc
++++ b/cmdline/apt-get.cc
+@@ -1752,12 +1752,12 @@ bool DoInstall(CommandLine &CmdL)
+ 	 if ((*Cache)[I].Install() == false)
+ 	    continue;
+ 
+-	 const char **J;
+-	 for (J = CmdL.FileList + 1; *J != 0; J++)
+-	    if (strcmp(*J,I.Name()) == 0)
++	 const char **K;
++	 for (K = CmdL.FileList + 1; *K != 0; K++)
++	    if (strcmp(*K,I.Name()) == 0)
+ 		break;
+ 	 
+-	 if (*J == 0) {
++	 if (*K == 0) {
+ 	    List += string(I.Name()) + " ";
+ 	    VersionsList += string(Cache[I].CandVersion) + "\n";
+ 	 }
+-- 
+1.7.1
+
meta/recipes-devtools/apt/apt-native_0.7.14.bb +1 -1
index ec3fd20..ca5476b 100644
@@ -1,6 +1,6 @@
 require apt-native.inc
 
-PR = "r7"
+PR = "r8"
 
 SRC_URI += "file://nodoc.patch \
             file://noconfigure.patch \
meta/recipes-devtools/apt/apt.inc +1 -0
index 61d9602..0d241a9 100644
@@ -7,6 +7,7 @@ SRC_URI = "${DEBIAN_MIRROR}/main/a/apt/apt_${PV}.tar.gz \
            file://use-host.patch \
            file://localefixes.patch \
            file://makerace.patch \
+           file://remove-redeclaration.patch \
            "
 
 inherit autotools gettext
meta/recipes-devtools/apt/apt_0.7.14.bb +1 -1
index 8464b7f..9ace6d2 100644
@@ -3,7 +3,7 @@ RDEPENDS_${PN} = "dpkg"
 LIC_FILES_CHKSUM = "file://COPYING.GPL;md5=0636e73ff0215e8d672dc4c32c317bb3"
 require apt.inc
 
-PR = "r10"
+PR = "r11"
 
 SRC_URI += "file://nodoc.patch \
             file://includes-fix.patch "
Signature · 1 line
1.7.10.2
#4 lore raw
In reply to Joshua Lock
Quoted 16 lines · Joshua Lock

With the toolchain provided on modern distros apt-native fails to compile, this series cherry-picks several patches from master which ensure that apt and apt-native can be built reliably.

Cheers,
Joshua

The following changes since commit 30c6ec403e1696b5fd94b92328ef9edec535a57a:

scripts/qemuimage-testlib: fix typos (2012-06-14 11:17:35 +0100)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib josh/edison
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=josh/edison

Quoted 6 lines

Richard Purdie (2):
apt: Fix locale header and hardcoded libname issues
apt: Fix parallel make race

Robert Yang (1):
apt 0.7.14: do_compile failed with gcc 4.7

Merged to 2011-1, thanks.

Richard