コード例 #1
0
ファイル: isebuild.py プロジェクト: rrozestw/portage
    def check(self, checkdirlist, checkdir, xpkg):
        self.continue_ = False
        ebuildlist = []
        pkgs = {}
        allvalid = True
        for y in checkdirlist:
            file_is_ebuild = y.endswith(".ebuild")
            file_should_be_non_executable = y in no_exec or file_is_ebuild

            if file_should_be_non_executable:
                file_is_executable = stat.S_IMODE(
                    os.stat(os.path.join(checkdir, y)).st_mode) & 0o111

                if file_is_executable:
                    self.qatracker.add_error("file.executable",
                                             os.path.join(checkdir, y))
            if file_is_ebuild:
                pf = y[:-7]
                ebuildlist.append(pf)
                catdir = xpkg.split("/")[0]
                cpv = "%s/%s" % (catdir, pf)
                try:
                    myaux = dict(
                        zip(allvars, self.portdb.aux_get(cpv, allvars)))
                except KeyError:
                    allvalid = False
                    self.qatracker.add_error("ebuild.syntax",
                                             os.path.join(xpkg, y))
                    continue
                except IOError:
                    allvalid = False
                    self.qatracker.add_error("ebuild.output",
                                             os.path.join(xpkg, y))
                    continue
                if not portage.eapi_is_supported(myaux["EAPI"]):
                    allvalid = False
                    self.qatracker.add_error("EAPI.unsupported",
                                             os.path.join(xpkg, y))
                    continue
                pkgs[pf] = Package(cpv=cpv,
                                   metadata=myaux,
                                   root_config=self.root_config,
                                   type_name="ebuild")

        if len(pkgs) != len(ebuildlist):
            # If we can't access all the metadata then it's totally unsafe to
            # commit since there's no way to generate a correct Manifest.
            # Do not try to do any more QA checks on this package since missing
            # metadata leads to false positives for several checks, and false
            # positives confuse users.
            self.continue_ = True

        return pkgs, allvalid
コード例 #2
0
ファイル: isebuild.py プロジェクト: zorry/zobsc
	def check(self, checkdirlist, checkdir, xpkg):
		self.continue_ = False
		ebuildlist = []
		pkgs = {}
		allvalid = True
		for y in checkdirlist:
			file_is_ebuild = y.endswith(".ebuild")
			file_should_be_non_executable = y in no_exec or file_is_ebuild

			if file_should_be_non_executable:
				file_is_executable = stat.S_IMODE(
					os.stat(os.path.join(checkdir, y)).st_mode) & 0o111

				if file_is_executable:
					self.qatracker.add_error("file.executable", os.path.join(checkdir, y))
			if file_is_ebuild:
				pf = y[:-7]
				ebuildlist.append(pf)
				catdir = xpkg.split("/")[0]
				cpv = "%s/%s" % (catdir, pf)
				try:
					myaux = dict(zip(allvars, self.portdb.aux_get(cpv, allvars)))
				except KeyError:
					allvalid = False
					self.qatracker.add_error("ebuild.syntax", os.path.join(xpkg, y))
					continue
				except IOError:
					allvalid = False
					self.qatracker.add_error("ebuild.output", os.path.join(xpkg, y))
					continue
				if not portage.eapi_is_supported(myaux["EAPI"]):
					allvalid = False
					self.qatracker.add_error("EAPI.unsupported", os.path.join(xpkg, y))
					continue
				pkgs[pf] = Package(
					cpv=cpv, metadata=myaux, root_config=self.root_config,
					type_name="ebuild")

		if len(pkgs) != len(ebuildlist):
			# If we can't access all the metadata then it's totally unsafe to
			# commit since there's no way to generate a correct Manifest.
			# Do not try to do any more QA checks on this package since missing
			# metadata leads to false positives for several checks, and false
			# positives confuse users.
			self.continue_ = True

		return pkgs, allvalid
コード例 #3
0
    def check_isebuild(self, **kwargs):
        """Test the file for qualifications that is is an ebuild

        @param checkdirlist: list of files in the current package directory
        @param checkdir: current package directory path
        @param xpkg: current package directory being checked
        @param validity_future: Future instance
        @returns: dictionary, including {pkgs, can_force}
        """
        checkdirlist = kwargs.get("checkdirlist").get()
        checkdir = kwargs.get("checkdir")
        xpkg = kwargs.get("xpkg")
        fuse = kwargs.get("validity_future")
        can_force = kwargs.get("can_force")
        self.continue_ = False
        ebuildlist = []
        pkgs = {}
        for y in checkdirlist:
            file_is_ebuild = y.endswith(".ebuild")
            file_should_be_non_executable = (
                y in self.repo_settings.qadata.no_exec or file_is_ebuild)

            if file_should_be_non_executable:
                file_is_executable = (stat.S_IMODE(
                    os.stat(os.path.join(checkdir, y)).st_mode) & 0o111)

                if file_is_executable:
                    self.qatracker.add_error("file.executable",
                                             os.path.join(checkdir, y))
            if file_is_ebuild:
                pf = y[:-7]
                ebuildlist.append(pf)
                catdir = xpkg.split("/")[0]
                cpv = "%s/%s" % (catdir, pf)
                allvars = self.repo_settings.qadata.allvars
                try:
                    myaux = dict(
                        zip(allvars, self.portdb.aux_get(cpv, allvars)))
                except KeyError:
                    fuse.set(False, ignore_InvalidState=True)
                    self.qatracker.add_error("ebuild.syntax",
                                             os.path.join(xpkg, y))
                    continue
                except IOError:
                    fuse.set(False, ignore_InvalidState=True)
                    self.qatracker.add_error("ebuild.output",
                                             os.path.join(xpkg, y))
                    continue
                except InvalidPackageName:
                    fuse.set(False, ignore_InvalidState=True)
                    self.qatracker.add_error("ebuild.invalidname",
                                             os.path.join(xpkg, y))
                    continue
                if not portage.eapi_is_supported(myaux["EAPI"]):
                    fuse.set(False, ignore_InvalidState=True)
                    self.qatracker.add_error("EAPI.unsupported",
                                             os.path.join(xpkg, y))
                    continue
                pkgs[pf] = Package(
                    cpv=cpv,
                    metadata=myaux,
                    root_config=self.root_config,
                    type_name="ebuild",
                )

        if len(pkgs) != len(ebuildlist):
            # If we can't access all the metadata then it's totally unsafe to
            # commit since there's no way to generate a correct Manifest.
            # Do not try to do any more QA checks on this package since missing
            # metadata leads to false positives for several checks, and false
            # positives confuse users.
            self.continue_ = True
            can_force.set(False, ignore_InvalidState=True)
        self.pkgs = pkgs
        # set our updated data
        dyn_pkgs = kwargs.get("pkgs")
        dyn_pkgs.set(pkgs)
        return self.continue_
コード例 #4
0
ファイル: ebuild.py プロジェクト: aeroniero33/portage
	def check_isebuild(self, **kwargs):
		'''Test the file for qualifications that is is an ebuild

		@param checkdirlist: list of files in the current package directory
		@param checkdir: current package directory path
		@param xpkg: current package directory being checked
		@param validity_future: Future instance
		@returns: dictionary, including {pkgs, can_force}
		'''
		checkdirlist = kwargs.get('checkdirlist').get()
		checkdir = kwargs.get('checkdir')
		xpkg = kwargs.get('xpkg')
		fuse = kwargs.get('validity_future')
		can_force = kwargs.get('can_force')
		self.continue_ = False
		ebuildlist = []
		pkgs = {}
		for y in checkdirlist:
			file_is_ebuild = y.endswith(".ebuild")
			file_should_be_non_executable = y in no_exec or file_is_ebuild

			if file_should_be_non_executable:
				file_is_executable = stat.S_IMODE(
					os.stat(os.path.join(checkdir, y)).st_mode) & 0o111

				if file_is_executable:
					self.qatracker.add_error("file.executable", os.path.join(checkdir, y))
			if file_is_ebuild:
				pf = y[:-7]
				ebuildlist.append(pf)
				catdir = xpkg.split("/")[0]
				cpv = "%s/%s" % (catdir, pf)
				try:
					myaux = dict(zip(allvars, self.portdb.aux_get(cpv, allvars)))
				except KeyError:
					fuse.set(False, ignore_InvalidState=True)
					self.qatracker.add_error("ebuild.syntax", os.path.join(xpkg, y))
					continue
				except IOError:
					fuse.set(False, ignore_InvalidState=True)
					self.qatracker.add_error("ebuild.output", os.path.join(xpkg, y))
					continue
				except InvalidPackageName:
					fuse.set(False, ignore_InvalidState=True)
					self.qatracker.add_error("ebuild.invalidname", os.path.join(xpkg, y))
					continue
				if not portage.eapi_is_supported(myaux["EAPI"]):
					fuse.set(False, ignore_InvalidState=True)
					self.qatracker.add_error("EAPI.unsupported", os.path.join(xpkg, y))
					continue
				pkgs[pf] = Package(
					cpv=cpv, metadata=myaux, root_config=self.root_config,
					type_name="ebuild")

		if len(pkgs) != len(ebuildlist):
			# If we can't access all the metadata then it's totally unsafe to
			# commit since there's no way to generate a correct Manifest.
			# Do not try to do any more QA checks on this package since missing
			# metadata leads to false positives for several checks, and false
			# positives confuse users.
			self.continue_ = True
			can_force.set(False, ignore_InvalidState=True)
		self.pkgs = pkgs
		# set our updated data
		dyn_pkgs = kwargs.get('pkgs')
		dyn_pkgs.set(pkgs)
		return self.continue_