]> git.ipfire.org Git - pakfire.git/commitdiff
pakfire: Drop old base module
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 19 Jun 2021 13:21:12 +0000 (13:21 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 19 Jun 2021 13:21:12 +0000 (13:21 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/pakfire/__init__.py
src/pakfire/base.py [deleted file]
src/pakfire/builder.py
src/pakfire/cli.py
src/pakfire/daemon.py

index c801d54ed129963ac5cbb6e7236566e6d849cdec..7bf4a7f3e45c604bde79642aa4e47669f0e26e61 100644 (file)
@@ -128,7 +128,6 @@ install-exec-local:
 pakfire_PYTHON = \
        src/pakfire/__init__.py \
        src/pakfire/__version__.py \
-       src/pakfire/base.py \
        src/pakfire/builder.py \
        src/pakfire/client.py \
        src/pakfire/cli.py \
index 290825a5a8e679b5112b8fc10cbca9b8337c6804..a9759336b3a28e3b4677fd297bf6f7aaf55f2f15 100644 (file)
@@ -19,7 +19,7 @@
 #                                                                             #
 ###############################################################################
 
-from .base import Pakfire
+from ._pakfire import Pakfire
 
 # Import Exceptions
 from ._pakfire import CommandExecutionError
diff --git a/src/pakfire/base.py b/src/pakfire/base.py
deleted file mode 100644 (file)
index 07cd0f7..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-#!/usr/bin/python3
-###############################################################################
-#                                                                             #
-# Pakfire - The IPFire package management system                              #
-# Copyright (C) 2011 Pakfire development team                                 #
-#                                                                             #
-# This program is free software: you can redistribute it and/or modify        #
-# it under the terms of the GNU General Public License as published by        #
-# the Free Software Foundation, either version 3 of the License, or           #
-# (at your option) any later version.                                         #
-#                                                                             #
-# This program is distributed in the hope that it will be useful,             #
-# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
-# GNU General Public License for more details.                                #
-#                                                                             #
-# You should have received a copy of the GNU General Public License           #
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
-#                                                                             #
-###############################################################################
-
-import logging
-import os
-import random
-import string
-
-from . import _pakfire
-from . import util
-
-from .system import system
-
-from .constants import *
-from .i18n import _
-
-class Pakfire(_pakfire.Pakfire):
-       __version__ = PAKFIRE_VERSION
-
-       def __enter__(self):
-               """
-                       Called to initialize this Pakfire instance when
-                       the context is entered.
-               """
-               return PakfireContext(self)
-
-       def __exit__(self, type, value, traceback):
-               pass
-
-
-class PakfireContext(object):
-       """
-               This context has functions that require
-               pakfire to be initialized.
-
-               That means that repository data has to be downloaded
-               and imported to be searchable, etc.
-       """
-       def __init__(self, pakfire):
-               self.pakfire = pakfire
-
-       def check(self, **kwargs):
-               """
-                       Try to fix any errors in the system.
-               """
-               # Detect any errors in the dependency tree.
-               # For that we create an empty request and solver and try to solve
-               # something.
-               request = _pakfire.Request(self.pakfire)
-               request.verify()
-
-               return request.solve(**kwargs)
-
-       def info(self, args):
-               pkgs = []
-
-               with _pakfire.Repo(self.pakfire, "tmp", clean=True) as r:
-                       for arg in args:
-                               if os.path.exists(arg) and not os.path.isdir(arg):
-                                       archive = _pakfire.Archive(self.pakfire, arg)
-
-                                       # Add the archive to the repository
-                                       pkg = r.add_archive(archive)
-                                       pkgs.append(pkg)
-
-                               else:
-                                       pkgs += self.pakfire.whatprovides(arg, name_only=True)
-
-               return sorted(pkgs)
-
-       def provides(self, patterns):
-               pkgs = []
-
-               for pattern in patterns:
-                       for pkg in self.pakfire.whatprovides(pattern):
-                               if pkg in pkgs:
-                                       continue
-
-                               pkgs.append(pkg)
-
-               return sorted(pkgs)
-
-       def search(self, pattern):
-               return self.pakfire.search(pattern)
-
-       def extract(self, filenames, target=None):
-               if target and target == "/":
-                       raise ValueError("Cannot extract to: %s" % target)
-
-               archives = []
-
-               # Open all archives
-               for filename in filenames:
-                       a = _pakfire.Archive(self.pakfire, filename)
-                       archives.append(a)
-
-               # Nothing to do when no archives where opened
-               if not archives:
-                       return
-
-               # Extract them all
-               for archive in archives:
-                       archive.extract(target)
-
-       # Transactions
-
-       def install(self, requires, **kwargs):
-               request = _pakfire.Request(self.pakfire)
-
-               # XXX handle files and URLs
-
-               for req in requires:
-                       request.install(req)
-
-               return request.solve(**kwargs)
-
-       def reinstall(self, pkgs, strict=False, logger=None):
-               """
-                       Reinstall one or more packages
-               """
-               raise NotImplementedError
-
-       def erase(self, pkgs, **kwargs):
-               request = _pakfire.Request(self.pakfire)
-
-               for pkg in pkgs:
-                       relation = _pakfire.Relation(self.pakfire, pkg)
-                       request.erase(relation)
-
-               return request.solve(**kwargs)
-
-       def update(self, reqs=None, excludes=None, **kwargs):
-               request = _pakfire.Request(self.pakfire)
-
-               # Add all packages that should be updated to the request
-               for req in reqs or []:
-                       relation = _pakfire.Relation(self.pakfire, req)
-                       request.upgrade(relation)
-
-               # Otherwise we will try to upgrade everything
-               else:
-                       request.upgrade_all()
-
-               # Exclude packages that should not be updated
-               for exclude in excludes or []:
-                       relation = _pakfire.Relation(self.pakfire, exclude)
-                       request.lock(relation)
-
-               return request.solve(**kwargs)
-
-       def downgrade(self, pkgs, logger=None, **kwargs):
-               assert pkgs
-
-               if logger is None:
-                       logger = logging.getLogger("pakfire")
-
-               # Create a new request.
-               request = self.pakfire.create_request()
-
-               # Fill request.
-               for pattern in pkgs:
-                       best = None
-                       for pkg in self.pakfire.repos.whatprovides(pattern):
-                               # Only consider installed packages.
-                               if not pkg.is_installed():
-                                       continue
-
-                               if best and pkg > best:
-                                       best = pkg
-                               elif best is None:
-                                       best = pkg
-
-                       if best is None:
-                               logger.warning(_("\"%s\" package does not seem to be installed.") % pattern)
-                       else:
-                               rel = self.pakfire.create_relation("%s < %s" % (best.name, best.friendly_version))
-                               request.install(rel)
-
-               # Solve the request.
-               solver = self.pakfire.solve(request, allow_downgrade=True, **kwargs)
-               assert solver.status is True
-
-               # Create the transaction.
-               t = transaction.Transaction.from_solver(self.pakfire, solver)
-               t.dump(logger=logger)
-
-               if not t:
-                       logger.info(_("Nothing to do"))
-                       return
-
-               if not t.cli_yesno():
-                       return
-
-               t.run()
index 03ea2d64d0a76a10b45b3bab8ff3079d2336297b..66469015e77201078234aca03a03eb71ead9d8fb 100644 (file)
@@ -24,7 +24,6 @@ import os
 import uuid
 
 from . import _pakfire
-from . import base
 from . import logger
 from . import util
 
@@ -74,7 +73,7 @@ class Builder(object):
                self.log.debug("Entering %s" % self)
 
                # Initialise Pakfire instance
-               pakfire = base.Pakfire(
+               pakfire = _pakfire.Pakfire(
                        arch=self.arch,
                        conf=self.conf,
 
index ba19b2fda9dfb7eb9b6083651bf2f144215cbae2..fe0307f6935c83b89c27e479ddf1fc6bfac3acd9 100644 (file)
@@ -29,7 +29,7 @@ import sys
 import tempfile
 import time
 
-from . import base
+from . import _pakfire
 from . import builder
 from . import client
 from . import config
@@ -196,7 +196,7 @@ class Cli(object):
                                help=_("Run pakfire in offline mode."))
 
        def pakfire(self, ns):
-               p = base.Pakfire(
+               p = _pakfire.Pakfire(
                        arch=ns.arch,
                        conf=ns.config,
                        path=ns.root if "root" in ns else self.default_path,
index ce4e0d466c9b278c844fd586b44a0e92ead623d9..87aab8fec5d15c2139577fa40beb606aa77dca78 100644 (file)
@@ -9,14 +9,12 @@ import sys
 import tempfile
 import time
 
-import pakfire.base
 import pakfire.builder
 import pakfire.util
 
 from .system import system
 
 from . import _pakfire
-from . import base
 from . import config
 from . import http
 from . import hub