]>
git.ipfire.org Git - people/stevee/pakfire.git/blob - python/pakfire/repository/system.py
2 ###############################################################################
4 # Pakfire - The IPFire package management system #
5 # Copyright (C) 2011 Pakfire development team #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
27 import pakfire
.packages
as packages
28 import pakfire
.util
as util
30 from pakfire
.constants
import *
31 from pakfire
.i18n
import _
33 class RepositorySystem(base
.RepositoryFactory
):
34 def __init__(self
, pakfire
):
35 base
.RepositoryFactory
.__init
__(self
, pakfire
, "@system", "Local repository")
37 # Open database connection.
38 self
.db
= database
.DatabaseLocal(self
.pakfire
, self
)
40 # Tell the solver, that these are the installed packages.
41 self
.pool
.set_installed(self
.solver_repo
)
45 return os
.path
.join(self
.pakfire
.path
, PACKAGES_SOLV
)
50 The local repository has always a high priority.
55 # Initialize database.
58 # Create a progressbar.
59 pb
= util
.make_progress(_("Loading installed packages"), len(self
.db
))
61 # Remove all data from the current index.
65 for pkg
in self
.db
.packages
:
70 self
.index
.add_package(pkg
)
81 # Commit all data that is currently pending for writing.
87 # Remove indexed data from memory.
90 # Mark repo as closed.
94 # Commit the database to disk.
97 # Make sure that all data in the index is accessable.
100 # Write the content of the index to a file
102 # XXX this is currently disabled
103 #self.index.write(self.cache_file)
105 def add_package(self
, pkg
):
106 # Add package to the database.
107 self
.db
.add_package(pkg
)
108 self
.index
.add_package(pkg
)
110 def rem_package(self
, pkg
):
111 assert isinstance(pkg
, packages
.SolvPackage
), pkg
113 # Remove package from the database.
114 self
.db
.rem_package(pkg
)
118 return self
.db
.get_filelist()