Skip to contentSkip to conversation

Delete WORKDIR/installed_pkgs.txt after use

PATCH In review [email protected] 3 participants 7 messages Nov 4, 2015 – Nov 5, 2015

lore
Share & tools
lore
#0 lore raw

cover Delete WORKDIR/installed_pkgs.txt after use

From: Mariano Lopez <[email protected]>

These changes will delete the file installed_pkgs.txt once it used. This file is used internally for complementary package installation but it was left there after the use. This file was causing some confusion and shouldn't be left there after the installation process

The following changes since commit fc45deac89ef63ca1c44e763c38ced7dfd72cbe1:

build-appliance-image: Update to jethro head revision (2015-11-03 14:03:03 +0000)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib mariano/bug8444
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=mariano/bug8444

Mariano Lopez (3):
runtime/_ptest.py: Delete WORKDIR/installed_pkgs.txt rootfs.py: Stop using installed_pkgs.txt package_manager.py: Delete installed_pkgs.txt file

 meta/lib/oe/package_manager.py  |  1 +
 meta/lib/oe/rootfs.py           | 24 +++++++++---------------
 meta/lib/oeqa/runtime/_ptest.py |  2 ++
 3 files changed, 12 insertions(+), 15 deletions(-)
Signature · 1 line
1.8.4.5
#1 lore raw

PATCH 1/3 runtime/_ptest.py: Delete WORKDIR/installed_pkgs.txt

From: Mariano Lopez <[email protected]>

The file WORKDIR/installed_pkgs.txt is an internal file used for package installation, neverteless it is left in the WORKDIR and this can cause confusion.

ptest use this file internally also (it overwrites the file left when creating the rootfs) and don't remove the file in WORKDIR, this changes deletes the file once is used.

[YOCTO #8444]

---
 meta/lib/oeqa/runtime/_ptest.py | 2 ++
 1 file changed, 2 insertions(+)
meta/lib/oeqa/runtime/_ptest.py +2 -0
index 0621028..fefc576 100644
@@ -91,7 +91,9 @@ class PtestRunnerTest(oeRuntimeTest):
         try:
             bb.note("Installing complementary packages ...")
             complementary_pkgs = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
+            os.remove(installed_pkgs_file)
         except subprocess.CalledProcessError as e:
+            os.remove(installed_pkgs_file)
             bb.fatal("Could not compute complementary packages list. Command "
                      "'%s' returned %d:\n%s" %
                      (' '.join(cmd), e.returncode, e.output))
Signature · 1 line
1.8.4.5
#2 lore raw

PATCH 2/3 rootfs.py: Stop using installed_pkgs.txt

In reply to [email protected]

From: Mariano Lopez <[email protected]>

The method _uninstall_unneeded uses the file installed_pkgs.txt, this file is left after the build and can cause confusion. This changes allow to get the installed packages using functions of rootfs instead of the installed_pkgs.txt file. With this change now is possible to remove the file without breaking anything.

[YOCTO #8444]

---
 meta/lib/oe/rootfs.py | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)
meta/lib/oe/rootfs.py +9 -15
index 18df22d..c004a5b 100644
@@ -243,25 +243,19 @@ class Rootfs(object):
             # Remove components that we don't need if we're not going to install
             # additional packages at runtime
             if delayed_postinsts is None:
-                installed_pkgs_dir = self.d.expand('${WORKDIR}/installed_pkgs.txt')
+                pkgs_installed = image_list_installed_packages(self.d)
                 pkgs_to_remove = list()
-                with open(installed_pkgs_dir, "r+") as installed_pkgs:
-                    pkgs_installed = installed_pkgs.read().splitlines()
-                    for pkg_installed in pkgs_installed[:]:
-                        pkg = pkg_installed.split()[0]
-                        if pkg in ["update-rc.d",
-                                "base-passwd",
-                                "shadow",
-                                "update-alternatives", pkg_to_remove,
-                                self.d.getVar("ROOTFS_BOOTSTRAP_INSTALL", True)
-                                ]:
-                            pkgs_to_remove.append(pkg)
-                            pkgs_installed.remove(pkg_installed)
+                for pkg in pkgs_installed.split():
+                    if pkg in ["update-rc.d",
+                            "base-passwd",
+                            "shadow",
+                            "update-alternatives", pkg_to_remove,
+                            self.d.getVar("ROOTFS_BOOTSTRAP_INSTALL", True)
+                            ]:
+                        pkgs_to_remove.append(pkg)
 
                 if len(pkgs_to_remove) > 0:
                     self.pm.remove(pkgs_to_remove, False)
-                    # Update installed_pkgs.txt
-                    open(installed_pkgs_dir, "w+").write('\n'.join(pkgs_installed))
 
             else:
                 self._save_postinsts()
Signature · 1 line
1.8.4.5
#3 lore raw

PATCH 3/3 package_manager.py: Delete installed_pkgs.txt file

In reply to [email protected]

From: Mariano Lopez <[email protected]>

This change removes the file installed_pkgs.txt after it was used for installation of complementary packages. This file was causing confusion when left in the WORKDIR after the build.

---
 meta/lib/oe/package_manager.py | 1 +
 1 file changed, 1 insertion(+)
meta/lib/oe/package_manager.py +1 -0
index 964fddc..bc33473 100644
@@ -625,6 +625,7 @@ class PackageManager(object):
                      "'%s' returned %d:\n%s" %
                      (' '.join(cmd), e.returncode, e.output))
         self.install(complementary_pkgs.split(), attempt_only=True)
+        os.remove(installed_pkgs_file)
 
     def deploy_dir_lock(self):
         if self.deploy_dir is None:
Signature · 1 line
1.8.4.5
#4 lore raw
In reply to [email protected]
Quoted 6 lines · On 11/04/2015 03:50 PM, [email protected] wrote:

From: Mariano Lopez <[email protected]>

These changes will delete the file installed_pkgs.txt once it used. This file is used internally for complementary package installation but it was left there after the use. This file was causing some confusion and shouldn't be left there after the installation process

The installed_pkgs.txt is very useful as a reference when we want to know which pkgs are installed, there is no other easy way to know.

// Robert

Quoted 20 lines

The following changes since commit fc45deac89ef63ca1c44e763c38ced7dfd72cbe1:

   build-appliance-image: Update to jethro head revision (2015-11-03 14:03:03 +0000)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib mariano/bug8444
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=mariano/bug8444

Mariano Lopez (3):
runtime/_ptest.py: Delete WORKDIR/installed_pkgs.txt rootfs.py: Stop using installed_pkgs.txt package_manager.py: Delete installed_pkgs.txt file

  meta/lib/oe/package_manager.py  |  1 +
  meta/lib/oe/rootfs.py           | 24 +++++++++---------------
  meta/lib/oeqa/runtime/_ptest.py |  2 ++
  3 files changed, 12 insertions(+), 15 deletions(-)
#5 lore raw
Quoted 3 lines · Robert Yang

The installed_pkgs.txt is very useful as a reference when we want to know which pkgs are installed, there is no other easy way to know.

There's a manifest in the deploy directory which has the advantage of being correct.

Ross

#6 lore raw
Quoted 7 lines · Ross

On 5 November 2015 at 01:28, Robert Yang <[email protected] <mailto:[email protected]>> wrote:

The installed_pkgs.txt is very useful as a reference when we want to know
which pkgs are installed, there is no other easy way to know.

You can also use function image_list_installed_packages from oe.rootfs

Mariano

Quoted 4 lines

There's a manifest in the deploy directory which has the advantage of being correct.

Ross