Skip to content

Commit

Permalink
fix: apt
Browse files Browse the repository at this point in the history
  • Loading branch information
zdm committed Mar 28, 2024
1 parent cccbb88 commit 8934ea0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/apt.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ export default class {
const packages = {};

for ( const file of files ) {
const match = path.basename( file ).match( /^(.+)_([\d.]+)-(\d+)_(.+)\.deb$/ );
const match = path.basename( file ).match( /^(.+)_(?:(\d+):)?([\d.]+)(?:-(\d+))?_(.+)\.deb$/ );

if ( !match ) continue;

Expand All @@ -384,9 +384,10 @@ export default class {
file,
id,
name,
"version": match[ 2 ],
"revision": +match[ 3 ],
"arch": match[ 4 ],
"epoch": match[ 2 ] ? +match[ 2 ] : 0,
"version": match[ 3 ],
"revision": match[ 4 ] ? +match[ 4 ] : 0,
"arch": match[ 5 ],
} );
}

Expand All @@ -395,7 +396,7 @@ export default class {

// sort dists
dists = dists.sort( ( a, b ) => {
return a.revision - b.revision || new Semver( a.version ).compare( b.version );
return a.epoch - b.epoch || new Semver( a.version ).compare( b.version ) || a.revision - b.revision;
} );

// keep latest dist
Expand Down

0 comments on commit 8934ea0

Please sign in to comment.