diff options
-rw-r--r-- | URPM.pm | 12 | ||||
-rw-r--r-- | URPM.xs | 129 |
2 files changed, 69 insertions, 72 deletions
@@ -239,8 +239,8 @@ and adds them to the URPM object. =item $urpm->parse_hdlist($file, %options) -This method load rpm informations from B<headers> contains in hdlist file -and adds them to the URPM object. Allowed options are +This method loads rpm informations from rpm B<headers> contained in an hdlist +file and adds them to the URPM object. Allowed options are packing => 0 / 1 callback => sub { ... } @@ -250,8 +250,8 @@ Return value is an array of first and last id parsed. =item $urpm->parse_rpms($files, %options) -This method load rpm informations from rpms B<headers> and adds them to -the URPM object. Allowed options are +This method loads rpm informations from rpm B<headers> and adds them to +the URPM object. Return value is an array of first and last id parsed. @@ -451,8 +451,8 @@ rpm tags. See rpmlib.h. Querying the package like rpm --queryformat do. -The function call directlly the rpmlib, then use headers informations, so it -silently failed if you use synthesis instead hdlist/rpms/headers files or rpmdb. +The function calls directly the rpmlib, then use header informations, so it +silently failed if you use synthesis instead of hdlist/rpm/header files or rpmdb. =item $package->get_tag_modifiers($tagid) @@ -505,7 +505,7 @@ callback_list_str_xpush(char *s, int slen, char *name, int_32 flags, char *evr, XPUSHs(sv_2mortal(newSVpv(buff, len))); } PUTBACK; - /* returning zero indicate to continue processing */ + /* returning zero indicates to continue processing */ return 0; } @@ -548,7 +548,7 @@ callback_list_str_overlap(char *s, int slen, char *name, int_32 flags, char *evr /* mark end of name */ if (eon) { eonc = *eon; *eon = 0; } - /* name should be equal, else it will not overlap */ + /* names should be equal, else it will not overlap */ if (!strcmp(name, os->name)) { /* perform overlap according to direction needed, negative for left */ if (os->direction < 0) @@ -694,97 +694,92 @@ return_list_tag_modifier(Header header, int_32 tag_name) { PUTBACK; } -void +void return_list_tag(URPM__Package pkg, int_32 tag_name) { dSP; if (pkg->h != NULL) { void *list = NULL; int_32 count, type; headerGetEntry(pkg->h, tag_name, &type, (void **) &list, &count); - + if (list) { - // avoid arch here (rpm don't return src), it's not beautifull - if (tag_name == RPMTAG_ARCH ) { - XPUSHs(sv_2mortal(newSVpv(headerIsEntry(pkg->h, RPMTAG_SOURCEPACKAGE) ? "src" : (char *) list, 0))); - } else - switch (type) { + if (tag_name == RPMTAG_ARCH) { + XPUSHs(sv_2mortal(newSVpv(headerIsEntry(pkg->h, RPMTAG_SOURCEPACKAGE) ? "src" : (char *) list, 0))); + } else + switch (type) { case RPM_NULL_TYPE: break; case RPM_CHAR_TYPE: case RPM_INT8_TYPE: case RPM_INT16_TYPE: case RPM_INT32_TYPE: - { - int i; - int *r; - r = (int *)list; - for (i=0; i < count; i++) { - XPUSHs(sv_2mortal(newSViv(r[i]))); - } - } + { + int i; + int *r; + r = (int *)list; + for (i=0; i < count; i++) { + XPUSHs(sv_2mortal(newSViv(r[i]))); + } + } break; -/* - case RPM_INT64_TYPE: - break; -*/ case RPM_STRING_TYPE: XPUSHs(sv_2mortal(newSVpv((char *) list, 0))); break; case RPM_BIN_TYPE: break; case RPM_STRING_ARRAY_TYPE: - { - int i; - char **s; + { + int i; + char **s; - s = (char **)list; - for (i = 0; i < count; i++) { - XPUSHs(sv_2mortal(newSVpv(s[i], 0))); - } - } + s = (char **)list; + for (i = 0; i < count; i++) { + XPUSHs(sv_2mortal(newSVpv(s[i], 0))); + } + } break; case RPM_I18NSTRING_TYPE: break; } } } else { - char *name; - char *version; - char *release; - char *arch; - char *eos; - switch (tag_name) { - case RPMTAG_NAME: - { - get_fullname_parts(pkg, &name, &version, &release, &arch, &eos); - if (version - name < 1) croak("invalid fullname"); - XPUSHs(sv_2mortal(newSVpv(name, version-name - 1))); - } - break; - case RPMTAG_VERSION: - { - get_fullname_parts(pkg, &name, &version, &release, &arch, &eos); - if (release - version < 1) croak("invalid fullname"); - XPUSHs(sv_2mortal(newSVpv(version, release-version - 1))); - } - break; - case RPMTAG_RELEASE: - { - get_fullname_parts(pkg, &name, &version, &release, &arch, &eos); - if (arch - release < 1) croak("invalid fullname"); - XPUSHs(sv_2mortal(newSVpv(release, arch-release - 1))); - } - break; - case RPMTAG_ARCH: - { - get_fullname_parts(pkg, &name, &version, &release, &arch, &eos); - XPUSHs(sv_2mortal(newSVpv(arch, eos-arch))); - } - break; - case RPMTAG_SUMMARY: - XPUSHs(sv_2mortal(newSVpv(pkg->summary, 0))); - break; - } + char *name; + char *version; + char *release; + char *arch; + char *eos; + switch (tag_name) { + case RPMTAG_NAME: + { + get_fullname_parts(pkg, &name, &version, &release, &arch, &eos); + if (version - name < 1) croak("invalid fullname"); + XPUSHs(sv_2mortal(newSVpv(name, version-name - 1))); + } + break; + case RPMTAG_VERSION: + { + get_fullname_parts(pkg, &name, &version, &release, &arch, &eos); + if (release - version < 1) croak("invalid fullname"); + XPUSHs(sv_2mortal(newSVpv(version, release-version - 1))); + } + break; + case RPMTAG_RELEASE: + { + get_fullname_parts(pkg, &name, &version, &release, &arch, &eos); + if (arch - release < 1) croak("invalid fullname"); + XPUSHs(sv_2mortal(newSVpv(release, arch-release - 1))); + } + break; + case RPMTAG_ARCH: + { + get_fullname_parts(pkg, &name, &version, &release, &arch, &eos); + XPUSHs(sv_2mortal(newSVpv(arch, eos-arch))); + } + break; + case RPMTAG_SUMMARY: + XPUSHs(sv_2mortal(newSVpv(pkg->summary, 0))); + break; + } } PUTBACK; } @@ -4099,3 +4094,5 @@ Urpm_stream2header(fp) } Fclose(fd); } + + /* vim:set ts=8 sts=2 sw=2: */ |