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

Add new functionality: Upload repository from VCS to fossology server. #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
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
35 changes: 35 additions & 0 deletions fossdriver/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,41 @@ def UploadFile(self, filePath, folderNum):
results = self._postFile(endpoint, values)
return fossdriver.parser.parseAnchorTagsForNewUploadNumber(results.content)

def UploadFromVCS(self, urlOfRepo, vcsKind, repoUserName, repoPassword, folderNum):
"""
Initiate an upload of a repository from Git or SVN to the fossology server.
No scanning agents will be triggered.
Arguments:
- urlOfRepo: url address of remote repository (starting with http://).
- vcsKind: Git or SVN.
-repoUserName: username for given repo.
-repoPassword: password for given repo.
-folderNum: ID number of folder to receive upload.
"""
endpoint = "/repo/?mod=upload_vcs"
buildtoken = self._getUploadFormBuildToken()

values = (
("uploadformbuild", buildtoken),
("vcstype", vcsKind),
("geturl", urlOfRepo),
("username", repoUserName),
("passwd", repoPassword),
("folder", str(folderNum)),
("public", "private"),
("Check_agent_bucket", "0"),
("Check_agent_copyright", "0"),
("Check_agent_ecc", "0"),
("Check_agent_mimetype", "0"),
("Check_agent_nomos", "0"),
("Check_agent_monk", "0"),
("Check_agent_pkgagent", "0"),
("deciderRules[]", ""),
)

results = self._post(endpoint, values)
return fossdriver.parser.parseAnchorTagsForNewUploadNumber(results.content)

def GetLicenses(self, uploadNum, itemNum):
"""
Obtain a dict of all licenses available in the Fossology server.
Expand Down