From Fedora Project Wiki

Revision as of 15:25, 19 February 2009 by Kasal (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Notes about maintaining the perl itself

How to update a module included in perl distribution tarball

Here is what I'm doing when one of the modules in perl-5.*tar.gz needs to be updated. Let's take an example, say File::Temp.

Let's suppose that perl.spec does not yet contain any patch updating File::Temp.

First, prepare two identical copies of perl source tree, say perl-5.10.0/ and perl-5.10.0.orig

Find out the version number included in the tarball:

    grep VERSION perl-5.10.0/lib/File/

Or, since this is what is installed on your rawhide, you can also use:

    perl -mFile::Temp -e 'print "$File::Temp::VERSION\n"'

Then go to and download that old version and the latest one. In this example, I downloaded versions 0.18 and 0.21.

By downloading the old tarball we find out what modifications were done while perl-5.*.tar.gz was assembled. If the old tarball has been deleted from CPAN, search the net, it is really helpful to have the old tarball.

unpack, then diff -qr File-Temp-{0.18,0.21} to see what files have been modified. Look where the files live in the main perl tarball.

Typically, the module code goes to one place in the tree, the tests somewhere else. Then there are individual files like Changes, README, Makefile.PL, examples/; some of them might occur in the module subdirectory, but in most cases they are omitted. But if the tarball contained perl-5.*/lib/File/Temp/Changes, it should be kept up-to date.

Then move the changes to the tree perl-5.10.0. For example, create a patch by diff -urN and divide it to several parts and apply. Take care that no backup files (*.orig) are created.

Then look again at the diff -qr output mentioned above. If there new test files (*.t) added, then it is necessary to add them to perl-5.10.0/MANIFEST; likewise removed test files should be deleted from MANIFEST. (This is necessary because the list of tests for "make test" is generated dynamically and MANIFEST is the primary sources for tests for included modules.)

If there are binary files added or modified, uuencode them:

   cd perl-5.10.0
   for f in path/to/added/files.ext; do
       perl -p $f $f.packed; rm $f

Mention all these *.packed files in MANIFEST. These files will get decoded as part of the build procedure.

Now the updated perl source tree is ready and you can generate the patch:

       (echo File-Temp-0.21; echo;diff -urN perl-5.10.0{.orig,}
               ) >perl-update-File-Temp.patch

(No version number in the file name, to be CVS friendly.)

To include the patch to perl.spec, follow these rules:

  • the module updates are Patch100 and above,
  • use an rpm macro for module version number,
  • all patches, including this one, have to be listed in patchlevel.h.

For example:

Patch102: perl-update-File-Temp.patch
%define File_Temp_version 0.21
%package File-Temp
Version: %{File_Temp_version}
%patch102 -p1
perl -x patchlevel.h \
 'Fedora Patch102: Update File::Temp to %{File_Temp_version}'