## JDS RPM Rules

The following RPM rules apply for hacking on the JDS sources -

### Scripts

- pre/post-install/remove scripts should never touch files belonging to another package.
- Never add or delete files in pre/post-install scripts. Adding files will result in files in the file system that do not belong to any packages. Removing files will cause the package to fail verification (rpm --verify) and result in warnings about missing files when you uninstall the package.
- If you change a file in a pre/post-install script, make sure you use %verify directive to tell RPM not to verify the MD5 checksum, size and modification of that file when running rpm --verify -

  > `%verify (not md5 size mtime) file.conf`

- The script fragment for registering help docs with scrollkeeper should be "`scrollkeeper-update -q`" and nothing else.
- Do not use the "j" or "z" flags of tar to uncompress sources as it's not portable on Solaris. Use "`bzip2 -dc %SOURCEn | tar xf -`"

### Dependencies

- When `%pre` and `%post` scripts depend on other packages (almost always the case), the package has to use the `PreReq: other-package` tag to define that dependency. This tag ensures that other-package is installed before the package that defines the tag. The Requires tag only specifies that both packages need to be installed to get a running system, but the order is not important.
  For example, if `%post` calls `scrollkeeper-update`, then the spec file must include "`PreReq: scrollkeeper`".
- When a previously delivered package obsoleted by new one, and therefore no longer delivered, the new package has to use the "Obsoletes" tag to avoid problems with upgrades. If the new package still provides the old code, also use the "Provides" tag. For example, if package `bonobo-activation` is merged into `libbonobo` put this into `libbonobo.spec` -

      		%define bonobo_activation_version 2.4.0
      		Obsoletes: bonobo-activation < %{bonobo_activation_version}
      		Provides: bonobo-activation = %{bonobo_activation_version}
      		Obsoletes: bonobo-activation-devel < %{bonobo_activation_version}
      		Provides: bonobo-activation-devel = %{bonobo_activation_version}

### Files

- Always use the most specific directory variable, e.g. `%_bindir` instead of `%_prefix/bin` and `%_datadir` instead of `%_prefix/share`.
- Use the `%config` directive for config files.
- Do not include libtool's .la files in the packages. Not even in the devel package.
- Do not include static libs unless absolutely necessary, in that case, include it in the devel package.
- Include lib*.so.* in the base package, lib*.so in the -devel package.

### Patches

- All patches should be p1 (i.e. the files names in the diff start with the top level source dir and you use `%patchn -p1` in the spec file.
- The patch naming convention should be the following - `module_name-nn-descriptive_text.diff`, where `modules_name` is the base name of the spec file without the .spec, `nn` is the number of the patch (`Patchnn` tag in the spec file) and `descriptive_text` is a very short description of what the patch does or why it is needed, e.g.:

  > `gst-02-fix-registry-crashes.diff.`

- When you remove a patch, make sure that patches with higher numbers are renumbered (update `Patchnn` tag in the spec file, rename file, cvs remove old_file, cvs add new_file). There is a script in the scripts directory to automatically reorder patches - use it carefully if you do so.