diff --git a/packages/p/pisi/actions.py b/packages/p/pisi/actions.py index 59c3a347144..f369f413c75 100644 --- a/packages/p/pisi/actions.py +++ b/packages/p/pisi/actions.py @@ -3,8 +3,23 @@ def install(): pythonmodules.install() - pisitools.dosym("eopkg-cli", "/usr/bin/eopkg") - pisitools.dosym("uneopkg", "/usr/bin/unpisi") - pisitools.dosym("lseopkg", "/usr/bin/lspisi") + # BEGIN comment these out for the epoch bump build of pisi + pisitools.dosym("eopkg.py2", "/usr/bin/eopkg") + pisitools.dosym("eopkg.py2", "/usr/bin/eopkg-cli") + pisitools.dosym("lseopkg.py2", "/usr/bin/lseopkg") + pisitools.dosym("lseopkg.py2", "/usr/bin/lspisi.py2") + pisitools.dosym("uneopkg.py2", "/usr/bin/uneopkg") + pisitools.dosym("uneopkg.py2", "/usr/bin/unpisi.py2") + # END comment these out for the epoch bump build of pisi pisitools.dodir("/etc/mudur") shelltools.echo("%s/etc/mudur/locale" % get.installDIR(), "") + + # Everything below here _removes_ stuff that we don't want installed. + # After the epoch bump, the goal is to make pisi own as little as + # practically possible, so that eopkg4 can own it instead for + # co-installability purposes as we deprecate pisi. + # + # Uncomment the line below for the epoch bump build of pisi + #shelltools.unlinkDir("%s/usr/share/defaults" % get.installDIR()) + pisitools.remove("/usr/share/doc/pisi/dependency.pdf") + pisitools.remove("/usr/share/doc/pisi/package_versions.pdf") diff --git a/packages/p/pisi/comar/manager.py3 b/packages/p/pisi/comar/manager.py3 new file mode 100755 index 00000000000..ab89bc48693 --- /dev/null +++ b/packages/p/pisi/comar/manager.py3 @@ -0,0 +1,253 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Copyright (C) 2005-2009 TUBITAK/UEKAE +# +# 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 2 of the License, or (at your option) +# any later version. +# +# Please read the COPYING file. +# + +# Disable cyclic garbage collector of Python to avoid comar segmentation +# faults under high load (#11110) +import gc +gc.disable() + +import os +import os.path +import locale +import string + +# FIXME: later this will be Comar's job +systemlocale = open("/etc/mudur/locale", "r").readline().strip() + +# for pisi +os.environ["LC_ALL"] = systemlocale + +# for system error messages +locale.setlocale(locale.LC_ALL, systemlocale) + +try: + import pisi.api + import pisi.db + import pisi.ui + import pisi.util as util + import pisi.configfile + from pisi.version import Version +except KeyboardInterrupt: + notify("System.Manager", "cancelled", "") + +class UI(pisi.ui.UI): + def error(self, msg): + notify("System.Manager", "error", str(msg)) + + def warning(self, msg): + notify("System.Manager", "warning", str(msg)) + + def notify(self, event, **keywords): + if event == pisi.ui.installing: + pkgname = keywords["package"].name + notify("System.Manager", "status", ("installing", pkgname, "", "")) + elif event == pisi.ui.configuring: + pkgname = keywords["package"].name + notify("System.Manager", "status", ("configuring", pkgname, "", "")) + elif event == pisi.ui.extracting: + pkgname = keywords["package"].name + notify("System.Manager", "status", ("extracting", pkgname, "", "")) + elif event == pisi.ui.updatingrepo: + reponame = keywords["name"] + notify("System.Manager", "status", ("updatingrepo", reponame, "", "")) + elif event == pisi.ui.removing: + pkgname = keywords["package"].name + notify("System.Manager", "status", ("removing", pkgname, "", "")) + elif event == pisi.ui.cached: + total = str(keywords["total"]) + cached = str(keywords["cached"]) + notify("System.Manager", "status", ("cached", total, cached, "")) + elif event == pisi.ui.installed: + notify("System.Manager", "status", ("installed", "", "", "")) + elif event == pisi.ui.removed: + notify("System.Manager", "status", ("removed", "", "", "")) + elif event == pisi.ui.upgraded: + notify("System.Manager", "status", ("upgraded", "", "", "")) + elif event == pisi.ui.packagestogo: + notify("System.Manager", "status", ("order", "", "", "")) + elif event == pisi.ui.desktopfile: + filepath = keywords["desktopfile"] + notify("System.Manager", "status", ("desktopfile", filepath, "", "")) + elif event == pisi.ui.systemconf: + notify("System.Manager", "status", ("systemconf", "", "", "")) + else: + return + + def ack(self, msg): + return True + + def confirm(self, msg): + return True + + def display_progress(self, operation, percent, info="", **kw): + if operation == "fetching": + file_name = kw["filename"] + if not file_name.startswith("eopkg-index.xml"): + file_name = pisi.util.parse_package_name(file_name)[0] + out = (operation, file_name, str(percent), int(kw["rate"]), kw["symbol"], int(kw["downloaded_size"]), int(kw["total_size"])) + else: + out = (operation, str(percent), info, 0, 0, 0, 0) + notify("System.Manager", "progress", out) + +def _init_pisi(): + ui = UI() + try: + pisi.api.set_userinterface(ui) + except KeyboardInterrupt: + cancelled() + +def _get_eopkg_config(): + if os.path.exists("/etc/eopkg/eopkg.conf"): + return "/etc/eopkg/eopkg.conf" + return "/usr/share/defaults/eopkg/eopkg.conf" + +def cancelled(): + notify("System.Manager", "cancelled", None) + +def started(operation=""): + notify("System.Manager", "started", operation) + +def finished(operation=""): + if operation in ["System.Manager.setCache", "System.Manager.installPackage", "System.Manager.removePackage", "System.Manager.updatePackage"]: + __checkCacheLimits() + + notify("System.Manager", "finished", operation) + +def privileged(func): + """ + Decorator for synchronizing privileged functions + """ + def wrapper(*__args,**__kw): + operation = "System.Manager.%s" % func.__name__ + + started(operation) + _init_pisi() + try: + func(*__args,**__kw) + except KeyboardInterrupt: + cancelled() + return + except Exception(e): + notify("System.Manager", "error", str(e)) + return + finished(operation) + + return wrapper + +@privileged +def installPackage(package=None): + if package: + package = package.split(",") + reinstall = package[0].endswith(".eopkg") + pisi.api.install(package, ignore_file_conflicts=True, reinstall=reinstall) + +@privileged +def reinstallPackage(package=None): + if package: + package = package.split(",") + pisi.api.install(package, ignore_file_conflicts=True, reinstall=True) + +@privileged +def updatePackage(package=None): + if package is None: + package = [] + else: + package = package.split(",") + pisi.api.upgrade(package) + +@privileged +def removePackage(package=None): + if package: + package = package.split(",") + pisi.api.remove(package) + +@privileged +def updateRepository(repository=None): + if repository: + pisi.api.update_repo(repository) + +@privileged +def updateAllRepositories(): + repos = pisi.db.repodb.RepoDB().list_repos() + for repo in repos: + try: + pisi.api.update_repo(repo) + except pisi.db.repodb.RepoError(e): + notify("System.Manager", "error", str(e)) + +@privileged +def addRepository(name=None,uri=None): + if name and uri: + pisi.api.add_repo(name,uri) + +@privileged +def removeRepository(repo=None): + if repo: + pisi.api.remove_repo(repo) + +@privileged +def setRepoActivities(repos=None): + if repos: + for repo, active in list(repos.items()): + pisi.api.set_repo_activity(repo, active) + +@privileged +def setRepositories(repos): + oldRepos = pisi.db.repodb.RepoDB().list_repos(only_active=False) + + for repo in oldRepos: + pisi.api.remove_repo(repo) + + for repo in repos: + pisi.api.add_repo(repo[0], repo[1]) + +@privileged +# ex: setConfig("general", "bandwidth_limit", "30") +def setConfig(category, name, value): + config = pisi.configfile.ConfigurationFile("/etc/eopkg/eopkg.conf") + config.set(category, name, value) + + config.write_config() + +@privileged +def setCache(enabled, limit): + config = pisi.configfile.ConfigurationFile("/etc/eopkg/eopkg.conf") + config.set("general", "package_cache", str(enabled)) + config.set("general", "package_cache_limit", str(limit)) + + config.write_config() + +@privileged +def takeSnapshot(): + pisi.api.snapshot() + +@privileged +def takeBack(operation): + pisi.api.takeback(operation) + +@privileged +def clearCache(cacheDir, limit): + pisi.api.clearCache(int(limit) == 0) + +def __checkCacheLimits(): + cached_pkgs_dir = "/var/cache/eopkg/packages" + config = pisi.configfile.ConfigurationFile(_get_eopkg_config()) + cache = config.get("general", "package_cache") + if cache == "True": + limit = config.get("general", "package_cache_limit") + + # If PackageCache is used and limit is 0. It means limitless. + if limit and int(limit) != 0: + clearCache(cached_pkgs_dir, int(limit) * 1024 * 1024) + elif cache == "False": + clearCache(cached_pkgs_dir, 0) diff --git a/packages/p/pisi/comar/package.py3 b/packages/p/pisi/comar/package.py3 new file mode 100755 index 00000000000..7daa908ad56 --- /dev/null +++ b/packages/p/pisi/comar/package.py3 @@ -0,0 +1,9 @@ +#!/usr/bin/env python3 + +import os + +def postInstall(fromVersion, fromRelease, toVersion, toRelease): + if not os.path.exists("/var/lib/pisi/package"): + os.system("mkdir /var/lib/pisi/package") + os.system("mv /var/lib/pisi/* /var/lib/pisi/package/") + os.system("mv /var/lib/pisi/package/scripts /var/lib/pisi/") diff --git a/packages/p/pisi/pspec.xml b/packages/p/pisi/pspec.xml index bac44066c5f..8aaaaa3908e 100644 --- a/packages/p/pisi/pspec.xml +++ b/packages/p/pisi/pspec.xml @@ -12,13 +12,14 @@ app:console PISI PISI is a modern package management system implemented in Python. Some of its main features are: package sources are written in XML and python, implements all functions through a simple-to-use API, integrates low-level and high-level package management features. - https://github.com/getsolus/eopkg/archive/refs/tags/v3.11.tar.gz + https://github.com/getsolus/eopkg/archive/refs/tags/v3.12.1.tar.gz - python - python2-xattr db5 - piksemel intltool + piksemel + python + python2-ordered-set + python2-xattr @@ -28,40 +29,65 @@ pisi + /etc/pisi/pisi.conf + /etc/mudur/locale + /usr/lib/tmpfiles.d/pisi.conf + /usr/share/defaults/eopkg + /usr/share/factory/var/db/comar3/scripts/System.Manager/pisi.py + /usr/share/mime/packages + /usr/share/doc + /usr/share/man/man1 /usr/bin /usr/sbin /usr/lib/python* /usr/share/locale - /usr/share/doc - /usr/share/man/man1 - /usr/share/defaults/eopkg - /etc/pisi/pisi.conf - /etc/mudur/locale - /usr/share/mime/packages - /usr/share/factory/var/db/comar3/scripts/System.Manager/pisi.py - /usr/lib/tmpfiles.d/pisi.conf + pisi.tmpfiles + mirrors.conf sandbox.conf - pisi.tmpfiles + manager.py + eopkg.1 + System.Package System.Manager - python - python2-xattr db5 + piksemel + python + python2-ordered-set + python2-xattr usysconf + + 24-06-2024 + 3.12.1 + sync to v3.12.1, add dep on python2-ordered-set +**Summary** +- Sync with pisi v3.12.1 upstream release, which always installs baselayout eopkg first if they are present in any given install/upgrade order. +- Add rundep on python2-ordered-set package +- Make pisi co-installable with the eopkg(py3) package +- Miscellaneous shebang and file name extension changes +- Sort pspec.xml file sections lexically for ease of reading/tweaking +- Change long_description to indicate that pisi is now considered legacy +- Create new comar/manager.py3 and comar/package.py3 build scripts in preparation for enabling building pisi with `eopkg.py3 build`. + Thank you to @ultr4_l4s3r for the porting work. The current comar/*.py scripts are still python2 for now. + + Rune Morling + ermo@serpentos.com + 10-06-2024 3.11