Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(conan): correct regex for packages without @user/channel but with revisions #26702

Merged
merged 3 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lib/modules/manager/conan/__fixtures__/conanfile.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
[requires]
poco/1.9.4
zlib/[~1.2.3, loose=False]
zlib/[~1.2.3, loose=False]
fake/8.62.134@test/dev
cairo/1.17.2#aff2d03608351db075ec1348a3afc9ff
cairo/1.17.2@_/_#aff2d03608351db075ec1348a3afc9ff

[build_requires]
7zip/[>1.1 <2.1, include_prerelease=True]
curl/[~1.2.3, loose=False, include_prerelease=True]@test/dev
boost/[>1.1 <2.1]
catch2/[2.8]
catch2/[2.8]
openssl/[~=3.0]@test/prod
cmake/[>1.1 || 0.8]
cmake/[>1.1 || 0.8]
cryptopp/[1.2.7 || >=1.2.9 <2.0.0]@test/local
#commentedout/1.2
# commentedout/3.4
Expand All @@ -29,4 +30,4 @@ openssl:shared=True

[imports]
bin, *.dll -> ./bin # Copies all dll files from packages bin folder to my local "bin" folder
lib, *.dylib* -> ./bin # Copies all dylib files from packages lib folder to my local "bin" folder
lib, *.dylib* -> ./bin # Copies all dylib files from packages lib folder to my local "bin" folder
10 changes: 10 additions & 0 deletions lib/modules/manager/conan/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ describe('modules/manager/conan/extract', () => {
packageName: 'fake/8.62.134@test/dev',
replaceString: 'fake/8.62.134@test/dev',
},
{
autoReplaceStringTemplate:
'{{depName}}/{{newValue}}@_/_{{#if newDigest}}#{{newDigest}}{{/if}}',
currentDigest: 'aff2d03608351db075ec1348a3afc9ff',
currentValue: '1.17.2',
depName: 'cairo',
depType: 'requires',
packageName: 'cairo/1.17.2@_/_',
replaceString: 'cairo/1.17.2#aff2d03608351db075ec1348a3afc9ff',
},
{
autoReplaceStringTemplate:
'{{depName}}/{{newValue}}@_/_{{#if newDigest}}#{{newDigest}}{{/if}}',
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-z0-9]+)/(?<version>[^@#\n{*"']+)(?<userChannel>@[-_a-zA-Z0-9]+(?:/[^#\n.{*"' ]+|))?#?(?<revision>[-_a-f0-9]+[^\n{*"'])?`,
);

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