You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
calculate-overlay/profiles/templates/3.6/6_ac_install_patch/sys-apps/portage/calculate_sync_module.patch

91 lines
2.6 KiB

# Calculate format=diff
diff --git a/lib/portage/sync/modules/calculate/__init__.py b/lib/portage/sync/modules/calculate/__init__.py
new file mode 100644
index 0000000..1b297f6
--- /dev/null
+++ b/lib/portage/sync/modules/calculate/__init__.py
@@ -0,0 +1,29 @@
+# Copyright 2014-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Calculate plug-in module for portage.
+Performs a git pull on repositories."""
+__doc__ = doc[:]
+
+from portage.localization import _
+from portage.sync.config_checks import CheckSyncConfig
+from portage.util import writemsg_level
+
+
+module_spec = {
+ 'name': 'calculate',
+ 'description': doc,
+ 'provides':{
+ 'calculate-module': {
+ 'name': "calculate",
+ 'sourcefile': "calculate",
+ 'class': "CalculateSync",
+ 'description': doc,
+ 'functions': ['sync'],
+ 'func_desc': {
+ 'sync': 'Performs a calculate overlay sychronization',
+ },
+ 'validate_config': CheckSyncConfig,
+ }
+ }
+}
diff --git a/lib/portage/sync/modules/calculate/calculate.py b/lib/portage/sync/modules/calculate/calculate.py
new file mode 100644
index 0000000..d3152f6
--- /dev/null
+++ b/lib/portage/sync/modules/calculate/calculate.py
@@ -0,0 +1,48 @@
+# Copyright 2005-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import io
+import logging
+import subprocess
+
+import portage
+from portage import os
+from portage.util import writemsg_level, shlex_split
+from portage.util.futures import asyncio
+from portage.output import create_color_func, EOutput
+good = create_color_func("GOOD")
+bad = create_color_func("BAD")
+warn = create_color_func("WARN")
+from portage.sync.syncbase import NewBase
+
+class CalculateSync(NewBase):
+ '''Calculate sync class'''
+
+ short_desc = "Perform sync operations on calculate based repositories"
+
+ @staticmethod
+ def name():
+ return "CalculateSync"
+
+
+ def __init__(self):
+ NewBase.__init__(self, "cl-core", "sys-apps/calculate-utils")
+
+ def update(self):
+ """
+ Internal function to update an existing calculate repository
+
+ @return: tuple of return code (0=success), whether the cache
+ needs to be updated
+ @rtype: (int, bool)
+ """
+
+ #calculate update
+ exitcode = portage.process.spawn_bash(
+ "/usr/sbin/cl-core --method update --rep %s "
+ "--sync-only on --skip-eix-update -T none" % self.repo.name)
+ if exitcode != os.EX_OK:
+ msg = "!!! calculate update error; exiting."
+ self.logger(self.xterm_titles, msg)
+ writemsg_level(msg + "\n", noiselevel=-1, level=logging.ERROR)
+ return (exitcode, False)