Skip to content

Commit e64b393

Browse files
committed
Added missing options
'requiredby' and 'optionalfor' were missing as available options
1 parent f73bcb5 commit e64b393

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

include/op.h

+20
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,26 @@ struct container *lspac_pkg_get_groups(void *data, char *prefix);
145145
* @param prefix: a container prefix
146146
* @returns a pointer to a container
147147
*/
148+
struct container *lspac_pkg_compute_requiredby(void *data, char *prefix);
149+
150+
/*
151+
* Creates a container that holds an array of strings representing packages
152+
* provided by the given package
153+
*
154+
* @param data: an alpm package
155+
* @param prefix: a container prefix
156+
* @returns a pointer to a container
157+
*/
158+
struct container *lspac_pkg_compute_optionalfor(void *data, char *prefix);
159+
160+
/*
161+
* Creates a container that holds an array of strings representing packages
162+
* that have the given package as an optional dependecy
163+
*
164+
* @param data: an alpm package
165+
* @param prefix: a container prefix
166+
* @returns a pointer to a container
167+
*/
148168
struct container *lspac_pkg_get_provides(void *data, char *prefix);
149169

150170
/*

src/lspac.c

+6
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ enum {
7171
OUT_REPLACES,
7272
OUT_CHECKDEPENDS,
7373
OUT_MAKEDEPENDS,
74+
OUT_REQUIREDBY,
75+
OUT_OPTIONALFOR,
7476
};
7577

7678
struct outinfo {
@@ -107,6 +109,8 @@ static struct outinfo infos[] = {
107109
[OUT_REPLACES] = { "REPLACES", "Packages replaces by given package", &lspac_pkg_get_replaces },
108110
[OUT_CHECKDEPENDS] = { "CHECKDEPENDS", "Package's check dependencies", &lspac_pkg_get_checkdepends },
109111
[OUT_MAKEDEPENDS] = { "MAKEDEPENDS", "Package's make dependencies", &lspac_pkg_get_makedepends },
112+
[OUT_REQUIREDBY] = { "REQUIREDBY", "Packages required by the given package", &lspac_pkg_compute_requiredby },
113+
[OUT_OPTIONALFOR] = { "OPTIONALFOR", "Packages that have the given package as an optional dependency", &lspac_pkg_compute_optionalfor },
110114
};
111115

112116
static int outputs[ARRAY_SIZE(infos) * 2];
@@ -394,6 +398,8 @@ int main(int argc, char **argv)
394398
case 'B':
395399
add_uniq_output(OUT_PROVIDES);
396400
add_uniq_output(OUT_DEPENDS);
401+
add_uniq_output(OUT_REQUIREDBY);
402+
add_uniq_output(OUT_OPTIONALFOR);
397403
add_uniq_output(OUT_CONFLICTS);
398404
add_uniq_output(OUT_REPLACES);
399405
add_uniq_output(OUT_CHECKDEPENDS);

src/op.c

+10
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ struct container *lspac_pkg_get_base64_sig(void *data, char *prefix)
6666

6767
/* ---------- */
6868

69+
struct container *lspac_pkg_compute_requiredby(void *data, char *prefix)
70+
{
71+
return list_to_container(alpm_pkg_compute_requiredby(data), prefix);
72+
}
73+
74+
struct container *lspac_pkg_compute_optionalfor(void *data, char *prefix)
75+
{
76+
return list_to_container(alpm_pkg_compute_optionalfor(data), prefix);
77+
}
78+
6979
struct container *lspac_pkg_get_licenses(void *data, char *prefix)
7080
{
7181
return list_to_container(alpm_pkg_get_licenses(data), prefix);

0 commit comments

Comments
 (0)