From 3605a316776eee62aeef478e3992399b7a62f008 Mon Sep 17 00:00:00 2001 From: Daniel Burrows Date: Wed, 30 Mar 2011 09:25:45 -0700 Subject: Fix compile errors caused by changes in the libapt API. Whoever's in charge of libapt these days apparently doesn't believe in backwards compatibility. Or in documenting how their APIs are to be used, or why names are deprecated --- src/cmdline/cmdline_download.cc | 3 +- src/cmdline/cmdline_download_progress_display.cc | 10 +++---- src/cmdline/cmdline_prompt.cc | 5 ++-- src/generic/apt/aptitude_resolver.cc | 38 +----------------------- src/generic/apt/changelog_parse.cc | 8 ++--- src/generic/apt/download_install_manager.cc | 5 ++-- src/generic/apt/download_queue.cc | 7 +++-- src/generic/apt/download_update_manager.cc | 7 +++-- src/generic/views/download_progress.h | 7 +++-- src/main.cc | 4 +-- 10 files changed, 32 insertions(+), 62 deletions(-) (limited to 'src') diff --git a/src/cmdline/cmdline_download.cc b/src/cmdline/cmdline_download.cc index 48881643..68329faf 100644 --- a/src/cmdline/cmdline_download.cc +++ b/src/cmdline/cmdline_download.cc @@ -63,7 +63,8 @@ int cmdline_download(int argc, char *argv[]) std::pair > progress_display = create_cmdline_download_progress(term, term, term, term); - pkgAcquire fetcher(progress_display.first); + pkgAcquire fetcher; + fetcher.Setup(progress_display.first); string filenames[(*apt_cache_file)->Head().PackageCount]; string default_release = aptcfg->Find("APT::Default-Release"); diff --git a/src/cmdline/cmdline_download_progress_display.cc b/src/cmdline/cmdline_download_progress_display.cc index 15febc6f..5c16cb38 100644 --- a/src/cmdline/cmdline_download_progress_display.cc +++ b/src/cmdline/cmdline_download_progress_display.cc @@ -1,6 +1,6 @@ /** \file cmdline_download_progress_display.cc */ -// Copyright (C) 2010 Daniel Burrows +// Copyright (C) 2010-2011 Daniel Burrows // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as @@ -74,11 +74,11 @@ namespace aptitude void file_started(const std::string &description, const boost::optional &id, - const boost::optional &file_size); + const boost::optional &file_size); void file_already_downloaded(const std::string &description, const boost::optional &id, - const boost::optional &file_size); + const boost::optional &file_size); void error(bool ignored, const std::string &error, @@ -122,7 +122,7 @@ namespace aptitude void download_progress::file_started(const std::string &description, const boost::optional &id, - const boost::optional &file_size) + const boost::optional &file_size) { if(display_messages) { @@ -145,7 +145,7 @@ namespace aptitude void download_progress::file_already_downloaded(const std::string &description, const boost::optional &id, - const boost::optional &file_size) + const boost::optional &file_size) { if(display_messages) { diff --git a/src/cmdline/cmdline_prompt.cc b/src/cmdline/cmdline_prompt.cc index 2e888ab6..eb94fac9 100644 --- a/src/cmdline/cmdline_prompt.cc +++ b/src/cmdline/cmdline_prompt.cc @@ -1,6 +1,6 @@ // cmdline_prompt.cc // -// Copyright (C) 2010 Daniel Burrows +// Copyright (C) 2010-2011 Daniel Burrows // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as @@ -82,7 +82,8 @@ static bool pkg_byname_compare(const pkgCache::PkgIterator &a, const pkgCache::P static bool get_fetchinfo(fetchinfo &f) { download_signal_log m; - pkgAcquire fetcher(&m); + pkgAcquire fetcher; + fetcher.Setup(&m); pkgSourceList l; if(!l.ReadMainList()) return _error->Error(_("Couldn't read list of sources")); diff --git a/src/generic/apt/aptitude_resolver.cc b/src/generic/apt/aptitude_resolver.cc index 6331fb33..cae6a937 100644 --- a/src/generic/apt/aptitude_resolver.cc +++ b/src/generic/apt/aptitude_resolver.cc @@ -1,6 +1,6 @@ // aptitude_resolver.cc // -// Copyright (C) 2005, 2008-2010 Daniel Burrows +// Copyright (C) 2005, 2008-2011 Daniel Burrows // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as @@ -86,42 +86,6 @@ namespace } // Logging operators. -std::ostream &operator<<(std::ostream &out, const pkgCache::DepIterator &dep) -{ - pkgCache::DepIterator d = dep; - bool first = true; - - while(true) - { - if(first) - first = false; - else - out << " | "; - - out << const_cast(dep).ParentPkg().Name() - << " " << const_cast(dep).ParentVer().VerStr() - << " " << const_cast(dep).DepType() - << " " << const_cast(dep).TargetPkg().Name(); - - if((dep->CompareOp & ~pkgCache::Dep::Or) != pkgCache::Dep::NoOp && - dep.TargetVer() != NULL) - { - out << " (" << const_cast(dep).CompType() - << " " << dep.TargetVer() - << ")"; - } - - if((d->CompareOp & pkgCache::Dep::Or) == 0) - break; - - ++d; - - if(d.end()) - break; // Shouldn't happen. - } - - return out; -} // Should version selections be logged the way they're written? // That's a little awkward since the syntax is hairy and some of them diff --git a/src/generic/apt/changelog_parse.cc b/src/generic/apt/changelog_parse.cc index 90911fa2..cd109459 100644 --- a/src/generic/apt/changelog_parse.cc +++ b/src/generic/apt/changelog_parse.cc @@ -1,6 +1,6 @@ // changelog_parse.cc // -// Copyright (C) 2005, 2008-2009 Daniel Burrows +// Copyright (C) 2005, 2008-2009, 2011 Daniel Burrows // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as @@ -66,9 +66,9 @@ namespace aptitude could_parse_date(false), date(0) { - // I use StrToTime instead of strptime because strptime is - // locale-dependent. - could_parse_date = StrToTime(date_str, date); + // I use RFC1123StrToTime instead of strptime because strptime + // is locale-dependent. + could_parse_date = RFC1123StrToTime(date_str.c_str(), date); } // Skips over whitespace in a text element, spilling elements as diff --git a/src/generic/apt/download_install_manager.cc b/src/generic/apt/download_install_manager.cc index 7cebd369..9ba5e47e 100644 --- a/src/generic/apt/download_install_manager.cc +++ b/src/generic/apt/download_install_manager.cc @@ -1,6 +1,6 @@ // download_install_manager.cc // -// Copyright (C) 2005-2010 Daniel Burrows +// Copyright (C) 2005-2011 Daniel Burrows // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as @@ -89,7 +89,8 @@ bool download_install_manager::prepare(OpProgress &progress, return false; } - fetcher = new pkgAcquire(&acqlog); + fetcher = new pkgAcquire; + fetcher->Setup(&acqlog); if(!pm->GetArchives(fetcher, &src_list, apt_package_records) || _error->PendingError()) diff --git a/src/generic/apt/download_queue.cc b/src/generic/apt/download_queue.cc index 51333b11..0c0b184c 100644 --- a/src/generic/apt/download_queue.cc +++ b/src/generic/apt/download_queue.cc @@ -1,7 +1,7 @@ /** \file download_queue.cc */ -// Copyright (C) 2009-2010 Daniel Burrows +// Copyright (C) 2009-2011 Daniel Burrows // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as @@ -316,7 +316,7 @@ namespace aptitude { const std::string lastModifiedTimeStr = LookupTag(Message, "Last-Modified"); time_t lastModifiedTime = 0; - if(!StrToTime(lastModifiedTimeStr, lastModifiedTime)) + if(!RFC1123StrToTime(lastModifiedTimeStr.c_str(), lastModifiedTime)) lastModifiedTime = 0; LOG_INFO(Loggers::getAptitudeDownloadQueue(), @@ -925,7 +925,8 @@ namespace aptitude "Setting up the download process for the background download queue."); download_callback cb; - pkgAcquire downloader(&cb); + pkgAcquire downloader; + downloader.Setup(&cb); for(std::deque >::const_iterator it = start_requests.begin(); diff --git a/src/generic/apt/download_update_manager.cc b/src/generic/apt/download_update_manager.cc index a0cc8413..c27fbbf3 100644 --- a/src/generic/apt/download_update_manager.cc +++ b/src/generic/apt/download_update_manager.cc @@ -1,6 +1,6 @@ // download_update_manager.cc // -// Copyright (C) 2005, 2007-2009 Daniel Burrows +// Copyright (C) 2005, 2007-2009, 2011 Daniel Burrows // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as @@ -94,7 +94,8 @@ bool download_update_manager::prepare(OpProgress &progress, } } - fetcher = new pkgAcquire(&acqlog); + fetcher = new pkgAcquire(); + fetcher->Setup(&acqlog); if(!src_list.GetIndexes(fetcher)) { @@ -328,7 +329,7 @@ void download_update_manager::finish(pkgAcquire::RunResult res, // redundant work at the command-line. { pkgCacheFile cachefile; - if(!cachefile.BuildCaches(*progress, true)) + if(!cachefile.BuildCaches(progress, true)) { _error->Error(_("Couldn't rebuild package cache")); k(failure); diff --git a/src/generic/views/download_progress.h b/src/generic/views/download_progress.h index 427c02c9..1b6c919a 100644 --- a/src/generic/views/download_progress.h +++ b/src/generic/views/download_progress.h @@ -1,6 +1,6 @@ /** \file download_progress.h */ // -*-c++-*- -// Copyright (C) 2010 Daniel Burrows +// Copyright (C) 2010-2011 Daniel Burrows // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as @@ -174,7 +174,7 @@ namespace aptitude */ virtual void file_started(const std::string &description, const boost::optional &id, - const boost::optional &file_size) = 0; + const boost::optional &file_size) = 0; /** \brief Invoked when a file isn't even started because it was * already downloaded. @@ -185,9 +185,10 @@ namespace aptitude * \param file_size The size of the file; invalid if the * file size isn't known. */ + virtual void file_already_downloaded(const std::string &description, const boost::optional &id, - const boost::optional &file_size) = 0; + const boost::optional &file_size) = 0; /** \brief Invoked when a file fails to download. * diff --git a/src/main.cc b/src/main.cc index 590dc110..748d5267 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,6 +1,6 @@ // main.cc (neƩ testscr.cc) // -// Copyright 1999-2010 Daniel Burrows +// Copyright 1999-2011 Daniel Burrows // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -1107,7 +1107,7 @@ int main(int argc, char *argv[]) { // Connect up the "please consume errors" routine for the // command-line. - consume_errors.connect(sigc::mem_fun(_error, &GlobalError::DumpErrors)); + consume_errors.connect(sigc::mem_fun(_error, (void (GlobalError::*)()) &GlobalError::DumpErrors)); if(update_only || install_only || autoclean_only || clean_only) { -- cgit v1.2.3