← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~pelpsi/launchpad-buildd:fix-rm-apt-cache into launchpad-buildd:master

 

Simone Pelosi has proposed merging ~pelpsi/launchpad-buildd:fix-rm-apt-cache into launchpad-buildd:master.

Commit message:
Use rm -rf /var/lib/apt/lists instead ../lists/*
    
The * is silently failing and the cache is not deleted properly.


Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~pelpsi/launchpad-buildd/+git/launchpad-buildd/+merge/474195
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~pelpsi/launchpad-buildd:fix-rm-apt-cache into launchpad-buildd:master.
diff --git a/lpbuildd/target/proxy.py b/lpbuildd/target/proxy.py
index bb3ca2c..1feaeaa 100644
--- a/lpbuildd/target/proxy.py
+++ b/lpbuildd/target/proxy.py
@@ -135,8 +135,14 @@ class BuilderProxyOperationMixin:
         self.backend.run(["systemctl", "restart", "snapd"])
 
     def delete_apt_cache(self):
+<<<<<<< lpbuildd/target/proxy.py
 
         self.backend.run(["rm", "-rf", "/var/lib/apt/lists/*"])
+=======
+        self.backend.run(
+            ["rm", "-rf", "/var/lib/apt/lists"]
+        )
+>>>>>>> lpbuildd/target/proxy.py
 
     def configure_git_protocol_v2(self):
         if self.backend.series == "focal":
diff --git a/lpbuildd/target/tests/test_build_rock.py b/lpbuildd/target/tests/test_build_rock.py
index 6b90e34..ddcb6d9 100644
--- a/lpbuildd/target/tests/test_build_rock.py
+++ b/lpbuildd/target/tests/test_build_rock.py
@@ -300,7 +300,7 @@ class TestBuildRock(TestCase):
                         "python3-setuptools",
                     ),
                     RanSnap("install", "--classic", "rockcraft"),
-                    RanCommand(["rm", "-rf", "/var/lib/apt/lists/*"]),
+                    RanCommand(["rm", "-rf", "/var/lib/apt/lists"]),
                     RanCommand(["update-ca-certificates"]),
                     RanCommand(
                         [
@@ -397,7 +397,7 @@ class TestBuildRock(TestCase):
                         "python3-setuptools",
                     ),
                     RanSnap("install", "--classic", "rockcraft"),
-                    RanCommand(["rm", "-rf", "/var/lib/apt/lists/*"]),
+                    RanCommand(["rm", "-rf", "/var/lib/apt/lists"]),
                     RanCommand(["update-ca-certificates"]),
                     RanCommand(
                         [
diff --git a/lpbuildd/target/tests/test_build_snap.py b/lpbuildd/target/tests/test_build_snap.py
index 3c6d276..78ed3dc 100644
--- a/lpbuildd/target/tests/test_build_snap.py
+++ b/lpbuildd/target/tests/test_build_snap.py
@@ -227,7 +227,7 @@ class TestBuildSnap(TestCase):
                         "install", "python3", "socat", "git", "snapcraft"
                     ),
                     RanCommand(["mkdir", "-p", "/root/.subversion"]),
-                    RanCommand(["rm", "-rf", "/var/lib/apt/lists/*"]),
+                    RanCommand(["rm", "-rf", "/var/lib/apt/lists"]),
                     RanCommand(["update-ca-certificates"]),
                     RanCommand(
                         [
@@ -327,7 +327,7 @@ class TestBuildSnap(TestCase):
                         "install", "python3", "socat", "git", "snapcraft"
                     ),
                     RanCommand(["mkdir", "-p", "/root/.subversion"]),
-                    RanCommand(["rm", "-rf", "/var/lib/apt/lists/*"]),
+                    RanCommand(["rm", "-rf", "/var/lib/apt/lists"]),
                     RanCommand(["update-ca-certificates"]),
                     RanCommand(
                         [