Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • rskys/pacman
  • mmhat/pacman
  • matthewq337/pacman-pacnew
  • zvova7890/pacman
  • ateles0x96/pacman
  • carsme/pacman
  • thijzert/pacman
  • staticnoise/pacman
  • jforberg/pacman
  • samueldr/pacman
  • archlinux/alpm/pacman
  • erwin-iosef/pacman-tinker
  • darktohka/pacman
  • poscat/pacman
  • integral-tech/pacman
  • voskresenie/pacman
  • heftig/pacman
  • guinux/pacman
  • tbodt/pacman
  • 0xfadead/pacman
  • rudy-in/pacman
  • karanveerb/pacman
  • xkozakj/pacman
  • misaka13514/pacman
  • boria138/pacman
  • tiziodcaio/pacman
  • vixfwis/pacman
  • filip-hejsek/pacman
  • ventureo/pacman
  • ikspress/pacman
  • 7ji/pacman
  • shyanjmc/pacman
  • lolpro11/pacman
  • patlefort/pacman
  • okabe/pacman
  • radioactiveman/pacman
  • yan12125/pacman
  • lazka/pacman
  • wiktor/pacman
  • boomer41/pacman
  • porkepix/pacman
  • rafaelff/pacman
  • lilydjwg/pacman
  • bartus/pacman
  • young42/pacman
  • demi/pacman
  • levitating/pacman
  • gromit/pacman
  • alerque/pacman
  • vannten/pacman
  • tomhale/pacman
  • hanabishi/pacman
  • aedalzotto/pacman
  • nikelborm/pacman
  • mikewalrus/pacman
  • vnepogodin/pacman
  • loqs/pacman
  • agowa338/pacman
  • alexhenrie/pacman
  • eds-collabora/pacman
  • disconnect3d/pacman
  • chrislongros/pacman
  • brocellous/pacman
  • zoorat/pacman
  • moviuro/pacman
  • vekhir/pacman
  • jamarley/pacman
  • pobrn/pacman
  • felixonmars/pacman
  • octylfractal/pacman
  • jackrosenthal/pacman
  • xiretza/pacman
  • antiz/pacman
  • matta/pacman
  • eworm/pacman
  • kpcyrd/pacman
  • wsdmatty/pacman
  • fxzzi/pacman
  • jwitteveen/pacman
  • xaoseric/pacman
  • derverrcktefuchs/pacman
  • jdknight/pacman
  • eclairevoyant/pacman
  • nrolans/pacman
  • prawn/pacman
  • joanbrugueram/pacman
  • franklinyu/pacman
  • mrtnster/pacman
  • bgyorgy/pacman
  • intelfx/pacman
  • soloturn/pacman
  • eatsu/pacman
  • sw/pacman
  • rgacogne/pacman
  • fantasquex/pacman
  • txtsd/pacman
  • miepee/pacman
  • mkurz/pacman
  • danielnachun/pacman
  • rhbvkleef/pacman
  • dvzrv/pacman
  • klausenbusk/pacman
  • sxw/pacman
  • michel/pacman
  • benthetechguy/pacman
  • daandemeyer/pacman
  • arodseth/pacman
  • diabonas/pacman
  • anthraxx/pacman
  • foxboron/pacman
  • mmdbalkhi/pacman
  • jelle/pacman
  • gustawho/pacman
  • mosman/pacman
  • lemmarathon/pacman
  • mattalxndr/pacman
  • pacman/pacman
117 results
Show changes
Commits on Source (11)
......@@ -237,10 +237,12 @@ Transaction Options (apply to '-S', '-R' and '-U')
Specify a printf-like format to control the output of the '\--print'
operation. The possible attributes are: "%a" for arch, "%b" for
builddate, "%d" for description, "%e" for pkgbase, "%f" for filename,
"%g" for base64 encoded PGP signature, "%h" for sha256sum, "%n" for
pkgname, "%p" for packager, "%v" for pkgver, "%l" for location, "%r"
for repository, "%s" for size, "%C" for checkdepends, "%D" for depends
and "%M" for makedepends.
"%g" for base64 encoded PGP signature, "%h" for sha256sum, "%m" for
md5sum, "%n" for pkgname, "%p" for packager, "%v" for pkgver, "%l" for
location, "%r" for repository, "%s" for size, "%C" for checkdepends,
"%D" for depends, "%G" for groups, "%H" for conflicts, "%L" for
licenses, "%M" for makedepends, "%O" for optional depends, "%P" for
provides and "%R" for replaces.
Implies '\--print'.
......
......@@ -61,13 +61,24 @@ enum {
CELL_FREE = (1 << 3)
};
#define VAL_FROM_FORMAT_STR(temp, format, func) \
#define PRINT_FORMAT_STRING(temp, format, func) \
if(strstr(temp, format)) { \
string = strreplace(temp, format, func(pkg)); \
free(temp); \
temp = string; \
} \
#define PRINT_FORMAT_LIST(temp, format, func, extract) \
if(strstr(temp, format)) { \
alpm_list_t *lst = func(pkg); \
char *cl = concat_list(lst, (formatfn)extract); \
string = strreplace(temp, format, cl); \
free(cl); \
free(temp); \
temp = string; \
} \
int trans_init(int flags, int check_valid)
{
int ret;
......@@ -405,26 +416,37 @@ char *strreplace(const char *str, const char *needle, const char *replace)
return newstr;
}
static char *concat_alpm_depends(alpm_list_t *lst)
typedef char *(*formatfn)(void*);
static char *concat_list(alpm_list_t *lst, formatfn fn)
{
char *depends = NULL;
char *tmp = NULL;
char *output = NULL, *tmp = NULL;
for(alpm_list_t *i = lst; i; i = alpm_list_next(i)) {
alpm_depend_t *dep = i->data;
char *depstring = alpm_dep_compute_string(dep);
char *str = fn ? fn(i->data) : i->data;
if(str == NULL) {
continue;
}
if(tmp) {
asprintf(&depends, "%s %s", tmp, depstring);
free(tmp);
asprintf(&output, "%s %s", tmp, str);
free(tmp);
} else {
asprintf(&depends, "%s", depstring);
asprintf(&output, "%s", str);
}
tmp = output;
if(fn) {
free(str);
}
tmp = depends;
free(depstring);
}
if(!depends) {
asprintf(&depends, "%s", "");
if(!output) {
asprintf(&output, "%s", "");
}
return depends;
return output;
}
static size_t string_length(const char *s)
......@@ -1197,21 +1219,23 @@ void print_packages(const alpm_list_t *packages)
}
}
/* %d : description */
VAL_FROM_FORMAT_STR(temp, "%d", alpm_pkg_get_desc)
PRINT_FORMAT_STRING(temp, "%d", alpm_pkg_get_desc)
/* %e : pkgbase */
VAL_FROM_FORMAT_STR(temp, "%e", alpm_pkg_get_base)
PRINT_FORMAT_STRING(temp, "%e", alpm_pkg_get_base)
/* %f : filename */
VAL_FROM_FORMAT_STR(temp, "%f", alpm_pkg_get_filename)
PRINT_FORMAT_STRING(temp, "%f", alpm_pkg_get_filename)
/* %g : base64 encoded PGP signature */
VAL_FROM_FORMAT_STR(temp, "%g", alpm_pkg_get_base64_sig)
PRINT_FORMAT_STRING(temp, "%g", alpm_pkg_get_base64_sig)
/* %h : sha25sum */
VAL_FROM_FORMAT_STR(temp, "%h", alpm_pkg_get_sha256sum)
PRINT_FORMAT_STRING(temp, "%h", alpm_pkg_get_sha256sum)
/* %n : pkgname */
VAL_FROM_FORMAT_STR(temp, "%n", alpm_pkg_get_name)
PRINT_FORMAT_STRING(temp, "%n", alpm_pkg_get_name)
/* %p : packager */
VAL_FROM_FORMAT_STR(temp, "%p", alpm_pkg_get_packager)
PRINT_FORMAT_STRING(temp, "%p", alpm_pkg_get_packager)
/* %v : pkgver */
VAL_FROM_FORMAT_STR(temp, "%v", alpm_pkg_get_version)
PRINT_FORMAT_STRING(temp, "%v", alpm_pkg_get_version)
/* %m : md5sum */
PRINT_FORMAT_STRING(temp, "%m", alpm_pkg_get_md5sum)
/* %l : location */
if(strstr(temp, "%l")) {
char *pkgloc = pkg_get_location(pkg);
......@@ -1240,34 +1264,26 @@ void print_packages(const alpm_list_t *packages)
free(temp);
}
/* %u : url */
VAL_FROM_FORMAT_STR(temp, "%u", alpm_pkg_get_url)
PRINT_FORMAT_STRING(temp, "%u", alpm_pkg_get_url)
/* %C : checkdepends */
if(strstr(temp, "%C")) {
alpm_list_t *lst = alpm_pkg_get_checkdepends(pkg);
char *depends = concat_alpm_depends(lst);
string = strreplace(temp, "%C", lst ? depends : "");
free(depends);
free(temp);
temp = string;
}
PRINT_FORMAT_LIST(temp, "%C", alpm_pkg_get_checkdepends, alpm_dep_compute_string)
/* %D : depends */
if(strstr(temp, "%D")) {
alpm_list_t *lst = alpm_pkg_get_depends(pkg);
char *depends = concat_alpm_depends(lst);
string = strreplace(temp, "%D", depends);
free(depends);
free(temp);
temp = string;
}
PRINT_FORMAT_LIST(temp, "%D", alpm_pkg_get_depends, alpm_dep_compute_string)
/* %G : groups */
PRINT_FORMAT_LIST(temp, "%G", alpm_pkg_get_groups, NULL)
/* %H : conflicts */
PRINT_FORMAT_LIST(temp, "%H", alpm_pkg_get_conflicts, alpm_dep_compute_string)
/* %M : makedepends */
if(strstr(temp, "%M")) {
alpm_list_t *lst = alpm_pkg_get_makedepends(pkg);
char *depends = concat_alpm_depends(lst);
string = strreplace(temp, "%M", depends);
free(depends);
free(temp);
temp = string;
}
PRINT_FORMAT_LIST(temp, "%M", alpm_pkg_get_makedepends, alpm_dep_compute_string)
/* %O : optdepends */
PRINT_FORMAT_LIST(temp, "%O", alpm_pkg_get_optdepends, alpm_dep_compute_string)
/* %P : provides */
PRINT_FORMAT_LIST(temp, "%P", alpm_pkg_get_provides, alpm_dep_compute_string)
/* %R : replaces */
PRINT_FORMAT_LIST(temp, "%R", alpm_pkg_get_replaces, alpm_dep_compute_string)
/* %L : license */
PRINT_FORMAT_LIST(temp, "%L", alpm_pkg_get_licenses, NULL)
printf("%s\n", string);
free(string);
}
......