FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 07-03-2012, 12:02 AM
Allan McRae
 
Default pacman: add front end support for disabled repos

On 03/07/12 09:45, Dave Reisner wrote:
> Hook up a per-repo 'Disabled' flag in the config for users to mark repos
> as disabled. This can take a boolean value such as 'yes', 'true', or
> '1', or the similar negated 'no', 'false', or '0'.

Why do we need this complexity? Why not just specifying "Disabled"
disables the repo and not specifying does not...


> Signed-off-by: Dave Reisner <dreisner@archlinux.org>
> ---
> It's possible that I'm blowing smoke with my strcasecmp commment...
>
> doc/pacman.conf.5.txt | 7 +++++++
> src/pacman/conf.c | 38 ++++++++++++++++++++++++++++++++++++++
> 2 files changed, 45 insertions(+)
>
> diff --git a/doc/pacman.conf.5.txt b/doc/pacman.conf.5.txt
> index a9c5db3..cc2d88f 100644
> --- a/doc/pacman.conf.5.txt
> +++ b/doc/pacman.conf.5.txt
> @@ -226,6 +226,13 @@ 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.
>
> +*Disabled =* boolean::
> + Allows a repository to be marked as disabled. Disabled repositories will
> + not be searched when looking for updates, but will continue to be refreshed.
> + This option takes a boolean true or false value. True can be the string
> + ``1', ``yes', or ``true', case insensitive. False can be the string ``0',
> + ``no', or ``false', case insensitive.
> +
> 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..4d042aa 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;
> + int disabled;
> };
>
> /**
> @@ -669,6 +670,8 @@ static int finish_section(struct section_t *section, int parse_options)
> goto cleanup;
> }
>
> + alpm_db_set_disabled(db, section->disabled);
> +
> for(i = section->servers; i; i = alpm_list_next(i)) {
> char *value = i->data;
> if(_add_mirror(db, value) != 0) {
> @@ -687,9 +690,29 @@ cleanup:
> section->siglevel = ALPM_SIG_USE_DEFAULT;
> free(section->name);
> section->name = NULL;
> + section->disabled = 0;
> return ret;
> }
>
> +static int string_to_boolean(const char *string)
> +{
> + /* usage of strcasecmp here is allowed since we're comparing
> + * against fixed strings */
> + if(strcasecmp(string, "1") == 0 ||
> + strcasecmp(string, "true") == 0 ||
> + strcasecmp(string, "yes") == 0) {
> + return 1;
> + }
> +
> + if(strcasecmp(string, "0") == 0 ||
> + strcasecmp(string, "false") == 0 ||
> + strcasecmp(string, "no") == 0) {
> + return 0;
> + }
> +
> + return -1;
> +}
> +
> /** The "real" parseconfig. Each "Include" directive will recall this method so
> * recursion and stack depth are limited to 10 levels. The publicly visible
> * parseconfig calls this with a NULL section argument so we can recall from
> @@ -856,6 +879,21 @@ static int _parseconfig(const char *file, struct section_t *section,
> }
> FREELIST(values);
> }
> + } else if(strcmp(key, "Disabled") == 0) {
> + if(value == NULL) {
> + pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: directive '%s' needs a value
"),
> + file, linenum, key);
> + ret = 1;
> + goto cleanup;
> + }
> + section->disabled = string_to_boolean(value);
> + if (section->disabled < 0) {
> + pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: directive '%s' has "
> + "invalid boolean value %s
"),
> + file, linenum, key, value);
> + ret = 1;
> + goto cleanup;
> + }
> } else {
> pm_printf(ALPM_LOG_WARNING,
> _("config file %s, line %d: directive '%s' in section '%s' not recognized.
"),
>
 
Old 07-03-2012, 12:15 AM
Dave Reisner
 
Default pacman: add front end support for disabled repos

On Tue, Jul 03, 2012 at 10:02:03AM +1000, Allan McRae wrote:
> On 03/07/12 09:45, Dave Reisner wrote:
> > Hook up a per-repo 'Disabled' flag in the config for users to mark repos
> > as disabled. This can take a boolean value such as 'yes', 'true', or
> > '1', or the similar negated 'no', 'false', or '0'.
>
> Why do we need this complexity? Why not just specifying "Disabled"
> disables the repo and not specifying does not...
>

We may not. Dan brought up the idea of making this a bit more granular,
but I don't have my IRC logs to recall exactly what was mentioned... he
can weigh in here.

> > Signed-off-by: Dave Reisner <dreisner@archlinux.org>
> > ---
> > It's possible that I'm blowing smoke with my strcasecmp commment...
> >
> > doc/pacman.conf.5.txt | 7 +++++++
> > src/pacman/conf.c | 38 ++++++++++++++++++++++++++++++++++++++
> > 2 files changed, 45 insertions(+)
> >
> > diff --git a/doc/pacman.conf.5.txt b/doc/pacman.conf.5.txt
> > index a9c5db3..cc2d88f 100644
> > --- a/doc/pacman.conf.5.txt
> > +++ b/doc/pacman.conf.5.txt
> > @@ -226,6 +226,13 @@ 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.
> >
> > +*Disabled =* boolean::
> > + Allows a repository to be marked as disabled. Disabled repositories will
> > + not be searched when looking for updates, but will continue to be refreshed.
> > + This option takes a boolean true or false value. True can be the string
> > + ``1', ``yes', or ``true', case insensitive. False can be the string ``0',
> > + ``no', or ``false', case insensitive.
> > +
> > 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..4d042aa 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;
> > + int disabled;
> > };
> >
> > /**
> > @@ -669,6 +670,8 @@ static int finish_section(struct section_t *section, int parse_options)
> > goto cleanup;
> > }
> >
> > + alpm_db_set_disabled(db, section->disabled);
> > +
> > for(i = section->servers; i; i = alpm_list_next(i)) {
> > char *value = i->data;
> > if(_add_mirror(db, value) != 0) {
> > @@ -687,9 +690,29 @@ cleanup:
> > section->siglevel = ALPM_SIG_USE_DEFAULT;
> > free(section->name);
> > section->name = NULL;
> > + section->disabled = 0;
> > return ret;
> > }
> >
> > +static int string_to_boolean(const char *string)
> > +{
> > + /* usage of strcasecmp here is allowed since we're comparing
> > + * against fixed strings */
> > + if(strcasecmp(string, "1") == 0 ||
> > + strcasecmp(string, "true") == 0 ||
> > + strcasecmp(string, "yes") == 0) {
> > + return 1;
> > + }
> > +
> > + if(strcasecmp(string, "0") == 0 ||
> > + strcasecmp(string, "false") == 0 ||
> > + strcasecmp(string, "no") == 0) {
> > + return 0;
> > + }
> > +
> > + return -1;
> > +}
> > +
> > /** The "real" parseconfig. Each "Include" directive will recall this method so
> > * recursion and stack depth are limited to 10 levels. The publicly visible
> > * parseconfig calls this with a NULL section argument so we can recall from
> > @@ -856,6 +879,21 @@ static int _parseconfig(const char *file, struct section_t *section,
> > }
> > FREELIST(values);
> > }
> > + } else if(strcmp(key, "Disabled") == 0) {
> > + if(value == NULL) {
> > + pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: directive '%s' needs a value
"),
> > + file, linenum, key);
> > + ret = 1;
> > + goto cleanup;
> > + }
> > + section->disabled = string_to_boolean(value);
> > + if (section->disabled < 0) {
> > + pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: directive '%s' has "
> > + "invalid boolean value %s
"),
> > + file, linenum, key, value);
> > + ret = 1;
> > + goto cleanup;
> > + }
> > } else {
> > pm_printf(ALPM_LOG_WARNING,
> > _("config file %s, line %d: directive '%s' in section '%s' not recognized.
"),
> >
>
>
>
 
Old 07-03-2012, 12:22 AM
Dan McGee
 
Default pacman: add front end support for disabled repos

On Mon, Jul 2, 2012 at 7:15 PM, Dave Reisner <d@falconindy.com> wrote:
> On Tue, Jul 03, 2012 at 10:02:03AM +1000, Allan McRae wrote:
>> On 03/07/12 09:45, Dave Reisner wrote:
>> > Hook up a per-repo 'Disabled' flag in the config for users to mark repos
>> > as disabled. This can take a boolean value such as 'yes', 'true', or
>> > '1', or the similar negated 'no', 'false', or '0'.
>>
>> Why do we need this complexity? Why not just specifying "Disabled"
>> disables the repo and not specifying does not...
>>
>
> We may not. Dan brought up the idea of making this a bit more granular,
> but I don't have my IRC logs to recall exactly what was mentioned... he
> can weigh in here.

Given that we have no key-only options under repos, I'm leaning
against having those be introduced. I've never been a fan of them in
the [options] section either.

-Dan
 
Old 07-03-2012, 12:50 AM
Allan McRae
 
Default pacman: add front end support for disabled repos

On 03/07/12 10:22, Dan McGee wrote:
> On Mon, Jul 2, 2012 at 7:15 PM, Dave Reisner <d@falconindy.com> wrote:
>> On Tue, Jul 03, 2012 at 10:02:03AM +1000, Allan McRae wrote:
>>> On 03/07/12 09:45, Dave Reisner wrote:
>>>> Hook up a per-repo 'Disabled' flag in the config for users to mark repos
>>>> as disabled. This can take a boolean value such as 'yes', 'true', or
>>>> '1', or the similar negated 'no', 'false', or '0'.
>>>
>>> Why do we need this complexity? Why not just specifying "Disabled"
>>> disables the repo and not specifying does not...
>>>
>>
>> We may not. Dan brought up the idea of making this a bit more granular,
>> but I don't have my IRC logs to recall exactly what was mentioned... he
>> can weigh in here.
>
> Given that we have no key-only options under repos, I'm leaning
> against having those be introduced. I've never been a fan of them in
> the [options] section either.

OK. But do we really need all of True/Yes/1 etc. I just find that
confusing compared to a single "Disabled" flag.

How about:
Usage = All (default)
Usage = Search Install Update


Allan
 
Old 07-03-2012, 01:16 AM
Dave Reisner
 
Default pacman: add front end support for disabled repos

On Tue, Jul 03, 2012 at 10:50:51AM +1000, Allan McRae wrote:
> On 03/07/12 10:22, Dan McGee wrote:
> > On Mon, Jul 2, 2012 at 7:15 PM, Dave Reisner <d@falconindy.com> wrote:
> >> On Tue, Jul 03, 2012 at 10:02:03AM +1000, Allan McRae wrote:
> >>> On 03/07/12 09:45, Dave Reisner wrote:
> >>>> Hook up a per-repo 'Disabled' flag in the config for users to mark repos
> >>>> as disabled. This can take a boolean value such as 'yes', 'true', or
> >>>> '1', or the similar negated 'no', 'false', or '0'.
> >>>
> >>> Why do we need this complexity? Why not just specifying "Disabled"
> >>> disables the repo and not specifying does not...
> >>>
> >>
> >> We may not. Dan brought up the idea of making this a bit more granular,
> >> but I don't have my IRC logs to recall exactly what was mentioned... he
> >> can weigh in here.
> >
> > Given that we have no key-only options under repos, I'm leaning
> > against having those be introduced. I've never been a fan of them in
> > the [options] section either.
>
> OK. But do we really need all of True/Yes/1 etc. I just find that
> confusing compared to a single "Disabled" flag.
>
> How about:
> Usage = All (default)
> Usage = Search Install Update
>
>
> Allan
>

I think I like this.

/me starts a new branch...
 

Thread Tools




All times are GMT. The time now is 11:45 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org