diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2012-02-11 18:54:48 +0100 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2012-02-11 18:54:48 +0100 |
commit | 5eb9a474dca2f48a935c234357c3adc9b372423e (patch) | |
tree | bfde8a8f9189366fb19984113eadcd1fddce6a3d | |
parent | 6fddb156b51b443781aa376e60e443eda09d1cad (diff) |
correctly ignore already (un)hold packages
-rw-r--r-- | apt-pkg/cacheset.h | 8 | ||||
-rw-r--r-- | cmdline/apt-mark.cc | 7 | ||||
-rw-r--r-- | debian/changelog | 3 |
3 files changed, 14 insertions, 4 deletions
diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h index 91d7eec1c..6f0a0e358 100644 --- a/apt-pkg/cacheset.h +++ b/apt-pkg/cacheset.h @@ -191,6 +191,8 @@ public: /*{{{*/ inline iterator operator++(int) { iterator tmp(*this); operator++(); return tmp; } inline bool operator!=(iterator const &i) const { return _iter != i._iter; }; inline bool operator==(iterator const &i) const { return _iter == i._iter; }; + inline iterator& operator=(iterator const &i) { _iter = i._iter; return *this; }; + inline iterator& operator=(typename Container::iterator const &i) { _iter = i; return *this; }; friend std::ostream& operator<<(std::ostream& out, iterator i) { return operator<<(out, *i); } }; /*}}}*/ @@ -201,7 +203,9 @@ public: /*{{{*/ bool empty() const { return _cont.empty(); }; void clear() { return _cont.clear(); }; + //FIXME: on ABI break, replace the first with the second without bool void erase(iterator position) { _cont.erase((typename Container::iterator)position); }; + iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); }; size_t erase(const pkgCache::PkgIterator x) { return _cont.erase(x); }; void erase(iterator first, iterator last) { _cont.erase(first, last); }; size_t size() const { return _cont.size(); }; @@ -507,6 +511,8 @@ public: /*{{{*/ inline iterator operator++(int) { iterator tmp(*this); operator++(); return tmp; } inline bool operator!=(iterator const &i) const { return _iter != i._iter; }; inline bool operator==(iterator const &i) const { return _iter == i._iter; }; + inline iterator& operator=(iterator const &i) { _iter = i._iter; return *this; }; + inline iterator& operator=(typename Container::iterator const &i) { _iter = i; return *this; }; friend std::ostream& operator<<(std::ostream& out, iterator i) { return operator<<(out, *i); } }; /*}}}*/ @@ -516,7 +522,9 @@ public: /*{{{*/ void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); }; bool empty() const { return _cont.empty(); }; void clear() { return _cont.clear(); }; + //FIXME: on ABI break, replace the first with the second without bool void erase(iterator position) { _cont.erase((typename Container::iterator)position); }; + iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); }; size_t erase(const pkgCache::VerIterator x) { return _cont.erase(x); }; void erase(iterator first, iterator last) { _cont.erase(first, last); }; size_t size() const { return _cont.size(); }; diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc index b067413e3..fa4134a20 100644 --- a/cmdline/apt-mark.cc +++ b/cmdline/apt-mark.cc @@ -220,7 +220,7 @@ bool DoHold(CommandLine &CmdL) bool const MarkHold = strcasecmp(CmdL.FileList[0],"hold") == 0; - for (APT::PackageList::iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg) + for (APT::PackageList::iterator Pkg = pkgset.begin(); Pkg != pkgset.end();) { if ((Pkg->SelectedState == pkgCache::State::Hold) == MarkHold) { @@ -228,9 +228,10 @@ bool DoHold(CommandLine &CmdL) ioprintf(c1out,_("%s was already set on hold.\n"), Pkg.FullName(true).c_str()); else ioprintf(c1out,_("%s was already not hold.\n"), Pkg.FullName(true).c_str()); - pkgset.erase(Pkg); - continue; + Pkg = pkgset.erase(Pkg, true); } + else + ++Pkg; } bool dpkgMultiArch = false; diff --git a/debian/changelog b/debian/changelog index fa8f396eb..d1a3354d0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -19,6 +19,7 @@ apt (0.8.16~exp13) UNRELEASED; urgency=low - ensure that architectures are not added multiple times * cmdline/apt-mark.cc: - detect if dpkg has multiarch support before calling --set-selections + - correctly ignore already (un)hold packages [ Steve Langasek ] * cmdline/apt-get.cc: @@ -41,7 +42,7 @@ apt (0.8.16~exp13) UNRELEASED; urgency=low * apt-pkg/contrib/fileutl.h: - fix compat with FileFd::OpenDescriptor() in ReadOnlyGzip mode - -- David Kalnischkies <kalnischkies@gmail.com> Fri, 10 Feb 2012 19:33:38 +0100 + -- David Kalnischkies <kalnischkies@gmail.com> Sat, 11 Feb 2012 18:54:11 +0100 apt (0.8.16~exp12) experimental; urgency=low |