kpcyrd / rebuilderd

Independent verification of binary packages - reproducible builds
GNU General Public License v3.0
355 stars 24 forks source link

Update unique constraint on packages table to allow multiple versions of the same package #97

Closed kpcyrd closed 2 years ago

kpcyrd commented 2 years ago

This allows multiple packages with the same name+version in the same distro+suite+architecture bucket and this command is working then:

REBUILDERD_COOKIE_PATH=secret/auth cargo run --bin rebuildctl -- pkgs sync-profile --sync-config contrib/confs/rebuilderd-sync.conf debian-main

But running a second import immediately after fails with this error:

rebuilderd-daemon-1  | [2021-11-25T01:00:58Z DEBUG rebuilderd::sync] pkgbase is already present: "\"zycore-c\"-\"1.1.0-3\""
rebuilderd-daemon-1  | [2021-11-25T01:00:58Z DEBUG rebuilderd::sync] pkgbase is already present: "\"zydis\"-\"3.2.1-3\""
rebuilderd-daemon-1  | [2021-11-25T01:00:58Z DEBUG rebuilderd::sync] pkgbase is already present: "\"zyn\"-\"1+git.20100609+dfsg0-4\""
rebuilderd-daemon-1  | [2021-11-25T01:00:58Z DEBUG rebuilderd::sync] pkgbase is already present: "\"zynaddsubfx\"-\"3.0.5-2\""
rebuilderd-daemon-1  | [2021-11-25T01:00:58Z DEBUG rebuilderd::sync] pkgbase is not yet present: "\"zynaddsubfx\"-\"3.0.5-2\""
rebuilderd-daemon-1  | [2021-11-25T01:00:58Z DEBUG rebuilderd::sync] pkgbase is already present: "\"zypper\"-\"1.14.42-2\""
rebuilderd-daemon-1  | [2021-11-25T01:00:58Z DEBUG rebuilderd::sync] pkgbase is not yet present: "\"zypper\"-\"1.14.42-2\""
rebuilderd-daemon-1  | [2021-11-25T01:00:58Z DEBUG rebuilderd::sync] pkgbase is already present: "\"zytrax\"-\"0+git20201215-1\""
rebuilderd-daemon-1  | [2021-11-25T01:00:58Z DEBUG rebuilderd::sync] pkgbase is already present: "\"zziplib\"-\"0.13.72+dfsg.1-1.1\""
rebuilderd-daemon-1  | [2021-11-25T01:00:58Z DEBUG rebuilderd::sync] pkgbase is already present: "\"zzuf\"-\"0.15-1\""
rebuilderd-daemon-1  | [2021-11-25T01:00:58Z DEBUG rebuilderd::sync] pkgbase is already present: "\"zzz-to-char\"-\"0.1.3-3\""
rebuilderd-daemon-1  | [2021-11-25T01:00:58Z DEBUG rebuilderd::sync] pkgbase is already present: "\"zzzeeksphinx\"-\"1.2.5-1\""
rebuilderd-daemon-1  | [2021-11-25T01:00:58Z INFO  rebuilderd::sync] found groups already in database: len=32977
rebuilderd-daemon-1  | [2021-11-25T01:00:58Z INFO  rebuilderd::sync] found groups that need to be added to database: len=4373
rebuilderd-daemon-1  | [2021-11-25T01:00:58Z INFO  rebuilderd::sync] found groups no longer present: len=0
rebuilderd-daemon-1  | [2021-11-25T01:00:58Z INFO  rebuilderd::sync] inserting new groups in batch: 1000/4373
rebuilderd-daemon-1  | [2021-11-25T01:00:58Z ERROR actix_http::response] Internal Server Error: Error { err: UNIQUE constraint failed: pkgbases.name, pkgbases.version, pkgbases.distro, pkgbases.suite, pkgbases.architecture }
rebuilderd-daemon-1  | [2021-11-25T01:00:58Z INFO  actix_web::middleware::logger] 172.21.0.1:50310 "POST /api/v0/pkgs/sync HTTP/1.1" 500 113 "-" "-" 2.368164

Instead the second run shouldn't detect any changes in groups (but it's reporting 4373 new groups).