Dependency Structure for Gbs-export

From Tizen Wiki
Jump to: navigation, search


This document analyzes dependency structure for gbs-export (GBS) from the following two perspectives:

  • Source dependency structure
  • Subpackage dependency structure

Source Dependency

Dependency Overview

           -- librpm-tizen(recommends)

Gbs-export depends on librpm-tizen (recommends)


The RPM Library `librpm` is a standard library used for spec file analysis. Because this standard library sets strict requirments for package names, which many Tizen packages can't meet, we customize `librpm` as `librpm-tizen` to accommodate Tizen development. More specifically, when unqualified package name is detected, `librpm` will display error message and exit, whereas `librpm-tizen` will proceed without exiting.

Essential Code and Logic

When `librpm-tizen` is installed, GBS will use this customized library to best accommodate Tizen development; otherwise `librpm` provided by the system will be used, which means `librpm-tizen` is **recommended** instead of **mandatory** dependency package for GBS.

      23 from gbp.rpm.policy import RpmPkgPolicy
      25 try:
      26     # Try to load special RPM lib to be used for GBP (only)
      27     librpm = __import__(RpmPkgPolicy.python_rpmlib_module_name)
      28 except ImportError:
      29     gbp.log.warn("Failed to import '%s' as rpm python module, using host's "
      30                     "default rpm library instead" %
      31                     RpmPkgPolicy.python_rpmlib_module_name)
      32     import rpm as librpm

Gbs-export depends on git-buildpackage


GBS used to handle the Debian source package maintenance in its own system. With the development of cross-site cooperation, an independent Debian source package maintenance tool named git-buildpackage grows mature and we choose to depend on git-buildpackage instead of covering this functionality in GBS.

Essential Code and Logic

GBS imports the main function of buildpackage_rpm() as gbp_build and calls it when exporting sources.

   35 from gbp.scripts.buildpackage_rpm import main as gbp_build
   199 def export_sources(repo, commit, export_dir, spec, args, create_tarball=True):
   200     """
   201     Export packaging files using git-buildpackage
   202     """
   209     try:
   210         ret = gbp_build(gbp_args)

Subpackage Dependency

         --gbs-api              --python
         |                      |
         --pristine-tar         --python-rpm              --python
         |                      |                         |
         --git-buildpackage-rpm---rpm2cpio                --git
                                |                         |