Kafa göz yararak da olsa, paket deposunu implement ettim.
cekirdek.uludag.org.tr/pisi altına örnek bir pisi deposu hazırladım. Test etmek için aşağıdakileri yapın. /etc/pisi/pisi.conf dosyasının içerisine: [repos] default = http://cekirdek.uludag.org.tr/pisi/ satırlarını yazın. Daha sonra sırası ile: pisi-cli updatedb pisi-cli install <paket-adı> (örneğin: pisi-cli install net-tools) komutlarını verin. Bundan sonra yalnızca paket adı ile verilen install işlemleri depodan yapılacak.
This commit is contained in:
@@ -182,12 +182,14 @@ class UpdateDB(Command):
|
||||
super(UpdateDB, self).__init__()
|
||||
|
||||
def run(self):
|
||||
if len(self.args) != 1:
|
||||
self.help()
|
||||
return
|
||||
|
||||
from pisi.operations import updatedb
|
||||
indexfile = self.args[0]
|
||||
try:
|
||||
indexfile = self.args[0]
|
||||
except IndexError:
|
||||
# doesn't have an index file, we'll use the repo url in
|
||||
# configuration file
|
||||
indexfile = None
|
||||
|
||||
updatedb(indexfile)
|
||||
|
||||
|
||||
|
||||
+4
-1
@@ -35,7 +35,10 @@ class Config(object):
|
||||
|
||||
def packages_dir(self):
|
||||
return self.destdir + self.values.dirs.packages_dir
|
||||
|
||||
|
||||
def index_dir(self):
|
||||
return self.destdir + self.values.dirs.index_dir
|
||||
|
||||
def tmp_dir(self):
|
||||
return self.destdir + self.values.dirs.tmp_dir
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ class Constants:
|
||||
self.__c.comar_dir = "comar"
|
||||
self.__c.files_xml = "files.xml"
|
||||
self.__c.metadata_xml = "metadata.xml"
|
||||
self.__c.pisi_index = "pisi-index.xml"
|
||||
|
||||
# functions in actions_file
|
||||
self.__c.setup_func = "setup"
|
||||
|
||||
+7
-6
@@ -21,16 +21,17 @@ class Index(XmlFile):
|
||||
def read(self, filename):
|
||||
"""Read PSPEC file"""
|
||||
|
||||
self.filename = filename
|
||||
self.filepath = filename
|
||||
url = PUrl(filename)
|
||||
if url.isRemoteFile():
|
||||
from os import getcwd
|
||||
from os.path import join
|
||||
from fetcher import fetchUrl
|
||||
# TODO: index dosyasını indirmek için bir yer bulmak lazım.
|
||||
fetchUrl(url, getcwd(), ui.Progress)
|
||||
self.filename = url.filename()
|
||||
# TODO: farklı depoların index dosyalarını handle edebilmek gerekiyor.
|
||||
dest = config.index_dir()
|
||||
fetchUrl(url, dest, ui.Progress)
|
||||
self.filepath = join(dest, url.filename())
|
||||
|
||||
self.readxml(self.filename)
|
||||
self.readxml(self.filepath)
|
||||
|
||||
# find all binary packages
|
||||
packageElts = self.getAllNodes("Package")
|
||||
|
||||
+43
-3
@@ -21,7 +21,42 @@ def remove(package_name):
|
||||
installdb.remove(package_name)
|
||||
removeScripts(package_name)
|
||||
|
||||
def install(pkg_location):
|
||||
def install(pkg):
|
||||
url = PUrl(pkg)
|
||||
# check if we are dealing with a remote file or a real path of
|
||||
# package filename. If we are working with a remote file
|
||||
# install_package() will handle it.
|
||||
if url.isRemoteFile() or os.path.exists(url.uri):
|
||||
install_package(pkg)
|
||||
else:
|
||||
from os.path import join
|
||||
from index import Index
|
||||
# no pisi package is specified. We are goin to install a
|
||||
# package from the repository.
|
||||
repo_url = config.values.repos.default
|
||||
index = Index()
|
||||
indexpath = join(config.index_dir(), const.pisi_index)
|
||||
index.read(indexpath)
|
||||
# search package in index file, if it's present in the
|
||||
# repository
|
||||
for package in index.packages:
|
||||
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
|
||||
release = package.history[0].release
|
||||
|
||||
pkg_name = package.name + '-' + version +\
|
||||
'-' + release + const.package_prefix
|
||||
package_uri = join(repo_url, pkg[0], pkg_name)
|
||||
ui.info("Installing %s from repository %s\n" %
|
||||
(pkg_name, repo_url))
|
||||
install_package(package_uri)
|
||||
return
|
||||
ui.error("Package %s not found in the index file." %pkg)
|
||||
|
||||
def install_package(pkg_location):
|
||||
from install import Installer
|
||||
|
||||
i = Installer(pkg_location)
|
||||
@@ -42,12 +77,17 @@ def index(repo_dir = '.'):
|
||||
ui.info('* Building index of PISI files under %s\n' % repo_dir)
|
||||
index = Index()
|
||||
index.index(repo_dir)
|
||||
index.write('pisi-index.xml')
|
||||
print const.pisi_index
|
||||
index.write(const.pisi_index)
|
||||
ui.info('* Index file written\n')
|
||||
|
||||
def updatedb(indexfile):
|
||||
def updatedb(indexfile = None):
|
||||
from index import Index
|
||||
|
||||
if not indexfile:
|
||||
repos_path = config.values.repos.default
|
||||
indexfile = os.path.join(repos_path, const.pisi_index)
|
||||
|
||||
ui.info('* Updating DB from index file: %s\n' % indexfile)
|
||||
index = Index()
|
||||
index.read(indexfile)
|
||||
|
||||
Reference in New Issue
Block a user