#1085265 local-apt-repository: use caching

#1085265#5
Date:
2024-10-17 12:44:07 UTC
From:
To:
Dear Maintainer,


If you have a bunch of packages, regeneration takes very long because it rebuilds everything from scratch. It should be using caching. Something like this:

      apt-ftparchive packages --db cache.db ../../../$DEBS > $REPO/Packages
      apt-ftparchive sources --db cache.db ../../../$DEBS > $REPO/Sources

I'm assuming you'll put it in /var/cache/local-apt-repository

#1085265#10
Date:
2024-10-17 17:24:11 UTC
From:
To:
Dear Maintainer,

i encoutered more issues. Because i'm using mv, the files are relativelly old, so the if statement with the stamp isn't triggered. But with caching this can be removed. Then also force can be removed. And also the stamp. So now, i changed it to run greedely and rely on caching.

in attachment what i'm using.

the cache probably needs to be moved (/var/cache) and also i don't know if the cache will just grow uncontrollably. apt-ftparchive has a clean command, but it expects a config file. Maybe it's an oversite there.

#1085265#15
Date:
2024-10-20 10:21:52 UTC
From:
To:
Dear Maintainer,


in the previous one, the loop doesn't do its job. fix

#1085265#20
Date:
2024-12-28 09:25:06 UTC
From:
To:
With the caching, it's also efficient to generate the Contents files
now:

diff --git a/rebuild b/rebuild
index 9afa60c..f0af00b 100755
--- a/rebuild
+++ b/rebuild
@@ -29,6 +29,10 @@ else
        (cd $REPO
        apt-ftparchive packages --db cache.db ../../../$DEBS > $REPO/Packages
        apt-ftparchive sources --db cache.db ../../../$DEBS > $REPO/Sources
+      for arch in $(dpkg --print-architecture) $(dpkg --print-foreign-architectures)
+      do
+        apt-ftparchive contents --db cache.db ../../../$DEBS > $REPO/Contents-$arch
+      done
        ) && break || true
        # ^ this can fail during a partial write to the directory (which
        #   would be detected by the loop), so ignore errors here

#1085265#25
Date:
2025-07-21 21:19:29 UTC
From:
To:
tags 1085265 + patch
thanks

I've taken these patches, added a few more, and created a merge request at:

https://salsa.debian.org/debian/local-apt-repository/-/merge_requests/2

I've also attached the same series of patches to this message.

#1085265#32
Date:
2025-07-21 23:41:40 UTC
From:
To:
Ah, I forgot to handle the case where /srv/local-apt-repository doesn't exist when the package is installed.  This updated patch (and my latest push on salsa.d.o) should fix that.