summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/CMakeLists.txt4
-rw-r--r--apt-pkg/acquire.cc4
-rw-r--r--apt-pkg/contrib/fileutl.h1
-rw-r--r--apt-pkg/contrib/progress.cc2
-rw-r--r--apt-private/private-install.cc27
-rw-r--r--apt-private/private-install.h4
-rw-r--r--apt-private/private-output.cc4
-rw-r--r--apt-private/private-upgrade.cc2
-rw-r--r--doc/apt-get.8.xml3
-rw-r--r--ftparchive/apt-ftparchive.cc2
-rw-r--r--po/ja.po9
-rwxr-xr-xtest/integration/test-apt-install-order-matters-a-bit75
-rwxr-xr-xtest/integration/test-multiarch-allowed8
-rw-r--r--test/interactive-helper/libnoprofile.c1
14 files changed, 116 insertions, 30 deletions
diff --git a/apt-pkg/CMakeLists.txt b/apt-pkg/CMakeLists.txt
index 469408e52..d13aed96c 100644
--- a/apt-pkg/CMakeLists.txt
+++ b/apt-pkg/CMakeLists.txt
@@ -3,7 +3,7 @@ include_directories(${PROJECT_BINARY_DIR}/include/apt-pkg)
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/include/apt-pkg/)
execute_process(COMMAND grep -v "^#" "${CMAKE_CURRENT_SOURCE_DIR}/tagfile-keys.list"
- OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/tagfile-keys.list")
+ OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/tagfile-keys.clean.list")
execute_process(COMMAND ${TRIEHASH_EXECUTABLE}
--ignore-case
--header ${PROJECT_BINARY_DIR}/include/apt-pkg/tagfile-keys.h
@@ -13,7 +13,7 @@ execute_process(COMMAND ${TRIEHASH_EXECUTABLE}
--function-name pkgTagHash
--include "<apt-pkg/tagfile.h>"
--include "<apt-pkg/header-is-private.h>"
- "${CMAKE_CURRENT_BINARY_DIR}/tagfile-keys.list")
+ "${CMAKE_CURRENT_BINARY_DIR}/tagfile-keys.clean.list")
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "tagfile-keys.list")
set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/tagfile-keys.cc" PROPERTIES COMPILE_DEFINITIONS APT_COMPILING_APT)
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc
index 100ccde32..dd0624ad6 100644
--- a/apt-pkg/acquire.cc
+++ b/apt-pkg/acquire.cc
@@ -53,11 +53,11 @@
using namespace std;
// helper to convert time_point to a timeval
-static struct timeval SteadyDurationToTimeVal(std::chrono::steady_clock::duration Time)
+constexpr struct timeval SteadyDurationToTimeVal(std::chrono::steady_clock::duration Time)
{
auto const Time_sec = std::chrono::duration_cast<std::chrono::seconds>(Time);
auto const Time_usec = std::chrono::duration_cast<std::chrono::microseconds>(Time - Time_sec);
- return {Time_sec.count(), Time_usec.count()};
+ return timeval{static_cast<time_t>(Time_sec.count()), static_cast<suseconds_t>(Time_usec.count())};
}
std::string pkgAcquire::URIEncode(std::string const &part) /*{{{*/
diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h
index f4eefd7c2..6f808ac9b 100644
--- a/apt-pkg/contrib/fileutl.h
+++ b/apt-pkg/contrib/fileutl.h
@@ -26,6 +26,7 @@
#include <set>
#include <string>
#include <vector>
+#include <sys/stat.h>
#include <time.h>
/* Define this for python-apt */
diff --git a/apt-pkg/contrib/progress.cc b/apt-pkg/contrib/progress.cc
index 03f88d4ce..eb688b9a2 100644
--- a/apt-pkg/contrib/progress.cc
+++ b/apt-pkg/contrib/progress.cc
@@ -122,7 +122,7 @@ bool OpProgress::CheckChange(float Interval)
auto const Now = std::chrono::steady_clock::now().time_since_epoch();
auto const Now_sec = std::chrono::duration_cast<std::chrono::seconds>(Now);
auto const Now_usec = std::chrono::duration_cast<std::chrono::microseconds>(Now - Now_sec);
- struct timeval NowTime = { Now_sec.count(), Now_usec.count() };
+ struct timeval NowTime = { static_cast<time_t>(Now_sec.count()), static_cast<suseconds_t>(Now_usec.count()) };
std::chrono::duration<decltype(Interval)> Delta =
std::chrono::seconds(NowTime.tv_sec - LastTime.tv_sec) +
diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc
index 4cddc3e0c..08d58a53c 100644
--- a/apt-private/private-install.cc
+++ b/apt-private/private-install.cc
@@ -593,12 +593,12 @@ static const unsigned short MOD_INSTALL = 2;
bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vector<PseudoPkg> &VolatileCmdL, CacheFile &Cache, int UpgradeMode,
APT::PackageVector &HeldBackPackages)
{
- std::map<unsigned short, APT::VersionSet> verset;
+ std::map<unsigned short, APT::VersionVector> verset;
std::set<std::string> UnknownPackages;
return DoCacheManipulationFromCommandLine(CmdL, VolatileCmdL, Cache, verset, UpgradeMode, UnknownPackages, HeldBackPackages);
}
bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vector<PseudoPkg> &VolatileCmdL, CacheFile &Cache,
- std::map<unsigned short, APT::VersionSet> &verset, int UpgradeMode,
+ std::map<unsigned short, APT::VersionVector> &verset, int UpgradeMode,
std::set<std::string> &UnknownPackages, APT::PackageVector &HeldBackPackages)
{
// Enter the special broken fixing mode if the user specified arguments
@@ -639,8 +639,13 @@ bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vector<PseudoPkg
mods.push_back(APT::VersionSet::Modifier(MOD_REMOVE, "-",
APT::VersionSet::Modifier::POSTFIX, APT::CacheSetHelper::NEWEST));
CacheSetHelperAPTGet helper(c0out);
- verset = APT::VersionSet::GroupedFromCommandLine(Cache,
+ verset = APT::VersionVector::GroupedFromCommandLine(Cache,
CmdL.FileList + 1, mods, fallback, helper);
+ for (auto &vs : verset)
+ {
+ std::set<map_id_t> seen;
+ vs.second.erase(std::remove_if(vs.second.begin(), vs.second.end(), [&](auto const &p) { return not seen.insert(p->ID).second; }), vs.second.end());
+ }
for (auto const &I: VolatileCmdL)
{
@@ -834,14 +839,14 @@ std::vector<PseudoPkg> GetPseudoPackages(pkgSourceList *const SL, CommandLine &C
/* Install named packages */
struct PkgIsExtraInstalled {
pkgCacheFile * const Cache;
- APT::VersionSet const * const verset;
- PkgIsExtraInstalled(pkgCacheFile * const Cache, APT::VersionSet const * const Container) : Cache(Cache), verset(Container) {}
+ APT::VersionVector const * const verset;
+ PkgIsExtraInstalled(pkgCacheFile * const Cache, APT::VersionVector const * const Container) : Cache(Cache), verset(Container) {}
bool operator() (pkgCache::PkgIterator const &Pkg)
{
if ((*Cache)[Pkg].Install() == false)
return false;
pkgCache::VerIterator const Cand = (*Cache)[Pkg].CandidateVerIter(*Cache);
- return verset->find(Cand) == verset->end();
+ return std::find(verset->begin(), verset->end(), Cand) == verset->end();
}
};
bool DoInstall(CommandLine &CmdL)
@@ -857,7 +862,7 @@ bool DoInstall(CommandLine &CmdL)
Cache.CheckDeps(CmdL.FileSize() != 1) == false)
return false;
- std::map<unsigned short, APT::VersionSet> verset;
+ std::map<unsigned short, APT::VersionVector> verset;
std::set<std::string> UnknownPackages;
APT::PackageVector HeldBackPackages;
@@ -1095,11 +1100,9 @@ bool TryToInstall::propagateReleaseCandidateSwitching(std::list<std::pair<pkgCac
}
/*}}}*/
void TryToInstall::doAutoInstall() { /*{{{*/
- for (APT::PackageSet::const_iterator P = doAutoInstallLater.begin();
- P != doAutoInstallLater.end(); ++P) {
- pkgDepCache::StateCache &State = (*Cache)[P];
- Cache->GetDepCache()->MarkInstall(P, true);
- }
+ auto * const DCache = Cache->GetDepCache();
+ for (auto const &P: doAutoInstallLater)
+ DCache->MarkInstall(P, true);
doAutoInstallLater.clear();
}
/*}}}*/
diff --git a/apt-private/private-install.h b/apt-private/private-install.h
index e3df9ac89..0f6d048fc 100644
--- a/apt-private/private-install.h
+++ b/apt-private/private-install.h
@@ -33,7 +33,7 @@ bool AddVolatileBinaryFile(pkgSourceList *const SL, PseudoPkg &&pkg, std::vector
bool AddVolatileSourceFile(pkgSourceList *const SL, PseudoPkg &&pkg, std::vector<PseudoPkg> &VolatileCmdL);
bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vector<PseudoPkg> &VolatileCmdL, CacheFile &Cache,
- std::map<unsigned short, APT::VersionSet> &verset, int UpgradeMode,
+ std::map<unsigned short, APT::VersionVector> &verset, int UpgradeMode,
std::set<std::string> &UnknownPackages, APT::PackageVector &HeldBackPackages);
bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vector<PseudoPkg> &VolatileCmdL, CacheFile &Cache, int UpgradeMode,
APT::PackageVector &HeldBackPackages);
@@ -54,7 +54,7 @@ struct TryToInstall {
pkgProblemResolver* Fix;
bool FixBroken;
unsigned long AutoMarkChanged;
- APT::PackageSet doAutoInstallLater;
+ APT::PackageVector doAutoInstallLater;
TryToInstall(pkgCacheFile &Cache, pkgProblemResolver *PM, bool const FixBroken) : Cache(&Cache), Fix(PM),
FixBroken(FixBroken), AutoMarkChanged(0) {};
diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc
index 04cb148ba..03fbe47e1 100644
--- a/apt-private/private-output.cc
+++ b/apt-private/private-output.cc
@@ -86,9 +86,9 @@ bool InitOutput(std::basic_streambuf<char> * const out) /*{{{*/
SigWinch(0);
}
- if(!isatty(1) || getenv("NO_COLOR") != nullptr)
+ if (isatty(STDOUT_FILENO) == 0 || not _config->FindB("APT::Color", true) || getenv("NO_COLOR") != nullptr)
{
- _config->Set("APT::Color", "false");
+ _config->Set("APT::Color", false);
_config->Set("APT::Color::Highlight", "");
_config->Set("APT::Color::Neutral", "");
} else {
diff --git a/apt-private/private-upgrade.cc b/apt-private/private-upgrade.cc
index 3423db525..97603dc16 100644
--- a/apt-private/private-upgrade.cc
+++ b/apt-private/private-upgrade.cc
@@ -27,7 +27,7 @@ static bool UpgradeHelper(CommandLine &CmdL, int UpgradeFlags)
if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
return false;
- std::map<unsigned short, APT::VersionSet> verset;
+ std::map<unsigned short, APT::VersionVector> verset;
std::set<std::string> UnknownPackages;
APT::PackageVector HeldBackPackages;
if (not DoCacheManipulationFromCommandLine(CmdL, VolatileCmdL, Cache, verset, UpgradeFlags, UnknownPackages, HeldBackPackages))
diff --git a/doc/apt-get.8.xml b/doc/apt-get.8.xml
index 9ecd10c19..895f24034 100644
--- a/doc/apt-get.8.xml
+++ b/doc/apt-get.8.xml
@@ -228,7 +228,8 @@
<varlistentry><term><option>download</option></term>
<listitem><para><literal>download</literal> will download the given
- binary package into the current directory.
+ binary package into the current directory. The authenticity of
+ the package data is ensured as usual.
</para></listitem>
</varlistentry>
diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc
index 87ce9153c..bbba0834b 100644
--- a/ftparchive/apt-ftparchive.cc
+++ b/ftparchive/apt-ftparchive.cc
@@ -53,7 +53,7 @@ static struct timeval GetTimevalFromSteadyClock() /*{{{*/
auto const Time = std::chrono::steady_clock::now().time_since_epoch();
auto const Time_sec = std::chrono::duration_cast<std::chrono::seconds>(Time);
auto const Time_usec = std::chrono::duration_cast<std::chrono::microseconds>(Time - Time_sec);
- return { Time_sec.count(), Time_usec.count() };
+ return { static_cast<time_t>(Time_sec.count()), static_cast<suseconds_t>(Time_usec.count()) };
}
/*}}}*/
static auto GetTimeDeltaSince(struct timeval StartTime) /*{{{*/
diff --git a/po/ja.po b/po/ja.po
index 21559f81e..534f87f02 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -8,18 +8,17 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: apt 1.4\n"
+"Project-Id-Version: apt 2.5\n"
"Report-Msgid-Bugs-To: APT Development Team <deity@lists.debian.org>\n"
"POT-Creation-Date: 2022-02-22 20:01+0100\n"
-"PO-Revision-Date: 2017-01-06 04:50+0900\n"
-"Last-Translator: Takuma Yamada <tyamada@takumayamada.com>\n"
+"PO-Revision-Date: 2022-08-14 14:30+0900\n"
+"Last-Translator: Hideki Yamane <henrich@debian.org>\n"
"Language-Team: Japanese <debian-japanese@lists.debian.org>\n"
"Language: ja\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
-"X-Generator: Gtranslator 2.91.6\n"
#: apt-pkg/acquire-item.cc
msgid ""
@@ -2024,7 +2023,7 @@ msgstr[0] ""
#: apt-private/private-install.cc
msgid "Note: This is done automatically and on purpose by dpkg."
-msgstr "注意: これは dpkg により自動でわざと行われれます。"
+msgstr "注意: これは dpkg により自動かつ意図的に実施されます。"
#: apt-private/private-install.cc
msgid "We are not supposed to delete stuff, can't start AutoRemover"
diff --git a/test/integration/test-apt-install-order-matters-a-bit b/test/integration/test-apt-install-order-matters-a-bit
new file mode 100755
index 000000000..e41709ff3
--- /dev/null
+++ b/test/integration/test-apt-install-order-matters-a-bit
@@ -0,0 +1,75 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+setupenvironment
+configarchitecture 'amd64'
+
+insertpackage 'unstable' 'a' 'all' '1' 'Depends: b | d'
+insertpackage 'unstable' 'b' 'all' '1'
+insertpackage 'unstable' 'c' 'all' '1' 'Depends: d | b'
+insertpackage 'unstable' 'd' 'all' '1'
+
+setupaptarchive
+
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following additional packages will be installed:
+ b
+The following NEW packages will be installed:
+ a b c
+0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
+Inst b (1 unstable [all])
+Inst a (1 unstable [all])
+Inst c (1 unstable [all])
+Conf b (1 unstable [all])
+Conf a (1 unstable [all])
+Conf c (1 unstable [all])' apt install a c -s
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following additional packages will be installed:
+ d
+The following NEW packages will be installed:
+ a c d
+0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
+Inst d (1 unstable [all])
+Inst a (1 unstable [all])
+Inst c (1 unstable [all])
+Conf d (1 unstable [all])
+Conf a (1 unstable [all])
+Conf c (1 unstable [all])' apt install c a -s
+
+TOPLEVELCHOICE='Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ a c d
+0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
+Inst d (1 unstable [all])
+Inst a (1 unstable [all])
+Inst c (1 unstable [all])
+Conf d (1 unstable [all])
+Conf a (1 unstable [all])
+Conf c (1 unstable [all])'
+testsuccessequal "$TOPLEVELCHOICE" apt install d a c -s
+testsuccessequal "$TOPLEVELCHOICE" apt install a c d -s
+
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+ MarkInstall a:amd64 < none -> 1 @un puN Ib > FU=1
+ MarkInstall b:amd64 < none -> 1 @un uN > FU=0
+ MarkInstall c:amd64 < none -> 1 @un puN > FU=1
+Starting pkgProblemResolver with broken count: 0
+Starting 2 pkgProblemResolver with broken count: 0
+Done
+The following additional packages will be installed:
+ b
+The following NEW packages will be installed:
+ a b c
+0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
+Inst b (1 unstable [all])
+Inst a (1 unstable [all])
+Inst c (1 unstable [all])
+Conf b (1 unstable [all])
+Conf a (1 unstable [all])
+Conf c (1 unstable [all])' apt install a a a c a a a -s -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1
diff --git a/test/integration/test-multiarch-allowed b/test/integration/test-multiarch-allowed
index db7f37169..fc63d0e33 100755
--- a/test/integration/test-multiarch-allowed
+++ b/test/integration/test-multiarch-allowed
@@ -62,12 +62,18 @@ Inst foo:i386 (1 unstable [i386])
Inst needsfoo:i386 (1 unstable [i386])
Conf foo:i386 (1 unstable [i386])
Conf needsfoo:i386 (1 unstable [i386])' aptget install needsfoo:i386 -s
+# FIXME: same problem, but two different unmet dependency messages depending on install order
testfailureequal "$BADPREFIX
The following packages have unmet dependencies:
- needsfoo:i386 : Depends: foo:i386 but it is not installable
+ foo : Conflicts: foo:i386 but 1 is to be installed
+ foo:i386 : Conflicts: foo but 1 is to be installed
E: Unable to correct problems, you have held broken packages." aptget install needsfoo:i386 foo:amd64 -s
testfailureequal "$BADPREFIX
The following packages have unmet dependencies:
+ needsfoo:i386 : Depends: foo:i386 but it is not installable
+E: Unable to correct problems, you have held broken packages." aptget install foo:amd64 needsfoo:i386 -s
+testfailureequal "$BADPREFIX
+The following packages have unmet dependencies:
foo : Conflicts: foo:i386 but 1 is to be installed
foo:i386 : Conflicts: foo but 1 is to be installed
E: Unable to correct problems, you have held broken packages." aptget install needsfoo foo:i386 -s
diff --git a/test/interactive-helper/libnoprofile.c b/test/interactive-helper/libnoprofile.c
index f11b89899..b26ec2a1c 100644
--- a/test/interactive-helper/libnoprofile.c
+++ b/test/interactive-helper/libnoprofile.c
@@ -1,4 +1,5 @@
#define _GNU_SOURCE
+#undef _FORTIFY_SOURCE
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>