docs: def create_srpm(dist='el7'):
      """Create an srpm
      Requires that sources are available in local directory
  
      dist: set package dist tag (default: el7)
      """
      if not RPM_AVAILABLE:
          raise RpmModuleNotAvailable()
      path = os.getcwd()
      try:
          specfile = spec_fn()
          spec = Spec(specfile)
      except Exception:
          return
  
      rpmdefines = ["--define 'dist .{}'".format(dist),
                    "--define '_sourcedir {}'".format(path),
                    "--define '_srcrpmdir {}'".format(path)]
      rpm.addMacro('_sourcedir', '.{}'.format(dist))
      # FIXME: needs to be fixed in Spec
      rpm.addMacro('dist', '.{}'.format(dist))
      module_name = spec.get_tag('Name', True)
      version = spec.get_tag('Version', True)
      release = spec.get_tag('Release', True)
      srpm = os.path.join(path,
                          "{}-{}-{}.src.rpm".format(module_name,
                                                    version,
                                                    release))
  
      # See if we need to build the srpm
      if os.path.exists(srpm):
          log.warn('Srpm found, rewriting it.')
  
      cmd = ['rpmbuild']
      cmd.extend(rpmdefines)
  
      cmd.extend(['--nodeps', '-bs', specfile])
      output = subprocess.check_output(' '.join(cmd), shell=True)
      log.warn(output)
      srpm = output.split()[1]
      return srpm