summaryrefslogtreecommitdiff
path: root/meta/recipes-devtools/dpkg
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/dpkg')
-rw-r--r--meta/recipes-devtools/dpkg/dpkg.inc73
-rw-r--r--meta/recipes-devtools/dpkg/dpkg/autofoo.patch50
-rw-r--r--meta/recipes-devtools/dpkg/dpkg/check_snprintf.patch34
-rw-r--r--meta/recipes-devtools/dpkg/dpkg/check_version.patch23
-rw-r--r--meta/recipes-devtools/dpkg/dpkg/dpkg-deb-avoid-fflush.patch198
-rw-r--r--meta/recipes-devtools/dpkg/dpkg/ignore_extra_fields.patch22
-rw-r--r--meta/recipes-devtools/dpkg/dpkg/nochroot.patch20
-rw-r--r--meta/recipes-devtools/dpkg/dpkg/noman.patch15
-rw-r--r--meta/recipes-devtools/dpkg/dpkg/noupdalt.patch18
-rw-r--r--meta/recipes-devtools/dpkg/dpkg/perllibdir.patch22
-rw-r--r--meta/recipes-devtools/dpkg/dpkg/preinst.patch46
-rw-r--r--meta/recipes-devtools/dpkg/dpkg_1.15.8.7.bb15
-rwxr-xr-xmeta/recipes-devtools/dpkg/run-postinsts/run-postinsts36
-rw-r--r--meta/recipes-devtools/dpkg/run-postinsts/run-postinsts.awk30
-rw-r--r--meta/recipes-devtools/dpkg/run-postinsts_1.0.bb29
15 files changed, 631 insertions, 0 deletions
diff --git a/meta/recipes-devtools/dpkg/dpkg.inc b/meta/recipes-devtools/dpkg/dpkg.inc
new file mode 100644
index 000000000..09bfbbcd0
--- /dev/null
+++ b/meta/recipes-devtools/dpkg/dpkg.inc
@@ -0,0 +1,73 @@
+DESCRIPTION = "Package maintenance system for Debian."
+LICENSE = "GPLv2.0+"
+SECTION = "base"
+
+INC_PR = "r16"
+
+SRC_URI = "${DEBIAN_MIRROR}/main/d/dpkg/dpkg_${PV}.tar.bz2 \
+ file://ignore_extra_fields.patch"
+
+DEPENDS = "zlib bzip2 perl"
+DEPENDS_virtclass-native = "bzip2-native zlib-native virtual/update-alternatives-native gettext-native perl-native-runtime"
+RDEPENDS_${PN} = "${VIRTUAL-RUNTIME_update-alternatives}"
+RDEPENDS_${PN}_virtclass-native = ""
+
+S = "${WORKDIR}/${BPN}-${PV}"
+
+PARALLEL_MAKE = ""
+
+inherit autotools gettext perlnative
+
+export PERL_LIBDIR = "${libdir}/perl"
+PERL_LIBDIR_virtclass-native = "${libdir}/perl-native/perl"
+
+EXTRA_OECONF = "--without-static-progs \
+ --without-dselect \
+ --with-start-stop-daemon \
+ --with-zlib \
+ --with-bz2lib \
+ --without-selinux \
+ --without-sgml-doc"
+
+do_configure () {
+ echo >> m4/compiler.m4
+ sed -i -e 's#PERL_LIBDIR=.*$#PERL_LIBDIR="${libdir}/perl"#' ${S}/configure
+ autotools_do_configure
+}
+
+
+DPKG_INIT_POSITION ?= "98"
+do_install_prepend () {
+ install -d ${D}/${sysconfdir}/rcS.d
+ # this happens at S98 where our good 'ole packages script used to run
+ printf "#!/bin/sh
+dpkg --configure -a
+rm -f ${sysconfdir}/rcS.d/S${DPKG_INIT_POSITION}run-postinsts
+" > ${D}/${sysconfdir}/rcS.d/S${DPKG_INIT_POSITION}run-postinsts
+ chmod 0755 ${D}/${sysconfdir}/rcS.d/S${DPKG_INIT_POSITION}run-postinsts
+}
+
+do_install_append () {
+ if [ "${PN}" = "dpkg-native" ]; then
+ # update-alternatives doesn't have an offline mode
+ rm ${D}${bindir}/update-alternatives
+ else
+ mv ${D}${bindir}/update-alternatives ${D}${sbindir}
+ fi
+}
+
+PROV = "virtual/update-alternatives"
+PROV_virtclass-native = ""
+
+PROVIDES += "${PROV}"
+
+PACKAGES =+ "update-alternatives-dpkg"
+FILES_update-alternatives-dpkg = "${sbindir}/update-alternatives ${localstatedir}/lib/dpkg/alternatives ${sysconfdir}/alternatives"
+RPROVIDES_update-alternatives-dpkg += "update-alternatives"
+
+PACKAGES += "${PN}-perl"
+FILES_${PN}-perl = "${libdir}/perl"
+
+BBCLASSEXTEND = "native"
+
+
diff --git a/meta/recipes-devtools/dpkg/dpkg/autofoo.patch b/meta/recipes-devtools/dpkg/dpkg/autofoo.patch
new file mode 100644
index 000000000..2f1edcec5
--- /dev/null
+++ b/meta/recipes-devtools/dpkg/dpkg/autofoo.patch
@@ -0,0 +1,50 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+Upstream-Status: Inappropriate [configuration]
+
+--- dpkg-1.10.23/configure.in~autofoo
++++ dpkg-1.10.23/configure.in
+@@ -227,21 +227,36 @@
+ # OpenBSD passes AC_TRY_COMPILE for va_copy even though
+ # it doesn't seem to exist, which is odd. We need to use
+ # AC_TRY_RUN.
++#
++# If crosscompiling, use AC_TRY_COMPILE. -CL
+ AC_TRY_RUN([
+ #include <stdarg.h>
+ main(){
+ va_list v1,v2;
+ va_copy(v1, v2);
+ exit(0);}
+-], [AC_MSG_RESULT(yes)
+-AC_DEFINE(HAVE_VA_COPY,,[Whether the va_copy macro exists])],[AC_MSG_RESULT(no)
+-AC_MSG_CHECKING([for va_list assignment copy])
++], [dpkg_cv_va_copy=yes], [dpkg_cv_va_copy=no],
+ AC_TRY_COMPILE([
+ #include <stdarg.h>
++main(){
++va_list v1,v2;
++va_copy(v1, v2);
++exit(0);}
++], [dpkg_cv_va_copy=yes], [dpkg_vc_va_copy=no]))
++
++if test "$dpkg_cv_va_copy" = "yes"; then
++ AC_MSG_RESULT(yes)
++ AC_DEFINE(HAVE_VA_COPY,,[Whether the va_copy macro exists])
++else
++ AC_MSG_RESULT(no)
++ AC_MSG_CHECKING([for va_list assignment copy])
++ AC_TRY_COMPILE([
++#include <stdarg.h>
+ ],[
+ va_list v1,v2;
+ v1 = v2;
+-], AC_MSG_RESULT(yes),AC_MSG_ERROR(no))])
++], AC_MSG_RESULT(yes), AC_MSG_ERROR(no))
++fi
+
+ DPKG_C_GCC_ATTRIBUTE([,,],supported,[int x],[,,],ATTRIB,[Define if function attributes a la GCC 2.5 and higher are available.],
+ DPKG_C_GCC_ATTRIBUTE(noreturn,noreturn,[int x],noreturn,NORETURN,[Define if nonreturning functions a la GCC 2.5 and higher are available.])
diff --git a/meta/recipes-devtools/dpkg/dpkg/check_snprintf.patch b/meta/recipes-devtools/dpkg/dpkg/check_snprintf.patch
new file mode 100644
index 000000000..56eb0ca5b
--- /dev/null
+++ b/meta/recipes-devtools/dpkg/dpkg/check_snprintf.patch
@@ -0,0 +1,34 @@
+Upstream-Status: Inappropriate [configuration]
+
+diff -ruN dpkg-1.15.8.5-orig/m4/dpkg-funcs.m4 dpkg-1.15.8.5/m4/dpkg-funcs.m4
+--- dpkg-1.15.8.5-orig/m4/dpkg-funcs.m4 2010-10-08 12:27:15.082131611 +0800
++++ dpkg-1.15.8.5/m4/dpkg-funcs.m4 2010-10-08 13:56:50.074284346 +0800
+@@ -27,7 +27,7 @@
+ # -----------------------
+ # Define HAVE_C99_SNPRINTF if we have C99 snprintf family semantics
+ AC_DEFUN([DPKG_FUNC_C99_SNPRINTF],
+-[AC_CACHE_CHECK([for C99 snprintf functions], [dpkg_cv_c99_snprintf],
++[AC_CACHE_CHECK([for C99 snprintf functions], [ac_cv_func_snprintf_c99],
+ [AC_RUN_IFELSE([AC_LANG_SOURCE([[
+ #include <stdarg.h>
+ #include <stdio.h>
+@@ -58,14 +58,14 @@
+ return 0;
+ }
+ ]])],
+- [dpkg_cv_c99_snprintf=yes],
+- [dpkg_cv_c99_snprintf=no],
+- [dpkg_cv_c99_snprintf=no])])
+-AS_IF([test "x$dpkg_cv_c99_snprintf" = "xyes"],
++ [ac_cv_func_snprintf_c99=yes],
++ [ac_cv_func_snprintf_c99=no],
++ [ac_cv_func_snprintf_c99=no])])
++AS_IF([test "x$ac_cv_func_snprintf_c99" = "xyes"],
+ [AC_DEFINE([HAVE_C99_SNPRINTF], 1,
+ [Define to 1 if the 'snprintf' family is C99 conformant])],
+ )
+-AM_CONDITIONAL(HAVE_C99_SNPRINTF, [test "x$dpkg_cv_c99_snprintf" = "xyes"])
++AM_CONDITIONAL(HAVE_C99_SNPRINTF, [test "x$ac_cv_func_snprintf_c99" = "xyes"])
+ ])# DPKG_FUNC_C99_SNPRINTF
+
+ # DPKG_MMAP
diff --git a/meta/recipes-devtools/dpkg/dpkg/check_version.patch b/meta/recipes-devtools/dpkg/dpkg/check_version.patch
new file mode 100644
index 000000000..524e715c0
--- /dev/null
+++ b/meta/recipes-devtools/dpkg/dpkg/check_version.patch
@@ -0,0 +1,23 @@
+Adapt to linux-wrs kernel version, which has character '_' inside.
+
+Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
+
+Upstream-Status: Inappropriate [embedded specific]
+
+diff -ruN dpkg-1.15.8.5-orig/lib/dpkg/parsehelp.c dpkg-1.15.8.5/lib/dpkg/parsehelp.c
+--- dpkg-1.15.8.5-orig/lib/dpkg/parsehelp.c 2010-10-08 12:27:15.058572774 +0800
++++ dpkg-1.15.8.5/lib/dpkg/parsehelp.c 2010-10-09 11:18:15.484190771 +0800
+@@ -268,11 +268,11 @@
+
+ /* XXX: Would be faster to use something like cisversion and cisrevision. */
+ for (ptr = rversion->version; *ptr; ptr++) {
+- if (!cisdigit(*ptr) && !cisalpha(*ptr) && strchr(".-+~:", *ptr) == NULL)
++ if (!cisdigit(*ptr) && !cisalpha(*ptr) && strchr(".-+~:_", *ptr) == NULL)
+ return _("invalid character in version number");
+ }
+ for (ptr = rversion->revision; *ptr; ptr++) {
+- if (!cisdigit(*ptr) && !cisalpha(*ptr) && strchr(".-+~", *ptr) == NULL)
++ if (!cisdigit(*ptr) && !cisalpha(*ptr) && strchr(".-+~_", *ptr) == NULL)
+ return _("invalid character in revision number");
+ }
+
diff --git a/meta/recipes-devtools/dpkg/dpkg/dpkg-deb-avoid-fflush.patch b/meta/recipes-devtools/dpkg/dpkg/dpkg-deb-avoid-fflush.patch
new file mode 100644
index 000000000..a5d6b616c
--- /dev/null
+++ b/meta/recipes-devtools/dpkg/dpkg/dpkg-deb-avoid-fflush.patch
@@ -0,0 +1,198 @@
+From 78eaf928d30d0b16e05d8d63c55a3632a135ed9a Mon Sep 17 00:00:00 2001
+From: Guillem Jover <guillem@debian.org>
+Date: Thu, 4 Nov 2010 00:51:13 +0100
+Subject: [PATCH] dpkg-deb: Use fd instead of stream based buffered I/O
+
+Behaviour of fflush() on input streams is undefined per POSIX, avoid
+mixing stream and file descriptor based I/O, and only use the latter
+instead.
+
+Upstream-Status: Backport of revision 2d420ee1d05033d237462a0075facfe406b08043 (in 1.16.x)
+
+---
+ dpkg-deb/extract.c | 83 ++++++++++++++++++++++++++++++++++++++-------------
+ 1 files changed, 62 insertions(+), 21 deletions(-)
+
+diff --git a/dpkg-deb/extract.c b/dpkg-deb/extract.c
+index 22aea98..0f5ac88 100644
+--- a/dpkg-deb/extract.c
++++ b/dpkg-deb/extract.c
+@@ -31,6 +31,7 @@
+ #include <ctype.h>
+ #include <string.h>
+ #include <dirent.h>
++#include <fcntl.h>
+ #include <unistd.h>
+ #include <ar.h>
+ #include <stdbool.h>
+@@ -61,13 +62,41 @@ static void movecontrolfiles(const char *thing) {
+ }
+
+ static void DPKG_ATTR_NORET
+-readfail(FILE *a, const char *filename, const char *what)
++read_fail(int rc, const char *filename, const char *what)
+ {
+- if (ferror(a)) {
+- ohshite(_("error reading %s from file %.255s"), what, filename);
+- } else {
++ if (rc == 0)
+ ohshit(_("unexpected end of file in %s in %.255s"),what,filename);
++ else
++ ohshite(_("error reading %s from file %.255s"), what, filename);
++}
++
++static ssize_t
++read_line(int fd, char *buf, size_t min_size, size_t max_size)
++{
++ ssize_t line_size = 0;
++ size_t n = min_size;
++
++ while (line_size < (ssize_t)max_size) {
++ ssize_t r;
++ char *nl;
++
++ r = read(fd, buf + line_size, n);
++ if (r <= 0)
++ return r;
++
++ nl = strchr(buf + line_size, '\n');
++ line_size += r;
++
++ if (nl != NULL) {
++ nl[1] = '\0';
++ return line_size;
++ }
++
++ n = 1;
+ }
++
++ buf[line_size] = '\0';
++ return line_size;
+ }
+
+ static size_t
+@@ -115,19 +144,26 @@ void extracthalf(const char *debar, const char *directory,
+ char versionbuf[40];
+ float versionnum;
+ size_t ctrllennum, memberlen= 0;
++ ssize_t r;
+ int dummy;
+ pid_t c1=0,c2,c3;
+ int p1[2], p2[2];
+- FILE *ar;
++ int arfd;
+ struct stat stab;
+ char nlc;
+ int adminmember;
+ bool oldformat, header_done;
+ struct compressor *decompressor = &compressor_gzip;
+
+- ar= fopen(debar,"r"); if (!ar) ohshite(_("failed to read archive `%.255s'"),debar);
+- if (fstat(fileno(ar),&stab)) ohshite(_("failed to fstat archive"));
+- if (!fgets(versionbuf,sizeof(versionbuf),ar)) readfail(ar,debar,_("version number"));
++ arfd = open(debar, O_RDONLY);
++ if (arfd < 0)
++ ohshite(_("failed to read archive `%.255s'"), debar);
++ if (fstat(arfd, &stab))
++ ohshite(_("failed to fstat archive"));
++
++ r = read_line(arfd, versionbuf, strlen(DPKG_AR_MAGIC), sizeof(versionbuf));
++ if (r < 0)
++ read_fail(r, debar, _("archive magic version number"));
+
+ if (!strcmp(versionbuf, DPKG_AR_MAGIC)) {
+ oldformat = false;
+@@ -137,8 +173,9 @@ void extracthalf(const char *debar, const char *directory,
+ for (;;) {
+ struct ar_hdr arh;
+
+- if (fread(&arh,1,sizeof(arh),ar) != sizeof(arh))
+- readfail(ar,debar,_("between members"));
++ r = read(arfd, &arh, sizeof(arh));
++ if (r != sizeof(arh))
++ read_fail(r, debar, _("archive member header"));
+
+ dpkg_ar_normalize_name(&arh);
+
+@@ -153,8 +190,9 @@ void extracthalf(const char *debar, const char *directory,
+ if (strncmp(arh.ar_name, DEBMAGIC, sizeof(arh.ar_name)) != 0)
+ ohshit(_("file `%.250s' is not a debian binary archive (try dpkg-split?)"),debar);
+ infobuf= m_malloc(memberlen+1);
+- if (fread(infobuf,1, memberlen + (memberlen&1), ar) != memberlen + (memberlen&1))
+- readfail(ar,debar,_("header info member"));
++ r = read(arfd, infobuf, memberlen + (memberlen & 1));
++ if ((size_t)r != (memberlen + (memberlen & 1)))
++ read_fail(r, debar, _("archive information header member"));
+ infobuf[memberlen] = '\0';
+ cur= strchr(infobuf,'\n');
+ if (!cur) ohshit(_("archive has no newlines in header"));
+@@ -174,7 +212,8 @@ void extracthalf(const char *debar, const char *directory,
+ /* Members with `_' are noncritical, and if we don't understand them
+ * we skip them.
+ */
+- stream_null_copy(ar, memberlen + (memberlen&1),_("skipped member data from %s"), debar);
++ fd_null_copy(arfd, memberlen + (memberlen & 1),
++ _("skipped archive member data from %s"), debar);
+ } else {
+ if (strncmp(arh.ar_name, ADMINMEMBER, sizeof(arh.ar_name)) == 0)
+ adminmember = 1;
+@@ -198,7 +237,8 @@ void extracthalf(const char *debar, const char *directory,
+ ctrllennum= memberlen;
+ }
+ if (!adminmember != !admininfo) {
+- stream_null_copy(ar, memberlen + (memberlen&1),_("skipped member data from %s"), debar);
++ fd_null_copy(arfd, memberlen + (memberlen & 1),
++ _("skipped archive member data from %s"), debar);
+ } else {
+ break; /* Yes ! - found it. */
+ }
+@@ -221,8 +261,10 @@ void extracthalf(const char *debar, const char *directory,
+ l = strlen(versionbuf);
+ if (l && versionbuf[l - 1] == '\n')
+ versionbuf[l - 1] = '\0';
+- if (!fgets(ctrllenbuf,sizeof(ctrllenbuf),ar))
+- readfail(ar, debar, _("control information length"));
++
++ r = read_line(arfd, ctrllenbuf, 1, sizeof(ctrllenbuf));
++ if (r < 0)
++ read_fail(r, debar, _("archive control member size"));
+ if (sscanf(ctrllenbuf,"%zi%c%d",&ctrllennum,&nlc,&dummy) !=2 || nlc != '\n')
+ ohshit(_("archive has malformatted control length `%s'"), ctrllenbuf);
+
+@@ -230,7 +272,8 @@ void extracthalf(const char *debar, const char *directory,
+ memberlen = ctrllennum;
+ } else {
+ memberlen = stab.st_size - ctrllennum - strlen(ctrllenbuf) - l;
+- stream_null_copy(ar, ctrllennum, _("skipped control area from %s"), debar);
++ fd_null_copy(arfd, ctrllennum,
++ _("skipped archive control member data from %s"), debar);
+ }
+
+ if (admininfo >= 2) {
+@@ -252,13 +295,11 @@ void extracthalf(const char *debar, const char *directory,
+
+ }
+
+- safe_fflush(ar);
+-
+ m_pipe(p1);
+ c1 = subproc_fork();
+ if (!c1) {
+ close(p1[0]);
+- stream_fd_copy(ar, p1[1], memberlen, _("failed to write to pipe in copy"));
++ fd_fd_copy(arfd, p1[1], memberlen, _("failed to write to pipe in copy"));
+ if (close(p1[1]))
+ ohshite(_("failed to close pipe in copy"));
+ exit(0);
+@@ -275,7 +316,7 @@ void extracthalf(const char *debar, const char *directory,
+ decompress_filter(decompressor, 0, 1, _("data"));
+ }
+ close(p1[0]);
+- fclose(ar);
++ close(arfd);
+ if (taroption) close(p2[1]);
+
+ if (taroption && directory) {
+--
+1.7.7.6
+
diff --git a/meta/recipes-devtools/dpkg/dpkg/ignore_extra_fields.patch b/meta/recipes-devtools/dpkg/dpkg/ignore_extra_fields.patch
new file mode 100644
index 000000000..0ff09e748
--- /dev/null
+++ b/meta/recipes-devtools/dpkg/dpkg/ignore_extra_fields.patch
@@ -0,0 +1,22 @@
+Upstream-Status: Inappropriate [workaround]
+
+diff -ruN dpkg-1.15.8.5-orig/dpkg-deb/build.c dpkg-1.15.8.5/dpkg-deb/build.c
+--- dpkg-1.15.8.5-orig/dpkg-deb/build.c 2010-10-08 12:27:15.042083703 +0800
++++ dpkg-1.15.8.5/dpkg-deb/build.c 2010-10-08 12:31:53.822534277 +0800
+@@ -275,14 +275,14 @@
+ controlfile, checkedinfo->otherpriority);
+ warns++;
+ }
+- for (field= checkedinfo->available.arbs; field; field= field->next) {
++ /*for (field= checkedinfo->available.arbs; field; field= field->next) {
+ if (known_arbitrary_field(field))
+ continue;
+
+ warning(_("'%s' contains user-defined field '%s'"),
+ controlfile, field->name);
+ warns++;
+- }
++ }*/
+
+ if (subdir) {
+ versionstring= versiondescribe(&checkedinfo->available.version,vdew_never);
diff --git a/meta/recipes-devtools/dpkg/dpkg/nochroot.patch b/meta/recipes-devtools/dpkg/dpkg/nochroot.patch
new file mode 100644
index 000000000..c7f2dfe28
--- /dev/null
+++ b/meta/recipes-devtools/dpkg/dpkg/nochroot.patch
@@ -0,0 +1,20 @@
+---
+ src/help.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+Upstream-Status: Inappropriate [configuration]
+
+--- dpkg-1.13.22.orig/src/help.c
++++ dpkg-1.13.22/src/help.c
+@@ -175,9 +175,11 @@ static const char* preexecscript(const c
+ */
+ size_t instdirl;
+
++#if 0
+ if (*instdir) {
+ if (chroot(instdir)) ohshite(_("failed to chroot to `%.250s'"),instdir);
+ }
++#endif
+ if (f_debug & dbg_scripts) {
+ fprintf(stderr,"D0%05o: fork/exec %s (",dbg_scripts,path);
+ while (*++argv) fprintf(stderr," %s",*argv);
diff --git a/meta/recipes-devtools/dpkg/dpkg/noman.patch b/meta/recipes-devtools/dpkg/dpkg/noman.patch
new file mode 100644
index 000000000..58cb22a19
--- /dev/null
+++ b/meta/recipes-devtools/dpkg/dpkg/noman.patch
@@ -0,0 +1,15 @@
+Upstream-Status: Inappropriate [disable feature]
+
+diff -ruN dpkg-1.15.8.5-orig/Makefile.am dpkg-1.15.8.5/Makefile.am
+--- dpkg-1.15.8.5-orig/Makefile.am 2010-10-08 12:27:15.042083703 +0800
++++ dpkg-1.15.8.5/Makefile.am 2010-10-08 12:27:27.755148228 +0800
+@@ -12,8 +12,7 @@
+ utils \
+ $(MAYBE_DSELECT) \
+ scripts \
+- po \
+- man
++ po
+
+ ACLOCAL_AMFLAGS = -I m4
+
diff --git a/meta/recipes-devtools/dpkg/dpkg/noupdalt.patch b/meta/recipes-devtools/dpkg/dpkg/noupdalt.patch
new file mode 100644
index 000000000..a9b38009e
--- /dev/null
+++ b/meta/recipes-devtools/dpkg/dpkg/noupdalt.patch
@@ -0,0 +1,18 @@
+---
+ scripts/Makefile.am | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+Upstream-Status: Inappropriate [configuration]
+
+--- dpkg-1.13.22.orig/scripts/Makefile.am
++++ dpkg-1.13.22/scripts/Makefile.am
+@@ -20,8 +20,7 @@ bin_SCRIPTS = \
+ sbin_SCRIPTS = \
+ cleanup-info \
+ dpkg-divert \
+- dpkg-statoverride \
+- update-alternatives
++ dpkg-statoverride
+
+ changelogdir = $(pkglibdir)/parsechangelog
+ changelog_SCRIPTS = \
diff --git a/meta/recipes-devtools/dpkg/dpkg/perllibdir.patch b/meta/recipes-devtools/dpkg/dpkg/perllibdir.patch
new file mode 100644
index 000000000..45973f012
--- /dev/null
+++ b/meta/recipes-devtools/dpkg/dpkg/perllibdir.patch
@@ -0,0 +1,22 @@
+We want to be able to set PERL_LIBDIR from the environment. This
+hardcoded assignment prevents us from doing so and obtains an
+incorrect value.
+
+Upstream-Status: Inappropriate [in this form at least]
+
+RP 14/11/2011
+
+Index: dpkg-1.15.8.7/m4/dpkg-progs.m4
+===================================================================
+--- dpkg-1.15.8.7.orig/m4/dpkg-progs.m4 2011-11-14 17:32:21.252053239 +0000
++++ dpkg-1.15.8.7/m4/dpkg-progs.m4 2011-11-14 17:32:55.180052455 +0000
+@@ -9,9 +9,6 @@
+ [AC_ARG_VAR([PERL], [Perl interpreter])dnl
+ AC_PATH_PROG([PERL], [perl], [/usr/bin/perl])dnl
+ AC_ARG_VAR([PERL_LIBDIR], [Perl library directory])dnl
+-PERL_LIBDIR=$($PERL -MConfig -e 'my $r = $Config{vendorlibexp};
+- $r =~ s/$Config{vendorprefixexp}/\$(prefix)/;
+- print $r')dnl
+ ])# DPKG_PROG_PERL
+
+ # DPKG_PROG_PO4A
diff --git a/meta/recipes-devtools/dpkg/dpkg/preinst.patch b/meta/recipes-devtools/dpkg/dpkg/preinst.patch
new file mode 100644
index 000000000..06d2aacf3
--- /dev/null
+++ b/meta/recipes-devtools/dpkg/dpkg/preinst.patch
@@ -0,0 +1,46 @@
+Our pre/postinsts expect $D to be set when running in a sysroot and
+don't expect a chroot. This matches up our system expectations with
+what dpkg does.
+
+Upstream-Status: Inappropriate [OE Specific]
+
+RP 2011/12/07
+
+Index: dpkg-1.15.8.7/src/help.c
+===================================================================
+--- dpkg-1.15.8.7.orig/src/help.c 2010-12-20 01:25:36.000000000 +0000
++++ dpkg-1.15.8.7/src/help.c 2011-12-07 14:51:02.783461487 +0000
+@@ -181,30 +181,9 @@
+ * FIXME: none of the stuff here will work if admindir isn't inside
+ * instdir as expected.
+ */
+- size_t instdirl;
+-
+- if (*instdir) {
+- if (chroot(instdir)) ohshite(_("failed to chroot to `%.250s'"),instdir);
+- if (chdir("/"))
+- ohshite(_("failed to chdir to `%.255s'"), "/");
+- }
+- if (f_debug & dbg_scripts) {
+- struct varbuf args = VARBUF_INIT;
+- const char **argv = cmd->argv;
+-
+- while (*++argv) {
+- varbufaddc(&args, ' ');
+- varbufaddstr(&args, *argv);
+- }
+- varbufaddc(&args, '\0');
+- debug(dbg_scripts, "fork/exec %s (%s )", cmd->filename, args.buf);
+- varbuf_destroy(&args);
+- }
+- instdirl= strlen(instdir);
+- if (!instdirl)
+- return cmd->filename;
+- assert(strlen(cmd->filename) >= instdirl);
+- return cmd->filename + instdirl;
++ if (*instdir)
++ setenv("D", instdir, 1);
++ return cmd->filename;
+ }
+
+ void
diff --git a/meta/recipes-devtools/dpkg/dpkg_1.15.8.7.bb b/meta/recipes-devtools/dpkg/dpkg_1.15.8.7.bb
new file mode 100644
index 000000000..1e7ef25be
--- /dev/null
+++ b/meta/recipes-devtools/dpkg/dpkg_1.15.8.7.bb
@@ -0,0 +1,15 @@
+require dpkg.inc
+LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
+
+SRC_URI += "file://noman.patch \
+ file://check_snprintf.patch \
+ file://check_version.patch \
+ file://perllibdir.patch \
+ file://preinst.patch \
+ file://dpkg-deb-avoid-fflush.patch"
+
+SRC_URI[md5sum] = "d1731d4147c1ea3b537a4d094519a6dc"
+SRC_URI[sha256sum] = "1ec1376471b04717a4497e5d7a27cd545248c92116898ce0c53ced8ea94267b5"
+
+PR = "${INC_PR}.4"
+
diff --git a/meta/recipes-devtools/dpkg/run-postinsts/run-postinsts b/meta/recipes-devtools/dpkg/run-postinsts/run-postinsts
new file mode 100755
index 000000000..5f6442cbe
--- /dev/null
+++ b/meta/recipes-devtools/dpkg/run-postinsts/run-postinsts
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# Copyright 2007 Openedhand Ltd.
+#
+# Author: Richard Purdie <rpurdie@openedhand.com>
+#
+
+PKGSYSTEM=/var/lib/dpkg
+
+if [ ! -e $PKGSYSTEM/status ]; then
+ if [ -e /var/lib/opkg/status ]; then
+ PKGSYSTEM=/var/lib/opkg
+ else
+ echo "No package system found"
+ exit 1
+ fi
+fi
+
+STAMP=$PKGSYSTEM/postinsts-done
+STATFILE=$PKGSYSTEM/status
+STATFILE2=$PKGSYSTEM/status2
+
+if [ -e $STAMP ]; then
+ exit 0
+fi
+
+awk -f /usr/share/run-postinsts/run-postinsts.awk $STATFILE > $STATFILE2
+if [ $? = 0 ]; then
+ mv $STATFILE2 $STATFILE
+ touch $STAMP
+ exit 0
+else
+ rm -f $STATFILE2
+ rm -f $STAMP
+ exit 1
+fi
diff --git a/meta/recipes-devtools/dpkg/run-postinsts/run-postinsts.awk b/meta/recipes-devtools/dpkg/run-postinsts/run-postinsts.awk
new file mode 100644
index 000000000..18a0492fc
--- /dev/null
+++ b/meta/recipes-devtools/dpkg/run-postinsts/run-postinsts.awk
@@ -0,0 +1,30 @@
+#
+# Copyright 2007 Openedhand Ltd.
+#
+# Author: Richard Purdie <rpurdie@openedhand.com>
+#
+# Rather hacky proof of concept
+#
+
+BEGIN {
+ rc=system("test -d /usr/dpkg/info/")
+ if (rc==0)
+ pkgdir="/var/lib/dpkg/info"
+ else
+ pkgdir="/var/lib/opkg/info"
+ package=""
+}
+/Package:.*/ {
+ package = substr($0, 10)
+}
+/Status:.*unpacked.*/ {
+ print "Configuring: " package > "/dev/stderr"
+ ret = system(pkgdir "/" package ".postinst 1>&2")
+ if (ret == 0)
+ $0 = gensub("unpacked", "installed", 1)
+ else
+ print "Postinstall failed for " package > "/dev/stderr"
+}
+{
+ print $0
+}
diff --git a/meta/recipes-devtools/dpkg/run-postinsts_1.0.bb b/meta/recipes-devtools/dpkg/run-postinsts_1.0.bb
new file mode 100644
index 000000000..7438a1042
--- /dev/null
+++ b/meta/recipes-devtools/dpkg/run-postinsts_1.0.bb
@@ -0,0 +1,29 @@
+DESCRIPTION = "Run postinstall scripts on device using awk"
+SECTION = "devel"
+PR = "r8"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \
+ file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+SRC_URI = "file://run-postinsts file://run-postinsts.awk"
+
+INITSCRIPT_NAME = "run-postinsts"
+INITSCRIPT_PARAMS = "start 98 S ."
+
+inherit update-rc.d
+
+do_configure() {
+ :
+}
+
+do_compile () {
+ :
+}
+
+do_install() {
+ install -d ${D}${sysconfdir}/init.d/
+ install -m 0755 ${WORKDIR}/run-postinsts ${D}${sysconfdir}/init.d/
+
+ install -d ${D}${datadir}/${PN}/
+ install -m 0644 ${WORKDIR}/run-postinsts.awk ${D}${datadir}/${PN}/
+}