pkgbase: fix decision logic to keep the old packages
when running update-package, we try to keep as much as possible the old
packages to avoid wasting users bandwidth. the previous code was failing
at catching properly the "snap" extension and we lost incremental build.
With this new code we only stop checking we we have an old package with
the same checksum if we transition from:
- alpha to beta
- beta to rc
- rc to release
but we keep old packages when we transition from release to p1 or when
we stay on a given snapshot
PR: 281393
Reported by: Evgenii Khramtsov <throwaway_vthgwq4@protonmail.com>