Faking a debian repository for package development

I use aptly to deliver my unofficial debian packages both to myself and others that might be interested.

However I’ve found that using aptly to do package development is a bad idea, because you can’t (by design, probably) overwrite packages in an aptly archive.  You can only create new versions.

For some installation tests it’s OK to use “dpkg –install”. But if your package needs to pull in depdencies, or if you wish to test a package upgrade, you need to use APT.

This article explains how to create a fake debian repository for use in package development.

Initial setup

Initial setup:

  1. Create the repository directory (this should be done as the same user you use to build the package)
    mkdir -p /tmp/repo
  2. Open /etc/apt/sources.list in a text editor and add the following (you need to be root to do this)
    # Test install apt archive
    deb [trusted=yes] file:///tmp repo/
    

Add new package to the repo

This the development cycle:

  1. Build the package (the example builds karaf)
    cd ~/git/karaf-debian/
    dpkg-buildpackage
  2. Copy the package to the fake repo (this example uses karaf, replace with your own package and package version):
    cp ~/git/karaf_4.1.5-0~9.30_all.deb /tmp/repo
  3. Generate a Packages file
    (cd /tmp; dpkg-scanpackages repo >repo/Packages)

Upgrading an existing package

This has to be done as root:

  1. First update APTs database of packages and archives
    apt-get update
  2. Run an upgrade with the following command
    apt-get dist-upgrade
  3. There will will be a question for if you wish to continue, to continue is the default, just press ENTER
    Do you want to continue? [Y/n]
  4. There will be a warning about that the package to be installed cannot be authenticated, the default here is not to install, so press “y” (without the quotes) to continue
    Install these packages without verification? [y/N]

Installing a package

This is used to e.g. test that a package is able to install its dependencies.

These operations have to be done as root:

  1. First update APT’s database of packages and archives
    apt-get update
  2. Use the following command to install a package and its dependencies, this example installs apache karaf:
    apt-get install karaf
  3. If the package pulls in new dependencies there will be a prompt for if you wish to continue. The default is to continue, so just press ENTER
    Do you want to continue? [Y/n]
  4. There will be a warning about that the package to be installed cannot be authenticated, the default here is not to install, so press “y” (without the quotes) to continue
    Install these packages without verification? [y/N]

One thought on “Faking a debian repository for package development”

  1. Edited the line added to /etc/apt/sources.list to add “[trusted=yes]”.

    Without this setting “apt updated” refuses to use the repository.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.