RPM Community Forums

Mailing List Message of <rpm-devel>

Re: upgrading from RPM 4 to RPM 5

From: Ralf S. Engelschall <rse+rpm-devel@rpm5.org>
Date: Wed 02 Jan 2008 - 11:26:51 CET
Message-ID: <20080102102651.GA10571@engelschall.com>
On Mon, Dec 31, 2007, Pixel wrote:

> Jeff Johnson <n3npq@mac.com> writes:
>
> > On Dec 31, 2007, at 8:52 AM, Ralf S. Engelschall wrote:
> >
> >>
> >> Perhaps a difference between RPM 4.2 (me) and 4.5 (you)?
> >>
> [...]
>
> > There have been several changes since rpm-4.2 detecting srpms,
> > all to get uncoupled from the vestigial lead structure (which was the
> > original test for a src rpm), and to stop adding an additional tag  explicitly
> > (testing on non-existence of RPMTAG_SOURCERPM is sufficient to
> > detect a srpm).
>
> in mandriva, we needed:
>
> # rpm 4.4.6 killed SOURCEPACKAGE, but this was announce lately, and will
> # break all older tools that was using it (mdv 2006, 2005) which need this
> # tag to know it is possible to rebuild a src.rpm
> # This patch readd the tag into src.rpm
> Patch88: rpm-4.4.6-SOURCEPACKAGE.patch
>
> which allowed rpm 4.4.2 to handle the .src.rpm created with >=4.4.6
> correctly:
> http://cvs.mandriva.com/cgi-bin/viewvc.cgi/SPECS/rpm/rpm.spec?r1=1.217&r2=1.218
>
> --- build/pack.c        3 Apr 2006 14:50:54 -0000       2.211.2.6
> +++ build/pack.c        11 Jun 2006 15:38:20 -0000
> @@ -971,6 +971,7 @@ int packageSources(Spec spec)
>  {
>      struct cpioSourceArchive_s csabuf;
>      CSA_t csa = &csabuf;
> +    int_32 one = 1;
>      int rc;
>
>      /* Add some cruft */
> @@ -980,6 +981,8 @@ int packageSources(Spec spec)
>                    RPM_STRING_TYPE, buildHost(), 1);
>      (void) headerAddEntry(spec->sourceHeader, RPMTAG_BUILDTIME,
>                    RPM_INT32_TYPE, getBuildTime(), 1);
> +    (void) headerAddEntry(spec->sourceHeader, RPMTAG_SOURCEPACKAGE,
> +            RPM_INT32_TYPE, &one, 1);
>
>      (void) genSourceRpmName(spec);

Bingo! That's it: RPMTAG_SOURCEPACKAGE is required for the old RPM 4!
I've ported this to the RPM 5 API and with this change applied the RPM
4.2.1 is able to "rpm --rebuild" the SRPM from RPM 5 just fine. Many
thanks for the hint.
                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com
Received on Wed Jan 2 11:27:43 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.