1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-26 01:46:13 +01:00
This commit is contained in:
Marcus Huewe 2013-01-16 14:38:13 +01:00
commit 12c8736129

View File

@ -466,11 +466,68 @@ def xmlindent(elem, level=0):
elem.tail = i elem.tail = i
class Project: class Project:
"""represent a project directory, holding packages""" """
Represent a checked out project directory, holding packages.
:Attributes:
``dir``
The directory path containing the project.
``name``
The name of the project.
``apiurl``
The endpoint URL of the API server.
``pacs_available``
List of names of packages available server-side.
This is only populated if ``getPackageList`` is set
to ``True`` in the constructor.
``pacs_have``
List of names of packages which exist server-side and
are expected to exist in the local project directory
(or which *do* exist if `do_package_tracking` is disabled).
``pacs_excluded``
List of names of packages in the local project directory
which are excluded by the `exclude_glob` configuration
variable. Only set if `do_package_tracking` is enabled.
``pacs_unvers``
List of names of packages in the local project directory
which are not registered server-side. Only set if
`do_package_tracking` is enabled.
``pacs_broken``
List of names of packages which exist server-side and
are expected to exist in the local project directory
but are missing. Only set if `do_package_tracking` is
enabled.
``pacs_missing``
List of names of packages which exist server-side but
are not expected to exist in the local project directory.
"""
REQ_STOREFILES = ('_project', '_apiurl') REQ_STOREFILES = ('_project', '_apiurl')
if conf.config['do_package_tracking']: if conf.config['do_package_tracking']:
REQ_STOREFILES += ('_packages',) REQ_STOREFILES += ('_packages',)
def __init__(self, dir, getPackageList=True, progress_obj=None, wc_check=True): def __init__(self, dir, getPackageList=True, progress_obj=None, wc_check=True):
"""
Constructor.
:Parameters:
`dir` : str
The directory path containing the checked out project.
`getPackageList` : bool
Set to `False` if you want to skip retrieval from the
server of the list of packages in the project .
`wc_check` : bool
"""
import fnmatch import fnmatch
self.dir = dir self.dir = dir
self.absdir = os.path.abspath(dir) self.absdir = os.path.abspath(dir)
@ -609,6 +666,10 @@ class Project:
ET.SubElement(self.pac_root, 'package', name=name, state=state) ET.SubElement(self.pac_root, 'package', name=name, state=state)
def read_packages(self): def read_packages(self):
"""
Returns an ``xml.etree.cElementTree`` object representing the
parsed contents of the project's ``.osc/_packages`` XML file.
"""
global store global store
packages_file = os.path.join(self.absdir, store, '_packages') packages_file = os.path.join(self.absdir, store, '_packages')