One thing to note is that while this problem is present in jammy-updates and focal-updates version of apt_check.py in /src, the version already in the devel branch seems to fix the issue.
+def get_apt_pkg_esm_cache():
+ """Get an apt_pkg cache with the ubuntu-advantage-tools esm data.
+
+ Set the configuration to get the u-a-t cache, then set it back to an
+ empty configuration state and init again so other calls to Cache work as
+ expected.
+ """
+ for key in apt_pkg.config.keys():
+ if re.match(r"^Acquire", key) is None:
+ apt_pkg.config.clear(key)
+ apt_pkg.config.set("Dir", PRO_ESM_CACHE_DIR)
+ apt_pkg.init()
+ try:
+ esm_cache = apt_pkg.Cache(progress=None)
+ except apt_pkg.Error:
+ esm_cache = None
+
+ for key in apt_pkg.config.keys():
+ apt_pkg.config.clear(key)
+ apt_pkg.init()
+
+ return esm_cache
+
+
def init():
" init the system, be nice "
# FIXME: do a ionice here too?
@@ -365,12 +390,7 @@ def run(options=None): sys.stderr.write("E: " + _("Error: Marking the upgrade (%s)") % e) sys.exit(-1)
One thing to note is that while this problem is present in jammy-updates and focal-updates version of apt_check.py in /src, the version already in the devel branch seems to fix the issue.
( This works: https:/ /git.launchpad. net/ubuntu/ +source/ update- notifier/ tree/data/ apt_check. py, /git.launchpad. net/ubuntu/ +source/ update- notifier/ tree/data/ apt_check. py?h=ubuntu% 2Ffocal- updates /git.launchpad. net/ubuntu/ +source/ update- notifier/ tree/data/ apt_check. py?h=ubuntu% 2Fjammy- updates
these don't:
- https:/
- https:/
)
Due to what was added in this commit:
update-notifier (3.192.63) lunar; urgency=medium
* Isolate creation of the esm apt cache in apt-check (LP: #2008212)
-- Renan Rodrigo Barbosa <email address hidden> Mon, 27 Feb 2023 23:15:02 -0300
+def get_apt_ pkg_esm_ cache() : advantage- tools esm data. config. keys(): r"^Acquire" , key) is None: config. clear(key) config. set("Dir" , PRO_ESM_CACHE_DIR) Cache(progress= None) config. keys(): config. clear(key)
sys.stderr. write(" E: " + _("Error: Marking the upgrade (%s)") % e)
sys.exit( -1)
+ """Get an apt_pkg cache with the ubuntu-
+
+ Set the configuration to get the u-a-t cache, then set it back to an
+ empty configuration state and init again so other calls to Cache work as
+ expected.
+ """
+ for key in apt_pkg.
+ if re.match(
+ apt_pkg.
+ apt_pkg.
+ apt_pkg.init()
+ try:
+ esm_cache = apt_pkg.
+ except apt_pkg.Error:
+ esm_cache = None
+
+ for key in apt_pkg.
+ apt_pkg.
+ apt_pkg.init()
+
+ return esm_cache
+
+
def init():
" init the system, be nice "
# FIXME: do a ionice here too?
@@ -365,12 +390,7 @@ def run(options=None):
- try: config. set("Dir" , "/var/lib/ ubuntu- advantage/ apt-esm/ ") init_system( ) Cache(progress= None) pkg_esm_ cache()
- apt_pkg.
- apt_pkg.
- esm_cache = apt_pkg.
- except apt_pkg.Error:
- esm_cache = None
+ esm_cache = get_apt_