pacman: add front end support for repo usage level
Add a "Usage" key to the repo section of the config which allows for the
tokens "Search", "Install", "Upgrade", "All", which correspond to values
in the alpm_db_usage_t enum. Users can specify "Usage" multiple times
for a given repo, or multiple flags per "Usage" line and they will be
OR'd together. If unspecified, the default is full usage of the repo.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
---
I'm wondering if there ought to be a way to specify 'None' here, which would
basically restrict you to only listing the contents of a repo and nothing else.
diff --git a/doc/pacman.conf.5.txt b/doc/pacman.conf.5.txt
index a9c5db3..4f50df9 100644
--- a/doc/pacman.conf.5.txt
+++ b/doc/pacman.conf.5.txt
@@ -226,6 +226,22 @@ even be used for different architectures.
Set the signature verification level for this repository. For more
information, see <<SC,Package and Database Signature Checking>> below.
+*Usage =* ...::
+ Set the usage level for this repository. This option takes a list of tokens
+ which can be any of the following:
+ *Search*;;
+ Enables searching for this repository.
+ *Install*;;
+ Enables installation of packages from this repository during a '--sync'
+ operation.
+ *Upgrade*;;
+ Allows this repository to be a valid source of packages when performing
+ a '--sysupgrade'.
+ *All*;;
+ Enables all of the above features for the repository. This is the default
+ if not specified.
+
+
Package and Database Signature Checking
---------------------------------------
The 'SigLevel' directive is valid in both the `[options]` and repository
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index 4aaacb5..00df6f8 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -636,6 +636,7 @@ struct section_t {
/* db section option gathering */
alpm_siglevel_t siglevel;
alpm_list_t *servers;
+ alpm_db_usage_t usage;
};
/**
@@ -669,6 +670,12 @@ static int finish_section(struct section_t *section, int parse_options)
goto cleanup;
}