diff options
author | tv <tv@971eb68f-4bfb-0310-8326-d2484c010a4c> | 2012-06-15 16:38:32 +0000 |
---|---|---|
committer | tv <tv@971eb68f-4bfb-0310-8326-d2484c010a4c> | 2012-06-15 16:38:32 +0000 |
commit | 68bd0657c64546bf3d17d8a64b479b8ead0e8ace (patch) | |
tree | 59cf9bf001f2edc54c8f434fe6c351c8b4c08c69 | |
parent | e7739438580e30fc9eb20ff446a7b9dc6c478015 (diff) | |
download | perl-RPM4-68bd0657c64546bf3d17d8a64b479b8ead0e8ace.tar perl-RPM4-68bd0657c64546bf3d17d8a64b479b8ead0e8ace.tar.gz perl-RPM4-68bd0657c64546bf3d17d8a64b479b8ead0e8ace.tar.bz2 perl-RPM4-68bd0657c64546bf3d17d8a64b479b8ead0e8ace.tar.xz perl-RPM4-68bd0657c64546bf3d17d8a64b479b8ead0e8ace.zip |
(Header_fullname,Spec_srcrpm) simplify using RPMTAG_NVR
git-svn-id: svn+ssh://haiku.zarb.org/home/projects/rpm4/svn/trunk@209 971eb68f-4bfb-0310-8326-d2484c010a4c
-rw-r--r-- | RPM4/NEWS | 1 | ||||
-rw-r--r-- | RPM4/src/RPM4.xs | 39 |
2 files changed, 12 insertions, 28 deletions
@@ -1,6 +1,7 @@ Version 0.29 - 12 June 2012 - functions that not are implemented since switching to rpm-4.6 now die +- internal cleanups - srcrpm(): fix returning "...nosrc.rpm" instead of "...src.rpm" when needed (it always returned "...src.rpm" since rpm-4.9+) - use rpm-4.6+ API, not rpm-4.4 compatibility one diff --git a/RPM4/src/RPM4.xs b/RPM4/src/RPM4.xs index 2a1f78b..507eb30 100644 --- a/RPM4/src/RPM4.xs +++ b/RPM4/src/RPM4.xs @@ -1199,35 +1199,22 @@ Header_fullname(h) nevr= 1 PREINIT: I32 gimme = GIMME_V; - char *name; - char *version; - char *release; - char *arch; PPCODE: if (h) { - name = get_name(h, RPMTAG_NAME); - version = get_name(h, RPMTAG_VERSION); - release = get_name(h, RPMTAG_RELEASE); - if (ix != 1) - arch = get_arch(h); - if (gimme == G_SCALAR) { + char *nvr = headerGetAsString(h, RPMTAG_NVR); if (ix == 1) { - mXPUSHs(newSVpvf("%s-%s-%s", name, version, release)); + mXPUSHs(newSVpv(nvr, 0)); } else { - mXPUSHs(newSVpvf("%s-%s-%s.%s", - name, - version, - release, - arch - )); + mXPUSHs(newSVpvf("%s.%s", nvr, get_arch(h))); } + free(nvr); } else if (gimme == G_ARRAY) { EXTEND(SP, 4); - mPUSHs(newSVpv(name, 0)); - mPUSHs(newSVpv(version, 0)); - mPUSHs(newSVpv(release, 0)); - mPUSHs(newSVpv(arch, 0)); + mPUSHs(newSVpv(get_name(h, RPMTAG_NAME), 0)); + mPUSHs(newSVpv(get_name(h, RPMTAG_VERSION), 0)); + mPUSHs(newSVpv(get_name(h, RPMTAG_RELEASE), 0)); + mPUSHs(newSVpv(get_arch(h), 0)); } } @@ -2731,7 +2718,6 @@ void Spec_srcrpm(spec) rpmSpec spec PREINIT: - const char *name, *version, *release; Header header = NULL; PPCODE: #ifdef RPM4_9_0 @@ -2741,13 +2727,10 @@ Spec_srcrpm(spec) #endif struct rpmtd_s td; int no_src = headerGet(header, RPMTAG_NOPATCH, &td, HEADERGET_MINMEM) || headerGet(header, RPMTAG_NOSOURCE, &td, HEADERGET_MINMEM); - name = get_name(header, RPMTAG_NAME); - version = get_name(header, RPMTAG_VERSION); - release = get_name(header, RPMTAG_RELEASE); - - mXPUSHs(newSVpvf("%s/%s-%s-%s.%ssrc.rpm", + char *nvr = headerGetAsString(header, RPMTAG_NVR); + mXPUSHs(newSVpvf("%s/%s.%ssrc.rpm", rpmGetPath("%{_srcrpmdir}", NULL), - name, version, release, + nvr, no_src ? "no" : "" )); |