Package: local-apt-repository
Version: 0.9
Followup-For: Bug #1085265
X-Debbugs-Cc: okgomdjgbm...@gmail.com

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.
#!/bin/bash

set -e

DEBS=/srv/local-apt-repository
REPO=/var/lib/local-apt-repository

if ! test -d $DEBS
then
  # We still need ot create the files lest apt will complain
  > $REPO/Packages
  > $REPO/Sources

else

  # We want to cater for the possibility that something is added to $DEBS as we
  # run, or that a file is slowly written. In this case, we want to wait a bit
  # and restart. But lets bound this to 10 runs.
  for n in $(seq 0 10)
  do
      # This is the second round alreay, lets wait a while
      if [ "$n" != "0" ]
      then
        echo "Further changes are coming in, waiting..."
        sleep 10
      fi

      # Relative paths work better than absolute
      (cd $REPO
      apt-ftparchive packages --db cache.db ../../../$DEBS > $REPO/Packages
      apt-ftparchive sources --db cache.db ../../../$DEBS > $REPO/Sources
     ) || true
      # ^ this can fail during a partial write to the directory (which
      #   would be detected by the loop), so ignore errors here

  done

fi

apt-ftparchive \
        -o "APT::FTPArchive::Release::Origin=local-apt-repository" \
        -o "APT::FTPArchive::Release::Description=Local repository created by 
local-apt-repository" \
        release $REPO > $REPO/Release

Reply via email to