示例#1
0
    def main(self):
        if len(self.env['pkginfo_repo_path']) < 1:
            self.output('empty pkginfo path')
            return

        pkginfo = readPlist(self.env['pkginfo_repo_path'])

        receipts_modified = []
        if 'receipts' in pkginfo.keys():
            for i, receipt in enumerate(pkginfo['receipts']):
                # made optional any pkginfos
                if receipt['packageid'] in self.env[
                        'pkg_ids_set_optional_true']:
                    pkginfo['receipts'][i]['optional'] = True
                    self.output('Setting package ID %s as optional' %
                                receipt['packageid'])
                    receipts_modified.append(receipt['packageid'])
        else:
            raise ProcessorError('pkginfo does not contain receipts key')

        if len(receipts_modified) > 0:
            self.output('Writing pkginfo to %s' %
                        self.env['pkginfo_repo_path'])
            writePlist(pkginfo, self.env['pkginfo_repo_path'])
        else:
            self.output('No receipts modified, not writing pkginfo')
示例#2
0
    def main(self):
        if len(self.env['pkginfo_repo_path']) < 1:
            self.output('empty pkginfo path')
            return

        pkginfo = readPlist(self.env['pkginfo_repo_path'])
        substrings = ['SA', 'postflight']
        substrings.append(self.env['redgiant_cc_version_substring'])
        receipts_modified = []
        if 'receipts' in pkginfo.keys():
            for i, receipt in enumerate(pkginfo['receipts']):
                # made optional any pkginfos
                if not any(substr in receipt['packageid']
                           for substr in substrings):
                    pkginfo['receipts'][i]['optional'] = True
                    self.output('Setting package ID %s as optional' %
                                receipt['packageid'])
                    receipts_modified.append(receipt['packageid'])
        else:
            raise ProcessorError('pkginfo does not contain receipts key')

        if len(receipts_modified) > 0:
            self.output('Writing pkginfo to %s' %
                        self.env['pkginfo_repo_path'])
            writePlist(pkginfo, self.env['pkginfo_repo_path'])
        else:
            self.output('No receipts modified, not writing pkginfo')
    def main(self):
        if len(self.env['pkginfo_repo_path']) < 1:
            self.output('empty pkginfo path')
            return

        pkginfo = readPlist(self.env['pkginfo_repo_path'])

        receipts_modified = []
        if 'receipts' in pkginfo.keys():
            for i, receipt in enumerate(pkginfo['receipts']):
                # made optional any pkginfos
                if receipt['packageid'] in self.env[
                        'pkg_ids_set_optional_true']:
                    pkginfo['receipts'][i]['optional'] = True
                    self.output(
                        'Setting package ID %s as optional' %
                        receipt['packageid'])
                    receipts_modified.append(receipt['packageid'])
        else:
            raise ProcessorError('pkginfo does not contain receipts key')

        if len(receipts_modified) > 0:
            self.output(
                'Writing pkginfo to %s' %
                self.env['pkginfo_repo_path'])
            writePlist(pkginfo, self.env['pkginfo_repo_path'])
        else:
            self.output('No receipts modified, not writing pkginfo')
示例#4
0
    def main(self):
        """Import item into IPFS"""
        if len(self.env['pkginfo_repo_path']) < 1:
            self.output('empty pkginfo path')
            return
        pkginfo = readPlist(self.env['pkginfo_repo_path'])
        # Generate arguments for makecatalogs.
        args = ["/usr/local/bin/ipfs", "add", "-w", "--only-hash"]
        if self.env["pkg_repo_path"].startswith("/"):
            # looks a file path instead of a URL
            args.append(self.env["pkg_repo_path"])

        # Call ipfs add.
        try:
            proc = subprocess.Popen(args,
                                    stdout=subprocess.PIPE,
                                    stderr=subprocess.PIPE)
            (output, err_out) = proc.communicate()
        except OSError as err:
            raise ProcessorError("ipfs add failed with error code %d: %s" %
                                 (err.errno, err.strerror))

        # Get the wrapper CID for the item
        self.env["ipfs_cid"] = str.splitlines(output)[1].split(' ')[1]
        self.env["ipfs_add_resultcode"] = proc.returncode
        self.env["ipfs_add_stderr"] = err_out.decode("utf-8")
        if proc.returncode != 0:
            error_text = "IPFS add failed: \n" + self.env["ipfs_add_stderr"]
            raise ProcessorError(error_text)
        else:
            pkginfo['ipfs_cid'] = self.env["ipfs_cid"]
            self.output('Writing pkginfo to %s' %
                        self.env['pkginfo_repo_path'])
            writePlist(pkginfo, self.env['pkginfo_repo_path'])
            self.output("{} added to IPFS with cid {}".format(
                self.env["pkg_repo_path"], self.env["ipfs_cid"]))
示例#5
0
 def write_choices_xml(self, parsed_choices, choices_xml_dest):
     '''Write the plist to a file'''
     try:
         writePlist(parsed_choices, choices_xml_dest)
     except:
         self.output('Could not write to file')
示例#6
0
 def write_choices_xml(self, parsed_choices, choices_xml_dest):
     '''Write the plist to a file'''
     try:
         writePlist(parsed_choices, choices_xml_dest)
     except:
         self.output('Could not write to file')