Re: [pacman-dev] Remove skipped warning message for already installed packages when --needed is specified?

2020-12-06 Thread Allan McRae
On 7/12/20 5:05 am, Daan De Meyer wrote:
> Hi,
> 
> I recently added --needed to pacman's invocation in mkosi but noticed
> that even when --needed is specified, pacman still prints warning
> messages for packages that it's skipping because they are already
> installed. My intuition was that by enabling --needed, I was
> explicitly telling pacman that there might be packages that are
> already installed in the packages that I'm installing and that I want
> to skip those and not be warned about them. The skipping works fine
> but I still get warnings. Would it make sense to remove the skipped
> warning message for packages that are already installed when --needed
> is specified since the user is explicitly requesting this behavior?
> 

I'm on the fence here.  You have explicitly asked for packages to be
installed by providing them on the command line, but then --needed says
they don't need installed.  That does seem warning-ish to me.

Allan


Re: [pacman-dev] Alternatives system

2020-12-06 Thread Allan McRae
On 7/12/20 3:03 am, Lone_Wolf wrote:
> 
> On 01-04-2019 01:56, Allan McRae wrote:
>> Hi all,
>>
>> I plan to finish implementing an alternatives system for pacman post 5.2
>> release:
>> https://wiki.archlinux.org/index.php/User:Allan/Alternatives
>>
>> Any comments or suggestions?
>>
>> Thanks,
>> Allan
> 
> 
> pacman 6 .0 alpha has been released, but there's no sign of an
> alternatives system I can find.
> 
> 
> The descriptions suggest the alternatives system could improve at least
> one of my aur packages by  a lot.
> 
> Is an alternatives system still on the roadmap ?
> 

It is on the roadmap.  Unlikely for 6.0, unless I feel motivated over
the upcoming holiday season.

Allan


[pacman-dev] Remove skipped warning message for already installed packages when --needed is specified?

2020-12-06 Thread Daan De Meyer
Hi,

I recently added --needed to pacman's invocation in mkosi but noticed
that even when --needed is specified, pacman still prints warning
messages for packages that it's skipping because they are already
installed. My intuition was that by enabling --needed, I was
explicitly telling pacman that there might be packages that are
already installed in the packages that I'm installing and that I want
to skip those and not be warned about them. The skipping works fine
but I still get warnings. Would it make sense to remove the skipped
warning message for packages that are already installed when --needed
is specified since the user is explicitly requesting this behavior?

Cheers,

Daan


Re: [pacman-dev] [PATCH] Implement TotalDownload functionality

2020-12-06 Thread Anatol Pomozov
Hi

Missed 2 other comments:

On Sun, Dec 6, 2020 at 12:02 AM Allan McRae  wrote:
>
> On 6/12/20 4:39 am, Anatol Pomozov wrote:
> > With the recent 'multibar' interface changes TotalDownload has been 
> > disabled.
> > Now we have a new UI and we need to find another way to display this
> > information.
> >
> > When 'TotalDownload' config option is enabled we are going to have an extra
> > progress bar at the bottom of the screen that shows how much of the entire
> > download has been completed.
> >
> > Closes FS#68202
>
> Thanks - that progress bar looks good.
>
> >
> > Signed-off-by: Anatol Pomozov 
> > ---
> >  doc/pacman.conf.5.asciidoc |   6 +--
> >  lib/libalpm/sync.c |   5 --
> >  src/pacman/callback.c  | 108 -
> >  3 files changed, 96 insertions(+), 23 deletions(-)
> >
> > diff --git a/doc/pacman.conf.5.asciidoc b/doc/pacman.conf.5.asciidoc
> > index dd1d3d5e..32612eb9 100644
> > --- a/doc/pacman.conf.5.asciidoc
> > +++ b/doc/pacman.conf.5.asciidoc
> > @@ -191,10 +191,8 @@ Options
> >   not support escape characters.
> >
> >  *TotalDownload*::
> > - When downloading, display the amount downloaded, download rate, ETA,
> > - and completed percentage of the entire download list rather
> > - than the percent of each individual download target. The progress
> > - bar is still based solely on the current file download.
> > + When downloading, display an extra progress bar with the amount 
> > downloaded,
> > + download rate, ETA, and completed percentage of the entire download 
> > list.
> >   This option won't work if XferCommand is used.
>
> OK.
>
> >
> >  *CheckSpace*::
> > diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
> > index 5d8652a5..e25e56d4 100644
> > --- a/lib/libalpm/sync.c
> > +++ b/lib/libalpm/sync.c
> > @@ -846,11 +846,6 @@ finish:
> >   pkg->download_size = 0;
> >   }
> >
> > - /* clear out value to let callback know we are done */
> > - if(handle->totaldlcb) {
> > - handle->totaldlcb(0);
> > - }
> > -
>
> OK.
>
> >   return ret;
> >  }
> >
> > diff --git a/src/pacman/callback.c b/src/pacman/callback.c
> > index 12ab952f..49bc3df4 100644
> > --- a/src/pacman/callback.c
> > +++ b/src/pacman/callback.c
> > @@ -40,8 +40,9 @@
> >  #include "conf.h"
> >
> >  /* download progress bar */
> > -static off_t list_xfered = 0.0;
>
> Appears that should have been cleaned up a while ago?

Yes. During the UI refactoring the old "TotalDownload" drawing logic
has been dropped. list_xfered was used for "amount of total downloaded
data".

Now we have a dedicated structure for a progress bar (struct
pacman_progress_bar) and "totalbar->xfered" becomes the new
"list_xfered".

>
> > +static int total_enabled = 0;
> >  static off_t list_total = 0.0;
> > +static struct pacman_progress_bar *totalbar;
> >
>
> OK
>
> >  /* delayed output during progress bar */
> >  static int on_progress = 0;
> > @@ -92,6 +93,10 @@ struct pacman_multibar_ui {
> >
> >  struct pacman_multibar_ui multibar_ui = {0};
> >
> > +static int dload_progressbar_enabled(void);
> > +static void init_total_progressbar(void);
> > +static void update_total_finalstats(void);
> > +
>
> Why do these need forward declared?  Just to avoid moving code around in
> the file?

Yes, I want to keep the progress bar handling logic together and it
appears after the cb_event() function that uses these declarations.

>
> >  void multibar_move_completed_up(bool value) {
> >   multibar_ui.move_completed_up = value;
> >  }
> > @@ -327,6 +332,10 @@ void cb_event(alpm_event_t *event)
> >   case ALPM_EVENT_PKG_RETRIEVE_START:
> >   colon_printf(_("Retrieving packages...\n"));
> >   on_progress = 1;
> > + total_enabled = config->totaldownload && list_total;
> > + if(total_enabled) {
> > + init_total_progressbar();
> > + }
>
> OK
>
> >   break;
> >   case ALPM_EVENT_DISKSPACE_START:
> >   if(config->noprogressbar) {
> > @@ -388,6 +397,11 @@ void cb_event(alpm_event_t *event)
> >   case ALPM_EVENT_PKG_RETRIEVE_DONE:
> >   case ALPM_EVENT_PKG_RETRIEVE_FAILED:
> >   console_cursor_move_end();
> > + if(total_enabled && dload_progressbar_enabled()) {
> > + update_total_finalstats();
> > + printf("\n");
> > + }
> > + total_enabled = 0;
>
> OK.
>
> >   flush_output_list();
> >   on_progress = 0;
> >   break;
> > @@ -679,11 +693,6 @@ void cb_progress(alpm_progress_t event, const char 
> > *pkgname, int percent,
> >  void cb_dl_total(off_t total)
> >  {
> >   list_total = total;
> > - /* if we get a 0 value, it means this list has 

Re: [pacman-dev] [PATCH] Implement TotalDownload functionality

2020-12-06 Thread Anatol Pomozov
Hi

On Sun, Dec 6, 2020 at 12:02 AM Allan McRae  wrote:
>
> On 6/12/20 4:39 am, Anatol Pomozov wrote:
> > With the recent 'multibar' interface changes TotalDownload has been 
> > disabled.
> > Now we have a new UI and we need to find another way to display this
> > information.
> >
> > When 'TotalDownload' config option is enabled we are going to have an extra
> > progress bar at the bottom of the screen that shows how much of the entire
> > download has been completed.
> >
> > Closes FS#68202
>
> Thanks - that progress bar looks good.
>
> >
> > Signed-off-by: Anatol Pomozov 
> > ---
> >  doc/pacman.conf.5.asciidoc |   6 +--
> >  lib/libalpm/sync.c |   5 --
> >  src/pacman/callback.c  | 108 -
> >  3 files changed, 96 insertions(+), 23 deletions(-)
> >
> > diff --git a/doc/pacman.conf.5.asciidoc b/doc/pacman.conf.5.asciidoc
> > index dd1d3d5e..32612eb9 100644
> > --- a/doc/pacman.conf.5.asciidoc
> > +++ b/doc/pacman.conf.5.asciidoc
> > @@ -191,10 +191,8 @@ Options
> >   not support escape characters.
> >
> >  *TotalDownload*::
> > - When downloading, display the amount downloaded, download rate, ETA,
> > - and completed percentage of the entire download list rather
> > - than the percent of each individual download target. The progress
> > - bar is still based solely on the current file download.
> > + When downloading, display an extra progress bar with the amount 
> > downloaded,
> > + download rate, ETA, and completed percentage of the entire download 
> > list.
> >   This option won't work if XferCommand is used.
>
> OK.
>
> >
> >  *CheckSpace*::
> > diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
> > index 5d8652a5..e25e56d4 100644
> > --- a/lib/libalpm/sync.c
> > +++ b/lib/libalpm/sync.c
> > @@ -846,11 +846,6 @@ finish:
> >   pkg->download_size = 0;
> >   }
> >
> > - /* clear out value to let callback know we are done */
> > - if(handle->totaldlcb) {
> > - handle->totaldlcb(0);
> > - }
> > -
>
> OK.
>
> >   return ret;
> >  }
> >
> > diff --git a/src/pacman/callback.c b/src/pacman/callback.c
> > index 12ab952f..49bc3df4 100644
> > --- a/src/pacman/callback.c
> > +++ b/src/pacman/callback.c
> > @@ -40,8 +40,9 @@
> >  #include "conf.h"
> >
> >  /* download progress bar */
> > -static off_t list_xfered = 0.0;
>
> Appears that should have been cleaned up a while ago?
>
> > +static int total_enabled = 0;
> >  static off_t list_total = 0.0;
> > +static struct pacman_progress_bar *totalbar;
> >
>
> OK
>
> >  /* delayed output during progress bar */
> >  static int on_progress = 0;
> > @@ -92,6 +93,10 @@ struct pacman_multibar_ui {
> >
> >  struct pacman_multibar_ui multibar_ui = {0};
> >
> > +static int dload_progressbar_enabled(void);
> > +static void init_total_progressbar(void);
> > +static void update_total_finalstats(void);
> > +
>
> Why do these need forward declared?  Just to avoid moving code around in
> the file?
>
> >  void multibar_move_completed_up(bool value) {
> >   multibar_ui.move_completed_up = value;
> >  }
> > @@ -327,6 +332,10 @@ void cb_event(alpm_event_t *event)
> >   case ALPM_EVENT_PKG_RETRIEVE_START:
> >   colon_printf(_("Retrieving packages...\n"));
> >   on_progress = 1;
> > + total_enabled = config->totaldownload && list_total;
> > + if(total_enabled) {
> > + init_total_progressbar();
> > + }
>
> OK
>
> >   break;
> >   case ALPM_EVENT_DISKSPACE_START:
> >   if(config->noprogressbar) {
> > @@ -388,6 +397,11 @@ void cb_event(alpm_event_t *event)
> >   case ALPM_EVENT_PKG_RETRIEVE_DONE:
> >   case ALPM_EVENT_PKG_RETRIEVE_FAILED:
> >   console_cursor_move_end();
> > + if(total_enabled && dload_progressbar_enabled()) {
> > + update_total_finalstats();
> > + printf("\n");
> > + }
> > + total_enabled = 0;
>
> OK.
>
> >   flush_output_list();
> >   on_progress = 0;
> >   break;
> > @@ -679,11 +693,6 @@ void cb_progress(alpm_progress_t event, const char 
> > *pkgname, int percent,
> >  void cb_dl_total(off_t total)
> >  {
> >   list_total = total;
> > - /* if we get a 0 value, it means this list has finished downloading,
> > -  * so clear out our list_xfered as well */
> > - if(total == 0) {
> > - list_xfered = 0;
> > - }
> >  }
>
> OK
>
> >
> >  static int dload_progressbar_enabled(void)
> > @@ -726,6 +735,16 @@ static bool find_bar_for_filename(const char 
> > *filename, int *index, struct pacma
> >   return false;
> >  }
> >
> > +static void init_total_progressbar(void)
> > +{
> > + totalbar = calloc(1, 

Re: [pacman-dev] Alternatives system

2020-12-06 Thread Lone_Wolf



On 01-04-2019 01:56, Allan McRae wrote:

Hi all,

I plan to finish implementing an alternatives system for pacman post 5.2
release:
https://wiki.archlinux.org/index.php/User:Allan/Alternatives

Any comments or suggestions?

Thanks,
Allan



pacman 6 .0 alpha has been released, but there's no sign of an 
alternatives system I can find.



The descriptions suggest the alternatives system could improve at least 
one of my aur packages by  a lot.


Is an alternatives system still on the roadmap ?


Lone_Wolf


Re: [pacman-dev] [PATCH] Implement TotalDownload functionality

2020-12-06 Thread Allan McRae
On 6/12/20 4:39 am, Anatol Pomozov wrote:
> With the recent 'multibar' interface changes TotalDownload has been disabled.
> Now we have a new UI and we need to find another way to display this
> information.
> 
> When 'TotalDownload' config option is enabled we are going to have an extra
> progress bar at the bottom of the screen that shows how much of the entire
> download has been completed.
> 
> Closes FS#68202

Thanks - that progress bar looks good.

> 
> Signed-off-by: Anatol Pomozov 
> ---
>  doc/pacman.conf.5.asciidoc |   6 +--
>  lib/libalpm/sync.c |   5 --
>  src/pacman/callback.c  | 108 -
>  3 files changed, 96 insertions(+), 23 deletions(-)
> 
> diff --git a/doc/pacman.conf.5.asciidoc b/doc/pacman.conf.5.asciidoc
> index dd1d3d5e..32612eb9 100644
> --- a/doc/pacman.conf.5.asciidoc
> +++ b/doc/pacman.conf.5.asciidoc
> @@ -191,10 +191,8 @@ Options
>   not support escape characters.
>  
>  *TotalDownload*::
> - When downloading, display the amount downloaded, download rate, ETA,
> - and completed percentage of the entire download list rather
> - than the percent of each individual download target. The progress
> - bar is still based solely on the current file download.
> + When downloading, display an extra progress bar with the amount 
> downloaded,
> + download rate, ETA, and completed percentage of the entire download 
> list.
>   This option won't work if XferCommand is used.

OK.

>  
>  *CheckSpace*::
> diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
> index 5d8652a5..e25e56d4 100644
> --- a/lib/libalpm/sync.c
> +++ b/lib/libalpm/sync.c
> @@ -846,11 +846,6 @@ finish:
>   pkg->download_size = 0;
>   }
>  
> - /* clear out value to let callback know we are done */
> - if(handle->totaldlcb) {
> - handle->totaldlcb(0);
> - }
> -

OK.

>   return ret;
>  }
>  
> diff --git a/src/pacman/callback.c b/src/pacman/callback.c
> index 12ab952f..49bc3df4 100644
> --- a/src/pacman/callback.c
> +++ b/src/pacman/callback.c
> @@ -40,8 +40,9 @@
>  #include "conf.h"
>  
>  /* download progress bar */
> -static off_t list_xfered = 0.0;

Appears that should have been cleaned up a while ago?

> +static int total_enabled = 0;
>  static off_t list_total = 0.0;
> +static struct pacman_progress_bar *totalbar;
>  

OK

>  /* delayed output during progress bar */
>  static int on_progress = 0;
> @@ -92,6 +93,10 @@ struct pacman_multibar_ui {
>  
>  struct pacman_multibar_ui multibar_ui = {0};
>  
> +static int dload_progressbar_enabled(void);
> +static void init_total_progressbar(void);
> +static void update_total_finalstats(void);
> +

Why do these need forward declared?  Just to avoid moving code around in
the file?

>  void multibar_move_completed_up(bool value) {
>   multibar_ui.move_completed_up = value;
>  }
> @@ -327,6 +332,10 @@ void cb_event(alpm_event_t *event)
>   case ALPM_EVENT_PKG_RETRIEVE_START:
>   colon_printf(_("Retrieving packages...\n"));
>   on_progress = 1;
> + total_enabled = config->totaldownload && list_total;
> + if(total_enabled) {
> + init_total_progressbar();
> + }

OK

>   break;
>   case ALPM_EVENT_DISKSPACE_START:
>   if(config->noprogressbar) {
> @@ -388,6 +397,11 @@ void cb_event(alpm_event_t *event)
>   case ALPM_EVENT_PKG_RETRIEVE_DONE:
>   case ALPM_EVENT_PKG_RETRIEVE_FAILED:
>   console_cursor_move_end();
> + if(total_enabled && dload_progressbar_enabled()) {
> + update_total_finalstats();
> + printf("\n");
> + }
> + total_enabled = 0;

OK.

>   flush_output_list();
>   on_progress = 0;
>   break;
> @@ -679,11 +693,6 @@ void cb_progress(alpm_progress_t event, const char 
> *pkgname, int percent,
>  void cb_dl_total(off_t total)
>  {
>   list_total = total;
> - /* if we get a 0 value, it means this list has finished downloading,
> -  * so clear out our list_xfered as well */
> - if(total == 0) {
> - list_xfered = 0;
> - }
>  }

OK

>  
>  static int dload_progressbar_enabled(void)
> @@ -726,6 +735,16 @@ static bool find_bar_for_filename(const char *filename, 
> int *index, struct pacma
>   return false;
>  }
>  
> +static void init_total_progressbar(void)
> +{
> + totalbar = calloc(1, sizeof(struct pacman_progress_bar));
> + assert(totalbar);
> + totalbar->filename = "Total progress:";
> + totalbar->init_time = get_time_ms();
> + totalbar->total_size = list_total;
> + totalbar->rate = 0.0;
> +}
> +

OK.

>  static void draw_pacman_progress_bar(struct pacman_progress_bar *bar)
>  {
>