Skip to content

Commit

Permalink
feat(manager/conan): Conan 1 package name compatibility (#32425)
Browse files Browse the repository at this point in the history
Co-authored-by: Rhys Arkins <[email protected]>
  • Loading branch information
caseyduquettesc and rarkins authored Nov 16, 2024
1 parent a413b75 commit dbfa6b2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/modules/datasource/conan/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const defaultRegistryUrl = 'https://center.conan.io/';
export const datasource = 'conan';

export const conanDatasourceRegex = regEx(
/(?<name>[a-z\-_0-9]+)\/(?<version>[^@/\n]+)(?<userChannel>@\S+\/\S+)/gim,
/(?<name>[a-zA-Z\-_0-9]+)\/(?<version>[^@/\n]+)(?<userChannel>@\S+\/\S+)/gim,
);

export function getConanPackage(packageName: string): ConanPackage {
Expand Down
1 change: 1 addition & 0 deletions lib/modules/manager/conan/__fixtures__/conanfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ zlib/[~1.2.3, loose=False]
fake/8.62.134@test/dev
cairo/1.17.2#aff2d03608351db075ec1348a3afc9ff
cairo/1.17.2@_/_#aff2d03608351db075ec1348a3afc9ff
Fake/8.62.134@

[build_requires]
7zip/[>1.1 <2.1, include_prerelease=True]
Expand Down
7 changes: 7 additions & 0 deletions lib/modules/manager/conan/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ describe('modules/manager/conan/extract', () => {
packageName: 'cairo/1.17.2@_/_',
replaceString: 'cairo/1.17.2@_/_#aff2d03608351db075ec1348a3afc9ff',
},
{
currentValue: '8.62.134',
depName: 'Fake',
depType: 'requires',
packageName: 'Fake/8.62.134@_/_',
replaceString: 'Fake/8.62.134',
},
{
currentValue: '[>1.1 <2.1, include_prerelease=True]',
depName: '7zip',
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/conan/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { PackageDependency, PackageFileContent } from '../types';
import { isComment } from './common';

const regex = regEx(
`(?<name>[-_a-z0-9]+)/(?<version>[^@#\n{*"']+)(?<userChannel>@[-_a-zA-Z0-9]+(?:/[^#\n.{*"' ]+|))?#?(?<revision>[-_a-f0-9]+[^\n{*"'])?`,
`(?<name>[-_a-zA-Z0-9]+)/(?<version>[^@#\n{*"']+)(?<userChannel>@[-_a-zA-Z0-9]+(?:/[^#\n.{*"' ]+|))?#?(?<revision>[-_a-f0-9]+[^\n{*"'])?`,
);

function setDepType(content: string, originalType: string): string {
Expand Down

0 comments on commit dbfa6b2

Please sign in to comment.