On Wed, 25 Dec 2024 16:40:36 -0000 (UTC), etphonehomefra...@gmail.com wrote:
> On 2024-12-18, Frank Guthausen <fg.deb...@shimps.de> wrote:
> >
> > I try to setup a repository with a similar structure as Debian's
> > original, just smaller. In the Debian repository, e.g. bookworm main[1]
> > there are a lot Contents-*.gz files. My repository is created with
> > reprepro following the wiki[2]. But I cannot find information about the
> > missing Contents-* files. What is the intended workflow to create them?
> >
> > The files of my packages are not included in the database of apt-file,
> > the mandatory ``apt-file update'' does not help to find files or show
> > files in my packages.
> >
> > I guess the problems are related.
> >
> > What can I do to solve those issues?
> >
> >  [1] https://ftp.debian.org/debian/dists/bookworm/main/
> >  [2] https://wiki.debian.org/DebianRepository/SetupWithReprepro
> >
> 
> Creating and managing a repository with a structure similar to Debian's
> requires generating the Contents-*.gz files, which map the files provided by
> packages to their respective packages. These files are crucial for tools
> like apt-file to function correctly. If you are using reprepro to manage
> your repository, these files are not generated by default. Here's how you
> can address this:
> 
> The Contents-*.gz files list all the files included in the packages of a
> particular section and architecture in the repository. These files allow
> tools like apt-file to index and search for files provided by packages.
> 
> reprepro is a lightweight tool and does not have built-in support for
> creating Contents-*.gz files. This is why you don't see these files in your
> repository and why apt-file update doesn't work as expected.
> 
> You can generate the Contents-*.gz files manually or use a script to
> automate the process. Here’s a general workflow:
> 
> Use a script to extract the contents of the data.tar.* (or data.cpio.*)
> archives from the .deb files in your repository. For example:
> 
> for deb in pool/main/*/*.deb; do dpkg-deb -c "$deb" | awk '{print $6}' | sed
> "s|^|$(basename "$deb" .deb) |" done This will produce lines in the format
> package file, which map files to their packages.
> 
> Organize the output by architecture (e.g., amd64, arm64) and section (e.g.,
> main, contrib).
> 
> For each architecture and section, write the organized output into a text
> file named Contents-<architecture>.gz. For example:
> 
> gzip -c > dists/bookworm/main/Contents-amd64.gz Step 4: Automate the Process
> You can create a shell or Python script to iterate through all architectures
> and sections in your repository, generating the required files.
> 
> After generating the Contents-*.gz files, ensure they are included in the
> Release file of your repository so that apt-file can detect them:
> 
> Update the Release file with the appropriate checksums for the Contents-*.gz
> files:
> 
> reprepro export Run apt update and then apt-file update on the client
> system to test the functionality.
> 
> Here is a basic example script:
> 
> #!/bin/bash REPO_PATH="/path/to/your/repo" DIST="bookworm" SECTIONS=("main"
> "contrib" "non-free") ARCHITECTURES=("amd64" "arm64")
> 
> for SECTION in "${SECTIONS[@]}"; do for ARCH in "${ARCHITECTURES[@]}"; do
> CONTENTS_FILE="$REPO_PATH/dists/$DIST/$SECTION/Contents-$ARCH"
> 

man reprepro -> conf/distributions -> Contents

Reply via email to