From 65e544b1299dc49ceb2dac8a418e65a58a7c1429 Mon Sep 17 00:00:00 2001 From: Sean Brogan Date: Mon, 8 Oct 2018 20:23:29 -0700 Subject: [PATCH] Add support NuGet.org and ApiKey authentication (#2) Update details for Public packages --- BaseTools/Bin/basetools_ext_dep.json | 2 +- BaseTools/Bin/nasm_ext_dep.json | 2 +- UefiBuild/CoreBuild/iasl_ext_dep.json | 6 +-- .../Mu-Basetools-Win32.config.json | 9 ++++ .../NugetPublishing/Mu-Basetools-Win32.md | 47 +++++++++++++++++++ UefiBuild/NugetPublishing/Mu-Nasm.config.json | 9 ++++ UefiBuild/NugetPublishing/Mu-Nasm.md | 35 ++++++++++++++ UefiBuild/NugetPublishing/NugetPublishing.py | 8 ++-- UefiBuild/NugetPublishing/ReadMe.md | 17 +++++-- UefiBuild/NugetPublishing/iasl.md | 38 +++++++++++++++ 10 files changed, 162 insertions(+), 11 deletions(-) create mode 100644 UefiBuild/NugetPublishing/Mu-Basetools-Win32.config.json create mode 100644 UefiBuild/NugetPublishing/Mu-Basetools-Win32.md create mode 100644 UefiBuild/NugetPublishing/Mu-Nasm.config.json create mode 100644 UefiBuild/NugetPublishing/Mu-Nasm.md create mode 100644 UefiBuild/NugetPublishing/iasl.md diff --git a/BaseTools/Bin/basetools_ext_dep.json b/BaseTools/Bin/basetools_ext_dep.json index 7871614d0b..0fd29eedec 100644 --- a/BaseTools/Bin/basetools_ext_dep.json +++ b/BaseTools/Bin/basetools_ext_dep.json @@ -2,7 +2,7 @@ "scope": "global-win", "type": "nuget", "name": "Basetools-Win32", - "source": "https://pkgs.dev.azure.com/projectmu/_packaging/mu_packages/nuget/v3/index.json", + "source": "https://api.nuget.org/v3/index.json", "version": "0.27306.1", "flags": ["set_shell_var", "set_path"], "var_name": "EDK_TOOLS_PATH" diff --git a/BaseTools/Bin/nasm_ext_dep.json b/BaseTools/Bin/nasm_ext_dep.json index 76908d537a..609efc9a16 100644 --- a/BaseTools/Bin/nasm_ext_dep.json +++ b/BaseTools/Bin/nasm_ext_dep.json @@ -2,7 +2,7 @@ "scope": "global-win", "type": "nuget", "name": "nasm", - "source": "https://pkgs.dev.azure.com/projectmu/_packaging/mu_packages/nuget/v3/index.json", + "source": "https://api.nuget.org/v3/index.json", "version": "2.13.03", "flags": ["set_shell_var"], "var_name": "NASM_PREFIX" diff --git a/UefiBuild/CoreBuild/iasl_ext_dep.json b/UefiBuild/CoreBuild/iasl_ext_dep.json index a62abc4a9c..035d48f7f0 100644 --- a/UefiBuild/CoreBuild/iasl_ext_dep.json +++ b/UefiBuild/CoreBuild/iasl_ext_dep.json @@ -1,8 +1,8 @@ { - "scope": "corebuild", + "scope": "global-win", "type": "nuget", "name": "iasl", - "source": "https://windowspartners.pkgs.visualstudio.com/_packaging/iasl/nuget/v3/index.json", - "version": "20180209", + "source": "https://api.nuget.org/v3/index.json", + "version": "20181003.0.0", "flags": ["set_path"] } \ No newline at end of file diff --git a/UefiBuild/NugetPublishing/Mu-Basetools-Win32.config.json b/UefiBuild/NugetPublishing/Mu-Basetools-Win32.config.json new file mode 100644 index 0000000000..1ffb3e8dd7 --- /dev/null +++ b/UefiBuild/NugetPublishing/Mu-Basetools-Win32.config.json @@ -0,0 +1,9 @@ +{ + "name": "Mu-Basetools-Win32", + "author_string": "ProjectMu, TianoCore", + "server_url": "https://api.nuget.org/v3/index.json", + "project_url": "https://aka.ms/projectmu", + "license_url": "https://github.com/tianocore/edk2/blob/master/License.txt", + "description_string": "Edk2 Basetools compiled for Windows packaged for Project Mu", + "copyright_string": "Copyright 2018" +} \ No newline at end of file diff --git a/UefiBuild/NugetPublishing/Mu-Basetools-Win32.md b/UefiBuild/NugetPublishing/Mu-Basetools-Win32.md new file mode 100644 index 0000000000..e2700adf15 --- /dev/null +++ b/UefiBuild/NugetPublishing/Mu-Basetools-Win32.md @@ -0,0 +1,47 @@ +# Mu BaseTools Win32 Notes + +This is a set of compiled tools for Edk2 development on Windows. This set has both the standard Edk2 tools as well as additional tools created for Project Mu. + +## Where + +Information about the TianoCore Edk2 Basetools can be found here: +* https://tianocore.org +* https://github.com/tianocore/edk2 +* https://github.com/tianocore/edk2-BaseTools-win32 + +Information about Project Mu can be found here: +* https://microsoft.github.io/mu/ +* https://github.com/Microsoft/mu +* https://github.com/microsoft/mu_basecore + +## What + +TianoCore/Project Mu Edk2 Build tools + +## Version + +====== TODO ====== + + + +Nuget version is AA.BB.CC + +* If the version is a single number then make it the _AA_ field and use zeros for _BB.CC_ + * Example: version command is **20160912** then NuGet version is **20160912.0.0** +* If a version has two numbers partitioned by a "-" then make those the _AA.BB_ fields and use zero for the _CC_ + * Example: version command is **1234-56** then NuGet version is **1234.56.0** + + +## Process to publish new version of tool + +1. Download desired version from +2. Unzip +3. Make a new folder (for my example I will call it "new") +4. Copy the assets to publish into this new folder +5. Run the <_TOOL_> -v command to see the version. +6. Open cmd prompt in the NugetPublishing dir +7. Pack and push + ```cmd + NugetProducerSupport.py --Operation PackAndPush --ConfigFilePath Mu-Basetools-Win32.config.json --Version --InputFolderPath --ApiKey + ``` + diff --git a/UefiBuild/NugetPublishing/Mu-Nasm.config.json b/UefiBuild/NugetPublishing/Mu-Nasm.config.json new file mode 100644 index 0000000000..0a346263ef --- /dev/null +++ b/UefiBuild/NugetPublishing/Mu-Nasm.config.json @@ -0,0 +1,9 @@ +{ + "name": "mu_nasm", + "author_string": "The NASM development team", + "server_url": "https://api.nuget.org/v3/index.json", + "project_url": "http://nasm.us/", + "license_url": "https://opensource.org/licenses/BSD-2-Clause", + "description_string": "NASM the netwide assembler packaged for Project Mu", + "copyright_string": "Copyright 2018" +} \ No newline at end of file diff --git a/UefiBuild/NugetPublishing/Mu-Nasm.md b/UefiBuild/NugetPublishing/Mu-Nasm.md new file mode 100644 index 0000000000..ba099b4aec --- /dev/null +++ b/UefiBuild/NugetPublishing/Mu-Nasm.md @@ -0,0 +1,35 @@ +# Mu-Nasm Notes + +This tool is the open source NASM assembler. More information can be found at https://nasm.us/ + +## Where + +Go to https://nasm.us and find the desired download. + +## What + +nasm.exe is the assembler. + +## Version + +``` cmd +nasm.exe -v +``` +Nuget version is AA.BB.CC + +* The version command generally outputs a version in AA.BB.CC format. + + +## Process to publish new version of tool + +1. Download desired version from nasm.us +2. Unzip +3. Make a new folder (for my example I will call it "new") +4. Copy the assets to publish into this new folder (in this case just nasm.exe and ndisasm.exe) +5. Run the nasm.exe -v command to see the version. +6. Open cmd prompt in the NugetPublishing dir +7. Pack and push + ```cmd + NugetProducerSupport.py --Operation PackAndPush --ConfigFilePath Mu-Nasm.config.json --Version --InputFolderPath --ApiKey + ``` + diff --git a/UefiBuild/NugetPublishing/NugetPublishing.py b/UefiBuild/NugetPublishing/NugetPublishing.py index 201c307e5e..ec23c745ac 100644 --- a/UefiBuild/NugetPublishing/NugetPublishing.py +++ b/UefiBuild/NugetPublishing/NugetPublishing.py @@ -284,7 +284,7 @@ def Pack(self, version, OutputDirectory, ContentDir, RelNotesText=None): self.TempFileToDelete.append(self.NuPackageFile) return ret - def Push(self, nuPackage): + def Push(self, nuPackage, apikey): if(not os.path.isfile(nuPackage)): raise Exception("Invalid file path for NuPkg file") logging.debug("Pushing %s file to server %s" % (nuPackage, self.ConfigData["server_url"])) @@ -293,7 +293,7 @@ def Push(self, nuPackage): cmd += ["-Verbosity", "detailed"] # cmd += ["-NonInteractive"] cmd += ["-Source", self.ConfigData["server_url"]] - cmd += ["-ApiKey", "VSTS"] + cmd += ["-ApiKey", apikey] cmd_string = " ".join(cmd) ret = RunCmd(cmd_string) @@ -335,10 +335,12 @@ def GatherArguments(): parser.add_argument('--ReleaseNotesText', dest="ReleaseNotes", help="Release Notes String", required=False) parser.add_argument('--InputFolderPath', dest="InputFolderPath", help="Relative or Absolute Path to folder containing content to pack. All content will be added but the folder will not", required=True) parser.add_argument('--Copyright', dest="Copyright", help="Change the Copyright string") + parser.add_argument('--ApiKey', dest="ApiKey", help="Api key to use. Default is 'VSTS' which will invoke interactive login", default="VSTS") elif(args.op.lower() == "push"): parser.add_argument("--ConfigFilePath", dest="ConfigFilePath", help="Path to config file", required=True) parser.add_argument('--PackageFile', dest="PackageFile", help="Path To Package File", required=True) + parser.add_argument('--ApiKey', dest="ApiKey", help="Api key to use. Default is 'VSTS' which will invoke interactive login", default="VSTS") if(args.op.lower() == "pack"): parser.add_argument('--OutputFolderPath', dest="OutputFolderPath", help="Output folder where nupkg will be saved. Default is cwd", default=os.getcwd()) @@ -457,7 +459,7 @@ def main(): if(not os.path.isfile(NuPkgFilePath)): logging.critical("NuPkgFilePath is not valid file. %s" % NuPkgFilePath) raise Exception("Invalid Pkg File. File doesn't exist") - ret = nu.Push(NuPkgFilePath) + ret = nu.Push(NuPkgFilePath, args.ApiKey) nu.LogObject() diff --git a/UefiBuild/NugetPublishing/ReadMe.md b/UefiBuild/NugetPublishing/ReadMe.md index 740cdedf67..e18b40f41f 100644 --- a/UefiBuild/NugetPublishing/ReadMe.md +++ b/UefiBuild/NugetPublishing/ReadMe.md @@ -1,10 +1,21 @@ # NugetPublishing -Tool to help create and publish nuget package for Project Mu resources +Tool to help create and publish nuget packages for Project Mu resources ## Usage -See NugetPublishing.py -h +See NugetPublishing.py -h + + +## Authentication + +For publishing most service providers require authentication. The **--ApiKey** parameter allows the caller to supply a unique key for authorization. There are numerous ways to authenticate. +For example +* Azure Dev Ops: + * VSTS credential manager. In an interactive session a dialog will popup for the user to login + * Tokens can also be used as the API key. Go to your account page to generate a token that can push packages +* NuGet.org + * Must use an API key. Go to your account page and generate a key. ## Example: Creating new config file for first use @@ -21,6 +32,6 @@ Using an existing config file publish a new iasl.exe. See the example file **ia 6. Open cmd prompt in the NugetPublishing dir 7. Pack and push (here is my example command. ) ```cmd - NugetProducerSupport.py --Operation PackAndPush --ConfigFilePath iasl.config.json --Version 20180209.0.0 --InputFolderPath "C:\temp\iasl-win-20180209\new" + NugetProducerSupport.py --Operation PackAndPush --ConfigFilePath iasl.config.json --Version 20180209.0.0 --InputFolderPath "C:\temp\iasl-win-20180209\new" --ApiKey ``` diff --git a/UefiBuild/NugetPublishing/iasl.md b/UefiBuild/NugetPublishing/iasl.md new file mode 100644 index 0000000000..d0b0dddc5b --- /dev/null +++ b/UefiBuild/NugetPublishing/iasl.md @@ -0,0 +1,38 @@ +# IASL Notes + +This tool is the open source ACPI compiler. More information can be found at https://acpica.org/ + +## Where + +For Windows Binary tools: https://acpica.org/downloads/binary-tools + +## What + +iasl.exe is the compiler. + +## Version + +``` cmd +iasl.exe -v +``` +Nuget version is AA.BB.CC + +* If the version is a single number then make it the _AA_ field and use zeros for _BB.CC_ + * Example: version command is **20160912** then NuGet version is **20160912.0.0** +* If a version has two numbers partitioned by a "-" then make those the _AA.BB_ fields and use zero for the _CC_ + * Example: version command is **1234-56** then NuGet version is **1234.56.0** + + +## Process to publish new version of tool + +1. Download desired version from acpica.org +2. Unzip +3. Make a new folder (for my example I will call it "new") +4. Copy the assets to publish into this new folder (in this case just iasl.exe) +5. Run the iasl.exe -v command to see the version. +6. Open cmd prompt in the NugetPublishing dir +7. Pack and push + ```cmd + NugetProducerSupport.py --Operation PackAndPush --ConfigFilePath iasl.config.json --Version --InputFolderPath --ApiKey + ``` +