Snapshots diff sometimes returns null side with older package
I have two snapshots, older one (_tcp-1440157930) and newer (_tcp-1440161185). Only difference between them is that newer snapshot contains package python-aptly 0.5.2
When I compare these snapshots, I always get null on the side of older snapshot:
$ curl http://localhost:8080/api/snapshots/_tcp-1440157930/diff/_tcp-1440161185
[{"Left":null,"Right":"Pall python-aptly 0.5.2 c0f4a0c3fc9e22c5"}]
$ curl http://localhost:8080/api/snapshots/_tcp-1440161185/diff/_tcp-1440157930
[{"Left":"Pall python-aptly 0.5.2 c0f4a0c3fc9e22c5","Right":null}]
So it seems that version comparison like 0.5.2 > 0.5 doesn't work.
Expected output would be:
[{"Left":"Pall python-aptly 0.5 f0dfd70e4a936c2f","Right":"Pall python-aptly 0.5.2 c0f4a0c3fc9e22c5"}]
This is how newer snapshot looks like:
$ curl -sss http://localhost:8080/api/snapshots/_tcp-1440161185/packages|json_pp|grep python-aptly|sort
"Pall python-aptly 0.2.2 cbd9cf268ece7eb2",
"Pall python-aptly 0.3.1 8142186f92d78d20",
"Pall python-aptly 0.4.1 950bac934669ffac",
"Pall python-aptly 0.4.2 984dd9ec9b30e4bf",
"Pall python-aptly 0.4.3 dc6e6adee37a0486",
"Pall python-aptly 0.4.4 d943dbd2a4bf39c9",
"Pall python-aptly 0.4.6 98288a131f1b253b",
"Pall python-aptly 0.4 864efe6993977f7f",
"Pall python-aptly 0.5.2 c0f4a0c3fc9e22c5",
"Pall python-aptly 0.5 f0dfd70e4a936c2f",
And the older one:
$ curl -sss http://localhost:8080/api/snapshots/_tcp-1440157930/packages|json_pp|grep python-aptly|sort
"Pall python-aptly 0.2.2 cbd9cf268ece7eb2",
"Pall python-aptly 0.3.1 8142186f92d78d20",
"Pall python-aptly 0.4.1 950bac934669ffac",
"Pall python-aptly 0.4.2 984dd9ec9b30e4bf",
"Pall python-aptly 0.4.3 dc6e6adee37a0486",
"Pall python-aptly 0.4.4 d943dbd2a4bf39c9",
"Pall python-aptly 0.4.6 98288a131f1b253b",
"Pall python-aptly 0.4 864efe6993977f7f",
"Pall python-aptly 0.5 f0dfd70e4a936c2f",
It also happens on complex versions like:
contrail-config (None -> 2.20+0~1440164666.77~1.44a14c7)
Unfortunately there's nothing in output of aptly api serve
I have noticed this happens when there's multiple versions of the same package in one of the snapshots, for example:
Original snapshot (newer, eg. nightly):
$ curl -q http://172.17.0.3:8080/api/snapshots/_main-1440161318/packages|json_pp|grep aptly
"Pall python-aptly 0.5 7840ce67841eeb47",
Package python-aptly-0.5 is then used to create another snapshot merged with one containing older version. Resulting in snapshot with multiple versions of python-aptly package:
$ curl -q http://172.17.0.3:8080/api/snapshots/_main-1444924682/packages|json_pp|grep aptly
"Pall python-aptly 0.5 7840ce67841eeb47",
"Pall python-aptly 0.4.6 8065acbf04255a3",
The result of compare is:
[{"Left":null,"Right":"Pall python-aptly 0.4.6 8065acbf04255a3"}]
Which is completely wrong, expected result would be same for both snapshots:
[{"Left":"Pall python-aptly 0.5 7840ce67841eeb47","Right":"Pall python-aptly 0.5 7840ce67841eeb47"}]
OT: I should probably implement deduplication mechanism for python-aptly publisher to avoid having old packages in repositories forever
@fpytloun I was re-reading your bug report... But I don't get what is wrong with aptly.
In your example, snapshot 1:
"Pall python-aptly 0.2.2 cbd9cf268ece7eb2",
"Pall python-aptly 0.3.1 8142186f92d78d20",
"Pall python-aptly 0.4.1 950bac934669ffac",
"Pall python-aptly 0.4.2 984dd9ec9b30e4bf",
"Pall python-aptly 0.4.3 dc6e6adee37a0486",
"Pall python-aptly 0.4.4 d943dbd2a4bf39c9",
"Pall python-aptly 0.4.6 98288a131f1b253b",
"Pall python-aptly 0.4 864efe6993977f7f",
"Pall python-aptly 0.5.2 c0f4a0c3fc9e22c5",
"Pall python-aptly 0.5 f0dfd70e4a936c2f",
snapshot 2:
"Pall python-aptly 0.2.2 cbd9cf268ece7eb2",
"Pall python-aptly 0.3.1 8142186f92d78d20",
"Pall python-aptly 0.4.1 950bac934669ffac",
"Pall python-aptly 0.4.2 984dd9ec9b30e4bf",
"Pall python-aptly 0.4.3 dc6e6adee37a0486",
"Pall python-aptly 0.4.4 d943dbd2a4bf39c9",
"Pall python-aptly 0.4.6 98288a131f1b253b",
"Pall python-aptly 0.4 864efe6993977f7f",
"Pall python-aptly 0.5 f0dfd70e4a936c2f",
If you run simple diff on command line you would get as expected:
8a9
> "Pall python-aptly 0.5.2 c0f4a0c3fc9e22c5",
Which is exactly what aptly is returning:
[{"Left":null,"Right":"Pall python-aptly 0.5.2 c0f4a0c3fc9e22c5"}]