comments.
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# PISI configuration (static and dynamic)
|
# Context module.
|
||||||
|
|
||||||
from specfile import SpecFile
|
from specfile import SpecFile
|
||||||
from constants import const
|
from constants import const
|
||||||
|
|||||||
+7
-6
@@ -1,6 +1,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# download magic
|
|
||||||
# maintainer: baris and meren
|
# Yet another Pisi module for fetching files from various sources. Of
|
||||||
|
# course, this is not limited to just fetching source files. We fetch
|
||||||
|
# all kinds of things: source tarballs, index files, packages, and God
|
||||||
|
# knows what.
|
||||||
|
|
||||||
# python standard library modules
|
# python standard library modules
|
||||||
import urlparse
|
import urlparse
|
||||||
@@ -15,10 +18,8 @@ class FetchError (Exception):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
class Fetcher:
|
class Fetcher:
|
||||||
"""Yet another Pisi tool for fetching files from various sources..
|
"""Fetcher can fetch a file from various sources using various
|
||||||
Of course, this is not limited to just fetching source files.
|
protocols."""
|
||||||
We fetch all kinds of things: source tarballs, index files,
|
|
||||||
packages, and God knows what."""
|
|
||||||
def __init__(self, source):
|
def __init__(self, source):
|
||||||
self.uri = source.archiveUri
|
self.uri = source.archiveUri
|
||||||
self.filedest = config.archives_dir()
|
self.filedest = config.archives_dir()
|
||||||
|
|||||||
+3
-2
@@ -1,11 +1,12 @@
|
|||||||
# class for files.xml
|
# Files module provides access to files.xml. files.xml is genarated
|
||||||
|
# during the build process of a package and used in installation.
|
||||||
|
|
||||||
import xmlfile
|
import xmlfile
|
||||||
from xmlfile import XmlFile
|
from xmlfile import XmlFile
|
||||||
|
|
||||||
|
|
||||||
class FileInfo:
|
class FileInfo:
|
||||||
|
"""FileInfo holds the information for a File node/tag in files.xml"""
|
||||||
def __init__(self, _path = "", _type = "", _size="", _hash = ""):
|
def __init__(self, _path = "", _type = "", _size="", _hash = ""):
|
||||||
self.path = _path
|
self.path = _path
|
||||||
self.type = _type
|
self.type = _type
|
||||||
|
|||||||
+5
-1
@@ -1,3 +1,7 @@
|
|||||||
|
# Metadata module provides access to metadata.xml. metadata.xml is
|
||||||
|
# generated during the build process of a package and used in the
|
||||||
|
# installation. Package repository also uses metadata.xml for building
|
||||||
|
# a package index.
|
||||||
|
|
||||||
from ui import ui
|
from ui import ui
|
||||||
|
|
||||||
@@ -40,7 +44,7 @@ class PackageInfo(specfile.PackageInfo):
|
|||||||
|
|
||||||
class MetaData(XmlFile):
|
class MetaData(XmlFile):
|
||||||
"""Package metadata. Metadata is composed of Specfile and various
|
"""Package metadata. Metadata is composed of Specfile and various
|
||||||
other information."""
|
other information. A metadata has two parts, Source and Package."""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
XmlFile.__init__(self,"PISI")
|
XmlFile.__init__(self,"PISI")
|
||||||
|
|||||||
+9
-7
@@ -7,39 +7,41 @@ from constants import const
|
|||||||
from config import config
|
from config import config
|
||||||
|
|
||||||
class Package:
|
class Package:
|
||||||
"""Package: PISI package class"""
|
"""PISI Package Class provides access to a pisi package (.pisi
|
||||||
|
file)."""
|
||||||
def __init__(self, packagefn, mode='r'):
|
def __init__(self, packagefn, mode='r'):
|
||||||
self.impl = archive.ArchiveZip(packagefn, 'zip', mode)
|
self.impl = archive.ArchiveZip(packagefn, 'zip', mode)
|
||||||
self.filename = packagefn
|
self.filename = packagefn
|
||||||
|
|
||||||
def add_file(self, fn):
|
def add_file(self, fn):
|
||||||
"""add a file or directory to package"""
|
"""Add a file or directory to package"""
|
||||||
self.impl.add_file(fn)
|
self.impl.add_file(fn)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
|
"""Close the package archive"""
|
||||||
self.impl.close()
|
self.impl.close()
|
||||||
|
|
||||||
def extract(self, outdir):
|
def extract(self, outdir):
|
||||||
"""extract entire package contents to directory"""
|
"""Extract entire package contents to directory"""
|
||||||
extract_dir('', outdir) # means package root
|
extract_dir('', outdir) # means package root
|
||||||
|
|
||||||
def extract_files(self, paths, outdir):
|
def extract_files(self, paths, outdir):
|
||||||
"""extract file with path to outdir"""
|
"""Extract file with path to outdir"""
|
||||||
self.impl.unpack_files(paths, outdir)
|
self.impl.unpack_files(paths, outdir)
|
||||||
|
|
||||||
def extract_dir(self, dir, outdir):
|
def extract_dir(self, dir, outdir):
|
||||||
"""extract directory recursively, this function
|
"""Extract directory recursively, this function
|
||||||
copies the directory archiveroot/dir to outdir"""
|
copies the directory archiveroot/dir to outdir"""
|
||||||
self.impl.unpack_dir(path, outdir)
|
self.impl.unpack_dir(path, outdir)
|
||||||
|
|
||||||
def extract_dir_flat(self, dir, outdir):
|
def extract_dir_flat(self, dir, outdir):
|
||||||
"""extract directory recursively, this function
|
"""Extract directory recursively, this function
|
||||||
unpacks the *contents* of directory archiveroot/dir inside outdir
|
unpacks the *contents* of directory archiveroot/dir inside outdir
|
||||||
this is the function used by the installer"""
|
this is the function used by the installer"""
|
||||||
self.impl.unpack_dir_flat(dir, outdir)
|
self.impl.unpack_dir_flat(dir, outdir)
|
||||||
|
|
||||||
def extract_PISI_files(self, outdir):
|
def extract_PISI_files(self, outdir):
|
||||||
"""extract PISI control files: metadata.xml, files.xml,
|
"""Extract PISI control files: metadata.xml, files.xml,
|
||||||
action scripts, etc."""
|
action scripts, etc."""
|
||||||
self.extract_files([const.metadata_xml,
|
self.extract_files([const.metadata_xml,
|
||||||
const.files_xml,'Config'], outdir)
|
const.files_xml,'Config'], outdir)
|
||||||
|
|||||||
+13
-3
@@ -1,10 +1,16 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# read/write PISI source package specification file
|
|
||||||
|
|
||||||
|
# Specfile module is our handler for PSPEC files. PSPEC (PISI SPEC)
|
||||||
|
# files are specification files for PISI source packages. This module
|
||||||
|
# provides read and write access to PSPEC files.
|
||||||
|
|
||||||
|
# standard python modules
|
||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
|
from os.path import basename
|
||||||
|
|
||||||
|
# pisi modules
|
||||||
from xmlext import *
|
from xmlext import *
|
||||||
from xmlfile import XmlFile
|
from xmlfile import XmlFile
|
||||||
from os.path import basename
|
|
||||||
from ui import ui
|
from ui import ui
|
||||||
|
|
||||||
class PackagerInfo:
|
class PackagerInfo:
|
||||||
@@ -74,7 +80,8 @@ class PathInfo:
|
|||||||
return node
|
return node
|
||||||
|
|
||||||
class SourceInfo:
|
class SourceInfo:
|
||||||
"a structure to hold source information"
|
"""A structure to hold source information. Source information is
|
||||||
|
located under <Source> tag in PSPEC file."""
|
||||||
def __init__(self, node):
|
def __init__(self, node):
|
||||||
self.name = getNodeText(node, "Name")
|
self.name = getNodeText(node, "Name")
|
||||||
self.homepage = getNodeText(node, "HomePage")
|
self.homepage = getNodeText(node, "HomePage")
|
||||||
@@ -117,6 +124,9 @@ class SourceInfo:
|
|||||||
return node
|
return node
|
||||||
|
|
||||||
class PackageInfo:
|
class PackageInfo:
|
||||||
|
"""A structure to hold package information. Package information is
|
||||||
|
located under <Package> tag in PSPEC file. Opposite to Source each
|
||||||
|
PSPEC file can have more than one Package tag."""
|
||||||
def __init__(self, node):
|
def __init__(self, node):
|
||||||
self.name = getNodeText(node, "Name")
|
self.name = getNodeText(node, "Name")
|
||||||
self.summary = getNodeText(node, "Summary")
|
self.summary = getNodeText(node, "Summary")
|
||||||
|
|||||||
+7
-4
@@ -1,13 +1,16 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# some helper functions for using minidom
|
|
||||||
|
# XmlFile is a halper module for accessing XML files using
|
||||||
|
# xml.dom.minidom.
|
||||||
|
#
|
||||||
|
# XmlFile class that further abstracts a dom object using the
|
||||||
|
# high-level dom functions provided in xml module (and sorely lacking
|
||||||
|
# in xml.dom :( )
|
||||||
|
|
||||||
import xml.dom.minidom as mdom
|
import xml.dom.minidom as mdom
|
||||||
|
|
||||||
from xmlext import *
|
from xmlext import *
|
||||||
|
|
||||||
# xmlfile class that further abstracts a dom object
|
|
||||||
# using the high-level dom functions provided in xml module
|
|
||||||
# (and sorely lacking in xml.dom :( )
|
|
||||||
|
|
||||||
class XmlFile(object):
|
class XmlFile(object):
|
||||||
"""A class for retrieving information from an XML file"""
|
"""A class for retrieving information from an XML file"""
|
||||||
|
|||||||
Reference in New Issue
Block a user