paludis Version 3.0.2
The one true package mangler
paludis::Environment Class Referenceabstract

#include <environment.hh>

Inheritance diagram for paludis::Environment:

Public Member Functions

virtual std::shared_ptr< PackageIDSequence > operator[] (const Selection &) const PALUDIS_ATTRIBUTE((warn_unused_result))=0
virtual const std::shared_ptr< Repository > repository_from_new_config_file (const FSPath &) PALUDIS_ATTRIBUTE((warn_unused_result))=0
MetadataConstIterator begin_metadata () const PALUDIS_ATTRIBUTE((warn_unused_result))
MetadataConstIterator end_metadata () const PALUDIS_ATTRIBUTE((warn_unused_result))
IteratorRange< MetadataConstIterator > metadata () const
MetadataConstIterator find_metadata (const std::string &) const PALUDIS_ATTRIBUTE((warn_unused_result))

Static Protected Member Functions

static const Filter & all_filter () PALUDIS_ATTRIBUTE((warn_unused_result))

Iterate over our repositories

typedef WrappedForwardIterator< RepositoryConstIteratorTag, const std::shared_ptr< Repository > > RepositoryConstIterator
virtual RepositoryConstIterator begin_repositories () const PALUDIS_ATTRIBUTE((warn_unused_result))=0
virtual RepositoryConstIterator end_repositories () const PALUDIS_ATTRIBUTE((warn_unused_result))=0
IteratorRange< RepositoryConstIterator > repositories () const

Basic operations

 Environment (const Environment &)=delete
Environment & operator= (const Environment &)=delete

Choice-related queries

virtual const Tribool want_choice_enabled (const std::shared_ptr< const PackageID > &, const std::shared_ptr< const Choice > &, const UnprefixedChoiceName &) const PALUDIS_ATTRIBUTE((warn_unused_result))=0
virtual const std::string value_for_choice_parameter (const std::shared_ptr< const PackageID > &, const std::shared_ptr< const Choice > &, const UnprefixedChoiceName &) const PALUDIS_ATTRIBUTE((warn_unused_result))=0
virtual std::shared_ptr< const Set< UnprefixedChoiceName > > known_choice_value_names (const std::shared_ptr< const PackageID > &, const std::shared_ptr< const Choice > &) const PALUDIS_ATTRIBUTE((warn_unused_result))=0

Suggestion-related queries

virtual Tribool interest_in_suggestion (const std::shared_ptr< const PackageID > &from_id, const PackageDepSpec &spec) const PALUDIS_ATTRIBUTE((warn_unused_result))=0

Mask-related queries

virtual bool accept_license (const std::string &, const std::shared_ptr< const PackageID > &) const PALUDIS_ATTRIBUTE((warn_unused_result))=0
virtual const std::shared_ptr< const Set< std::string > > expand_licence (const std::string &) const PALUDIS_ATTRIBUTE((warn_unused_result))=0
virtual bool accept_keywords (const std::shared_ptr< const KeywordNameSet > &, const std::shared_ptr< const PackageID > &) const PALUDIS_ATTRIBUTE((warn_unused_result))=0
virtual const std::shared_ptr< const Mask > mask_for_user (const std::shared_ptr< const PackageID > &, const bool will_be_used_for_overridden) const PALUDIS_ATTRIBUTE((warn_unused_result))=0
virtual bool unmasked_by_user (const std::shared_ptr< const PackageID > &, const std::string &) const PALUDIS_ATTRIBUTE((warn_unused_result))=0

System information

virtual std::shared_ptr< const FSPathSequence > bashrc_files () const PALUDIS_ATTRIBUTE((warn_unused_result))=0
virtual std::shared_ptr< const FSPathSequence > syncers_dirs () const PALUDIS_ATTRIBUTE((warn_unused_result))=0
virtual std::shared_ptr< const FSPathSequence > fetchers_dirs () const PALUDIS_ATTRIBUTE((warn_unused_result))=0
virtual std::shared_ptr< const FSPathSequence > hook_dirs () const PALUDIS_ATTRIBUTE((warn_unused_result))=0
virtual std::string reduced_username () const =0
virtual uid_t reduced_uid () const =0
virtual gid_t reduced_gid () const =0
virtual bool is_paludis_package (const QualifiedPackageName &) const PALUDIS_ATTRIBUTE((warn_unused_result))=0

Mirror information

virtual std::shared_ptr< const MirrorsSequence > mirrors (const std::string &) const PALUDIS_ATTRIBUTE((warn_unused_result))=0

Package sets

virtual void add_set (const SetName &base_name, const SetName &combined_name, const std::function< std::shared_ptr< const SetSpecTree >()> &func, const bool combine) const =0
virtual std::shared_ptr< const SetNameSet > set_names () const PALUDIS_ATTRIBUTE((warn_unused_result))=0
virtual const std::shared_ptr< const SetSpecTree > set (const SetName &) const PALUDIS_ATTRIBUTE((warn_unused_result))=0

Hook methods

virtual HookResult perform_hook (const Hook &, const std::shared_ptr< OutputManager > &optional_output_manager) const PALUDIS_ATTRIBUTE((warn_unused_result))=0

Distribution information

virtual std::string distribution () const PALUDIS_ATTRIBUTE((warn_unused_result))=0

World and configuration functionality

virtual bool add_to_world (const QualifiedPackageName &) const =0
virtual bool add_to_world (const SetName &) const =0
virtual bool remove_from_world (const QualifiedPackageName &) const =0
virtual bool remove_from_world (const SetName &) const =0
virtual void update_config_files_for_package_move (const PackageDepSpec &, const QualifiedPackageName &) const =0

Specific metadata keys

virtual const std::shared_ptr< const MetadataValueKey< FSPath > > preferred_root_key () const =0
virtual const std::shared_ptr< const MetadataValueKey< FSPath > > system_root_key () const =0
virtual const std::shared_ptr< const MetadataValueKey< std::string > > format_key () const =0
virtual const std::shared_ptr< const MetadataValueKey< FSPath > > config_location_key () const =0

Output management

virtual const std::shared_ptr< OutputManager > create_output_manager (const CreateOutputManagerInfo &) const =0
virtual NotifierCallbackID add_notifier_callback (const NotifierCallbackFunction &)=0
virtual void remove_notifier_callback (const NotifierCallbackID)=0
virtual void trigger_notifier_callback (const NotifierCallbackEvent &) const =0

Repositories

virtual void add_repository (int importance, const std::shared_ptr< Repository > &)=0
virtual const std::shared_ptr< const Repository > fetch_repository (const RepositoryName &) const PALUDIS_ATTRIBUTE((warn_unused_result))=0
virtual const std::shared_ptr< Repository > fetch_repository (const RepositoryName &) PALUDIS_ATTRIBUTE((warn_unused_result))=0
virtual bool has_repository_named (const RepositoryName &) const PALUDIS_ATTRIBUTE((warn_unused_result))=0
virtual QualifiedPackageName fetch_unique_qualified_package_name (const PackageNamePart &, const Filter &=all_filter(), const bool disambiguate=true) const PALUDIS_ATTRIBUTE((warn_unused_result))=0
virtual bool more_important_than (const RepositoryName &, const RepositoryName &) const PALUDIS_ATTRIBUTE((warn_unused_result))=0

Additional Inherited Members

typedef WrappedForwardIterator< MetadataConstIteratorTag, const std::shared_ptr< const MetadataKey > > MetadataConstIterator
Protected Member Functions inherited from paludis::MetadataKeyHolder
virtual void add_metadata_key (const std::shared_ptr< const MetadataKey > &) const
virtual void clear_metadata_keys () const
virtual void need_keys_added () const =0

Detailed Description

Represents a working environment, which contains an available packages database and provides various methods for querying package visibility and options.

Holds a number of Repository instances.

Environment itself is purely an interface class. Actual Environment implementations usually descend from EnvironmentImplementation, which provides much of the common implementation details. EnvironmentFactory is often used to create the appropriate Environment subclass for an application.

See also
EnvironmentFactory
EnvironmentImplementation
Repository

Member Function Documentation

◆ accept_keywords()

virtual bool paludis::Environment::accept_keywords ( const std::shared_ptr< const KeywordNameSet > & ,
const std::shared_ptr< const PackageID > &  ) const
pure virtual

Do we accept any of the specified keywords for a particular package?

If the collection includes "*", should return true.

Used by PackageID implementations. Generally PackageID's masks methods should be used rather than calling this directly.

Since
0.58 takes id by shared_ptr

Implemented in paludis::TestEnvironment.

References PALUDIS_ATTRIBUTE.

◆ accept_license()

virtual bool paludis::Environment::accept_license ( const std::string & ,
const std::shared_ptr< const PackageID > &  ) const
pure virtual

Do we accept a particular license for a particular package?

Used by PackageID implementations. Generally PackageID's masks methods should be used rather than calling this directly.

Since
0.58 takes id by shared_ptr

Implemented in paludis::TestEnvironment.

References PALUDIS_ATTRIBUTE.

◆ add_notifier_callback()

virtual NotifierCallbackID paludis::Environment::add_notifier_callback ( const NotifierCallbackFunction & )
pure virtual

Set a callback function to use when a particular event occurs.

The return value can be passed to remove_notifier_callback.

Since
0.40

Implemented in paludis::EnvironmentImplementation.

References add_notifier_callback().

Referenced by add_notifier_callback().

◆ add_repository()

virtual void paludis::Environment::add_repository ( int importance,
const std::shared_ptr< Repository > &  )
pure virtual

Add a repository.

Since
0.61 is in Environment rather than PackageDatabase
Exceptions
DuplicateRepositoryErrorif a Repository with the same name as the new Repository already exists in our collection.

Implemented in paludis::EnvironmentImplementation.

References add_repository().

Referenced by add_repository().

◆ add_set()

virtual void paludis::Environment::add_set ( const SetName & base_name,
const SetName & combined_name,
const std::function< std::shared_ptr< const SetSpecTree >()> & func,
const bool combine ) const
pure virtual

Add a package set.

Generally called by repositories, when Repository::populate_sets is called.

Parameters
base_nameThe basic name of the set, such as 'security'.
combined_nameThe name to use for this set when combine is true, such as 'security.myrepo'. If combine is false, should be the same as base_name.
funcA function that returns the set.
combineIf true, rename the set from foo to foo.reponame, and make the foo set contain foo.reponame, along with any other repositories' sets named foo. If false, throw if the set already exists.
Since
0.40

Implemented in paludis::EnvironmentImplementation.

References add_set().

Referenced by add_set().

◆ add_to_world() [1/2]

virtual bool paludis::Environment::add_to_world ( const QualifiedPackageName & ) const
pure virtual

Add this package to world.

Returns
whether anything was added
Since
0.49

Implemented in paludis::TestEnvironment.

References add_to_world().

Referenced by add_to_world(), and add_to_world().

◆ add_to_world() [2/2]

virtual bool paludis::Environment::add_to_world ( const SetName & ) const
pure virtual

Add this set to world.

Returns
whether anything was added
Since
0.49

Implemented in paludis::TestEnvironment.

References add_to_world().

◆ bashrc_files()

virtual std::shared_ptr< const FSPathSequence > paludis::Environment::bashrc_files ( ) const
pure virtual

Return a collection of bashrc files to be used by the various components that are implemented in bash.

Implemented in paludis::EnvironmentImplementation.

References PALUDIS_ATTRIBUTE.

◆ config_location_key()

virtual const std::shared_ptr< const MetadataValueKey< FSPath > > paludis::Environment::config_location_key ( ) const
pure virtual

The config_location_key, if non-zero, specifies the location of the configuration file or directory, the contents of which depends on the format returned by format_key.

Implemented in paludis::TestEnvironment.

References config_location_key().

Referenced by config_location_key().

◆ create_output_manager()

virtual const std::shared_ptr< OutputManager > paludis::Environment::create_output_manager ( const CreateOutputManagerInfo & ) const
pure virtual

Create an output manager.

Since
0.36

Implemented in paludis::TestEnvironment.

References create_output_manager().

Referenced by create_output_manager().

◆ expand_licence()

virtual const std::shared_ptr< const Set< std::string > > paludis::Environment::expand_licence ( const std::string & ) const
pure virtual

Expand a licence group into its constituent licences, recursively (if any of our repositories thinks it is a group).

The original group is included in the result.

Since
0.68

Implemented in paludis::EnvironmentImplementation.

References PALUDIS_ATTRIBUTE.

◆ fetch_repository() [1/2]

virtual const std::shared_ptr< const Repository > paludis::Environment::fetch_repository ( const RepositoryName & ) const
pure virtual

Fetch a named repository.

Since
0.61 is in Environment rather than PackageDatabase

Implemented in paludis::EnvironmentImplementation.

References fetch_repository(), and PALUDIS_ATTRIBUTE.

Referenced by fetch_repository(), and fetch_repository().

◆ fetch_repository() [2/2]

virtual const std::shared_ptr< Repository > paludis::Environment::fetch_repository ( const RepositoryName & )
pure virtual

Fetch a named repository.

Since
0.61 is in Environment rather than PackageDatabase

Implemented in paludis::EnvironmentImplementation.

References fetch_repository(), and PALUDIS_ATTRIBUTE.

◆ fetch_unique_qualified_package_name()

virtual QualifiedPackageName paludis::Environment::fetch_unique_qualified_package_name ( const PackageNamePart & ,
const Filter & = all_filter(),
const bool disambiguate = true ) const
pure virtual

Disambiguate a package name. If a filter is specified, limit the potential results to packages that match.

Exceptions
AmbiguousPackageNameErrorif there is no unambiguous disambiguation. If disambiguate is set to false, the exception will be always thrown in presence of ambiguity.
Since
0.56 takes the disambiguate flag.
0.61 is in Environment rather than PackageDatabase

Implemented in paludis::EnvironmentImplementation.

References fetch_unique_qualified_package_name(), and PALUDIS_ATTRIBUTE.

Referenced by fetch_unique_qualified_package_name().

◆ fetchers_dirs()

virtual std::shared_ptr< const FSPathSequence > paludis::Environment::fetchers_dirs ( ) const
pure virtual

Return directories to search for fetcher scripts.

Implemented in paludis::EnvironmentImplementation.

References fetchers_dirs(), and PALUDIS_ATTRIBUTE.

Referenced by fetchers_dirs().

◆ format_key()

virtual const std::shared_ptr< const MetadataValueKey< std::string > > paludis::Environment::format_key ( ) const
pure virtual

The format_key, if non-zero, holds our environment's format. Environment implementations should not return zero here, but clients should still check.

Implemented in paludis::TestEnvironment.

References format_key().

Referenced by format_key().

◆ has_repository_named()

virtual bool paludis::Environment::has_repository_named ( const RepositoryName & ) const
pure virtual

Do we have a named repository?

Since
0.61 is in Environment rather than PackageDatabase

Implemented in paludis::EnvironmentImplementation.

References has_repository_named(), and PALUDIS_ATTRIBUTE.

Referenced by has_repository_named().

◆ hook_dirs()

virtual std::shared_ptr< const FSPathSequence > paludis::Environment::hook_dirs ( ) const
pure virtual

Return directories to search for hooks.

Implemented in paludis::TestEnvironment.

References hook_dirs(), and PALUDIS_ATTRIBUTE.

Referenced by hook_dirs().

◆ interest_in_suggestion()

virtual Tribool paludis::Environment::interest_in_suggestion ( const std::shared_ptr< const PackageID > & from_id,
const PackageDepSpec & spec ) const
pure virtual

Do we want to ignore or take a particular suggestion from a particular package?

Command line things override this.

Since
0.58

Implemented in paludis::TestEnvironment.

References PALUDIS_ATTRIBUTE.

◆ is_paludis_package()

virtual bool paludis::Environment::is_paludis_package ( const QualifiedPackageName & ) const
pure virtual

Is the specified package Paludis?

Used by InstallTask to decide whether to exec() after installing a package.

Implemented in paludis::EnvironmentImplementation.

References is_paludis_package(), and PALUDIS_ATTRIBUTE.

Referenced by is_paludis_package().

◆ known_choice_value_names()

virtual std::shared_ptr< const Set< UnprefixedChoiceName > > paludis::Environment::known_choice_value_names ( const std::shared_ptr< const PackageID > & ,
const std::shared_ptr< const Choice > &  ) const
pure virtual

Return a collection of known value names for a particular choice.

Only for use by Repository, to get defaults from the environment. Clients should query the metadata key directly.

This is to deal with cases like USE_EXPAND values, where the repository doesn't know all possible values.

Implemented in paludis::TestEnvironment.

References PALUDIS_ATTRIBUTE.

◆ mask_for_user()

virtual const std::shared_ptr< const Mask > paludis::Environment::mask_for_user ( const std::shared_ptr< const PackageID > & ,
const bool will_be_used_for_overridden ) const
pure virtual

Do we have a 'user' mask for a particular package?

Returns a zero pointer if no.

If the second parameter is true, return a Mask suitable for being added to an OverriddenMask.

Used by PackageID implementations. Generally PackageID's masks methods should be used rather than calling this directly.

Since
0.58 takes id by shared_ptr

Implemented in paludis::TestEnvironment.

References PALUDIS_ATTRIBUTE.

◆ mirrors()

virtual std::shared_ptr< const MirrorsSequence > paludis::Environment::mirrors ( const std::string & ) const
pure virtual

Return the mirror URI prefixes for a named mirror.

Implemented in paludis::TestEnvironment.

References mirrors(), and PALUDIS_ATTRIBUTE.

Referenced by mirrors().

◆ more_important_than()

virtual bool paludis::Environment::more_important_than ( const RepositoryName & ,
const RepositoryName &  ) const
pure virtual

Return true if the first repository is more important than the second.

Since
0.61 is in Environment rather than PackageDatabase

Implemented in paludis::EnvironmentImplementation.

References more_important_than(), and PALUDIS_ATTRIBUTE.

Referenced by more_important_than().

◆ operator[]()

virtual std::shared_ptr< PackageIDSequence > paludis::Environment::operator[] ( const Selection & ) const
pure virtual

Select some packages.

Implemented in paludis::EnvironmentImplementation.

References PALUDIS_ATTRIBUTE.

◆ perform_hook()

virtual HookResult paludis::Environment::perform_hook ( const Hook & ,
const std::shared_ptr< OutputManager > & optional_output_manager ) const
pure virtual

Perform a hook.

Since
0.53 takes optional_output_manager

Implemented in paludis::TestEnvironment.

References PALUDIS_ATTRIBUTE, and perform_hook().

Referenced by perform_hook().

◆ preferred_root_key()

virtual const std::shared_ptr< const MetadataValueKey< FSPath > > paludis::Environment::preferred_root_key ( ) const
pure virtual

The preferred_root_key, which must not be null, specifies the preferred filesystem root for actions.

Since
0.54

Implemented in paludis::TestEnvironment.

References preferred_root_key().

Referenced by preferred_root_key().

◆ reduced_gid()

virtual gid_t paludis::Environment::reduced_gid ( ) const
pure virtual

Group id to use when reduced privs are permissible.

Implemented in paludis::TestEnvironment.

References reduced_gid().

Referenced by reduced_gid().

◆ reduced_uid()

virtual uid_t paludis::Environment::reduced_uid ( ) const
pure virtual

User id to use when reduced privs are permissible.

Implemented in paludis::TestEnvironment.

References reduced_uid().

Referenced by reduced_uid().

◆ reduced_username()

virtual std::string paludis::Environment::reduced_username ( ) const
pure virtual

User name to use when reduced privs are permissible.

Implemented in paludis::TestEnvironment.

References reduced_username().

Referenced by reduced_username().

◆ remove_from_world() [1/2]

virtual bool paludis::Environment::remove_from_world ( const QualifiedPackageName & ) const
pure virtual

Remove this package from world, if it is present.

Returns
whether anything was removed
Since
0.49

Implemented in paludis::TestEnvironment.

References remove_from_world().

Referenced by remove_from_world(), and remove_from_world().

◆ remove_from_world() [2/2]

virtual bool paludis::Environment::remove_from_world ( const SetName & ) const
pure virtual

Remove this set from world, if it is present.

Returns
whether anything was removed
Since
0.49

Implemented in paludis::TestEnvironment.

References remove_from_world().

◆ remove_notifier_callback()

virtual void paludis::Environment::remove_notifier_callback ( const NotifierCallbackID )
pure virtual

Remove a function added with add_notifier_callback.

Since
0.40

Implemented in paludis::EnvironmentImplementation.

References remove_notifier_callback().

Referenced by remove_notifier_callback().

◆ repository_from_new_config_file()

virtual const std::shared_ptr< Repository > paludis::Environment::repository_from_new_config_file ( const FSPath & )
pure virtual

Create a repository from a particular file.

Does not add the repository to the Environment.

This allows RepositoryRepository to add a repo config file, then sync that repo. If you aren't RepositoryRepository you shouldn't be calling this.

Since
0.48

Implemented in paludis::TestEnvironment.

References PALUDIS_ATTRIBUTE.

◆ set()

virtual const std::shared_ptr< const SetSpecTree > paludis::Environment::set ( const SetName & ) const
pure virtual

Return a named set.

If the named set is not known, returns a zero pointer.

Implemented in paludis::EnvironmentImplementation.

References PALUDIS_ATTRIBUTE, and set().

Referenced by set().

◆ set_names()

virtual std::shared_ptr< const SetNameSet > paludis::Environment::set_names ( ) const
pure virtual

Return all known named sets.

Implemented in paludis::EnvironmentImplementation.

References PALUDIS_ATTRIBUTE, and set_names().

Referenced by set_names().

◆ syncers_dirs()

virtual std::shared_ptr< const FSPathSequence > paludis::Environment::syncers_dirs ( ) const
pure virtual

Return directories to search for syncer scripts.

Implemented in paludis::EnvironmentImplementation.

References PALUDIS_ATTRIBUTE, and syncers_dirs().

Referenced by syncers_dirs().

◆ system_root_key()

virtual const std::shared_ptr< const MetadataValueKey< FSPath > > paludis::Environment::system_root_key ( ) const
pure virtual

The system_root_key, which must not be null, specifies the filesystem root for dependencies etc. This is usually "/", unless something funky is going on.

Since
0.55

Implemented in paludis::TestEnvironment.

References system_root_key().

Referenced by system_root_key().

◆ trigger_notifier_callback()

virtual void paludis::Environment::trigger_notifier_callback ( const NotifierCallbackEvent & ) const
pure virtual

Trigger a notifier callback.

Since
0.40

Implemented in paludis::EnvironmentImplementation.

References trigger_notifier_callback().

Referenced by trigger_notifier_callback().

◆ unmasked_by_user()

virtual bool paludis::Environment::unmasked_by_user ( const std::shared_ptr< const PackageID > & ,
const std::string &  ) const
pure virtual

Do we have a user unmask for a particular package?

This is only applied to repository and profile style masks, not keywords, licences etc. If true, user_mask shouldn't be used.

Used by PackageID implementations. Generally PackageID's masks methods should be used rather than calling this directly.

Since
0.58 takes id by shared_ptr
0.60 takes optional extra reason string

Implemented in paludis::TestEnvironment.

References PALUDIS_ATTRIBUTE.

◆ update_config_files_for_package_move()

virtual void paludis::Environment::update_config_files_for_package_move ( const PackageDepSpec & ,
const QualifiedPackageName &  ) const
pure virtual

Where possible, update configuration files with the first spec to use the second package name.

Does not necessarily invalidate any in-memory configuration.

Since
0.48

Implemented in paludis::TestEnvironment.

References update_config_files_for_package_move().

Referenced by update_config_files_for_package_move().

◆ value_for_choice_parameter()

virtual const std::string paludis::Environment::value_for_choice_parameter ( const std::shared_ptr< const PackageID > & ,
const std::shared_ptr< const Choice > & ,
const UnprefixedChoiceName &  ) const
pure virtual

What string value, if any, is set for the parameter for a particular choice for a particular package?

There is no difference between "not set" and "set to an empty string".

Only for use by Repository, to get defaults from the environment. Clients should query the metadata key directly.

The third parameter is the name of the value, which might not have been created yet.

Since
0.40

Implemented in paludis::TestEnvironment.

References PALUDIS_ATTRIBUTE.

◆ want_choice_enabled()

virtual const Tribool paludis::Environment::want_choice_enabled ( const std::shared_ptr< const PackageID > & ,
const std::shared_ptr< const Choice > & ,
const UnprefixedChoiceName &  ) const
pure virtual

Do we want a choice enabled for a particular package?

Only for use by Repository, to get defaults from the environment. Clients should query the metadata key directly.

The third parameter is the name of the value, which might not have been created yet.

Implemented in paludis::TestEnvironment.

References PALUDIS_ATTRIBUTE.


The documentation for this class was generated from the following file: