biraz temizlik...

This commit is contained in:
Barış Metin
2005-07-19 21:54:15 +00:00
parent 4f99a945c7
commit ba7f8d1816
4 changed files with 26 additions and 21 deletions
+5 -5
View File
@@ -243,13 +243,13 @@ class PisiBuild:
self.genFilesXml(package) self.genFilesXml(package)
ui.info(" done.\n") ui.info(" done.\n")
# testing name = util.package_name(package.name,
pkgName = package.name + '-' + self.spec.source.version +\ self.spec.source.version,
'-' + self.spec.source.release + const.package_prefix self.spec.source.release)
ui.info("Creating PISI package %s\n" % pkgName) ui.info("Creating PISI package %s\n" % name)
pkg = Package(pkgName, 'w') pkg = Package(name, 'w')
c = os.getcwd() c = os.getcwd()
# add comar files to package # add comar files to package
+1
View File
@@ -88,6 +88,7 @@ class MetaData(XmlFile):
self.readxml(filename) self.readxml(filename)
self.source = SourceInfo(self.getNode("Source")) self.source = SourceInfo(self.getNode("Source"))
self.package = PackageInfo(self.getNode("Package")) self.package = PackageInfo(self.getNode("Package"))
self.package.version = self.package.history[0].version self.package.version = self.package.history[0].version
self.package.release = self.package.history[0].release self.package.release = self.package.history[0].release
+12 -16
View File
@@ -4,6 +4,7 @@ from config import config
from constants import const from constants import const
from ui import ui from ui import ui
from purl import PUrl from purl import PUrl
import util
# all package operation interfaces are here # all package operation interfaces are here
@@ -23,35 +24,31 @@ def remove(package_name):
def install(pkg): def install(pkg):
url = PUrl(pkg) url = PUrl(pkg)
# check if we are dealing with a remote file or a real path of # Check if we are dealing with a remote file or a real path of
# package filename. If we are working with a remote file # package filename. Otherwise we'll try installing a package from
# install_package() will handle it. # the package repository.
if url.isRemoteFile() or os.path.exists(url.uri): if url.isRemoteFile() or os.path.exists(url.uri):
install_package(pkg) install_package(pkg)
else: else:
from os.path import join from os.path import join
from index import Index from index import Index
# no pisi package is specified. We are goin to install a
# package from the repository. # TODO: Currently we're supporting for only one
# repository. We'll extend this functionality soon.
repo_url = config.values.repos.default repo_url = config.values.repos.default
index = Index() index = Index()
indexpath = join(config.index_dir(), const.pisi_index) indexpath = join(config.index_dir(), const.pisi_index)
index.read(indexpath) index.read(indexpath)
# search package in index file, if it's present in the
# repository # search pkg in index for it's presence in repository
for package in index.packages: for package in index.packages:
if package.name == pkg: if package.name == pkg:
# As we have no Version tag we need to get
# the last version and release information
# from the first child of History/Update. And it works :)
version = package.history[0].version version = package.history[0].version
release = package.history[0].release release = package.history[0].release
pkg_name = package.name + '-' + version +\ name = util.package_name(pkg, version, release)
'-' + release + const.package_prefix package_uri = join(repo_url, name[0], name)
package_uri = join(repo_url, pkg[0], pkg_name) ui.info("Installing %s from repository %s\n" %(name, repo_url))
ui.info("Installing %s from repository %s\n" %
(pkg_name, repo_url))
install_package(package_uri) install_package(package_uri)
return return
ui.error("Package %s not found in the index file.\n" %pkg) ui.error("Package %s not found in the index file.\n" %pkg)
@@ -77,7 +74,6 @@ def index(repo_dir = '.'):
ui.info('* Building index of PISI files under %s\n' % repo_dir) ui.info('* Building index of PISI files under %s\n' % repo_dir)
index = Index() index = Index()
index.index(repo_dir) index.index(repo_dir)
print const.pisi_index
index.write(const.pisi_index) index.write(const.pisi_index)
ui.info('* Index file written\n') ui.info('* Index file written\n')
+8
View File
@@ -15,6 +15,7 @@ import statvfs
# pisi modules # pisi modules
from ui import ui from ui import ui
from constants import const
class FileError(Exception): class FileError(Exception):
pass pass
@@ -245,3 +246,10 @@ def partition_freespace(directory):
""" returns free space of given directory's partition """ """ returns free space of given directory's partition """
st = os.statvfs(directory) st = os.statvfs(directory)
return st[statvfs.F_BSIZE] * st[statvfs.F_BFREE] return st[statvfs.F_BSIZE] * st[statvfs.F_BFREE]
#############################
# Package Related Functions #
#############################
def package_name(name, version, release):
return name + '-' + version + '-' + release + const.package_prefix