generated from aboutcode-org/skeleton
-
-
Notifications
You must be signed in to change notification settings - Fork 38
Add support to mine maven Package-URLs #660 #678
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
Merged
Merged
Changes from 29 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
b12150b
Create minecode_pipeline module and move relevent code over #660
JonoYang e4fdae9
Move maven crawler code into new module #660
JonoYang 8f1f9ac
Yield packages from index, collect, and write to file #660
JonoYang 837d0d1
Push commits at regular intervals
JonoYang b92a8bd
Use new branch of scio #660
JonoYang 6b3372d
Create write_purls_to_repo #660
JonoYang 4ff859b
Merge branch 'main' into 660-purl-next-maven
JonoYang 44f4363
Merge branch 'main' into 660-purl-next-maven
JonoYang b0a3d6e
Clone repo per package #660
JonoYang d9c8b8d
Add methods to fetch maven index properties and increments #660
JonoYang ac7f6d8
Merge branch 'main' into 660-purl-next-maven
JonoYang 1bfb2d8
Move files to minecode_pipelines #660
JonoYang dda2bca
Move tests over to minecode_pipelines #660
JonoYang 74bd21c
Create purls.yml path without leading segment #660
JonoYang 810956f
Use last incremental from index properties #660
JonoYang 0d441f9
Move code to proper place #660
JonoYang e5ed41a
Merge branch 'main' into 660-purl-next-maven
JonoYang eb4a4fb
Use new common functions for writing and commiting purls #660
JonoYang 289c336
Handle downloading and deleting index archive using constructor/destr…
JonoYang 88956bf
Split repo deletion into separate pipeline step #660
JonoYang 9449ee2
Fix logic in destructor #660
JonoYang a35a351
Merge branch 'main' into 660-purl-next-maven
JonoYang 81b1243
Declare mine_maven pipeline in pyproject #660
JonoYang a225502
Remove repo clone step #660
JonoYang d126ea0
Update code style #660
JonoYang 113bce5
Revert change to scio dep version #660
JonoYang 78045ef
Remove unnecessary logger #660
JonoYang 644fbc0
Clean up all downloads in destructor #660
JonoYang 77295a3
Update docstrings #660
JonoYang bc240f2
Simplify download tracking #660
JonoYang fabe276
Update MinePypi pipeline name
JonoYang 0b36220
Update pipeline #660
JonoYang 16adc5c
Update expected test result
JonoYang ac3032a
Update package batch size #660
JonoYang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # http://nexb.com and https://github.com/aboutcode-org/scancode.io | ||
| # The ScanCode.io software is licensed under the Apache License version 2.0. | ||
| # Data generated with ScanCode.io is provided as-is without warranties. | ||
| # ScanCode is a trademark of nexB Inc. | ||
| # | ||
| # You may not use this software except in compliance with the License. | ||
| # You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0 | ||
| # Unless required by applicable law or agreed to in writing, software distributed | ||
| # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
| # CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations under the License. | ||
| # | ||
| # Data Generated with ScanCode.io is provided on an "AS IS" BASIS, WITHOUT WARRANTIES | ||
| # OR CONDITIONS OF ANY KIND, either express or implied. No content created from | ||
| # ScanCode.io should be considered or used as legal advice. Consult an Attorney | ||
| # for any legal advice. | ||
| # | ||
| # ScanCode.io is a free software code scanning tool from nexB Inc. and others. | ||
| # Visit https://github.com/aboutcode-org/scancode.io for support and download. | ||
|
|
||
|
|
||
| from minecode_pipelines import pipes | ||
| from minecode_pipelines.pipes import maven | ||
| from scanpipe.pipelines.publish_to_federatedcode import PublishToFederatedCode | ||
|
|
||
|
|
||
| class MineMaven(PublishToFederatedCode): | ||
| """ | ||
| Create DiscoveredPackages for packages found on maven: | ||
| - input: url of maven repo | ||
| - process index | ||
| - collect purls, grouped by package | ||
| - write to files | ||
| - publish to fetchcode | ||
| - loop | ||
|
|
||
| """ | ||
|
|
||
| @classmethod | ||
| def steps(cls): | ||
| return ( | ||
| cls.check_federatedcode_eligibility, | ||
| cls.collect_packages_from_maven, | ||
| cls.delete_cloned_repos, | ||
| ) | ||
|
|
||
| def collect_packages_from_maven(self): | ||
| self.repos = maven.collect_packages_from_maven(self.project, self.log) | ||
|
|
||
| def delete_cloned_repos(self): | ||
| pipes.delete_cloned_repos(repos=self.repos, logger=self.log) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # The MIT License (MIT) | ||
| # | ||
| # Copyright (c) 2014 Gustav Arngården | ||
| # | ||
| # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| # of this software and associated documentation files (the "Software"), to deal | ||
| # in the Software without restriction, including without limitation the rights | ||
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| # copies of the Software, and to permit persons to whom the Software is | ||
| # furnished to do so, subject to the following conditions: | ||
| # | ||
| # The above copyright notice and this permission notice shall be included in all | ||
| # copies or substantial portions of the Software. | ||
| # | ||
| # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| # SOFTWARE. | ||
|
|
||
|
|
||
| """Reading from Java DataInputStream format.""" | ||
|
|
||
| import struct | ||
|
|
||
|
|
||
| class DataInputStream: | ||
| def __init__(self, stream): | ||
| self.stream = stream | ||
|
|
||
| def read(self, n=1): | ||
| data = self.stream.read(n) | ||
| if len(data) != n: | ||
| # this is a problem but in most cases we have reached EOF | ||
| raise EOFError | ||
| return data | ||
|
|
||
| def read_byte(self): | ||
| return struct.unpack("b", self.read(1))[0] | ||
|
|
||
| def read_long(self): | ||
| return struct.unpack(">q", self.read(8))[0] | ||
|
|
||
| def read_utf(self): | ||
| utf_length = struct.unpack(">H", self.read(2))[0] | ||
| return self.read(utf_length) | ||
|
|
||
| def read_int(self): | ||
| return struct.unpack(">i", self.read(4))[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| about_resource: java_stream.py | ||
| name: java_stream.py | ||
| version: 7d118ceef9746981e6bc198861125ca2bb6f920f | ||
| homepage_url: https://github.com/arngarden/python_java_datastream | ||
| owner: Gustav Arngården | ||
| copyright: Copyright (c) 2014 Gustav Arngården | ||
| download_url: https://raw.githubusercontent.com/arngarden/python_java_datastream/7d118ceef9746981e6bc198861125ca2bb6f920f/data_input_stream.py | ||
| license_text_file: license_expfession: mit | ||
| licenses: | ||
| - key: mit | ||
| file: java_stream.py.LICENSE | ||
|
|
||
| vcs_tool: git | ||
| vcs_repo: https://github.com/arngarden/python_java_datastream |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| The MIT License (MIT) | ||
|
|
||
| Copyright (c) 2014 Gustav Arngården | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.