Commit 91950bfc authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

Merge branch 'bf/clear-channels-bug' into 'master'

Bf/clear channels bug

See merge request fsl/conda/fsl-ci-rules!99
parents 157ab366 f27c3b3d
......@@ -20,7 +20,7 @@ import subprocess as sp
import yaml
__version__ = '0.18.3'
__version__ = '0.18.4'
"""Current version of the fsl-ci-rules."""
......
......@@ -72,7 +72,9 @@ def clear_packages(channeldir, clear, patterns, dry_run):
packages = load_packages(chandata, platdata)
def sortkey(pkg):
return (pkgver.parse(pkg[1]['version']), int(pkg[1]['build']))
version = pkg[1]['version']
build = pkg[1]['build'].split('_')[-1]
return (pkgver.parse(version), int(build))
def match(filename):
if patterns is None:
......
......@@ -267,3 +267,42 @@ def test_clear_all_multiple_patterns():
elif channel == 'public': exppkgs = intpkgs + exppubpkgs
elif channel == 'internal': exppkgs = pubpkgs + expintpkgs
check_pkgs(exppkgs)
def test_clear_old_buildstr():
pkgs = ['linux-64/a-1.0-0',
'linux-64/a-1.0-1',
'linux-64/a-1.0-2',
'linux-64/b-1.0-habc_0',
'linux-64/b-1.0-habc_1',
'linux-64/b-1.0-habc_2',
'osx-64/a-1.0-0',
'osx-64/a-1.0-1',
'osx-64/a-1.0-2',
'osx-64/b-1.0-habc_0',
'osx-64/b-1.0-habc_1',
'osx-64/b-1.0-habc_2',
'noarch/c-1.0-0',
'noarch/c-1.0-1',
'noarch/c-1.0-2',
'noarch/d-1.0-habc_0',
'noarch/d-1.0-habc_1',
'noarch/d-1.0-habc_2']
exppkgs = [p for p in pkgs if p.endswith('2')]
pubpkgs = [op.join('public', f'{p}.tar.bz2') for p in pkgs]
intpkgs = [op.join('internal', f'{p}.tar.bz2') for p in pkgs]
exppubpkgs = [op.join('public', f'{p}.tar.bz2') for p in exppkgs]
expintpkgs = [op.join('internal', f'{p}.tar.bz2') for p in exppkgs]
for dry_run, channel in it.product([True, False], ['public', 'internal']):
with genenv('old', dry_run, channel):
create_mock_conda_channel('public', pkgs)
create_mock_conda_channel('internal', pkgs)
clear_channel.main()
if dry_run: exppkgs = intpkgs + pubpkgs
elif channel == 'public': exppkgs = intpkgs + exppubpkgs
elif channel == 'internal': exppkgs = pubpkgs + expintpkgs
check_pkgs(exppkgs)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment