* implement first version of installdb
* start a generalized ui module which will abstract the particulars of CLI, KDE, etc. (Beginning with CLI) * fix: usage doesn't belong in util, sorry * write some maintainer comments * bir de sunlari turkce yazacaktik galiba gene gaza geldim
This commit is contained in:
+11
-5
@@ -6,20 +6,26 @@ from os.path import basename
|
||||
|
||||
import pisi.config
|
||||
import pisi.util
|
||||
import pisi.ui
|
||||
from pisi.build import PisiBuild, PisiBuildError
|
||||
|
||||
def usage(progname = "pisi-build"):
|
||||
print """
|
||||
Usage:
|
||||
%s [options] package-name.pspec
|
||||
""" %(progname)
|
||||
|
||||
def doProgress(filename, percent, rate, symbol):
|
||||
out = '\r%-30.30s %3d%% %12.2f %s' % \
|
||||
(pd['filename'], pd['percent'], pd['rate'], pd['symbol'])
|
||||
pisi.util.information(out)
|
||||
pisi.ui.info(out)
|
||||
|
||||
def main():
|
||||
import sys
|
||||
import getopt
|
||||
|
||||
# wrapper for usage(progname) function
|
||||
help = lambda: pisi.util.usage(sys.argv[0])
|
||||
help = lambda: usage(sys.argv[0])
|
||||
|
||||
# getopt magic
|
||||
try:
|
||||
@@ -47,11 +53,11 @@ def main():
|
||||
|
||||
# doing the real job.
|
||||
pb = PisiBuild(pspec)
|
||||
pisi.util.information("Building PISI source package: %s\n" % pb.spec.sourceName)
|
||||
pisi.ui.info("Building PISI source package: %s\n" % pb.spec.sourceName)
|
||||
|
||||
pisi.util.information("Fetching source from: %s (be patient)\n" % pb.spec.archiveUri)
|
||||
pisi.ui.info("Fetching source from: %s (be patient)\n" % pb.spec.archiveUri)
|
||||
pb.fetchArchive(doProgress)
|
||||
pisi.util.information("Source archive is stored: %s/%s\n" %(pisi.config.archives_dir, pb.archiveName))
|
||||
pisi.ui.info("Source archive is stored: %s/%s\n" %(pisi.config.archives_dir, pb.archiveName))
|
||||
# pb.unpackArchive()
|
||||
# pb.applyPatches()
|
||||
# pb.buildSource()
|
||||
|
||||
+7
-1
@@ -4,12 +4,18 @@
|
||||
import pisi.install
|
||||
import pisi.util
|
||||
|
||||
def usage(progname = "pisi-install"):
|
||||
print """
|
||||
Usage:
|
||||
%s [options] <packagefilename>
|
||||
""" %(progname)
|
||||
|
||||
def main():
|
||||
import sys
|
||||
import getopt
|
||||
|
||||
# wrapper for usage(progname) function
|
||||
help = lambda: pisi.util.usage(sys.argv[0])
|
||||
help = lambda: usage(sys.argv[0])
|
||||
|
||||
# getopt magic
|
||||
try:
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# utilities to extract and build archives of zip, tar, targz, tarbz2
|
||||
# maintainer: baris and murat
|
||||
|
||||
+5
-3
@@ -1,4 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# package bulding stuff
|
||||
# maintainer: baris and meren
|
||||
|
||||
# python standard library
|
||||
import os
|
||||
@@ -10,7 +12,7 @@ from fetcher import Fetcher
|
||||
# import pisipackage
|
||||
import util
|
||||
import config
|
||||
|
||||
import ui
|
||||
|
||||
class PisiBuildError(Exception):
|
||||
pass
|
||||
@@ -36,7 +38,7 @@ class PisiBuild:
|
||||
destpath = fetch.filedest + "/" + fetch.filename
|
||||
if os.access(destpath, os.R_OK):
|
||||
if util.md5_file(destpath)==self.spec.archiveMD5:
|
||||
util.information(fetch.filename + " cached\n")
|
||||
ui.info(fetch.filename + " cached\n")
|
||||
return
|
||||
|
||||
if percentHook:
|
||||
@@ -57,5 +59,5 @@ class PisiBuild:
|
||||
|
||||
def buildPackages(self):
|
||||
for package in self.spec.packages:
|
||||
util.information("** Building package %s\n" % package.name);
|
||||
ui.info("** Building package %s\n" % package.name);
|
||||
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
# dependency analyzer
|
||||
# maintainer: eray and caglar
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# download magic
|
||||
# maintainer: baris and meren
|
||||
|
||||
# python standard library modules
|
||||
import urlparse
|
||||
|
||||
+9
-6
@@ -4,9 +4,10 @@
|
||||
from specfile import SpecFile
|
||||
from package import Package
|
||||
import util
|
||||
#import repodb
|
||||
#import packagedb
|
||||
#import dependency
|
||||
import ui
|
||||
import installdb
|
||||
import packagedb
|
||||
import dependency
|
||||
#import conflicts
|
||||
|
||||
|
||||
@@ -15,15 +16,16 @@ def install_package_file(package_fn):
|
||||
package = Package(package_fn, "r")
|
||||
# extract control files
|
||||
util.clean_directory(install_dir)
|
||||
ui.info.("extracting files\n")
|
||||
package.extract_files(install_dir)
|
||||
|
||||
# verify package
|
||||
# check if we have all required files
|
||||
|
||||
specfile = SpecFile()
|
||||
specfile.read(install_dir + "/pspec.xml")
|
||||
spec = PackageSpecFile()
|
||||
spec.read(install_dir + '/pspec.xml')
|
||||
# check pspec semantics
|
||||
specfile.verify()
|
||||
spec.verify()
|
||||
# check file system requirements
|
||||
# check conflicts
|
||||
# check dependencies
|
||||
@@ -31,6 +33,7 @@ def install_package_file(package_fn):
|
||||
# unzip package in place
|
||||
|
||||
# update databases
|
||||
installdb.install(spec.install_dir + '/files.xml')
|
||||
|
||||
# installdb
|
||||
|
||||
|
||||
+28
-10
@@ -1,25 +1,43 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# installation database
|
||||
# maintainer: eray and caglar
|
||||
|
||||
from config import *
|
||||
import shelve
|
||||
import util
|
||||
|
||||
|
||||
d = shelve.open( db_dir + '/install.dbm')
|
||||
|
||||
files_dir = archive_dir + "/files"
|
||||
|
||||
class InstallDBError(Exception):
|
||||
pass
|
||||
|
||||
def files_name(name, version, release):
|
||||
return files + '/' + name + '-' + version + '-' + release
|
||||
|
||||
def is_recorded(name, version, release):
|
||||
key = (name, version, release)
|
||||
return d.has_key( key )
|
||||
|
||||
def isRecorded(name, version, release):
|
||||
return d.has_key( (name, version, release) )
|
||||
def is_installed(name, version, release):
|
||||
key = (name, version, release)
|
||||
return is_recorded(key) and d[key]=='i'
|
||||
|
||||
def isInstalled(name, version, release):
|
||||
return d.has_key( (name, version, release) )
|
||||
|
||||
def install( name, version, release, state):
|
||||
if isInstalled(name,version,release):
|
||||
def install( name, version, release, files_xml):
|
||||
key = (name, version, release)
|
||||
if isInstalled(key):
|
||||
raise InstallDBError("already installed")
|
||||
d[ (name,version,release) ] = state
|
||||
|
||||
d[key] = 'i'
|
||||
util.copy_file(files_xml, files_name( name, version, release) )
|
||||
|
||||
def remove( name, version, release):
|
||||
if
|
||||
key = (name, version, release)
|
||||
d[key] = 'r'
|
||||
|
||||
def purge( name, version, release):
|
||||
d.delete(key)
|
||||
util.remove_file( files_name( name, version, release) )
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# package abstraction
|
||||
# provides methods to add/remove files, extract control files
|
||||
# maintainer: baris and meren
|
||||
|
||||
class Package:
|
||||
"""Package: PISI package class"""
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# package database
|
||||
# interface for update/query to local package repository
|
||||
# maintainer: eray and caglar
|
||||
|
||||
import shelve
|
||||
|
||||
files_dir = archive_dir + "/files"
|
||||
|
||||
|
||||
+1
-10
@@ -1,14 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# misc. utility functions, including process and file utils
|
||||
# maintainer: eray and caglar and baris and meren!
|
||||
|
||||
import os
|
||||
import sys
|
||||
import md5
|
||||
|
||||
def information(message):
|
||||
sys.stdout.write(message)
|
||||
sys.stdout.flush()
|
||||
|
||||
# check if directory exists, and create if it doesn't
|
||||
# works recursively
|
||||
# FIXME: could hav a better name
|
||||
@@ -49,9 +46,3 @@ def strlist(l):
|
||||
|
||||
class ArgError(Exception):
|
||||
pass
|
||||
|
||||
def usage(progname = "pisi-build"):
|
||||
print """
|
||||
Usage:
|
||||
%s [options] package-name.pspec
|
||||
""" %(progname)
|
||||
|
||||
Reference in New Issue
Block a user