paludis  Version 2.6.0
test_environment.hh
Go to the documentation of this file.
1 /* vim: set sw=4 sts=4 et foldmethod=syntax : */
2 
3 /*
4  * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2014 Ciaran McCreesh
5  *
6  * This file is part of the Paludis package manager. Paludis is free software;
7  * you can redistribute it and/or modify it under the terms of the GNU General
8  * Public License version 2, as published by the Free Software Foundation.
9  *
10  * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
11  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
17  * Place, Suite 330, Boston, MA 02111-1307 USA
18  */
19 
20 #ifndef PALUDIS_GUARD_PALUDIS_TEST_ENVIRONMENT_HH
21 #define PALUDIS_GUARD_PALUDIS_TEST_ENVIRONMENT_HH 1
22 
25 #include <paludis/util/pimp.hh>
26 
27 /** \file
28  * Declarations for the TestEnvironment class.
29  *
30  * \ingroup grptestenvironment
31  */
32 
33 namespace paludis
34 {
35  /**
36  * A TestEnvironment is an environment used during testing that lets us
37  * control all the options rather than reading them from configuration
38  * files.
39  *
40  * \ingroup grptestenvironment
41  */
44  {
45  private:
47 
48  protected:
49  virtual void need_keys_added() const;
50  virtual void populate_sets() const;
51 
52  public:
53  ///\name Basic operations
54  ///\{
55 
57  TestEnvironment(bool);
58  TestEnvironment(const FSPath &);
59  TestEnvironment(const FSPath &, bool);
60 
61  ~TestEnvironment();
62 
63  ///\}
64 
65  virtual bool accept_license(const std::string &, const std::shared_ptr<const PackageID> &) const
66  PALUDIS_ATTRIBUTE((warn_unused_result));
67 
68  virtual bool accept_keywords(const std::shared_ptr<const KeywordNameSet> &, const std::shared_ptr<const PackageID> &) const
69  PALUDIS_ATTRIBUTE((warn_unused_result));
70 
71  virtual const std::shared_ptr<const Mask> mask_for_user(const std::shared_ptr<const PackageID> &, const bool) const
72  PALUDIS_ATTRIBUTE((warn_unused_result));
73 
74  virtual bool unmasked_by_user(const std::shared_ptr<const PackageID> &, const std::string &) const
75  PALUDIS_ATTRIBUTE((warn_unused_result));
76 
77  virtual std::shared_ptr<const FSPathSequence> hook_dirs() const
78  PALUDIS_ATTRIBUTE((warn_unused_result));
79 
80  virtual uid_t reduced_uid() const;
81 
82  virtual gid_t reduced_gid() const;
83 
84  virtual std::shared_ptr<const MirrorsSequence> mirrors(const std::string &) const
85  PALUDIS_ATTRIBUTE((warn_unused_result));
86 
87  virtual HookResult perform_hook(
88  const Hook &,
89  const std::shared_ptr<OutputManager> &) const
90  PALUDIS_ATTRIBUTE((warn_unused_result));
91 
92  virtual bool add_to_world(const QualifiedPackageName &) const;
93 
94  virtual bool add_to_world(const SetName &) const;
95 
96  virtual bool remove_from_world(const QualifiedPackageName &) const;
97 
98  virtual bool remove_from_world(const SetName &) const;
99 
100  virtual const std::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
101  virtual const std::shared_ptr<const MetadataValueKey<FSPath> > config_location_key() const;
102  virtual const std::shared_ptr<const MetadataValueKey<FSPath> > preferred_root_key() const;
103  virtual const std::shared_ptr<const MetadataValueKey<FSPath> > system_root_key() const;
104 
105  virtual Tribool interest_in_suggestion(
106  const std::shared_ptr<const PackageID> & from_id,
107  const PackageDepSpec & spec) const;
108 
109  virtual const Tribool want_choice_enabled(
110  const std::shared_ptr<const PackageID> &,
111  const std::shared_ptr<const Choice> &,
112  const UnprefixedChoiceName &
113  ) const
114  PALUDIS_ATTRIBUTE((warn_unused_result));
115 
116  virtual const std::string value_for_choice_parameter(
117  const std::shared_ptr<const PackageID> &,
118  const std::shared_ptr<const Choice> &,
119  const UnprefixedChoiceName &
120  ) const
121  PALUDIS_ATTRIBUTE((warn_unused_result));
122 
123  virtual std::shared_ptr<const Set<UnprefixedChoiceName> > known_choice_value_names(
124  const std::shared_ptr<const PackageID> &,
125  const std::shared_ptr<const Choice> &
126  ) const
127  PALUDIS_ATTRIBUTE((warn_unused_result));
128 
129  virtual const std::shared_ptr<OutputManager> create_output_manager(
130  const CreateOutputManagerInfo &) const;
131 
132  void set_want_choice_enabled(const ChoicePrefixName &, const UnprefixedChoiceName &, const Tribool);
133 
134  virtual const std::shared_ptr<Repository> repository_from_new_config_file(
135  const FSPath &) PALUDIS_ATTRIBUTE((noreturn));
136 
137  virtual void update_config_files_for_package_move(
138  const PackageDepSpec &, const QualifiedPackageName &) const;
139 
140  void set_system_root(const FSPath &);
141  };
142 }
143 
144 #endif
Definition: pimp.hh:51
Definition: about_metadata-fwd.hh:23
Definition: test_environment.hh:42
Definition: name.hh:110
Definition: hook.hh:61
Definition: dep_spec.hh:345
Definition: environment_implementation.hh:49
Definition: hook.hh:74
Definition: wrapped_value-fwd.hh:29
Definition: fs_path.hh:33
Definition: tribool.hh:27
Definition: create_output_manager_info.hh:43
#define PALUDIS_ATTRIBUTE(x)
Definition: attributes.hh:53
#define PALUDIS_VISIBLE
Definition: attributes.hh:59