Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
devel:openSUSE:Factory:rpmlint
rpm
rpmsort_reverse.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File rpmsort_reverse.diff of Package rpm
--- tools/rpmsort.c.orig 2023-10-11 11:38:36.639686209 +0000 +++ tools/rpmsort.c 2023-10-11 12:01:36.112837741 +0000 @@ -119,6 +119,11 @@ exit: return vercmpflag; } +static int package_version_compare_reverse(const void *p, const void *q) +{ + return -package_version_compare(p, q); +} + static void add_input(const char *filename, char ***package_names, size_t *n_package_names) { @@ -169,7 +174,13 @@ static void add_input(const char *filena *n_package_names = n_names; } -static struct poptOption optionsTable[] = { POPT_AUTOHELP POPT_TABLEEND }; +static int reverse = 0; + +static struct poptOption optionsTable[] = { + { "reverse", 'r', POPT_ARG_VAL, &reverse, 1, + N_("reverse the result of comparisons"), NULL }, + POPT_AUTOHELP POPT_TABLEEND +}; int main(int argc, const char *argv[]) { @@ -181,7 +192,7 @@ int main(int argc, const char *argv[]) optCon = poptGetContext(NULL, argc, argv, optionsTable, 0); poptSetOtherOptionHelp(optCon, "<FILES>"); - if (poptGetNextOpt(optCon) == 0) { + if (poptGetNextOpt(optCon) != -1) { poptPrintUsage(optCon, stderr, 0); exit(EXIT_FAILURE); } @@ -201,7 +212,8 @@ int main(int argc, const char *argv[]) } qsort(package_names, n_package_names, sizeof(char *), - package_version_compare); + reverse ? package_version_compare_reverse + : package_version_compare); /* Send sorted list to stdout. */ for (int i = 0; i < n_package_names; i++) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor