Ejemplo n.º 1
0
                      dest="dry",
                      action="store_true",
                      default=False,
                      help="run the command in dry mode")

    parser.add_option("",
                      "",
                      "--verbose",
                      dest="debug",
                      action="store_true",
                      default=False,
                      help="be more verbose ")

    options, args = parser.parse_args()

    fp_obj = FormatedPrint(formated=False)

    branches = Config().getBranches()
    if options.branches != "":
        bs = filter(lambda b: b != "", options.branches.split(","))
        for branch in bs:
            if branch in branches:
                continue

            print "%s branch not in a list of all branches" % branch
            exit(1)

        branches = bs

    if options.ebranches != "":
        ebs = filter(lambda b: b != "", options.ebranches.split(","))
Ejemplo n.º 2
0
            "", "", "--all-occurrences", dest="alloccurrences", action = "store_true", default = False,
            help = "List imported paths in all packages including main. Default is skip main packages."
        )

	parser.add_option(
            "", "", "--show-occurrence", dest="showoccurrence", action = "store_true", default = False,
            help = "Show occurence of import paths."
        )

	options, args = parser.parse_args()

	path = "."
	if len(args):
		path = args[0]

	fmt_obj = FormatedPrint()

	if not options.scanalldirs:
		noGodeps = Config().getSkippedDirectories()
	else:
		noGodeps = []

	if options.skipdirs:
		for dir in options.skipdirs.split(','):
			dir = dir.strip()
			if dir == "":
				continue
			noGodeps.append(dir)

	gse_obj = GoSymbolsExtractor(path, imports_only=True, skip_errors=options.skiperrors, noGodeps=noGodeps)
	if not gse_obj.extract():
Ejemplo n.º 3
0
	archive = fd.getArchive()

	# if options only files detection
	if options.info:
		exit(0)

	if options.archive:
		archive = options.archive

	if options.spec:
		specfile = options.spec

	if options.sources:
		sources = options.sources

	fp_obj = FormatedPrint(formated=True)

	if archive == "":
		fp_obj.printError("archive not set")
		exit(1)

	if specfile == "":
		fp_obj.printError("specfile not set")
		exit(1)

	if not options.scanalldirs:
		noGodeps = Config().getSkippedDirectories()
	else:
		noGodeps = []

	if options.skipdirs:
Ejemplo n.º 4
0
	os.chdir("%s/fedora/%s" % (name, name))

def downloadTarball(archive_url):
	so, se, rc = runCommand("wget -nv %s --no-check-certificate" % archive_url)
	if rc != 0:		
		print "%sUnable to download tarball:\n%s%s" % (RED, se, ENDC)
		exit(1)

if __name__ == "__main__":

	options, args = setOptions()

	if checkOptions(options):
		exit(1)

	fmt_obj = FormatedPrint(options.format)

	if not options.format:
		ENDC = ""
		RED = ""
		GREEN = ""

	if options.detect == "":
		# collect spec file information
		project = options.project
		repo = options.repo
		if project == "":
			fmt_obj.printError("Project missing")
			exit(1)

		if repo == "":
Ejemplo n.º 5
0
def printBasicInfo(url, commit, name, formated=True):
	fmt_obj = FormatedPrint(formated)
	fmt_obj.printInfo("Repo URL: %s" % url)
	fmt_obj.printInfo("Commit: %s" % commit)
	fmt_obj.printInfo("Name: %s" % name)
Ejemplo n.º 6
0
def printBasicInfo(url, commit, name, formated=True):
	fmt_obj = FormatedPrint(formated)
	fmt_obj.printInfo("Repo URL: %s" % url)
	fmt_obj.printInfo("Commit: %s" % commit)
	fmt_obj.printInfo("Name: %s" % name)
Ejemplo n.º 7
0
        "",
        "--show-main",
        dest="showmain",
        action="store_true",
        default=False,
        help=
        "Show occurence of import paths in main packages only (+means not just main)."
    )

    options, args = parser.parse_args()

    path = "."
    if len(args):
        path = args[0]

    fmt_obj = FormatedPrint()

    if not options.scanalldirs:
        noGodeps = Config().getSkippedDirectories()
    else:
        noGodeps = []

    if options.skipdirs:
        for dir in options.skipdirs.split(','):
            dir = dir.strip()
            if dir == "":
                continue
            noGodeps.append(dir)

    gse_obj = GoSymbolsExtractor(path,
                                 imports_only=True,
Ejemplo n.º 8
0
    parser.add_option(
        "",
        "-m",
        "--minimal",
        dest="minimal",
        action="store_true",
        default=False,
        help="List only packages. Used with -s option.",
    )

    parser.add_option("", "-v", "--verbose", dest="verbose", action="store_true", default=False, help="Verbose mode.")

    options, args = parser.parse_args()

    fmt_obj = FormatedPrint(formated=False)

    if options.imports and options.provides:
        print "You can not set both -i and -o options at the same time"
        exit(1)

    if options.create:
        if createDB(full=options.full, verbose=options.verbose):
            print "DB updated"
        else:
            print "DB not updated"

    elif options.imports:
        ipdb_obj = ImportPathDB()
        if not ipdb_obj.load():
            fmt_obj.printError(ipdb_obj.getError())
Ejemplo n.º 9
0
	os.chdir("%s/fedora/%s" % (name, name))

def downloadTarball(archive_url):
	so, se, rc = runCommand("wget -nv %s --no-check-certificate" % archive_url)
	if rc != 0:		
		print "%sUnable to download tarball:\n%s%s" % (RED, se, ENDC)
		exit(1)

if __name__ == "__main__":

	options, args = setOptions()

	if checkOptions(options):
		exit(1)

	fmt_obj = FormatedPrint(options.format)

	if not options.format:
		ENDC = ""
		RED = ""
		GREEN = ""

	if options.detect == "":
		# collect spec file information
		project = options.project
		repo = options.repo
		if not options.googlecode and project == "":
			fmt_obj.printError("Project missing")
			exit(1)

		if repo == "":
Ejemplo n.º 10
0
    if len(args) > 0:
        pkg_name = args[0]

    if not options.scanalldirs:
        noGodeps = Config().getSkippedDirectories()
    else:
        noGodeps = []

    if options.skipdirs:
        for dir in options.skipdirs.split(','):
            dir = dir.strip()
            if dir == "":
                continue
            noGodeps.append(dir)

    fp = FormatedPrint()

    scan_time_start = time()
    if not options.cyclic and not options.leaves and not options.roots and not options.graphviz:
        print "Synopsis: prog [-d --from-dir|--from-xml] -c|-l|-r|-g [-v] [PACKAGE]"
        exit(1)

    if options.decompose != "":
        gb = ProjectDecompositionGraphBuilder(options.decompose,
                                              skip_errors=options.skiperrors,
                                              noGodeps=noGodeps)
        if options.fromxml != "":
            if not gb.buildFromXml(options.fromxml):
                fp.printError(gb.getError())
                exit(1)
        elif options.fromdir != "":
Ejemplo n.º 11
0
	    help = "Prefix of import paths to display. Used with -i and -p options."
	)

	parser.add_option(
	    "", "-m", "--minimal", dest="minimal", action = "store_true",  default = False,
	    help = "List only packages. Used with -s option."
	)

	parser.add_option(
	    "", "-v", "--verbose", dest="verbose", action = "store_true",  default = False,
	    help = "Verbose mode."
	)

	options, args = parser.parse_args()

	fmt_obj = FormatedPrint(formated=False)

	if options.imports and options.provides:
		print "You can not set both -i and -o options at the same time"
		exit(1)

	if options.create:
		if createDB(full=options.full, verbose=options.verbose):
			print "DB updated"
		else:
			print "DB not updated"

	elif options.imports:
		ipdb_obj = ImportPathDB()
		if not ipdb_obj.load():
			fmt_obj.printError(ipdb_obj.getError())
Ejemplo n.º 12
0
    archive = fd.getArchive()

    # if options only files detection
    if options.info:
        exit(0)

    if options.archive:
        archive = options.archive

    if options.spec:
        specfile = options.spec

    if options.sources:
        sources = options.sources

    fp_obj = FormatedPrint(formated=True)

    if archive == "":
        fp_obj.printError("archive not set")
        exit(1)

    if specfile == "":
        fp_obj.printError("specfile not set")
        exit(1)

    if not options.scanalldirs:
        noGodeps = Config().getSkippedDirectories()
    else:
        noGodeps = []

    if options.skipdirs:
Ejemplo n.º 13
0
	    help = "use all branches except listed ones"
	)

	parser.add_option(
	    "", "", "--dry", dest="dry", action = "store_true", default = False,
	    help = "run the command in dry mode"
	)

	parser.add_option(
	    "", "", "--verbose", dest="debug", action = "store_true", default = False,
	    help = "be more verbose "
	)

	options, args = parser.parse_args()

	fp_obj = FormatedPrint(formated=False)

	branches = Config().getBranches()
	if options.branches != "":
		bs = filter(lambda b: b != "", options.branches.split(","))
		for branch in bs:
			if branch in branches:
				continue

			print "%s branch not in a list of all branches" % branch
			exit(1)

		branches = bs

	if options.ebranches != "":
		ebs = filter(lambda b: b != "", options.ebranches.split(","))
Ejemplo n.º 14
0
	if len(args) > 0:
		pkg_name = args[0]

	if not options.scanalldirs:
		noGodeps = Config().getSkippedDirectories()
	else:
		noGodeps = []

	if options.skipdirs:
		for dir in options.skipdirs.split(','):
			dir = dir.strip()
			if dir == "":
				continue
			noGodeps.append(dir)

	fp = FormatedPrint()

	scan_time_start = time()
	if not options.cyclic and not options.leaves and not options.roots and not options.graphviz:
		print "Synopsis: prog [-d --from-dir|--from-xml] -c|-l|-r|-g [-v] [PACKAGE]"
		exit(1)

	if options.decompose != "":
		config = ParserConfig()
		if options.skiperrors:
			config.setSkipErrors()
		config.setNoGodeps(noGodeps)
		config.setImportPathPrefix(options.decompose)

		gb = ProjectDecompositionGraphBuilder(config)
		if options.fromxml != "":