OBS 101: How to treat packages with multiple spec files

If you have an OBS package containing multiple spec files, you may have discovered that OBS only builds the spec file matching the OBS package name. If you want to have the other(s) spec file(s) built, you should use a link, don’t use copypac!

For example, devel:languages:python / python-nose is a OBS package containing four (!) spec files. In this case, documentation building is separate because doc building dependencies (python-Sphinx) would create a build cycle. A second set of packages are Python3-related, because devel:languages:python builds both Python and Python3 at the moment. So we end up with the following list of spec files:

    python-nose/python-nose.spec
    python-nose/python-nose-doc.spec
    python-nose/python3-nose.spec
    python-nose/python3-nose-doc.spec

As you can see here, only python-nose.spec is build, so we have to do the following (on a command line near you, given you have the rights to do it in the project):

    $ osc linkpac devel:languages:python python-nose \
                  devel:languages:python python-nose-doc
    $ osc linkpac devel:languages:python python-nose \
                  devel:languages:python python3-nose
    $ osc linkpac devel:languages:python python-nose \
                  devel:languages:python python3-nose-doc

Even though you end up with four OBS packages, you only have to change or fix python-nose due to the links. This is better than using copypac (as I’ve seen recently). Of course you should only split up into several spec files if there’s a very good reason for the extra work. Here are some:

  • To avoid build cycles
  • To off-load looong-running parts of a package build, like:
    • Running a testsuite ($PACKAGE-testsuite.spec)
    • Building documentation ($PACKAGE-doc.spec)
  • When building the same thing against a different set of (build) requirements, like:
    • Different $DYNAMIC_LANGUAGE interpreter versions
      (usually $INTERPRETER-$PACKAGE.spec)

Lastly, to make sure other people branch from the right package, you should set the “base” package as the devel package of the linked ones like this:

    $ osc changedevelrequest devel:languages:python python-nose-doc \
                             devel:languages:python python-nose
    $ osc changedevelrequest devel:languages:python python3-nose \
                             devel:languages:python python-nose
    $ osc changedevelrequest devel:languages:python python3-nose-doc \
                             devel:languages:python python3-nose

This way, people always end up branching from python-nose when they try to branch python-nose-doc (or python3-nose / python3-nose-doc).  Thanks to vuntz for reminding me of the last point!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s