diff options
Diffstat (limited to 'meta/recipes-devtools/apt/apt')
21 files changed, 1023 insertions, 796 deletions
diff --git a/meta/recipes-devtools/apt/apt/0001-CMakeLists.txt-avoid-changing-install-paths-based-on.patch b/meta/recipes-devtools/apt/apt/0001-CMakeLists.txt-avoid-changing-install-paths-based-on.patch new file mode 100644 index 0000000000..199f11bf20 --- /dev/null +++ b/meta/recipes-devtools/apt/apt/0001-CMakeLists.txt-avoid-changing-install-paths-based-on.patch @@ -0,0 +1,29 @@ +From 9023589317843df4e57f8ebef1d9a8398ddb929d Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin <alex.kanavin@gmail.com> +Date: Thu, 28 May 2020 15:34:05 +0000 +Subject: [PATCH] CMakeLists.txt: avoid changing install paths based on host + distro + +Upstream-Status: Inappropriate [oe-core specific] +Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> +--- + CMakeLists.txt | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2cd4f8e..4759812 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -21,9 +21,9 @@ set(CMAKE_EXE_LINKER_FLAGS_COVERAGE "-lgcov") + set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE "-lgcov") + + # Work around bug in GNUInstallDirs +-if (EXISTS "/etc/debian_version") +- set(CMAKE_INSTALL_LIBEXECDIR "lib") +-endif() ++#if (EXISTS "/etc/debian_version") ++set(CMAKE_INSTALL_LIBEXECDIR "lib") ++#endif() + + # Include stuff + include(Misc) diff --git a/meta/recipes-devtools/apt/apt/0001-Disable-documentation-directory-altogether.patch b/meta/recipes-devtools/apt/apt/0001-Disable-documentation-directory-altogether.patch new file mode 100644 index 0000000000..8b28ede8a8 --- /dev/null +++ b/meta/recipes-devtools/apt/apt/0001-Disable-documentation-directory-altogether.patch @@ -0,0 +1,27 @@ +From f629d1c3fcfb560ed24efc3e73d4e4999b1eab33 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin <alex.kanavin@gmail.com> +Date: Fri, 10 May 2019 14:16:47 +0200 +Subject: [PATCH] Disable documentation directory altogether + +Even when WITH_DOC=False, the build requires po4a to generate manpages. + +Upstream-Status: Inappropriate [oe-core specific] +Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> + +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9745c13..7cfc9ee 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -239,7 +239,7 @@ add_subdirectory(apt-pkg) + add_subdirectory(apt-private) + add_subdirectory(cmdline) + add_subdirectory(completions) +-add_subdirectory(doc) ++#add_subdirectory(doc) + add_subdirectory(dselect) + add_subdirectory(ftparchive) + add_subdirectory(methods) diff --git a/meta/recipes-devtools/apt/apt/0001-Do-not-init-tables-from-dpkg-configuration.patch b/meta/recipes-devtools/apt/apt/0001-Do-not-init-tables-from-dpkg-configuration.patch new file mode 100644 index 0000000000..72713c3b1a --- /dev/null +++ b/meta/recipes-devtools/apt/apt/0001-Do-not-init-tables-from-dpkg-configuration.patch @@ -0,0 +1,29 @@ +From c7a79e753e50f1a5f248ba5812c61616f2f524f0 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin <alex.kanavin@gmail.com> +Date: Fri, 10 May 2019 16:47:38 +0200 +Subject: [PATCH] Do not init tables from dpkg configuration + +This would require sysroot relocation logic, and it's easier to just disable them. + +Upstream-Status: Inappropriate [oe-core specific] +Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> + +--- + apt-pkg/init.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc +index b9d9b15..1725c59 100644 +--- a/apt-pkg/init.cc ++++ b/apt-pkg/init.cc +@@ -281,8 +281,8 @@ bool pkgInitSystem(Configuration &Cnf,pkgSystem *&Sys) + return _error->Error(_("Unable to determine a suitable packaging system type")); + } + +- if (pkgInitArchTupleMap() == false) +- return false; ++// if (pkgInitArchTupleMap() == false) ++// return false; + + return Sys->Initialize(Cnf); + } diff --git a/meta/recipes-devtools/apt/apt/0001-Fix-musl-build.patch b/meta/recipes-devtools/apt/apt/0001-Fix-musl-build.patch new file mode 100644 index 0000000000..0cefbedd6d --- /dev/null +++ b/meta/recipes-devtools/apt/apt/0001-Fix-musl-build.patch @@ -0,0 +1,28 @@ +From 6b8547161b902b01b639d05a4cdf849d7694556f Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin <alex.kanavin@gmail.com> +Date: Fri, 22 May 2020 15:29:23 +0000 +Subject: [PATCH] apt-pkg/contrib/srvrec.h: Explicitly include sys/types.h + +This avoids type errors with musl C library. + +Upstream-Status: Submitted [https://salsa.debian.org/apt-team/apt/-/merge_requests/200] +Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> +--- + apt-pkg/contrib/srvrec.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/apt-pkg/contrib/srvrec.h b/apt-pkg/contrib/srvrec.h +index e5d0f43..2010184 100644 +--- a/apt-pkg/contrib/srvrec.h ++++ b/apt-pkg/contrib/srvrec.h +@@ -9,6 +9,7 @@ + #ifndef SRVREC_H + #define SRVREC_H + ++#include <sys/types.h> + #include <string> + #include <vector> + #include <arpa/nameser.h> +-- +2.20.1 + diff --git a/meta/recipes-devtools/apt/apt/0001-Hide-fstatat64-and-prlimit64-defines-on-musl.patch b/meta/recipes-devtools/apt/apt/0001-Hide-fstatat64-and-prlimit64-defines-on-musl.patch new file mode 100644 index 0000000000..f1816836b5 --- /dev/null +++ b/meta/recipes-devtools/apt/apt/0001-Hide-fstatat64-and-prlimit64-defines-on-musl.patch @@ -0,0 +1,48 @@ +From e849b161ce1d87ab369b921438abcf5b3a03e186 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Sun, 25 Apr 2021 08:57:03 -0700 +Subject: [PATCH] Hide fstatat64 and prlimit64 defines on musl + +musl defines fstatat64 and prlimit64 as macros which confuses the +seccomp sysall rewiring since there are syscalls with same names + +Upstream-Status: Pending +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + methods/aptmethod.h | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/methods/aptmethod.h b/methods/aptmethod.h +index bd50e80..3085aed 100644 +--- a/methods/aptmethod.h ++++ b/methods/aptmethod.h +@@ -121,6 +121,12 @@ protected: + if (ctx == NULL) + return _error->FatalE("HttpMethod::Configuration", "Cannot init seccomp"); + ++#ifndef __GLIBC__ ++#pragma push_macro("fstatat64") ++#pragma push_macro("prlimit64") ++#undef fstatat64 ++#undef prlimit64 ++#endif + #define ALLOW(what) \ + if ((rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(what), 0))) \ + return _error->FatalE("HttpMethod::Configuration", "Cannot allow %s: %s", #what, strerror(-rc)); +@@ -320,9 +326,11 @@ protected: + if ((rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, seccomp_syscall_resolve_name(custom.c_str()), 0))) + return _error->FatalE("aptMethod::Configuration", "Cannot allow %s: %s", custom.c_str(), strerror(-rc)); + } +- + #undef ALLOW +- ++#ifndef __GLIBC__ ++#pragma pop_macro("fstatat64") ++#pragma pop_macro("prlimit64") ++#endif + rc = seccomp_load(ctx); + if (rc == -EINVAL) + { +-- +2.31.1 + diff --git a/meta/recipes-devtools/apt/apt/0001-Revert-always-run-dpkg-configure-a-at-the-end-of-our.patch b/meta/recipes-devtools/apt/apt/0001-Revert-always-run-dpkg-configure-a-at-the-end-of-our.patch index d33069b73a..1517b47858 100644 --- a/meta/recipes-devtools/apt/apt/0001-Revert-always-run-dpkg-configure-a-at-the-end-of-our.patch +++ b/meta/recipes-devtools/apt/apt/0001-Revert-always-run-dpkg-configure-a-at-the-end-of-our.patch @@ -1,11 +1,9 @@ -From 106797f1c66fa578dad21fd9380bf9d576573dfd Mon Sep 17 00:00:00 2001 -From: Roy Li <rongqing.li@windriver.com> -Date: Fri, 22 May 2015 08:05:15 +0800 +From 393ac20efc66bfc000a2457e093e369b934c5a50 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin <alex.kanavin@gmail.com> +Date: Thu, 21 May 2020 20:13:25 +0000 Subject: [PATCH] Revert "always run 'dpkg --configure -a' at the end of our dpkg callings" -Upstream-Status: Inappropriate [embedded specific] - This reverts commit a2a75ff4516f7609f4c55b42270abb8d08943c60, which always run 'dpkg --configure -a' at the end of our dpkg callings, but it does not work for cross-compile, since the rootfs dir can not @@ -14,24 +12,19 @@ be passed into dpkg, and lead to the below similar error: |mkdir: cannot create directory '/usr/lib/opkg': Permission denied ------- -Signed-off-by: Roy Li <rongqing.li@windriver.com> +Upstream-Status: Inappropriate [embedded specific] +Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> + --- - apt-pkg/deb/dpkgpm.cc | 9 +-- - test/integration/framework | 25 ++++---- - test/integration/test-apt-progress-fd | 67 +++++++++---------- - test/integration/test-apt-progress-fd-deb822 | 18 ++---- - test/integration/test-apt-progress-fd-error | 2 +- - ...est-bug-769609-triggers-still-pending-after-run | 75 ---------------------- - .../test-no-fds-leaked-to-maintainer-scripts | 6 +- - 7 files changed, 56 insertions(+), 146 deletions(-) - delete mode 100755 test/integration/test-bug-769609-triggers-still-pending-after-run + apt-pkg/deb/dpkgpm.cc | 9 ++------- + 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc -index b187efb..f269764 100644 +index 46a6dee..8617a9e 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc -@@ -1049,12 +1049,6 @@ void pkgDPkgPM::BuildPackagesProgressMap() - PackagesTotal++; +@@ -1211,12 +1211,6 @@ void pkgDPkgPM::BuildPackagesProgressMap() + } } } - /* one extra: We don't want the progress bar to reach 100%, especially not @@ -42,337 +35,14 @@ index b187efb..f269764 100644 - ++PackagesTotal; } /*}}}*/ - #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13) -@@ -1294,8 +1288,9 @@ bool pkgDPkgPM::GoNoABIBreak(APT::Progress::PackageManager *progress) - - // support subpressing of triggers processing for special - // cases like d-i that runs the triggers handling manually -+ bool const SmartConf = (_config->Find("PackageManager::Configure", "all") != "all"); + void pkgDPkgPM::StartPtyMagic() /*{{{*/ +@@ -1710,7 +1704,8 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress) + + // support subpressing of triggers processing for special + // cases like d-i that runs the triggers handling manually +- if (_config->FindB("DPkg::ConfigurePending", true)) ++ bool const SmartConf = (_config->Find("PackageManager::Configure", "all") != "all"); ++ if (0) + List.emplace_back(Item::ConfigurePending, pkgCache::PkgIterator()); + } bool const TriggersPending = _config->FindB("DPkg::TriggersPending", false); -- if (_config->FindB("DPkg::ConfigurePending", true) == true) -+ if (_config->FindB("DPkg::ConfigurePending", SmartConf) == true) - List.push_back(Item(Item::ConfigurePending, PkgIterator())); - - // for the progress -diff --git a/test/integration/framework b/test/integration/framework -index 70ad381..00672ad 100644 ---- a/test/integration/framework -+++ b/test/integration/framework -@@ -1178,13 +1178,10 @@ testnopackage() { - fi - } - --testdpkgstatus() { -- local STATE="$1" -- local NR="$2" -- shift 2 -- msgtest "Test that $NR package(s) are in state $STATE with" "dpkg -l $*" -- local PKGS="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)" -- if [ "$PKGS" != $NR ]; then -+testdpkginstalled() { -+ msgtest "Test for correctly installed package(s) with" "dpkg -l $*" -+ local PKGS="$(dpkg -l "$@" 2>/dev/null | grep '^i' | wc -l)" -+ if [ "$PKGS" != $# ]; then - echo >&2 $PKGS - dpkg -l "$@" | grep '^[a-z]' >&2 - msgfail -@@ -1193,12 +1190,16 @@ testdpkgstatus() { - fi - } - --testdpkginstalled() { -- testdpkgstatus 'ii' "$#" "$@" --} -- - testdpkgnotinstalled() { -- testdpkgstatus 'ii' '0' "$@" -+ msgtest "Test for correctly not-installed package(s) with" "dpkg -l $*" -+ local PKGS="$(dpkg -l "$@" 2> /dev/null | grep '^i' | wc -l)" -+ if [ "$PKGS" != 0 ]; then -+ echo -+ dpkg -l "$@" | grep '^[a-z]' >&2 -+ msgfail -+ else -+ msgpass -+ fi - } - - testmarkedauto() { -diff --git a/test/integration/test-apt-progress-fd b/test/integration/test-apt-progress-fd -index 68cc043..d72e7e7 100755 ---- a/test/integration/test-apt-progress-fd -+++ b/test/integration/test-apt-progress-fd -@@ -19,14 +19,13 @@ testequal "dlstatus:1:0:Retrieving file 1 of 1 - dlstatus:1:0:Retrieving file 1 of 1 - pmstatus:dpkg-exec:0:Running dpkg - pmstatus:testing:0:Installing testing (amd64) --pmstatus:testing:16.6667:Preparing testing (amd64) --pmstatus:testing:33.3333:Unpacking testing (amd64) --pmstatus:testing:50:Preparing to configure testing (amd64) --pmstatus:dpkg-exec:50:Running dpkg --pmstatus:testing:50:Configuring testing (amd64) --pmstatus:testing:66.6667:Configuring testing (amd64) --pmstatus:testing:83.3333:Installed testing (amd64) --pmstatus:dpkg-exec:83.3333:Running dpkg" cat apt-progress.log -+pmstatus:testing:20:Preparing testing (amd64) -+pmstatus:testing:40:Unpacking testing (amd64) -+pmstatus:testing:60:Preparing to configure testing (amd64) -+pmstatus:dpkg-exec:60:Running dpkg -+pmstatus:testing:60:Configuring testing (amd64) -+pmstatus:testing:80:Configuring testing (amd64) -+pmstatus:testing:100:Installed testing (amd64)" cat apt-progress.log - - # upgrade - exec 3> apt-progress.log -@@ -35,14 +34,13 @@ testequal "dlstatus:1:0:Retrieving file 1 of 1 - dlstatus:1:0:Retrieving file 1 of 1 - pmstatus:dpkg-exec:0:Running dpkg - pmstatus:testing:0:Installing testing (amd64) --pmstatus:testing:16.6667:Preparing testing (amd64) --pmstatus:testing:33.3333:Unpacking testing (amd64) --pmstatus:testing:50:Preparing to configure testing (amd64) --pmstatus:dpkg-exec:50:Running dpkg --pmstatus:testing:50:Configuring testing (amd64) --pmstatus:testing:66.6667:Configuring testing (amd64) --pmstatus:testing:83.3333:Installed testing (amd64) --pmstatus:dpkg-exec:83.3333:Running dpkg" cat apt-progress.log -+pmstatus:testing:20:Preparing testing (amd64) -+pmstatus:testing:40:Unpacking testing (amd64) -+pmstatus:testing:60:Preparing to configure testing (amd64) -+pmstatus:dpkg-exec:60:Running dpkg -+pmstatus:testing:60:Configuring testing (amd64) -+pmstatus:testing:80:Configuring testing (amd64) -+pmstatus:testing:100:Installed testing (amd64)" cat apt-progress.log - - # reinstall - exec 3> apt-progress.log -@@ -51,24 +49,22 @@ testequal "dlstatus:1:0:Retrieving file 1 of 1 - dlstatus:1:0:Retrieving file 1 of 1 - pmstatus:dpkg-exec:0:Running dpkg - pmstatus:testing:0:Installing testing (amd64) --pmstatus:testing:16.6667:Preparing testing (amd64) --pmstatus:testing:33.3333:Unpacking testing (amd64) --pmstatus:testing:50:Preparing to configure testing (amd64) --pmstatus:dpkg-exec:50:Running dpkg --pmstatus:testing:50:Configuring testing (amd64) --pmstatus:testing:66.6667:Configuring testing (amd64) --pmstatus:testing:83.3333:Installed testing (amd64) --pmstatus:dpkg-exec:83.3333:Running dpkg" cat apt-progress.log -+pmstatus:testing:20:Preparing testing (amd64) -+pmstatus:testing:40:Unpacking testing (amd64) -+pmstatus:testing:60:Preparing to configure testing (amd64) -+pmstatus:dpkg-exec:60:Running dpkg -+pmstatus:testing:60:Configuring testing (amd64) -+pmstatus:testing:80:Configuring testing (amd64) -+pmstatus:testing:100:Installed testing (amd64)" cat apt-progress.log - - # and remove - exec 3> apt-progress.log - testsuccess aptget remove testing -y -o APT::Status-Fd=3 - testequal "pmstatus:dpkg-exec:0:Running dpkg - pmstatus:testing:0:Removing testing (amd64) --pmstatus:testing:25:Preparing for removal of testing (amd64) --pmstatus:testing:50:Removing testing (amd64) --pmstatus:testing:75:Removed testing (amd64) --pmstatus:dpkg-exec:75:Running dpkg" cat apt-progress.log -+pmstatus:testing:33.3333:Preparing for removal of testing (amd64) -+pmstatus:testing:66.6667:Removing testing (amd64) -+pmstatus:testing:100:Removed testing (amd64)" cat apt-progress.log - - # install non-native and ensure we get proper progress info - exec 3> apt-progress.log -@@ -79,13 +75,12 @@ testequal "dlstatus:1:0:Retrieving file 1 of 1 - dlstatus:1:0:Retrieving file 1 of 1 - pmstatus:dpkg-exec:0:Running dpkg - pmstatus:testing2:0:Installing testing2 (i386) --pmstatus:testing2:16.6667:Preparing testing2 (i386) --pmstatus:testing2:33.3333:Unpacking testing2 (i386) --pmstatus:testing2:50:Preparing to configure testing2 (i386) --pmstatus:dpkg-exec:50:Running dpkg --pmstatus:testing2:50:Configuring testing2 (i386) --pmstatus:testing2:66.6667:Configuring testing2 (i386) --pmstatus:testing2:83.3333:Installed testing2 (i386) --pmstatus:dpkg-exec:83.3333:Running dpkg" cat apt-progress.log -+pmstatus:testing2:20:Preparing testing2 (i386) -+pmstatus:testing2:40:Unpacking testing2 (i386) -+pmstatus:testing2:60:Preparing to configure testing2 (i386) -+pmstatus:dpkg-exec:60:Running dpkg -+pmstatus:testing2:60:Configuring testing2 (i386) -+pmstatus:testing2:80:Configuring testing2 (i386) -+pmstatus:testing2:100:Installed testing2 (i386)" cat apt-progress.log - - rm -f apt-progress*.log -diff --git a/test/integration/test-apt-progress-fd-deb822 b/test/integration/test-apt-progress-fd-deb822 -index badc985..9d22794 100755 ---- a/test/integration/test-apt-progress-fd-deb822 -+++ b/test/integration/test-apt-progress-fd-deb822 -@@ -27,41 +27,37 @@ Message: Installing testing (amd64) - - Status: progress - Package: testing:amd64 --Percent: 16.6667 -+Percent: 20 - Message: Preparing testing (amd64) - - Status: progress - Package: testing:amd64 --Percent: 33.3333 -+Percent: 40 - Message: Unpacking testing (amd64) - - Status: progress - Package: testing:amd64 --Percent: 50 -+Percent: 60 - Message: Preparing to configure testing (amd64) - - Status: progress --Percent: 50 -+Percent: 60 - Message: Running dpkg - - Status: progress - Package: testing:amd64 --Percent: 50 -+Percent: 60 - Message: Configuring testing (amd64) - - Status: progress - Package: testing:amd64 --Percent: 66.6667 -+Percent: 80 - Message: Configuring testing (amd64) - - Status: progress - Package: testing:amd64 --Percent: 83.3333 -+Percent: 100 - Message: Installed testing (amd64) -- --Status: progress --Percent: 83.3333 --Message: Running dpkg - " cat apt-progress.log - - -diff --git a/test/integration/test-apt-progress-fd-error b/test/integration/test-apt-progress-fd-error -index 6323007..a47095b 100755 ---- a/test/integration/test-apt-progress-fd-error -+++ b/test/integration/test-apt-progress-fd-error -@@ -18,7 +18,7 @@ setupaptarchive - exec 3> apt-progress.log - testfailure aptget install foo1 foo2 -y -o APT::Status-Fd=3 - msgtest "Ensure correct error message" --if grep -q "aptarchive/pool/foo2_0.8.15_amd64.deb:36.3636:trying to overwrite '/usr/bin/file-conflict', which is also in package foo1 0.8.15" apt-progress.log; then -+if grep -q "aptarchive/pool/foo2_0.8.15_amd64.deb:40:trying to overwrite '/usr/bin/file-conflict', which is also in package foo1 0.8.15" apt-progress.log; then - msgpass - else - cat apt-progress.log -diff --git a/test/integration/test-bug-769609-triggers-still-pending-after-run b/test/integration/test-bug-769609-triggers-still-pending-after-run -deleted file mode 100755 -index 146fa76..0000000 ---- a/test/integration/test-bug-769609-triggers-still-pending-after-run -+++ /dev/null -@@ -1,75 +0,0 @@ --#!/bin/sh --set -e -- --TESTDIR=$(readlink -f $(dirname $0)) --. $TESTDIR/framework -- --setupenvironment --configarchitecture 'amd64' -- --msgtest 'Check if installed dpkg supports' 'noawait trigger' --if dpkg-checkbuilddeps -d 'dpkg (>= 1.16.1)' /dev/null; then -- msgpass --else -- msgskip 'dpkg version too old' -- exit 0 --fi --configdpkgnoopchroot -- --buildtriggerpackages() { -- local TYPE="$1" -- setupsimplenativepackage "triggerable-$TYPE" 'all' '1.0' 'unstable' "Depends: trigdepends-$TYPE" -- BUILDDIR="incoming/triggerable-${TYPE}-1.0" -- cat >${BUILDDIR}/debian/postinst <<EOF --#!/bin/sh --if [ "\$1" = 'triggered' ]; then -- ls -l /proc/self/fd/ --fi --EOF -- echo "$TYPE /usr/share/doc" > ${BUILDDIR}/debian/triggers -- buildpackage "$BUILDDIR" 'unstable' 'main' 'native' -- rm -rf "$BUILDDIR" -- buildsimplenativepackage "trigdepends-$TYPE" 'all' '1.0' 'unstable' --} -- --#buildtriggerpackages 'interest' --buildtriggerpackages 'interest-noawait' --buildsimplenativepackage "trigstuff" 'all' '1.0' 'unstable' -- --setupaptarchive -- --runtests() { -- local TYPE="$1" -- msgmsg 'Working with trigger type' "$TYPE" -- testsuccess aptget install triggerable-$TYPE -y -- cp rootdir/tmp/testsuccess.output terminal.output -- testsuccess grep '^REWRITE ' terminal.output -- testdpkginstalled triggerable-$TYPE trigdepends-$TYPE -- -- testsuccess aptget install trigdepends-$TYPE -y --reinstall -- cp rootdir/tmp/testsuccess.output terminal.output -- testsuccess grep '^REWRITE ' terminal.output -- testsuccess grep ' root root ' terminal.output -- testdpkginstalled triggerable-$TYPE trigdepends-$TYPE -- -- testsuccess aptget install trigstuff -y -- cp rootdir/tmp/testsuccess.output terminal.output -- testsuccess grep '^REWRITE ' terminal.output -- testsuccess grep ' root root ' terminal.output -- testdpkginstalled triggerable-$TYPE trigdepends-$TYPE trigstuff -- -- testsuccess aptget purge trigstuff -y -- cp rootdir/tmp/testsuccess.output terminal.output -- testsuccess grep '^REWRITE ' terminal.output -- testsuccess grep ' root root ' terminal.output -- testdpkginstalled triggerable-$TYPE trigdepends-$TYPE -- testdpkgnotinstalled trigstuff -- -- testsuccess aptget purge trigdepends-$TYPE -y -- cp rootdir/tmp/testsuccess.output terminal.output -- testfailure grep '^REWRITE ' terminal.output -- testfailure grep ' root root ' terminal.output -- testdpkgnotinstalled triggerable-$TYPE trigdepends-$TYPE --} --#runtests 'interest' --runtests 'interest-noawait' -diff --git a/test/integration/test-no-fds-leaked-to-maintainer-scripts b/test/integration/test-no-fds-leaked-to-maintainer-scripts -index 41c0570..d3960d7 100755 ---- a/test/integration/test-no-fds-leaked-to-maintainer-scripts -+++ b/test/integration/test-no-fds-leaked-to-maintainer-scripts -@@ -59,8 +59,7 @@ startup packages configure - configure $PKGNAME 1.0 <none> - status unpacked $PKGNAME 1.0 - status half-configured $PKGNAME 1.0 --status installed $PKGNAME 1.0 --startup packages configure" cut -f 3- -d' ' rootdir/var/log/dpkg.log -+status installed $PKGNAME 1.0" cut -f 3- -d' ' rootdir/var/log/dpkg.log - } - checkinstall - -@@ -85,8 +84,7 @@ status config-files $PKGNAME 1.0 - status config-files $PKGNAME 1.0 - status config-files $PKGNAME 1.0 - status config-files $PKGNAME 1.0 --status not-installed $PKGNAME <none> --startup packages configure" cut -f 3- -d' ' rootdir/var/log/dpkg.log -+status not-installed $PKGNAME <none>" cut -f 3- -d' ' rootdir/var/log/dpkg.log - } - checkpurge - --- -2.1.4 - diff --git a/meta/recipes-devtools/apt/apt/0001-aptwebserver.cc-Include-array.patch b/meta/recipes-devtools/apt/apt/0001-aptwebserver.cc-Include-array.patch new file mode 100644 index 0000000000..cfee50c7a0 --- /dev/null +++ b/meta/recipes-devtools/apt/apt/0001-aptwebserver.cc-Include-array.patch @@ -0,0 +1,32 @@ +From f999aeb5ceb77b81c36e6a55300a521aaa2da882 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Wed, 26 May 2021 22:12:46 -0700 +Subject: [PATCH] aptwebserver.cc: Include <array> + +This helps getting std::array definition + +Fixes +test/interactive-helper/aptwebserver.cc:36:55: error: constexpr variable cannot have non-literal type 'const std::array<std::array<const char *, 2>, 6>' + constexpr std::array<std::array<char const *,2>,6> htmlencode = {{ + +Upstream-Status: Submitted [https://github.com/Debian/apt/pull/133] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + test/interactive-helper/aptwebserver.cc | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc +index 58ba54f84..0e030c7e9 100644 +--- a/test/interactive-helper/aptwebserver.cc ++++ b/test/interactive-helper/aptwebserver.cc +@@ -22,6 +22,7 @@ + #include <unistd.h> + + #include <algorithm> ++#include <array> + #include <fstream> + #include <iostream> + #include <list> +-- +2.31.1 + diff --git a/meta/recipes-devtools/apt/apt/0001-cmake-Do-not-build-po-files.patch b/meta/recipes-devtools/apt/apt/0001-cmake-Do-not-build-po-files.patch new file mode 100644 index 0000000000..2837b7f1b3 --- /dev/null +++ b/meta/recipes-devtools/apt/apt/0001-cmake-Do-not-build-po-files.patch @@ -0,0 +1,37 @@ +From 33347f9f8301633b01af4e208b7be5fdfcb0df0c Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Sat, 20 Mar 2021 14:45:18 -0700 +Subject: [PATCH] cmake: Do not build po files + +Fixes +| CMake Error at CMakeLists.txt:252 (add_dependencies): +| The dependency target "update-po4a" of target "update-po" does not exist. +| + +Upstream-Status: Inappropriate [Cross-compile specific] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + CMakeLists.txt | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3c8ec3f..821a24f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -245,13 +245,6 @@ add_subdirectory(ftparchive) + add_subdirectory(methods) + add_subdirectory(test) + +-if (USE_NLS) +-add_subdirectory(po) +- +-# Link update-po4a into the update-po target +-add_dependencies(update-po update-po4a) +-endif() +- + # Create our directories. + install_empty_directories( + ${CONF_DIR}/apt.conf.d +-- +2.31.0 + diff --git a/meta/recipes-devtools/apt/apt/0001-fix-the-gcc-version-check.patch b/meta/recipes-devtools/apt/apt/0001-fix-the-gcc-version-check.patch deleted file mode 100644 index beea56d2ae..0000000000 --- a/meta/recipes-devtools/apt/apt/0001-fix-the-gcc-version-check.patch +++ /dev/null @@ -1,160 +0,0 @@ -From 15c6ef6a827d3681ad06e862d27ab3dfb84cb687 Mon Sep 17 00:00:00 2001 -From: Roy Li <rongqing.li@windriver.com> -Date: Wed, 27 May 2015 14:30:28 +0800 -Subject: [PATCH] fix the gcc version check - -Upstream-Status: pending - -"GCC diagnostic push" is gcc 4.6 feature, gcc 4.4.7 on centos did not know it - -Signed-off-by: Roy Li <rongqing.li@windriver.com> ---- - apt-pkg/cacheset.h | 4 ++-- - apt-pkg/deb/debsrcrecords.cc | 12 ++++++------ - apt-pkg/srcrecords.cc | 4 ++-- - apt-pkg/srcrecords.h | 4 ++-- - apt-pkg/vendorlist.cc | 4 ++-- - 5 files changed, 14 insertions(+), 14 deletions(-) - -diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h -index b7229bc..8cc2917 100644 ---- a/apt-pkg/cacheset.h -+++ b/apt-pkg/cacheset.h -@@ -119,12 +119,12 @@ public: - inline std::string FullName(bool const Pretty) const { return getPkg().FullName(Pretty); } - inline std::string FullName() const { return getPkg().FullName(); } - APT_DEPRECATED inline const char *Section() const { --#if __GNUC__ >= 4 -+#if __GNUC__ >= 4 + (6 >= __GNUC_MINOR__) - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wdeprecated-declarations" - #endif - return getPkg().Section(); --#if __GNUC__ >= 4 -+#if __GNUC__ >= 4 + (6 >= __GNUC_MINOR__) - #pragma GCC diagnostic pop - #endif - } -diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc -index 49a348d..4bc9dcf 100644 ---- a/apt-pkg/deb/debsrcrecords.cc -+++ b/apt-pkg/deb/debsrcrecords.cc -@@ -126,13 +126,13 @@ bool debSrcRecordParser::Files(std::vector<pkgSrcRecords::File> &F) - for (std::vector<pkgSrcRecords::File2>::const_iterator f2 = F2.begin(); f2 != F2.end(); ++f2) - { - pkgSrcRecords::File2 f; --#if __GNUC__ >= 4 -+#if __GNUC__ >= 4 + (6 >= __GNUC_MINOR__) - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wdeprecated-declarations" - #endif - f.MD5Hash = f2->MD5Hash; - f.Size = f2->Size; --#if __GNUC__ >= 4 -+#if __GNUC__ >= 4 + (6 >= __GNUC_MINOR__) - #pragma GCC diagnostic pop - #endif - f.Path = f2->Path; -@@ -190,14 +190,14 @@ bool debSrcRecordParser::Files2(std::vector<pkgSrcRecords::File2> &List) - // we have it already, store the new hash and be done - if (file != List.end()) - { --#if __GNUC__ >= 4 -+#if __GNUC__ >= 4 + (6 >= __GNUC_MINOR__) - // set for compatibility only, so warn users not us - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wdeprecated-declarations" - #endif - if (checksumField == "Files") - file->MD5Hash = hash; --#if __GNUC__ >= 4 -+#if __GNUC__ >= 4 + (6 >= __GNUC_MINOR__) - #pragma GCC diagnostic pop - #endif - // an error here indicates that we have two different hashes for the same file -@@ -212,7 +212,7 @@ bool debSrcRecordParser::Files2(std::vector<pkgSrcRecords::File2> &List) - F.FileSize = strtoull(size.c_str(), NULL, 10); - F.Hashes.push_back(hashString); - --#if __GNUC__ >= 4 -+#if __GNUC__ >= 4 + (6 >= __GNUC_MINOR__) - // set for compatibility only, so warn users not us - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wdeprecated-declarations" -@@ -220,7 +220,7 @@ bool debSrcRecordParser::Files2(std::vector<pkgSrcRecords::File2> &List) - F.Size = F.FileSize; - if (checksumField == "Files") - F.MD5Hash = hash; --#if __GNUC__ >= 4 -+#if __GNUC__ >= 4 + (6 >= __GNUC_MINOR__) - #pragma GCC diagnostic pop - #endif - -diff --git a/apt-pkg/srcrecords.cc b/apt-pkg/srcrecords.cc -index 3175ee7..340e796 100644 ---- a/apt-pkg/srcrecords.cc -+++ b/apt-pkg/srcrecords.cc -@@ -160,7 +160,7 @@ bool pkgSrcRecords::Parser::Files2(std::vector<pkgSrcRecords::File2> &F2)/*{{{*/ - for (std::vector<pkgSrcRecords::File>::const_iterator f = F.begin(); f != F.end(); ++f) - { - pkgSrcRecords::File2 f2; --#if __GNUC__ >= 4 -+#if __GNUC__ >= 4 + (6 >= __GNUC_MINOR__) - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wdeprecated-declarations" - #endif -@@ -168,7 +168,7 @@ bool pkgSrcRecords::Parser::Files2(std::vector<pkgSrcRecords::File2> &F2)/*{{{*/ - f2.Size = f->Size; - f2.Hashes.push_back(HashString("MD5Sum", f->MD5Hash)); - f2.FileSize = f->Size; --#if __GNUC__ >= 4 -+#if __GNUC__ >= 4 + (6 >= __GNUC_MINOR__) - #pragma GCC diagnostic pop - #endif - f2.Path = f->Path; -diff --git a/apt-pkg/srcrecords.h b/apt-pkg/srcrecords.h -index dde22bd..91f8061 100644 ---- a/apt-pkg/srcrecords.h -+++ b/apt-pkg/srcrecords.h -@@ -30,7 +30,7 @@ class pkgSrcRecords - { - public: - --#if __GNUC__ >= 4 -+#if __GNUC__ >= 4 + (6 >= __GNUC_MINOR__) - // ensure that con- & de-structor don't trigger this warning - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wdeprecated-declarations" -@@ -48,7 +48,7 @@ class pkgSrcRecords - unsigned long long FileSize; - HashStringList Hashes; - }; --#if __GNUC__ >= 4 -+#if __GNUC__ >= 4 + (6 >= __GNUC_MINOR__) - #pragma GCC diagnostic pop - #endif - -diff --git a/apt-pkg/vendorlist.cc b/apt-pkg/vendorlist.cc -index fb33ff1..ba1d3c3 100644 ---- a/apt-pkg/vendorlist.cc -+++ b/apt-pkg/vendorlist.cc -@@ -11,7 +11,7 @@ - - #include <apti18n.h> - --#if __GNUC__ >= 4 -+#if __GNUC__ >= 4 + (6 >= __GNUC_MINOR__) - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wdeprecated-declarations" - #endif -@@ -163,6 +163,6 @@ const Vendor* pkgVendorList::FindVendor(const std::vector<string> GPGVOutput) /* - } - /*}}}*/ - --#if __GNUC__ >= 4 -+#if __GNUC__ >= 4 + (6 >= __GNUC_MINOR__) - #pragma GCC diagnostic pop - #endif --- -1.9.1 - diff --git a/meta/recipes-devtools/apt/apt/0001-remove-Wsuggest-attribute-from-CFLAGS.patch b/meta/recipes-devtools/apt/apt/0001-remove-Wsuggest-attribute-from-CFLAGS.patch deleted file mode 100644 index 7c42ff07b8..0000000000 --- a/meta/recipes-devtools/apt/apt/0001-remove-Wsuggest-attribute-from-CFLAGS.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 2bff7ee06a4f96e7d326991d61fb86f8aa651d48 Mon Sep 17 00:00:00 2001 -From: Roy Li <rongqing.li@windriver.com> -Date: Wed, 27 May 2015 09:48:45 +0800 -Subject: [PATCH] remove Wsuggest-attribute from CXXFLAGS - -Upstream-Status: Inappropriate - -Wsuggest-attribute is GCC 4.6 feature, centos6 is using GCC -4.4.7 which unknown this flag, so remove it from CXXFLAGS - -Signed-off-by: Roy Li <rongqing.li@windriver.com> ---- - buildlib/environment.mak.in | 1 - - test/libapt/makefile | 1 - - 2 files changed, 2 deletions(-) - -diff --git a/buildlib/environment.mak.in b/buildlib/environment.mak.in -index b0a8d9d..91ed011 100644 ---- a/buildlib/environment.mak.in -+++ b/buildlib/environment.mak.in -@@ -11,7 +11,6 @@ CPPFLAGS+= @CPPFLAGS@ @DEFS@ -D_REENTRANT -D_FORTIFY_SOURCE=2 - CXX = @CXX@ - CXXFLAGS+= @CXXFLAGS@ -Wall -Wextra - CXXFLAGS+= -Wcast-align -Wlogical-op -Wredundant-decls -Wmissing-declarations -Wunsafe-loop-optimizations --CXXFLAGS+= -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=noreturn - # a bit too pedantic to be run by default - #CXXFLAGS+= -Wpedantic -Wno-long-long -Wno-vla -Wno-variadic-macros - NUM_PROCS = @NUM_PROCS@ -diff --git a/test/libapt/makefile b/test/libapt/makefile -index 7f23ace..e805f13 100644 ---- a/test/libapt/makefile -+++ b/test/libapt/makefile -@@ -39,7 +39,6 @@ CXXFLAGS += -pthread - # disable some flags for gtest again - CXXFLAGS+= -Wno-missing-declarations - CXXFLAGS+= -Wno-missing-field-initializers --CXXFLAGS+= -Wno-suggest-attribute=pure -Wno-suggest-attribute=const -Wno-suggest-attribute=noreturn - - # All Google Test headers. Usually you shouldn't change this definition. - GTEST_HEADERS = /usr/include/gtest/*.h \ --- -1.9.1 - diff --git a/meta/recipes-devtools/apt/apt/0001-srvrec-Keep-support-for-older-resolver.patch b/meta/recipes-devtools/apt/apt/0001-srvrec-Keep-support-for-older-resolver.patch new file mode 100644 index 0000000000..94d67a87ac --- /dev/null +++ b/meta/recipes-devtools/apt/apt/0001-srvrec-Keep-support-for-older-resolver.patch @@ -0,0 +1,44 @@ +From f98c12b9f04ef3a9daec822c210044095b41a0ac Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Sat, 20 Mar 2021 12:33:34 -0700 +Subject: [PATCH] srvrec: Keep support for older resolver + +Some C libraries e.g. musl do not implement the new res_n* APIs +therefore keep the old implementation as fallback and check __RES +version macro to determine the API level + +Upstream-Status: Submitted [https://github.com/Debian/apt/pull/129] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +Cc: Julian Andres Klode <julian.klode@canonical.com> +--- + apt-pkg/contrib/srvrec.cc | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/apt-pkg/contrib/srvrec.cc b/apt-pkg/contrib/srvrec.cc +index 4ca208273..3eb5f1d4c 100644 +--- a/apt-pkg/contrib/srvrec.cc ++++ b/apt-pkg/contrib/srvrec.cc +@@ -62,6 +62,7 @@ bool GetSrvRecords(std::string name, std::vector<SrvRec> &Result) + unsigned char answer[PACKETSZ]; + int answer_len, compressed_name_len; + int answer_count; ++#if __RES >= 19991006 + struct __res_state res; + + if (res_ninit(&res) != 0) +@@ -71,6 +72,12 @@ bool GetSrvRecords(std::string name, std::vector<SrvRec> &Result) + std::shared_ptr<void> guard(&res, res_nclose); + + answer_len = res_nquery(&res, name.c_str(), C_IN, T_SRV, answer, sizeof(answer)); ++#else ++ if (res_init() != 0) ++ return _error->Errno("res_init", "Failed to init resolver"); ++ ++ answer_len = res_query(name.c_str(), C_IN, T_SRV, answer, sizeof(answer)); ++#endif //__RES >= 19991006 + if (answer_len == -1) + return false; + if (answer_len < (int)sizeof(HEADER)) +-- +2.31.0 + diff --git a/meta/recipes-devtools/apt/apt/disable-configure-in-makefile.patch b/meta/recipes-devtools/apt/apt/disable-configure-in-makefile.patch deleted file mode 100644 index 7c2f64e3e6..0000000000 --- a/meta/recipes-devtools/apt/apt/disable-configure-in-makefile.patch +++ /dev/null @@ -1,18 +0,0 @@ -Disable configure at compilation stage - -Upstream-Status: Inappropriate [configuration] -Signed-off-by: Constantin Musca <constantinx.musca@intel.com> - -Index: apt-0.9.7.7/Makefile -=================================================================== ---- apt-0.9.7.7.orig/Makefile -+++ apt-0.9.7.7/Makefile -@@ -33,7 +33,7 @@ veryclean: clean - # The startup target builds the necessary configure scripts. It should - # be used after a CVS checkout. - CONVERTED=environment.mak include/config.h include/apti18n.h build/doc/Doxyfile makefile --include buildlib/configure.mak -+#include buildlib/configure.mak - $(BUILDDIR)/include/config.h: buildlib/config.h.in - $(BUILDDIR)/include/apti18n.h: buildlib/apti18n.h.in - $(BUILDDIR)/environment.mak: buildlib/environment.mak.in diff --git a/meta/recipes-devtools/apt/apt/disable-test.patch b/meta/recipes-devtools/apt/apt/disable-test.patch deleted file mode 100644 index 676795dc8a..0000000000 --- a/meta/recipes-devtools/apt/apt/disable-test.patch +++ /dev/null @@ -1,58 +0,0 @@ -[PATCH] disable test - -Upstream-Status: Inappropriate [configuration] - -test needs gtest package, so not build the test dir - -Signed-off-by: Roy Li <rongqing.li@windriver.com> ---- - Makefile | 7 +++---- - configure.ac | 6 ------ - 2 files changed, 3 insertions(+), 10 deletions(-) - -diff --git a/Makefile b/Makefile -index 5f5fb27..5070e96 100644 ---- a/Makefile -+++ b/Makefile -@@ -9,8 +9,8 @@ endif - .PHONY: default - default: startup all - --.PHONY: headers library clean veryclean all binary program doc test update-po --all headers library clean veryclean binary program doc manpages docbook test update-po startup dirs: -+.PHONY: headers library clean veryclean all binary program doc update-po -+all headers library clean veryclean binary program doc manpages docbook update-po startup dirs: - $(MAKE) -C vendor $@ - $(MAKE) -C apt-pkg $@ - $(MAKE) -C apt-inst $@ -@@ -21,9 +21,8 @@ all headers library clean veryclean binary program doc manpages docbook test upd - $(MAKE) -C dselect $@ - # $(MAKE) -C doc $@ - $(MAKE) -C po $@ -- $(MAKE) -C test $@ - --all headers library clean veryclean binary program doc manpages docbook test update-po: startup dirs -+all headers library clean veryclean binary program doc manpages docbook update-po: startup dirs - - dirs: startup - -diff --git a/configure.ac b/configure.ac -index 5663aaf..b0f9564 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -89,12 +89,6 @@ AC_CHECK_LIB(curl, curl_easy_init, - AC_MSG_ERROR([failed: I need CURL due https support]), - ) - --AC_LANG_PUSH([C++]) --AC_CHECK_HEADER(gtest/gtest.h,, -- AC_MSG_ERROR([failed: I need gtest to build tests]), --) --AC_LANG_POP([C++]) -- - - AC_SUBST(BDBLIB) - --- -1.9.1 - diff --git a/meta/recipes-devtools/apt/apt/fix-gcc-4.6-null-not-defined.patch b/meta/recipes-devtools/apt/apt/fix-gcc-4.6-null-not-defined.patch deleted file mode 100644 index 801ae6dddb..0000000000 --- a/meta/recipes-devtools/apt/apt/fix-gcc-4.6-null-not-defined.patch +++ /dev/null @@ -1,12 +0,0 @@ -Upstream-Status: Pending - ---- a/apt-pkg/contrib/weakptr.h -+++ b/apt-pkg/contrib/weakptr.h -@@ -21,6 +21,7 @@ - #ifndef WEAK_POINTER_H - #define WEAK_POINTER_H - -+#include <cstdlib> - #include <set> - /** - * Class for objects providing support for weak pointers. diff --git a/meta/recipes-devtools/apt/apt/makerace.patch b/meta/recipes-devtools/apt/apt/makerace.patch deleted file mode 100644 index 46e3161b67..0000000000 --- a/meta/recipes-devtools/apt/apt/makerace.patch +++ /dev/null @@ -1,23 +0,0 @@ -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.9.9.4/buildlib/library.mak -=================================================================== ---- apt-0.9.9.4.orig/buildlib/library.mak 2013-07-31 15:45:07.320440575 +0300 -+++ apt-0.9.9.4/buildlib/library.mak 2013-07-31 15:46:49.440440561 +0300 -@@ -61,7 +61,7 @@ - - # Compilation rules - vpath %.cc $(SUBDIRS) --$(OBJ)/%.opic: %.cc $(LIBRARYDEPENDS) -+$(OBJ)/%.opic: %.cc $(LIBRARYDEPENDS) $($(LOCAL)-HEADERS) - echo Compiling $< to $@ - $(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXFLAGS) $(PICFLAGS) -o $@ $< - $(DoDep) diff --git a/meta/recipes-devtools/apt/apt/no-nls-dpkg.patch b/meta/recipes-devtools/apt/apt/no-nls-dpkg.patch deleted file mode 100644 index a0996d4d44..0000000000 --- a/meta/recipes-devtools/apt/apt/no-nls-dpkg.patch +++ /dev/null @@ -1,26 +0,0 @@ -Upstream-Status: Pending - ---- a/apt-pkg/deb/dpkgpm.cc -+++ b/apt-pkg/deb/dpkgpm.cc -@@ -42,6 +42,12 @@ - #include <apti18n.h> - /*}}}*/ - -+#ifdef USE_NLS -+#define _dpkg(x) dgettext("dpkg", x) -+#else -+#define _dpkg(x) x -+#endif -+ - using namespace std; - - namespace -@@ -1279,7 +1285,7 @@ void pkgDPkgPM::WriteApportReport(const - } - - // check if its not a follow up error -- const char *needle = dgettext("dpkg", "dependency problems - leaving unconfigured"); -+ const char *needle = _dpkg("dependency problems - leaving unconfigured"); - if(strstr(errormsg, needle) != NULL) { - std::clog << _("No apport report written because the error message indicates its a followup error from a previous failure.") << std::endl; - return; diff --git a/meta/recipes-devtools/apt/apt/noconfigure.patch b/meta/recipes-devtools/apt/apt/noconfigure.patch deleted file mode 100644 index ebc67203b4..0000000000 --- a/meta/recipes-devtools/apt/apt/noconfigure.patch +++ /dev/null @@ -1,37 +0,0 @@ -Upstream-Status: Inappropriate [configuration] -Signed-off-by: Constantin Musca <constantinx.musca@intel.com> - - -diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc -index 249542c..0a1911f 100644 ---- a/apt-pkg/packagemanager.cc -+++ b/apt-pkg/packagemanager.cc -@@ -952,10 +952,12 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c - return false; - - if (Immediate == true) { -+#if 0 - // Perform immedate configuration of the package. - if (SmartConfigure(Pkg, Depth + 1) == false) - _error->Error(_("Could not perform immediate configuration on '%s'. " - "Please see man 5 apt.conf under APT::Immediate-Configure for details. (%d)"),Pkg.FullName().c_str(),2); -+#endif - } - - return true; -@@ -1038,6 +1040,7 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall() - } - } - -+#if 0 - // Final run through the configure phase - if (ConfigureAll() == false) - return Failed; -@@ -1052,6 +1055,7 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall() - return Failed; - } - } -+#endif - - return Completed; - } diff --git a/meta/recipes-devtools/apt/apt/nodoc.patch b/meta/recipes-devtools/apt/apt/nodoc.patch deleted file mode 100644 index 449e42df4a..0000000000 --- a/meta/recipes-devtools/apt/apt/nodoc.patch +++ /dev/null @@ -1,18 +0,0 @@ -Disable documentation - -Upstream-Status: Inappropriate [configuration] -Signed-off-by: Constantin Musca <constantinx.musca@intel.com> - -Index: apt-0.9.7.7/Makefile -=================================================================== ---- apt-0.9.7.7.orig/Makefile -+++ apt-0.9.7.7/Makefile -@@ -17,7 +17,7 @@ all headers library clean veryclean bina - $(MAKE) -C cmdline $@ - $(MAKE) -C ftparchive $@ - $(MAKE) -C dselect $@ -- $(MAKE) -C doc $@ -+# $(MAKE) -C doc $@ - $(MAKE) -C po $@ - $(MAKE) -C test $@ - diff --git a/meta/recipes-devtools/apt/apt/triehash b/meta/recipes-devtools/apt/apt/triehash new file mode 100755 index 0000000000..b08bc6ec30 --- /dev/null +++ b/meta/recipes-devtools/apt/apt/triehash @@ -0,0 +1,728 @@ +#!/usr/bin/perl -w +# +# Copyright (C) 2016 Julian Andres Klode <jak@jak-linux.org> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +=encoding utf8 + +=head1 NAME + +triehash - Generate a perfect hash function derived from a trie. + +=cut + +use strict; +use warnings; +use utf8; +use Getopt::Long; + +=head1 SYNOPSIS + +B<triehash> [S<I<option>>] [S<I<input file>>] + +=head1 DESCRIPTION + +triehash takes a list of words in input file and generates a function and +an enumeration to describe the word + +=head1 INPUT FILE FORMAT + +The file consists of multiple lines of the form: + + [label ~ ] word [= value] + +This maps word to value, and generates an enumeration with entries of the form: + + label = value + +If I<label> is undefined, the word will be used, the minus character will be +replaced by an underscore. If value is undefined it is counted upwards from +the last value. + +There may also be one line of the format + + [ label ~] = value + +Which defines the value to be used for non-existing keys. Note that this also +changes default value for other keys, as for normal entries. So if you place + + = 0 + +at the beginning of the file, unknown strings map to 0, and the other strings +map to values starting with 1. If label is not specified, the default is +I<Unknown>. + +=head1 OPTIONS + +=over 4 + +=item B<-C>I<.c file> B<--code>=I<.c file> + +Generate code in the given file. + +=item B<-H>I<header file> B<--header>=I<header file> + +Generate a header in the given file, containing a declaration of the hash +function and an enumeration. + +=item B<--enum-name=>I<word> + +The name of the enumeration. + +=item B<--function-name=>I<word> + +The name of the function. + +=item B<--label-prefix=>I<word> + +The prefix to use for labels. + +=item B<--label-uppercase> + +Uppercase label names when normalizing them. + +=item B<--namespace=>I<name> + +Put the function and enum into a namespace (C++) + +=item B<--class=>I<name> + +Put the function and enum into a class (C++) + +=item B<--enum-class> + +Generate an enum class instead of an enum (C++) + +=item B<--counter-name=>I<name> + +Use I<name> for a counter that is set to the latest entry in the enumeration ++ 1. This can be useful for defining array sizes. + +=item B<--ignore-case> + +Ignore case for words. + +=item B<--multi-byte>=I<value> + +Generate code reading multiple bytes at once. The value is a string of power +of twos to enable. The default value is 320 meaning that 8, 4, and single byte +reads are enabled. Specify 0 to disable multi-byte completely, or add 2 if you +also want to allow 2-byte reads. 2-byte reads are disabled by default because +they negatively affect performance on older Intel architectures. + +This generates code for both multiple bytes and single byte reads, but only +enables the multiple byte reads of GNU C compatible compilers, as the following +extensions are used: + +=over 8 + +=item Byte-aligned integers + +We must be able to generate integers that are aligned to a single byte using: + + typedef uint64_t __attribute__((aligned (1))) triehash_uu64; + +=item Byte-order + +The macros __BYTE_ORDER__ and __ORDER_LITTLE_ENDIAN__ must be defined. + +=back + +We forcefully disable multi-byte reads on platforms where the variable +I<__ARM_ARCH> is defined and I<__ARM_FEATURE_UNALIGNED> is not defined, +as there is a measurable overhead from emulating the unaligned reads on +ARM. + +=item B<--language=>I<language> + +Generate a file in the specified language. Currently known are 'C' and 'tree', +the latter generating a tree. + +=item B<--include=>I<header> + +Add the header to the include statements of the header file. The value must +be surrounded by quotes or angle brackets for C code. May be specified multiple +times. + +=back + +=cut + +my $unknown = -1; +my $unknown_label = undef; +my $counter_start = 0; +my $enum_name = 'PerfectKey'; +my $function_name = 'PerfectHash'; +my $enum_class = 0; + +my $code_name = '-'; +my $header_name = '-'; +my $code; +my $header; +my $label_prefix = undef; +my $label_uppercase = 0; +my $ignore_case = 0; +my $multi_byte = '320'; +my $language = 'C'; +my $counter_name = undef; +my @includes = (); + + +Getopt::Long::config('default', + 'bundling', + 'no_getopt_compat', + 'no_auto_abbrev', + 'permute', + 'auto_help'); + +GetOptions ('code|C=s' => \$code_name, + 'header|H=s' => \$header_name, + 'function-name=s' => \$function_name, + 'label-prefix=s' => \$label_prefix, + 'label-uppercase' => \$label_uppercase, + 'ignore-case' => \$ignore_case, + 'enum-name=s' => \$enum_name, + 'language|l=s' => \$language, + 'multi-byte=s' => \$multi_byte, + 'enum-class' => \$enum_class, + 'include=s' => \@includes, + 'counter-name=s' => \$counter_name) + or die('Could not parse options!'); + + +# This implements a simple trie. Each node has three attributes: +# +# children - A hash of keys to other nodes +# value - The value to be stored here +# label - A named representation of the value. +# +# The key at each level of the trie can consist of one or more bytes, and the +# trie can be normalized to a form where all keys at a level have the same +# length using rebuild_tree(). +package Trie { + + sub new { + my $class = shift; + my $self = {}; + bless $self, $class; + + $self->{children} = {}; + $self->{value} = undef; + $self->{label} = undef; + + return $self; + } + + # Return the largest power of 2 smaller or equal to the argument + sub alignpower2 { + my ($self, $length) = @_; + + return 8 if ($length >= 8 && $multi_byte =~ /3/); + return 4 if ($length >= 4 && $multi_byte =~ /2/); + return 2 if ($length >= 2 && $multi_byte =~ /1/); + + return 1; + } + + # Split the key into a head block and a tail + sub split_key { + my ($self, $key) = @_; + my $length = length $key; + my $split = $self->alignpower2($length); + + return (substr($key, 0, $split), substr($key, $split)); + } + + # Given a key, a label, and a value, insert that into the tree, possibly + # replacing an existing node. + sub insert { + my ($self, $key, $label, $value) = @_; + + if (length($key) == 0) { + $self->{label} = $label; + $self->{value} = $value; + return; + } + + my ($child, $tail) = $self->split_key($key); + + $self->{children}{$child} = Trie->new if (!defined($self->{children}{$child})); + + $self->{children}{$child}->insert($tail, $label, $value); + } + + # Construct a new trie that only contains words of a given length. This + # is used to split up the common trie after knowing all words, so we can + # switch on the expected word length first, and have the per-trie function + # implement simple longest prefix matching. + sub filter_depth { + my ($self, $togo) = @_; + + my $new = Trie->new; + + if ($togo != 0) { + my $found = 0; + foreach my $key (sort keys %{$self->{children}}) { + if ($togo > length($key) || defined $self->{children}{$key}->{value}) { + my $child = $self->{children}{$key}->filter_depth($togo - length($key)); + + $new->{children}{$key}= $child if defined $child; + $found = 1 if defined $child; + } + } + return if (!$found); + } else { + $new->{value} = $self->{value}; + $new->{label} = $self->{label}; + } + + return $new; + } + + # (helper for rebuild_tree) + # Reinsert all value nodes into the specified $trie, prepending $prefix + # to their $paths. + sub reinsert_value_nodes_into { + my ($self, $trie, $prefix) = @_; + + $trie->insert($prefix, $self->{label}, $self->{value}) if (defined $self->{value}); + + foreach my $key (sort keys %{$self->{children}}) { + $self->{children}{$key}->reinsert_value_nodes_into($trie, $prefix . $key); + } + } + + # (helper for rebuild_tree) + # Find the earliest point to split a key. Normally, we split at the maximum + # power of 2 that is greater or equal than the length of the key. When we + # are building an ASCII-optimised case-insensitive trie that simply ORs + # each byte with 0x20, we need to split at the first ambiguous character: + # + # For example, the words a-bc and a\rbc are identical in such a situation: + # '-' | 0x20 == '-' == '\r' | 0x20 + # We cannot simply switch on all 4 bytes at once, but need to split before + # the ambiguous character so we can process the ambiguous character on its + # own. + sub find_earlier_split { + my ($self, $key) = @_; + + if ($ignore_case) { + for my $i (0..length($key)-1) { + # If the key starts with an ambiguous character, we need to + # take only it. Otherwise, we need to take everything + # before the character. + return $self->alignpower2($i || 1) if (main::ambiguous(substr($key, $i, 1))); + } + } + return $self->alignpower2(length $key); + } + + # This rebuilds the trie, splitting each key before ambiguous characters + # as explained in find_earlier_split(), and then chooses the smallest + # such split at each level, so that all keys at all levels have the same + # length (so we can use a multi-byte switch). + sub rebuild_tree { + my $self = shift; + # Determine if/where we need to split before an ambiguous character + my $new_split = 99999999999999999; + foreach my $key (sort keys %{$self->{children}}) { + my $special_length = $self->find_earlier_split($key); + $new_split = $special_length if ($special_length < $new_split); + } + + # Start building a new uniform trie + my $newself = Trie->new; + $newself->{label} = $self->{label}; + $newself->{value} = $self->{value}; + $newself->{children} = {}; + + foreach my $key (sort keys %{$self->{children}}) { + my $head = substr($key, 0, $new_split); + my $tail = substr($key, $new_split); + # Rebuild the child node at $head, pushing $tail downwards + $newself->{children}{$head} //= Trie->new; + $self->{children}{$key}->reinsert_value_nodes_into($newself->{children}{$head}, $tail); + # We took up to one special character of each key label. There might + # be more, so we need to rebuild recursively. + $newself->{children}{$head} = $newself->{children}{$head}->rebuild_tree(); + } + + return $newself; + } +} + +# Code generator for C and C++ +package CCodeGen { + my $static = ($code_name eq $header_name) ? "static " : ""; + my $enum_specifier = $enum_class ? "enum class" : "enum"; + + sub new { + my $class = shift; + my $self = {}; + bless $self, $class; + + return $self; + } + + sub open_output { + my $self = shift; + if ($code_name ne '-') { + open($code, '>', $code_name) or die "Cannot open $code_name: $!" ; + } else { + $code = *STDOUT; + } + if($code_name eq $header_name) { + $header = $code; + } elsif ($header_name ne '-') { + open($header, '>', $header_name) or die "Cannot open $header_name: $!" ; + } else { + $header = *STDOUT; + } + } + + sub mangle_label { + my ($self, $label) = @_; + + $label = $label_prefix . $label if defined($label_prefix); + $label = uc $label if $label_uppercase; + + return $label; + } + + sub word_to_label { + my ($self, $word) = @_; + + $word =~ s/_/__/g; + $word =~ s/-/_/g; + + return $self->mangle_label($word); + } + + # Return a case label, by shifting and or-ing bytes in the word + sub case_label { + my ($self, $key) = @_; + + return sprintf("'%s'", substr($key, 0, 1)) if not $multi_byte; + + my $output = '0'; + + for my $i (0..length($key)-1) { + $output .= sprintf("| onechar('%s', %d, %d)", substr($key, $i, 1), 8 * $i, 8*length($key)); + } + + return $output; + } + + # Return an appropriate read instruction for $length bytes from $offset + sub switch_key { + my ($self, $offset, $length) = @_; + + return "string[$offset]" if $length == 1; + return sprintf("*((triehash_uu%s*) &string[$offset])", $length * 8); + } + + # Render the trie so that it matches the longest prefix. + sub print_table { + my ($self, $trie, $fh, $indent, $index) = @_; + $indent //= 0; + $index //= 0; + + # If we have children, try to match them. + if (%{$trie->{children}}) { + # The difference between lowercase and uppercase alphabetical characters + # is that they have one bit flipped. If we have alphabetical characters + # in the search space, and the entire search space works fine if we + # always turn on the flip, just OR the character we are switching over + # with the bit. + my $want_use_bit = 0; + my $can_use_bit = 1; + my $key_length = 0; + foreach my $key (sort keys %{$trie->{children}}) { + $can_use_bit &= not main::ambiguous($key); + $want_use_bit |= ($key =~ /^[a-zA-Z]+$/); + $key_length = length($key); + } + + if ($ignore_case && $can_use_bit && $want_use_bit) { + printf { $fh } ((' ' x $indent) . "switch(%s | 0x%s) {\n", $self->switch_key($index, $key_length), '20' x $key_length); + } else { + printf { $fh } ((' ' x $indent) . "switch(%s) {\n", $self->switch_key($index, $key_length)); + } + + my $notfirst = 0; + foreach my $key (sort keys %{$trie->{children}}) { + if ($notfirst) { + printf { $fh } (' ' x $indent . " break;\n"); + } + if ($ignore_case) { + printf { $fh } (' ' x $indent . "case %s:\n", $self->case_label(lc($key))); + printf { $fh } (' ' x $indent . "case %s:\n", $self->case_label(uc($key))) if lc($key) ne uc($key) && !($can_use_bit && $want_use_bit); + } else { + printf { $fh } (' ' x $indent . "case %s:\n", $self->case_label($key)); + } + + $self->print_table($trie->{children}{$key}, $fh, $indent + 1, $index + length($key)); + + $notfirst=1; + } + + printf { $fh } (' ' x $indent . "}\n"); + } + + + # This node has a value, so it is a possible end point. If no children + # matched, we have found our longest prefix. + if (defined $trie->{value}) { + printf { $fh } (' ' x $indent . "return %s;\n", ($enum_class ? "${enum_name}::" : '').$trie->{label}); + } + + } + + sub print_words { + my ($self, $trie, $fh, $indent, $sofar) = @_; + + $indent //= 0; + $sofar //= ''; + + + printf { $fh } (' ' x $indent."%s = %s,\n", $trie->{label}, $trie->{value}) if defined $trie->{value}; + + foreach my $key (sort keys %{$trie->{children}}) { + $self->print_words($trie->{children}{$key}, $fh, $indent, $sofar . $key); + } + } + + sub print_functions { + my ($self, $trie, %lengths) = @_; + foreach my $local_length (sort { $a <=> $b } (keys %lengths)) { + print { $code } ("static enum ${enum_name} ${function_name}${local_length}(const char *string)\n"); + print { $code } ("{\n"); + $self->print_table($trie->filter_depth($local_length)->rebuild_tree(), $code, 1); + printf { $code } (" return %s$unknown_label;\n", ($enum_class ? "${enum_name}::" : '')); + print { $code } ("}\n"); + } + } + + sub main { + my ($self, $trie, $num_values, %lengths) = @_; + print { $header } ("#ifndef TRIE_HASH_${function_name}\n"); + print { $header } ("#define TRIE_HASH_${function_name}\n"); + print { $header } ("#include <stddef.h>\n"); + print { $header } ("#include <stdint.h>\n"); + foreach my $include (@includes) { + print { $header } ("#include $include\n"); + } + printf { $header } ("enum { $counter_name = $num_values };\n") if (defined($counter_name)); + print { $header } ("${enum_specifier} ${enum_name} {\n"); + $self->print_words($trie, $header, 1); + printf { $header } (" $unknown_label = $unknown,\n"); + print { $header } ("};\n"); + print { $header } ("${static}enum ${enum_name} ${function_name}(const char *string, size_t length);\n"); + + print { $code } ("#include \"$header_name\"\n") if ($header_name ne $code_name); + + if ($multi_byte) { + print { $code } ("#ifdef __GNUC__\n"); + foreach my $i ((16, 32, 64)) { + print { $code } ("typedef uint${i}_t __attribute__((aligned (1))) triehash_uu${i};\n"); + print { $code } ("typedef char static_assert${i}[__alignof__(triehash_uu${i}) == 1 ? 1 : -1];\n"); + } + + print { $code } ("#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__\n"); + print { $code } ("#define onechar(c, s, l) (((uint64_t)(c)) << (s))\n"); + print { $code } ("#else\n"); + print { $code } ("#define onechar(c, s, l) (((uint64_t)(c)) << (l-8-s))\n"); + print { $code } ("#endif\n"); + print { $code } ("#if (!defined(__ARM_ARCH) || defined(__ARM_FEATURE_UNALIGNED)) && !defined(TRIE_HASH_NO_MULTI_BYTE)\n"); + print { $code } ("#define TRIE_HASH_MULTI_BYTE\n"); + print { $code } ("#endif\n"); + print { $code } ("#endif /*GNUC */\n"); + + print { $code } ("#ifdef TRIE_HASH_MULTI_BYTE\n"); + $self->print_functions($trie, %lengths); + $multi_byte = 0; + print { $code } ("#else\n"); + $self->print_functions($trie, %lengths); + print { $code } ("#endif /* TRIE_HASH_MULTI_BYTE */\n"); + } else { + $self->print_functions($trie, %lengths); + } + + print { $code } ("${static}enum ${enum_name} ${function_name}(const char *string, size_t length)\n"); + print { $code } ("{\n"); + print { $code } (" switch (length) {\n"); + foreach my $local_length (sort { $a <=> $b } (keys %lengths)) { + print { $code } (" case $local_length:\n"); + print { $code } (" return ${function_name}${local_length}(string);\n"); + } + print { $code } (" default:\n"); + printf { $code } (" return %s$unknown_label;\n", ($enum_class ? "${enum_name}::" : '')); + print { $code } (" }\n"); + print { $code } ("}\n"); + + # Print end of header here, in case header and code point to the same file + print { $header } ("#endif /* TRIE_HASH_${function_name} */\n"); + } +} + +# A character is ambiguous if the 1<<5 (0x20) bit does not correspond to the +# lower case bit. A word is ambiguous if any character is. This definition is +# used to check if we can perform the |0x20 optimization when building a case- +# insensitive trie. +sub ambiguous { + my $word = shift; + + foreach my $char (split //, $word) { + # If 0x20 does not solely indicate lowercase, it is ambiguous + return 1 if ord(lc($char)) != (ord($char) | 0x20); + return 1 if ord(uc($char)) != (ord($char) & ~0x20); + } + + return 0; +} + +sub build_trie { + my $codegen = shift; + my $trie = Trie->new; + + my $counter = $counter_start; + my $prev_value; + my %lengths; + + open(my $input, '<', $ARGV[0]) or die "Cannot open $ARGV[0]: $!"; + while (my $line = <$input>) { + my ($label, $word, $value) = $line =~ m{ + (?:\s*([^~\s]+)\s*~)? # Label ~ + (?:\s*([^~=\s]+))? # Word + (?:\s*=\s*([^\s]+)\s+)? # = Value + \s* + }x; + + if (defined $word) { + $label //= $codegen->word_to_label($word); + $value //= defined $prev_value ? $prev_value + 1 : 0; + + $trie->insert($word, $label, $value); + $lengths{length($word)} = 1; + } elsif (defined $value) { + $unknown = $value; + $unknown_label = $codegen->mangle_label($label) if defined $label; + } else { + die "Invalid line: $line"; + } + + $prev_value = $value; + $counter = $value + 1 if $value >= $counter; + } + + $unknown_label //= $codegen->mangle_label('Unknown'); + + return ($trie, $counter, %lengths); +} + +# Generates an ASCII art tree +package TreeCodeGen { + + sub new { + my $class = shift; + my $self = {}; + bless $self, $class; + + return $self; + } + + sub mangle_label { + my ($self, $label) = @_; + return $label; + } + + sub word_to_label { + my ($self, $word) = @_; + return $word; + } + + sub main { + my ($self, $trie, $counter, %lengths) = @_; + printf { $code } ("┌────────────────────────────────────────────────────┐\n"); + printf { $code } ("│ Initial trie │\n"); + printf { $code } ("└────────────────────────────────────────────────────┘\n"); + $self->print($trie); + printf { $code } ("┌────────────────────────────────────────────────────┐\n"); + printf { $code } ("│ Rebuilt trie │\n"); + printf { $code } ("└────────────────────────────────────────────────────┘\n"); + $self->print($trie->rebuild_tree()); + + foreach my $local_length (sort { $a <=> $b } (keys %lengths)) { + printf { $code } ("┌────────────────────────────────────────────────────┐\n"); + printf { $code } ("│ Trie for words of length %-4d │\n", $local_length); + printf { $code } ("└────────────────────────────────────────────────────┘\n"); + $self->print($trie->filter_depth($local_length)->rebuild_tree()); + } + } + + sub open_output { + my $self = shift; + if ($code_name ne '-') { + open($code, '>:encoding(utf8)', $code_name) or die "Cannot open $ARGV[0]: $!" ; + } else { + $code = *STDOUT; + binmode($code, ':encoding(utf8)'); + } + } + + # Print a trie + sub print { + my ($self, $trie, $depth) = @_; + $depth //= 0; + + print { $code } (' → ') if defined($trie->{label}); + print { $code } ($trie->{label} // '', "\n"); + foreach my $key (sort keys %{$trie->{children}}) { + print { $code } ('│ ' x ($depth), "├── $key"); + $self->print($trie->{children}{$key}, $depth + 1); + } + } +} + +my %codegens = ( + C => 'CCodeGen', + tree => 'TreeCodeGen', +); + + +defined($codegens{$language}) or die "Unknown language $language. Valid choices: ", join(', ', keys %codegens); +my $codegen = $codegens{$language}->new(); +my ($trie, $counter, %lengths) = build_trie($codegen); + +$codegen->open_output(); +$codegen->main($trie, $counter, %lengths); + + +=head1 LICENSE + +triehash is available under the MIT/Expat license, see the source code +for more information. + +=head1 AUTHOR + +Julian Andres Klode <jak@jak-linux.org> + +=cut + diff --git a/meta/recipes-devtools/apt/apt/truncate-filename.patch b/meta/recipes-devtools/apt/apt/truncate-filename.patch deleted file mode 100644 index db1c42b66c..0000000000 --- a/meta/recipes-devtools/apt/apt/truncate-filename.patch +++ /dev/null @@ -1,35 +0,0 @@ -strutl.cc: the filename can't be longer than 255 - -The URItoFileName translates the path into the filename, but the -filename can't be longer than 255 according to -/usr/include/linux/limits.h. - -Truncate it when it is longer than 240 (leave some spaces for -".Packages" and "._Release" suffix) - -Upstream-Status: Pending -Signed-off-by: Robert Yang <liezhi.yang@windriver.com> ---- - apt-pkg/contrib/strutl.cc | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc ---- a/apt-pkg/contrib/strutl.cc -+++ b/apt-pkg/contrib/strutl.cc -@@ -399,7 +399,12 @@ string URItoFileName(const string &URI) - // "\x00-\x20{}|\\\\^\\[\\]<>\"\x7F-\xFF"; - string NewURI = QuoteString(U,"\\|{}[]<>\"^~_=!@#$%^&*"); - replace(NewURI.begin(),NewURI.end(),'/','_'); -- return NewURI; -+ -+ // Truncate from the head when it is longer than 240 -+ if(NewURI.length() > 240) -+ return NewURI.substr(NewURI.length() - 240, NewURI.length() - 1); -+ else -+ return NewURI; - } - /*}}}*/ - // Base64Encode - Base64 Encoding routine for short strings /*{{{*/ --- -1.7.10.4 - diff --git a/meta/recipes-devtools/apt/apt/use-host.patch b/meta/recipes-devtools/apt/apt/use-host.patch deleted file mode 100644 index b30fcff0d6..0000000000 --- a/meta/recipes-devtools/apt/apt/use-host.patch +++ /dev/null @@ -1,15 +0,0 @@ -Upstream-Status: Pending - -Index: apt-0.9.7.7/configure.ac -=================================================================== ---- apt-0.9.7.7.orig/configure.ac -+++ apt-0.9.7.7/configure.ac -@@ -112,7 +112,7 @@ dnl This is often the dpkg architecture - dnl First check against the full canonical canoncial-system-type in $target - dnl and if that fails, just look for the cpu - AC_MSG_CHECKING(debian architecture) --archset="`dpkg-architecture -qDEB_HOST_ARCH`" -+archset="`echo $host_alias|cut -d'-' -f1`" - if test "x$archset" = "x"; then - AC_MSG_ERROR([failed: use --host= or output from dpkg-architecture]) - fi |