Skip to content

Commit

Permalink
TEST: Add repo type
Browse files Browse the repository at this point in the history
  • Loading branch information
makubacki committed Feb 2, 2023
1 parent 1fdfaa0 commit d98b2d9
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,18 @@ def FromConfigfile(self, filepath):
with open(self.Config, "r") as c:
self.ConfigData = yaml.safe_load(c)

def SetBasicData(self, authors, license, project, description, server,
copyright, repositoryUrl=None, repositoryBranch=None,
repositoryCommit=None):
def SetBasicData(self, authors, license, project, description, server, copyright,
repositoryType=None, repositoryUrl=None, repositoryBranch=None,
repositoryCommit=None):
"""Set basic data in the config data."""
self.ConfigData["author_string"] = authors
if license:
self.ConfigData["license"] = license
self.ConfigData["project_url"] = project
self.ConfigData["description_string"] = description
self.ConfigData["server_url"] = server
if repositoryType:
self.ConfigData["repository_type"] = repositoryType
if repositoryUrl:
self.ConfigData["repository_url"] = repositoryUrl
if repositoryBranch:
Expand Down Expand Up @@ -174,8 +176,11 @@ def UpdateTags(self, tags=[]):
self.ConfigData["tags_string"] = " ".join(tags)
self.ConfigChanged = True

def UpdateRepositoryInfo(self, url=None, branch=None, commit=None):
def UpdateRepositoryInfo(self, type=None, url=None, branch=None, commit=None):
"""Update repository information."""
if type:
self.ConfigData["repository_type"] = type
self.ConfigChanged = True
if url:
self.ConfigData["repository_url"] = url
self.ConfigChanged = True
Expand Down Expand Up @@ -237,9 +242,11 @@ def _MakeNuspecXml(self, ContentDir, ReleaseNotesText=None):
meta.find("version").text = self.NewVersion
meta.find("authors").text = self.ConfigData["author_string"]
meta.find("projectUrl").text = self.ConfigData["project_url"]
if "repository" in self.ConfigData:
repository_item_present = bool([k for k in self.ConfigData.keys() if "repository_" in k.lower()])
if repository_item_present:
r = meta.find("repository")
r.set("type", "git")
if "repository_type" in self.ConfigData:
r.set("type", self.ConfigData["repository_type"])
if "repository_url" in self.ConfigData:
r.set("url", self.ConfigData["repository_url"])
if "repository_branch" in self.ConfigData:
Expand Down Expand Up @@ -332,7 +339,7 @@ def Pack(self, version, OutputDirectory, ContentDir, RelNotesText=None):
ret = RunCmd(cmd[0], " ".join(cmd[1:]))

if (ret != 0):
logging.error("Failed on nuget commend. RC = 0x%x" % ret)
logging.error("Failed on nuget command. RC = 0x%x" % ret)
return ret

self.NuPackageFile = os.path.join(OutputDirectory, self._GetNuPkgFileName(self.NewVersion))
Expand Down Expand Up @@ -368,7 +375,7 @@ def Push(self, nuPackage, apikey):
logging.critical("API key is invalid. Please use --ApiKey to provide a valid key.")

# Generic error.
logging.error("Failed on nuget commend. RC = 0x%x" % ret)
logging.error("Failed on nuget command. RC = 0x%x" % ret)

return ret

Expand Down Expand Up @@ -397,6 +404,7 @@ def GatherArguments():
required=True)
parser.add_argument('--Author', dest="Author", help="<Required> Author string for publishing", required=True)
parser.add_argument("--ProjectUrl", dest="Project", help="<Required> Project Url", required=True)
parser.add_argument("--RepositoryType", dest="RepositoryType", help="<Optional> Repository Type", required=False)
parser.add_argument("--RepositoryUrl", dest="RepositoryUrl", help="<Optional> Repository Url", required=False)
parser.add_argument("--RepositoryBranch", dest="RepositoryBranch", help="<Optional> Repository Branch", required=False)
parser.add_argument("--RepositoryCommit", dest="RepositoryCommit", help="<Optional> Repository Commit", required=False)
Expand Down Expand Up @@ -427,6 +435,7 @@ def GatherArguments():
parser.add_argument('--CustomLicensePath', dest="CustomLicensePath", default=None,
help="<Optional> If CustomLicense set in `new` phase, provide absolute path of License \
File to pack. Does not override existing valid license.")
parser.add_argument("--RepositoryType", dest="RepositoryType", help="<Optional> Repository Type", required=False)
parser.add_argument("--RepositoryUrl", dest="RepositoryUrl", help="<Optional> Change the repository Url", required=False)
parser.add_argument("--RepositoryBranch", dest="RepositoryBranch", help="<Optional> Change the repository branch", required=False)
parser.add_argument("--RepositoryCommit", dest="RepositoryCommit", help="<Optional> Change the repository commit", required=False)
Expand Down Expand Up @@ -499,6 +508,7 @@ def main():
args.Description,
args.FeedUrl,
args.Copyright,
args.RepositoryType,
args.RepositoryUrl,
args.RepositoryBranch,
args.RepositoryCommit)
Expand Down Expand Up @@ -545,7 +555,8 @@ def main():
if (args.Copyright is not None):
nu.UpdateCopyright(args.Copyright)

nu.UpdateRepositoryInfo(args.RepositoryUrl, args.RepositoryBranch, args.RepositoryCommit)
nu.UpdateRepositoryInfo(args.RepositoryType, args.RepositoryUrl,
args.RepositoryBranch, args.RepositoryCommit)

if (len(args.Tags) > 0):
tagListSet = set()
Expand Down
1 change: 1 addition & 0 deletions Platforms/QemuQ35Pkg/NugetPublishing/DebugConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ copyright_string: Copyright (c) Microsoft Corporation.
description_string: QEMU Q35 DEBUG Platform Firmware
name: TEST.Mu.QemuQ35.FW.DEBUG
project_url: https://microsoft.github.io/mu/
repository_type: git
repository_url: https://github.com/makubacki/mu_tiano_platforms
server_url: https://nuget.pkg.github.com/makubacki/index.json
tags_string: ''
1 change: 1 addition & 0 deletions Platforms/QemuQ35Pkg/NugetPublishing/ReleaseConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ copyright_string: Copyright (c) Microsoft Corporation.
description_string: QEMU Q35 RELEASE Platform Firmware
name: TEST.Mu.QemuQ35.FW.RELEASE
project_url: https://microsoft.github.io/mu/
repository_type: git
repository_url: https://github.com/makubacki/mu_tiano_platforms
server_url: https://nuget.pkg.github.com/makubacki/index.json
tags_string: ''
1 change: 1 addition & 0 deletions Platforms/QemuSbsaPkg/NugetPublishing/DebugConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ copyright_string: Copyright (c) Microsoft Corporation.
description_string: QEMU Q35 SBSA DEBUG Platform Firmware
name: TEST.Mu.QemuQ35SBSA.FW.DEBUG
project_url: https://microsoft.github.io/mu/
repository_type: git
repository_url: https://github.com/makubacki/mu_tiano_platforms
server_url: https://nuget.pkg.github.com/makubacki/index.json
tags_string: ''
1 change: 1 addition & 0 deletions Platforms/QemuSbsaPkg/NugetPublishing/ReleaseConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ copyright_string: Copyright (c) Microsoft Corporation.
description_string: QEMU Q35 SBSA RELEASE Platform Firmware
name: TEST.Mu.QemuQ35SBSA.FW.RELEASE
project_url: https://microsoft.github.io/mu/
repository_type: git
repository_url: https://github.com/makubacki/mu_tiano_platforms
server_url: https://nuget.pkg.github.com/makubacki/index.json
tags_string: ''

0 comments on commit d98b2d9

Please sign in to comment.