]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
builder: Drop legacy Python build stuff
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 17 May 2022 16:24:52 +0000 (16:24 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 17 May 2022 16:24:52 +0000 (16:24 +0000)
This has now all moved into the C library

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/pakfire/builder.py [deleted file]
src/pakfire/daemon.py

index 9807957465aa7be7a1df4ba12622fcbd6e86501e..acd520b11c6a0461dd3a36f0c3a95ec9217c52d5 100644 (file)
@@ -124,7 +124,6 @@ CLEANFILES += \
 pakfire_PYTHON = \
        src/pakfire/__init__.py \
        src/pakfire/__version__.py \
-       src/pakfire/builder.py \
        src/pakfire/client.py \
        src/pakfire/config.py \
        src/pakfire/constants.py \
diff --git a/src/pakfire/builder.py b/src/pakfire/builder.py
deleted file mode 100644 (file)
index 6646901..0000000
+++ /dev/null
@@ -1,164 +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 glob
-import os
-import uuid
-
-from . import _pakfire
-from . import logger
-from . import util
-
-import logging
-log = logging.getLogger("pakfire.builder")
-
-from .constants import *
-from .i18n import _
-from .errors import *
-
-BUILD_LOG_HEADER = """
- ____       _     __ _            _           _ _     _
-|  _ \ __ _| | __/ _(_)_ __ ___  | |__  _   _(_) | __| | ___ _ __
-| |_) / _` | |/ / |_| | '__/ _ \ | '_ \| | | | | |/ _` |/ _ \ '__|
-|  __/ (_| |   <|  _| | | |  __/ | |_) | |_| | | | (_| |  __/ |
-|_|   \__,_|_|\_\_| |_|_|  \___| |_.__/ \__,_|_|_|\__,_|\___|_|
-
-       Version : %(version)s
-       Host    : %(hostname)s (%(host_arch)s)
-       Time    : %(time)s
-
-"""
-
-class Builder(object):
-       def __init__(self, conf, arch=None, build_id=None, logfile=None, **kwargs):
-               self.conf = conf
-
-               # Settings array.
-               self.settings = {
-                       "enable_ccache"   : True,
-                       "enable_snapshot" : True,
-               }
-
-               # Add settings from keyword arguments
-               self.settings.update(kwargs)
-
-               # Generate a build ID
-               self.build_id = build_id or "%s" % uuid.uuid4()
-
-               # Setup logging
-               self.log = self.setup_logging(logfile)
-
-               # Architecture to build for
-               self.arch = arch or _pakfire.native_arch()
-
-       def __enter__(self):
-               self.log.debug("Entering %s" % self)
-
-               # Initialise Pakfire instance
-               pakfire = _pakfire.Pakfire(
-                       arch=self.arch,
-                       conf=self.conf,
-
-                       # Enable build mode
-                       build=True,
-                       **self.settings,
-               )
-
-               # Setup domain name resolution in chroot
-               for i in ("/etc/resolv.conf", "/etc/hosts"):
-                       pakfire.copy_in(i, i)
-
-               return BuilderContext(pakfire, self)
-
-       def __exit__(self, type, value, traceback):
-               self.log.debug("Leaving %s" % self)
-
-       def setup_logging(self, logfile):
-               l = log.getChild(self.build_id)
-               l.setLevel(logging.DEBUG)
-
-               # Print everything to the console
-               console = logger.ConsoleHandler()
-               l.addHandler(console)
-
-               # If we have a log file, we write INFO and higher level messages to it
-               # using the build formatter which adds a timestamp
-               if logfile:
-                       h = logging.FileHandler(logfile)
-                       h.setLevel(logging.INFO)
-                       l.addHandler(h)
-
-                       # Set formatter
-                       f = logger.BuildFormatter()
-                       h.setFormatter(f)
-
-               return l
-
-
-class BuilderContext(object):
-       def __init__(self, pakfire, builder):
-               self.pakfire = pakfire
-               self.builder = builder
-
-               # Get a reference to the logger
-               self.log = self.builder.log
-
-       def _install(self, packages):
-               self.log.debug(_("Installing packages in build environment:"))
-               for package in packages:
-                       self.log.debug("        %s" % package)
-
-               # Initialise Pakfire
-               with self.pakfire as p:
-                       # Install all required packages
-                       transaction = p.install(packages)
-
-                       # Return how many packages were installed/changed
-                       ret = len(transaction)
-
-                       # Dump transaction to log
-                       t = transaction.dump()
-                       self.log.info(t)
-
-                       # Download transaction
-                       transaction.download()
-
-                       # Run the transaction
-                       transaction.run()
-
-                       return ret
-
-       def build(self, path, shell=True):
-               # Install the package
-               self._install([path])
-
-               for makefile in glob.glob("%s/usr/src/packages/*/*.nm" % self.pakfire.path):
-                       self.pakfire.build(makefile, logging_callback=self.log.log, interactive=shell)
-
-       def shell(self, packages=[], install=None):
-               if install:
-                       packages += install
-
-               self._install(packages)
-
-               # Enter the shell
-               self.pakfire.shell()
-
index 73a0aeb3602059553c6b445628bb48c38a295351..ea46094cf7a5423cecbb2f036c252a8379a58d7b 100644 (file)
@@ -9,7 +9,6 @@ import sys
 import tempfile
 import time
 
-import pakfire.builder
 import pakfire.util
 
 from .system import system