Skip to content

Add purl2url support for rust - #17

Closed
TG1999 wants to merge 1 commit into
aboutcode-org:masterfrom
TG1999:purl-url-rust
Closed

Add purl2url support for rust#17
TG1999 wants to merge 1 commit into
aboutcode-org:masterfrom
TG1999:purl-url-rust

Conversation

@TG1999

@TG1999 TG1999 commented Mar 18, 2020

Copy link
Copy Markdown
Collaborator

Solves issue #13
Signed-off-by: TG1999 tushar.goel.dav@gmail.com

@steven-esser steven-esser left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a few more tests here, especially cases where the rust url contains special characters or is Null?

@TG1999

TG1999 commented Mar 23, 2020

Copy link
Copy Markdown
Collaborator Author

Got this @MaJuRG

@TG1999

TG1999 commented Mar 24, 2020

Copy link
Copy Markdown
Collaborator Author

Done @MaJuRG

Comment thread purl2url/rust.py Outdated
scheme = url_parts.scheme
if not(scheme == 'pkg'):
raise Exception('Not a valid PURL')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this empty space.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got this

Comment thread purl2url/rust.py Outdated
"""
url_parts = urlparse(purl)
scheme = url_parts.scheme
if not(scheme == 'pkg'):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change this to if scheme != 'pkg':

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got this

@TG1999

TG1999 commented Mar 24, 2020

Copy link
Copy Markdown
Collaborator Author

Done @MaJuRG

@TG1999
TG1999 requested a review from steven-esser March 27, 2020 15:32
Comment thread purl2url/rust.py Outdated
url_parts = urlparse(purl)
scheme = url_parts.scheme
if scheme != 'pkg':
raise Exception('Not a valid PURL')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a bit more detail here. We want to know why the given thing is not a valid pURL. What was missing from the string? The user would want to know this.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, cool got this one

Comment thread purl2url/rust.py Outdated

part_paths = part_paths[0].split('/')
if 'crates' != part_paths[0]:
raise Exception('Not a valid crate PURL')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing as above. Why is the given pURL not a valid crate pURL?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got this one too

@TG1999

TG1999 commented Mar 30, 2020

Copy link
Copy Markdown
Collaborator Author

Done @MaJuRG , BTW I think we should wait for package-url/packageurl-python#24 to get merged first, because we don't know which type it should be 'crates' or 'cargo', what say?

@TG1999

TG1999 commented Apr 6, 2020

Copy link
Copy Markdown
Collaborator Author

@MaJuRG good to go ?

Comment thread purl2url/rust.py Outdated
if scheme != 'pkg':
raise Exception('Not a valid PURL, `scheme` of URL should be `pkg` to be it a PURL for more info refer https://github.com/package-url/purl-spec/blob/master/README.rst')

else :

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need this else here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay got this one 👌

Signed-off-by: TG1999 <tushar.goel.dav@gmail.com>
@TG1999

TG1999 commented Apr 14, 2020

Copy link
Copy Markdown
Collaborator Author

Done @MaJuRG

@steven-esser steven-esser left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pombredanne Anything to add here?

@steven-esser
steven-esser requested a review from pombredanne May 4, 2020 23:07
@TG1999 TG1999 closed this Jul 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants