def _build(self, args):
        '''
        Build a package
        '''
        if 2 < len(args):
            raise SPMInvocationError('A path to a formula must be specified')

        self.abspath = args[1].rstrip('/')
        comps = self.abspath.split('/')
        self.relpath = comps[-1]

        formula_path = '{0}/FORMULA'.format(self.abspath)
        if not os.path.exists(formula_path):
            raise SPMPackageError('Formula file {0} not found'.format(formula_path))
        with salt.utils.fopen(formula_path) as fp_:
            formula_conf = yaml.safe_load(fp_)

        for field in ('name', 'version', 'release', 'summary', 'description'):
            if field not in formula_conf:
                raise SPMPackageError('Invalid package: a {0} must be defined'.format(field))

        out_path = '{0}/{1}-{2}-{3}.spm'.format(
            self.opts['spm_build_dir'],
            formula_conf['name'],
            formula_conf['version'],
            formula_conf['release'],
        )

        if not os.path.exists(self.opts['spm_build_dir']):
            os.mkdir(self.opts['spm_build_dir'])

        self.formula_conf = formula_conf

        formula_tar = tarfile.open(out_path, 'w:bz2')

        try:
            formula_tar.add(formula_path, formula_conf['name'], filter=self._exclude)
            formula_tar.add(self.abspath, formula_conf['name'], filter=self._exclude)
        except TypeError:
            formula_tar.add(formula_path, formula_conf['name'], exclude=self._exclude)
            formula_tar.add(self.abspath, formula_conf['name'], exclude=self._exclude)
        formula_tar.close()

        self.ui.status('Built package {0}'.format(out_path))
dataset/ETHPy150Open saltstack/salt/salt/spm/__init__.py/SPMClient._build/swapped operands of `<`