diff options
author | Daniel Burrows <Daniel Burrows Daniel_Burrows@alumni.brown.edu> | 2010-06-18 10:19:17 -0700 |
---|---|---|
committer | Daniel Burrows <Daniel Burrows Daniel_Burrows@alumni.brown.edu> | 2010-06-18 10:19:17 -0700 |
commit | 94121f6a1f3e17926b5cb099159d91415fddc5f2 (patch) | |
tree | 87ec284fb67ec29e56df629b2c32b67d15643e5d | |
parent | 4262f66092d24235f89cf88819cf31766bea8467 (diff) | |
download | aptitude-94121f6a1f3e17926b5cb099159d91415fddc5f2.tar.gz |
Extract the declarations of the global pointers to apt structures into a separate file to reduce test dependencies.
No reason for tests to pull in half of src/generic/apt just because a module
linked into the test happens to reference a global pointer.
-rw-r--r-- | src/generic/apt/Makefile.am | 1 | ||||
-rw-r--r-- | src/generic/apt/SConscript | 1 | ||||
-rw-r--r-- | src/generic/apt/apt.cc | 7 | ||||
-rw-r--r-- | src/generic/apt/globals.cc | 49 | ||||
-rw-r--r-- | tests/SConscript | 35 |
5 files changed, 61 insertions, 32 deletions
diff --git a/src/generic/apt/Makefile.am b/src/generic/apt/Makefile.am index 0c9329ca..ca5f9133 100644 --- a/src/generic/apt/Makefile.am +++ b/src/generic/apt/Makefile.am @@ -51,6 +51,7 @@ libgeneric_apt_a_SOURCES = \ download_signal_log.h \ dump_packages.cc \ dump_packages.h \ + globals.cc \ infer_reason.cc \ infer_reason.h \ log.cc \ diff --git a/src/generic/apt/SConscript b/src/generic/apt/SConscript index 4c7f5cea..537bb41a 100644 --- a/src/generic/apt/SConscript +++ b/src/generic/apt/SConscript @@ -39,6 +39,7 @@ toplevel_srcs = map(File, [ 'download_update_manager.h', 'dump_packages.cc', 'dump_packages.h', + 'globals.cc', 'infer_reason.cc', 'infer_reason.h', 'log.cc', diff --git a/src/generic/apt/apt.cc b/src/generic/apt/apt.cc index dea5cc85..c535dcfe 100644 --- a/src/generic/apt/apt.cc +++ b/src/generic/apt/apt.cc @@ -68,18 +68,11 @@ static interesting_state *cached_deps_interesting = NULL; // pointer in the following table is set to 1 when a result is cached: static pkgCache::Dependency **cached_surrounding_or = NULL; -aptitudeCacheFile *apt_cache_file=NULL; -signalling_config *aptcfg=NULL; -pkgRecords *apt_package_records=NULL; -pkgSourceList *apt_source_list=NULL; -undo_list *apt_undos=NULL; pkg_hier *user_pkg_hier=NULL; -resolver_manager *resman = NULL; string *pendingerr=NULL; bool erroriswarning=false; -boost::shared_ptr<aptitude::util::file_cache> download_cache; // Set to "true" if we have a version of the apt library with // support for overriding configuration settings via RootDir. diff --git a/src/generic/apt/globals.cc b/src/generic/apt/globals.cc new file mode 100644 index 00000000..5f7c247c --- /dev/null +++ b/src/generic/apt/globals.cc @@ -0,0 +1,49 @@ +/** \file globals.cc */ + +// Copyright (C) 2010 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 the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#include <boost/shared_ptr.hpp> + +class aptcfg; +class aptitudeCacheFile; +class pkgRecords; +class pkgSourceList; +class resolver_manager; +class signalling_config; +class undo_list; + +namespace aptitude +{ + namespace util + { + class file_cache; + } +} + +// Definitions of global pointers exposed in apt.h. They are defined +// here so that test code can get away with just linking in globals.o +// rather than apt.o and everything it requires. +aptitudeCacheFile *apt_cache_file=NULL; +signalling_config *aptcfg=NULL; +pkgRecords *apt_package_records=NULL; +pkgSourceList *apt_source_list=NULL; +undo_list *apt_undos=NULL; +resolver_manager *resman = NULL; + +boost::shared_ptr<aptitude::util::file_cache> download_cache; + diff --git a/tests/SConscript b/tests/SConscript index 5248dbe4..86b8ba35 100644 --- a/tests/SConscript +++ b/tests/SConscript @@ -40,6 +40,7 @@ cppunit_test_extra_deps = [ '../src/generic/apt/config_signal.o', '../src/generic/apt/download_queue.o', '../src/generic/apt/dump_packages.o', + '../src/generic/apt/globals.o', '../src/generic/apt/matching/compare_patterns.o', '../src/generic/apt/matching/match.o', '../src/generic/apt/matching/parse.o', @@ -74,39 +75,19 @@ boost_test_sources = [ ] boost_test_extra_deps = [ - '../src/loggers.o', - '../src/generic/apt/apt.o', - '../src/generic/apt/aptcache.o', - '../src/generic/apt/aptitude_resolver.o', - '../src/generic/apt/aptitude_resolver_cost_settings.o', - '../src/generic/apt/aptitude_resolver_cost_syntax.o', - '../src/generic/apt/aptitude_resolver_cost_types.o', - '../src/generic/apt/aptitude_resolver_universe.o', - '../src/generic/apt/aptitudepolicy.o', - '../src/generic/apt/config_signal.o', - '../src/generic/apt/download_queue.o', - '../src/generic/apt/dump_packages.o', + '../src/generic/apt/globals.o', '../src/generic/apt/matching/compare_patterns.o', - '../src/generic/apt/matching/match.o', '../src/generic/apt/matching/parse.o', '../src/generic/apt/matching/pattern.o', - '../src/generic/apt/matching/serialize.o', - '../src/generic/apt/pkg_hier.o', - '../src/generic/apt/resolver_manager.o', - '../src/generic/apt/tags.o', - '../src/generic/apt/tasks.o', - '../src/generic/problemresolver/cost.o', - '../src/generic/problemresolver/cost_limits.o', - '../src/generic/problemresolver/incremental_expression.o', + '../src/gtk/controllers/search_input.o', + '../src/gtk/views/search_input.o', '../src/generic/util/file_cache.o', '../src/generic/util/logging.o', '../src/generic/util/refcounted_base.o', '../src/generic/util/sqlite.o', '../src/generic/util/temp.o', - '../src/generic/util/undo.o', '../src/generic/util/util.o', - '../src/gtk/controllers/search_input.o', - '../src/gtk/views/search_input.o', + '../src/loggers.o', ] gtest_test_sources = [ @@ -121,13 +102,17 @@ gtest_test_sources = [ gtest_test_extra_deps = [ '../src/cmdline/cmdline_progress_display.o', + '../src/cmdline/cmdline_progress_throttle.o', '../src/cmdline/cmdline_search_progress.o', '../src/cmdline/mocks/teletype.o', '../src/cmdline/mocks/terminal.o', - '../src/cmdline/mocks/transient_message.o', '../src/cmdline/terminal.o', '../src/cmdline/transient_message.o', + '../src/generic/apt/globals.o', '../src/generic/util/logging.o', + '../src/generic/util/progress_info.o', + '../src/generic/util/util.o', + '../src/loggers.o', ] test_data_files = [ |