From e7e8935a722ea26865d00d9bffe7f6b4271ea6a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=2E=C3=87a=C4=9Flar=20Onur?= Date: Thu, 12 Oct 2006 21:22:21 +0000 Subject: [PATCH] remove unneeeded scripts, minimize pisi installation. If anyone using these, please revert back --- scripts/calc-build-order.py | 81 -------------------------------- scripts/find-lib-deps.py | 64 ------------------------- scripts/pisish | 88 ----------------------------------- scripts/rmcomp-source-repo.py | 46 ------------------ setup.py | 8 +--- 5 files changed, 2 insertions(+), 285 deletions(-) delete mode 100755 scripts/calc-build-order.py delete mode 100755 scripts/find-lib-deps.py delete mode 100755 scripts/pisish delete mode 100755 scripts/rmcomp-source-repo.py diff --git a/scripts/calc-build-order.py b/scripts/calc-build-order.py deleted file mode 100755 index 3c2fc06a..00000000 --- a/scripts/calc-build-order.py +++ /dev/null @@ -1,81 +0,0 @@ -#! /usr/bin/python -# a simple tool to find the correct build order of source -# packages in the repository. this one works really fast. -# just give it the repository directory as an argument -# author: exa - -import sys -import os -sys.path.insert(0, '.') - -import gettext -__trans = gettext.translation('pisi', fallback=True) -_ = __trans.ugettext - -import pisi.context as ctx -import pisi -import pisi.api -import pisi.config -import pisi.specfile as specfile -import pisi.util -import pisi.graph - -options = pisi.config.Options() -if len(sys.argv) > 2: - options.destdir=sys.argv[2] -else: - options.destdir = '/' -pisi.api.init(database=False, options=options) -repo_uri = sys.argv[1] - -specfiles = [] - -print "reading pspecfiles, just a moment" -for root, dirs, files in os.walk(repo_uri): - for fn in files: - if fn == 'pspec.xml': - #ctx.ui.info(_('Adding %s to package index') % fn) - sf = specfile.SpecFile() - sf.read(pisi.util.join_path(root, fn)) - sf.check() - sys.stdout.write('.') - sys.stdout.flush() - specfiles.append(sf) - -def plan_build(specfiles): - # try to construct a pisi graph of packages to - # install / reinstall - - G_f = pisi.graph.Digraph() - pkgtosrc = {} - for sf in specfiles: - for pkg in sf.packages: - pkgtosrc[str(pkg.name)] = str(sf.source.name) - - for x in specfiles: - #G_f.add_package(x) - src = x.source - if not str(src.name) in G_f.vertices(): - G_f.add_vertex(str(src.name), (src.version, src.release)) - for builddep in src.buildDependencies: - G_f.add_edge(str(src.name), str(builddep.package)) - for pkg in x.packages: - for rtdep in pkg.packageDependencies: - tsrc = pkgtosrc[rtdep.package] - if not src.name == tsrc: # firefox - firefox-devel thing - G_f.add_edge(src.name, tsrc ) - - if ctx.config.get_option('debug'): - G_f.write_graphviz(sys.stdout) - order = G_f.topological_sort() - order.reverse() - return G_f, order - -print "planning build order" -try: - G_f, order = plan_build(specfiles) - print order -except pisi.graph.CycleException, e: - print e - -pisi.api.finalize() diff --git a/scripts/find-lib-deps.py b/scripts/find-lib-deps.py deleted file mode 100755 index dd624f49..00000000 --- a/scripts/find-lib-deps.py +++ /dev/null @@ -1,64 +0,0 @@ -#! /usr/bin/python -# -*- coding: utf-8 -*- -# -# find library dependencies of a package -# author: exa (Eray Ă–zkural) - -import locale -import sys -import os -import fnmatch - -import gettext -__trans = gettext.translation('pisi', fallback=True) -_ = __trans.ugettext - -import pisi -import pisi.api -import pisi.config -import pisi.specfile as specfile -import pisi.context as ctx -import pisi.util as util -from pisi.package import Package - -locale.setlocale(locale.LC_ALL, '') -options = pisi.config.Options() -if len(sys.argv) > 2: - options.destdir=sys.argv[2] -else: - options.destdir = '/' -pisi.api.init(database=True, comar=False, options=options) - -filename = sys.argv[1] -package = Package(filename) -package.read() -util.clean_dir('/tmp/install') -package.extract_dir_flat('install', '/tmp/install') -deps = set() -needed = set() -for file in package.files.list: - #print file.path, file.type - if file.type == 'executable': - (ret, lines) = util.run_batch('objdump -p %s' % util.join_path('/tmp/install', file.path)) - for x in lines: - if x.startswith(' NEEDED'): - needed.add(x[8:].strip()) - -#print 'needed guys', needed - -for lib in needed: - - (ret, out) = util.run_batch('locate %s' % lib) - path = out[0].strip().lstrip('/') - try: - (pkg_name, file_info) = ctx.filesdb.get_file(path) - ctx.ui.info("Library dependency: '%s' due to library '%s'" % (pkg_name, file_info.path)) - deps.add(pkg_name) - except: - ctx.ui.warning('Cannot find an installed package for library %s' % lib) - -ctx.ui.info('Found deps:') -for x in deps: - ctx.ui.info(x) - -pisi.api.finalize() diff --git a/scripts/pisish b/scripts/pisish deleted file mode 100755 index 7ead3a77..00000000 --- a/scripts/pisish +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/python -# -# Copyright (C) 2005, TUBITAK/UEKAE -# -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# Please read the COPYING file. - -import sys -import locale -import traceback -import exceptions -import signal -import bsddb3.db as db -import os - -import pisi.ui -import pisi.context as ctx -from pisi.cli.pisicli import PisiCLI - -import gettext -__trans = gettext.translation('pisi', fallback=True) -_ = __trans.ugettext - -def exit(retval = 0): - pisi.api.finalize() - sys.exit(retval) - -if __name__ == "__main__": - - locale.setlocale(locale.LC_ALL, '') - print """Welcome to the interactive PISI shell. -Type "help" to see a list of commands. -To end the session, type "exit". -You can run system commands by prefixing with '!' as in '!ls'. -Copyright 2006 (c) Pardus. -""" - while 1: - cmd = raw_input('pisi> ') - if cmd.strip()=='exit': - print 'Bye!' - exit() - if cmd.startswith('!'): - cmd = cmd[1:] - os.system(cmd) - continue - try: - cli = PisiCLI(cmd.split()) - cli.run_command() - except Exception, value: - signal.signal(signal.SIGINT, signal.SIG_IGN) # disable further interrupts - ui = pisi.cli.CLI() # make a temporary UI - show_traceback = False - if isinstance(value, exceptions.KeyboardInterrupt): - ui.error(_("Keyboard Interrupt: Exiting...")) - elif isinstance(value, pisi.Error): - ui.error(_("Program Terminated.")) - show_traceback = ctx.get_option('debug') - elif isinstance(value, db.DBRunRecoveryError): - ui.error(_("""A database operation has been aborted. You should run pisi -again for normal DB recovery procedure. Make sure you have free disk space. -You have to run rebuild-db only when there is file corruption and database upgrades.""")) - elif isinstance(value, pisi.Exception): - show_traceback = True - ui.error(_("""Unhandled internal exception. -Please file a bug report. (http://bugs.uludag.org.tr)""")) - else: - # For any other exception (possibly Python exceptions) show - # the traceback! - show_traceback = ctx.get_option('debug') - ui.error(_("System Error. Program Terminated.")) - - if ctx.get_option('debug'): - ui.error(u"%s: %s" % (exception, value)) - else: - ui.error(unicode(value)) - - ui.info(_("Please type 'help' for general help.")) - - if show_traceback: - ui.info(_("Traceback:")) - #traceback.print_exc(file=sys.stdout) - traceback.print_tb(sys.exc_traceback) - else: - ui.info(_("Use --debug to see a traceback.")) diff --git a/scripts/rmcomp-source-repo.py b/scripts/rmcomp-source-repo.py deleted file mode 100755 index bd7a2ff0..00000000 --- a/scripts/rmcomp-source-repo.py +++ /dev/null @@ -1,46 +0,0 @@ -#! /usr/bin/python -# a simple tool to list stuff in source repository -# author: exa - -import sys -import os - -import pisi -import pisi.api -import pisi.config -import pisi.specfile as specfile -import pisi.context as ctx -import pisi.util -import pisi.pxml.xmlfilecdom as xmlfile - -options = pisi.config.Options() -if len(sys.argv) > 2: - options.destdir=sys.argv[2] -else: - options.destdir = '/' -pisi.api.init(database=False, options=options) -repo_uri = sys.argv[1] - -for root, dirs, files in os.walk(repo_uri): - for fn in files: - if fn == 'pspec.xml': - sf = xmlfile.XmlFile(tag = 'PISI') - path = pisi.util.join_path(root, fn) - ctx.ui.info('Looking at %s' % path) - ls = file(path).readlines() - ls = filter(lambda x:x.find('')==-1, ls) - f = file(path, 'w') - for x in ls: - f.write(x) - f.close() - #sf.readxml(path) - #src = sf.getNode('Source') - #comp = sf.getNode('Source/PartOf') - #print src, comp - #if comp: - # print 'removing partof tag' - # src.removeChild(comp) - #else: - # print 'no comp already' - #sf.writexml(path) -pisi.api.finalize() diff --git a/setup.py b/setup.py index 69fbffc1..73524810 100755 --- a/setup.py +++ b/setup.py @@ -87,12 +87,8 @@ setup(name="pisi", url="http://www.pardus.org.tr/eng/pisi/", package_dir = {'': ''}, packages = ['pisi', 'pisi.cli', 'pisi.actionsapi', 'pisi.pxml', 'pisi.search', 'pisi.scenarioapi'], - scripts = ['pisi-cli', 'scripts/repostats.py', 'scripts/find-lib-deps.py', - 'scripts/lspisi', 'scripts/unpisi', 'scripts/check-newconfigs.py', - 'scripts/calc-build-order.py', 'scripts/pisish'], - cmdclass = { - 'install' : Install - } + scripts = ['pisi-cli', 'scripts/find-lib-deps.py', 'scripts/lspisi', 'scripts/unpisi', 'scripts/check-newconfigs.py'], + cmdclass = {'install' : Install} ) # the below stuff is really nice but we already have a version