[pacman-dev] [PATCH v3 0/2] Make -Fs behave like -Ss and output group-membership and installation-state
I realized that in my previous patch[1] I totally forgot about groups. Reading through the bugtracker I also realized there's already a task open on it FS#47948. This patchset Includes the install status and the group status patches. PS. I'm not too sure on what to do when adding a patch to an existing one. Should I have resent the first? Should this be v3 or v1? If anyone can clear that up I'd appreciate it. [1] https://lists.archlinux.org/pipermail/pacman-dev/2018-August/022769.html morganamilo (2): Show install status during file search Show group status during file search src/pacman/files.c | 7 ++++++- src/pacman/package.c | 34 +++++++++++++++++++--------------- src/pacman/package.h | 1 + 3 files changed, 26 insertions(+), 16 deletions(-) -- 2.18.0
When doing "pacman -Fs", show the "[installed: version]" message just like "pacman -Ss". Signed-off-by: morganamilo <morganamilo@gmail.com> --- src/pacman/files.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pacman/files.c b/src/pacman/files.c index d7fc5446..58cf8d3d 100644 --- a/src/pacman/files.c +++ b/src/pacman/files.c @@ -101,6 +101,7 @@ static int files_fileowner(alpm_list_t *syncs, alpm_list_t *targets) { static int files_search(alpm_list_t *syncs, alpm_list_t *targets, int regex) { int ret = 0; + alpm_db_t *db_local = alpm_get_localdb(config->handle); alpm_list_t *t; const colstr_t *colstr = &config->colstr; @@ -157,10 +158,13 @@ static int files_search(alpm_list_t *syncs, alpm_list_t *targets, int regex) { printf("%s/%s\n", alpm_db_get_name(repo), alpm_pkg_get_name(pkg)); } else { alpm_list_t *ml; - printf("%s%s/%s%s %s%s%s\n", colstr->repo, alpm_db_get_name(repo), + printf("%s%s/%s%s %s%s%s", colstr->repo, alpm_db_get_name(repo), colstr->title, alpm_pkg_get_name(pkg), colstr->version, alpm_pkg_get_version(pkg), colstr->nocolor); + print_installed(db_local, pkg); + printf("\n"); + for(ml = match; ml; ml = alpm_list_next(ml)) { c = ml->data; printf(" %s\n", c); -- 2.18.0
When doing "pacman -Fs", show the "(groupname)" message just like "pacman -Ss". And refactor group printing to its own function. Signed-off-by: morganamilo <morganamilo@gmail.com> --- src/pacman/files.c | 1 + src/pacman/package.c | 34 +++++++++++++++++++--------------- src/pacman/package.h | 1 + 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/pacman/files.c b/src/pacman/files.c index 58cf8d3d..fa4170bd 100644 --- a/src/pacman/files.c +++ b/src/pacman/files.c @@ -162,6 +162,7 @@ static int files_search(alpm_list_t *syncs, alpm_list_t *targets, int regex) { colstr->title, alpm_pkg_get_name(pkg), colstr->version, alpm_pkg_get_version(pkg), colstr->nocolor); + print_groups(pkg); print_installed(db_local, pkg); printf("\n"); diff --git a/src/pacman/package.c b/src/pacman/package.c index e80c5953..386b4260 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -494,6 +494,24 @@ void print_installed(alpm_db_t *db_local, alpm_pkg_t *pkg) } } +void print_groups(alpm_pkg_t *pkg) { + alpm_list_t *grp; + if((grp = alpm_pkg_get_groups(pkg)) != NULL) { + const colstr_t *colstr = &config->colstr; + alpm_list_t *k; + printf(" %s(", colstr->groups); + for(k = grp; k; k = alpm_list_next(k)) { + const char *group = k->data; + fputs(group, stdout); + if(alpm_list_next(k)) { + /* only print a spacer if there are more groups */ + putchar(' '); + } + } + printf(")%s", colstr->nocolor); + } +} + /** * Display the details of a search. * @param db the database we're searching @@ -526,7 +544,6 @@ int dump_pkg_search(alpm_db_t *db, alpm_list_t *targets, int show_status) cols = getcols(); for(i = searchlist; i; i = alpm_list_next(i)) { - alpm_list_t *grp; alpm_pkg_t *pkg = i->data; if(config->quiet) { @@ -536,20 +553,7 @@ int dump_pkg_search(alpm_db_t *db, alpm_list_t *targets, int show_status) colstr->title, alpm_pkg_get_name(pkg), colstr->version, alpm_pkg_get_version(pkg), colstr->nocolor); - if((grp = alpm_pkg_get_groups(pkg)) != NULL) { - alpm_list_t *k; - printf(" %s(", colstr->groups); - for(k = grp; k; k = alpm_list_next(k)) { - const char *group = k->data; - fputs(group, stdout); - if(alpm_list_next(k)) { - /* only print a spacer if there are more groups */ - putchar(' '); - } - } - printf(")%s", colstr->nocolor); - } - + print_groups(pkg); if(show_status) { print_installed(db_local, pkg); } diff --git a/src/pacman/package.h b/src/pacman/package.h index 68c2a630..03e1afa0 100644 --- a/src/pacman/package.h +++ b/src/pacman/package.h @@ -29,6 +29,7 @@ void dump_pkg_files(alpm_pkg_t *pkg, int quiet); void dump_pkg_changelog(alpm_pkg_t *pkg); void print_installed(alpm_db_t *db_local, alpm_pkg_t *pkg); +void print_groups(alpm_pkg_t *pkg); int dump_pkg_search(alpm_db_t *db, alpm_list_t *targets, int show_status); #endif /* PM_PACKAGE_H */ -- 2.18.0
On 9/3/18 6:50 PM, morganamilo wrote:
I realized that in my previous patch[1] I totally forgot about groups. Reading through the bugtracker I also realized there's already a task open on it FS#47948.
This patchset Includes the install status and the group status patches.
PS. I'm not too sure on what to do when adding a patch to an existing one. Should I have resent the first? Should this be v3 or v1? If anyone can clear that up I'd appreciate it.
[1] https://lists.archlinux.org/pipermail/pacman-dev/2018-August/022769.html No need to resubmit the old one at all :D just send in the second patch on its own.
I guess that this depends on the previous one, so you could simply mention that. Or git format-patch has a fancy option, -n --start-number 2 which would make the subject be patch [PATCH 2/2], and you could send that in reply to the previous patch. -- Eli Schwartz Bug Wrangler and Trusted User
When doing "pacman -Fs", show the "(groupname)" message just like "pacman -Ss". And refactor group printing to its own function. Signed-off-by: morganamilo <morganamilo@gmail.com> --- Fix style src/pacman/files.c | 1 + src/pacman/package.c | 34 +++++++++++++++++++--------------- src/pacman/package.h | 1 + 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/pacman/files.c b/src/pacman/files.c index 58cf8d3d..fa4170bd 100644 --- a/src/pacman/files.c +++ b/src/pacman/files.c @@ -162,6 +162,7 @@ static int files_search(alpm_list_t *syncs, alpm_list_t *targets, int regex) { colstr->title, alpm_pkg_get_name(pkg), colstr->version, alpm_pkg_get_version(pkg), colstr->nocolor); + print_groups(pkg); print_installed(db_local, pkg); printf("\n"); diff --git a/src/pacman/package.c b/src/pacman/package.c index e80c5953..639b1247 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -494,6 +494,25 @@ void print_installed(alpm_db_t *db_local, alpm_pkg_t *pkg) } } +void print_groups(alpm_pkg_t *pkg) +{ + alpm_list_t *grp; + if((grp = alpm_pkg_get_groups(pkg)) != NULL) { + const colstr_t *colstr = &config->colstr; + alpm_list_t *k; + printf(" %s(", colstr->groups); + for(k = grp; k; k = alpm_list_next(k)) { + const char *group = k->data; + fputs(group, stdout); + if(alpm_list_next(k)) { + /* only print a spacer if there are more groups */ + putchar(' '); + } + } + printf(")%s", colstr->nocolor); + } +} + /** * Display the details of a search. * @param db the database we're searching @@ -526,7 +545,6 @@ int dump_pkg_search(alpm_db_t *db, alpm_list_t *targets, int show_status) cols = getcols(); for(i = searchlist; i; i = alpm_list_next(i)) { - alpm_list_t *grp; alpm_pkg_t *pkg = i->data; if(config->quiet) { @@ -536,20 +554,7 @@ int dump_pkg_search(alpm_db_t *db, alpm_list_t *targets, int show_status) colstr->title, alpm_pkg_get_name(pkg), colstr->version, alpm_pkg_get_version(pkg), colstr->nocolor); - if((grp = alpm_pkg_get_groups(pkg)) != NULL) { - alpm_list_t *k; - printf(" %s(", colstr->groups); - for(k = grp; k; k = alpm_list_next(k)) { - const char *group = k->data; - fputs(group, stdout); - if(alpm_list_next(k)) { - /* only print a spacer if there are more groups */ - putchar(' '); - } - } - printf(")%s", colstr->nocolor); - } - + print_groups(pkg); if(show_status) { print_installed(db_local, pkg); } diff --git a/src/pacman/package.h b/src/pacman/package.h index 68c2a630..03e1afa0 100644 --- a/src/pacman/package.h +++ b/src/pacman/package.h @@ -29,6 +29,7 @@ void dump_pkg_files(alpm_pkg_t *pkg, int quiet); void dump_pkg_changelog(alpm_pkg_t *pkg); void print_installed(alpm_db_t *db_local, alpm_pkg_t *pkg); +void print_groups(alpm_pkg_t *pkg); int dump_pkg_search(alpm_db_t *db, alpm_list_t *targets, int show_status); #endif /* PM_PACKAGE_H */ -- 2.18.0
On 4/9/18 11:47 pm, morganamilo wrote:
When doing "pacman -Fs", show the "(groupname)" message just like "pacman -Ss".
And refactor group printing to its own function.
Signed-off-by: morganamilo <morganamilo@gmail.com> ---
Thanks. Normally I'd prefer two patches. The first being the refactor, and the second adding the groupnames to the -Fs output. It just splits the patch intention up and makes it easier to follow. But given the second one would be a single line patch, I am not worried in this instance. A
participants (3)
-
Allan McRae
-
Eli Schwartz
-
morganamilo