ionos-cloud/reprepro

Error "Package database is not sorted!!!" by update command

Closed this issue · 5 comments

Hello,

we are just having a look at using reprepro for setting up several internal repositories for example for Icinga2. As we also would like to have older package versions in these repositories I played a bit around with reprepro.

After installation and configuration I was only able to download the latest version from (in this case) http://packages.icinga.com/debian/pool/main/i/icinga2/. I wasn't able to get the older versions for Debian Stretch too.

If I try to download them manually und put them into the repository by using the option includedeb everything seems to work correctly. I'm able to have a look at all versions with the command ls icinga2:

icinga2 | 2.8.0-1.stretch | icinga-stretch | i386, amd64
icinga2 | 2.7.2-1.stretch | icinga-stretch | i386, amd64
icinga2 | 2.7.1-2.stretch | icinga-stretch | i386, amd64
icinga2 | 2.7.1-1.stretch | icinga-stretch | i386, amd64
icinga2 | 2.7.0-1.stretch | icinga-stretch | i386, amd64
icinga2 | 2.6.3-1.stretch | icinga-stretch | i386, amd64

But If I use the command reprepro --noskipold update I just get the following error message:

Calculating packages to get...
Package database is not sorted!!!
reprepro: upgradelist.c:135: save_package_version: Assertion `false' failed.
Aborted

Is there a possibility to get this working as expected or am I only able to get the latest version from a repository and newer ones after this while using reprepro? Or do I just have to use reprepro update without option --noskipold?

That assertion error is a bug. Can you provide your configs and exact steps to reproduce?

Yes of course, no Problem. The config files:

distributions:

Origin: Icinga2
Label: Icinga2
Suite: icinga-stretch
Codename: icinga-stretch
Description: Icinga2 packages for Debian Stretch
Architectures: i386 amd64
Components: main
SignWith: yes
Update: icinga-stretch
Log: /var/log/reprepro/icinga2.log

options:

basedir /var/opt/repos
gnupghome /var/opt/repos/.gnupg
keepunreferencedfiles

updates:

Name: icinga-stretch
Method: http://packages.icinga.com/debian
Config: Acquire::Http::Proxy=http://<PROXYADDRESS>:<PROXYPORT>/
Suite: icinga-stretch
Components: main
Architectures: i386 amd64
VerifyRelease: C6E319C334410682

For the configuration I used the manual from http://chrisgilmerproj.github.io/debian/mirror/reprepro/2013/08/29/mirror-with-reprepro.html.

So I installed the package and started the first download with reprepro --noskipold -b /var/opt/repos update. After this I had a look at the repository using

reprepro -b /var/opt/repos ls icinga2

and this showed me the entry for

icinga2 | 2.8.0-1.stretch | icinga-stretch | i386, amd64

As I also wanted older package versions in this repository I downloaded them manually and added them to the repository by using reprepro -b /var/opt/repos includedeb icinga-stretch icinga2_2.7.2-1.stretch_amd64.deb for example.

If I try to have a look at the repository now using reprepro -b /var/opt/repos ls icinga2 everything looks fine:

icinga2 | 2.8.0-1.stretch | icinga-stretch | i386, amd64
icinga2 | 2.7.2-1.stretch | icinga-stretch | i386, amd64

but if I try to do a reprepro --noskipold -b /var/opt/repos update the error message

Calculating packages to get...
Package database is not sorted!!!
reprepro: upgradelist.c:135: save_package_version: Assertion `false' failed.
Aborted

occurs.

I also tried to download all packages manually and add them to the repository manually staring with the lowest version number: Same error message.

If you need any more information just let me know. It's installed on Debian Stretch (9.2) with kernel 4.9.0-4-amd64 #1 SMP Debian 4.9.51-1 (2017-09-28) x86_64 GNU/Linux.

Thanks. I can reproduce this issue, putting your steps in a script:

#!/bin/sh
set -eu

mkdir -p bug6repo/conf
cat > bug6repo/conf/distributions <<EOF
Origin: Icinga2
Label: Icinga2
Suite: icinga-stretch
Codename: icinga-stretch
Description: Icinga2 packages for Debian Stretch
Architectures: i386 amd64
Components: main
SignWith: yes
Update: icinga-stretch
Log: icinga2.log
EOF
cat > bug6repo/conf/options <<EOF
basedir repos
keepunreferencedfiles
EOF
cat > bug6repo/conf/updates <<EOF
Name: icinga-stretch
Method: http://packages.icinga.com/debian
Suite: icinga-stretch
Components: main
Architectures: i386 amd64
VerifyRelease: C6E319C334410682
EOF
./reprepro --noskipold -b bug6repo update
./reprepro -b bug6repo ls icinga2

wget http://packages.icinga.com/debian/pool/main/i/icinga2/icinga2_2.8.0-1.stretch_amd64.deb
./reprepro -b bug6repo includedeb icinga-stretch icinga2_2.8.0-1.stretch_amd64.deb
./reprepro -b bug6repo ls icinga2

./reprepro --noskipold -b bug6repo update

I created a test case for shunit2 and fixed it in the 5.2.0-multiple-versions branch. Please test and report if you encounter any new issues.

Seems to work fine now. Thank you!