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

[vcpkg] Added python script to generate all packages file list, added to azur… #12177

Merged
merged 6 commits into from
Jul 6, 2020
Merged
Show file tree
Hide file tree
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
12 changes: 12 additions & 0 deletions scripts/azure-pipelines/linux/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,15 @@ jobs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/failureLogs'
ArtifactName: 'x64-linux port build failure logs'
condition: failed()
- bash: |
python3 scripts/file_script.py /mnt/vcpkg-ci/installed/vcpkg/info/
displayName: 'Build a file list for all packages'
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))

- task: PublishBuildArtifacts@1
displayName: 'Upload file lists for all packages'
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))

inputs:
PathtoPublish: scripts/list_files
ArtifactName: "x64-linux package file lists"
12 changes: 12 additions & 0 deletions scripts/azure-pipelines/osx/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,15 @@ jobs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/failureLogs'
ArtifactName: 'x64-osx port build failure logs'
condition: failed()
- bash: |
python3 scripts/file_script.py /Users/vagrant/Data/installed/vcpkg/info/
displayName: 'Build a file list for all packages'
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))

- task: PublishBuildArtifacts@1
displayName: 'Upload file lists for all packages'
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))

inputs:
PathtoPublish: scripts/list_files
ArtifactName: "x64-osx package file lists"
16 changes: 16 additions & 0 deletions scripts/azure-pipelines/windows/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,19 @@ jobs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\failureLogs'
ArtifactName: '${{ parameters.triplet }} port build failure logs'
condition: failed()
- task: PowerShell@2
displayName: "Generating all packages files"
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))

inputs:
targetType: inline
script: |
$env:VCPKG_DOWNLOADS = "D:\downloads"
./vcpkg.exe fetch python3
Comment on lines +74 to +75
Copy link
Member

Choose a reason for hiding this comment

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

This is going to cause a merge conflict with a @ras0219 PR which removes this explicit variable set.

Also, why duplicate the fetch python3 call?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The second fetch python3 call was to get the executable file path to execute python.

Which variable set does the PR remove exactly?

Copy link
Member

Choose a reason for hiding this comment

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

#12198 <- This is the conflicting change. Your PR landed first so the comment goes to that one instead.

& $(.\vcpkg fetch python3) .\scripts\file_script.py D:\installed\vcpkg\info\
- task: PublishBuildArtifacts@1
displayName: 'Upload file lists for all packages'
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
inputs:
PathtoPublish: scripts/list_files
ArtifactName: "${{ parameters.triplet }} package file lists"
39 changes: 39 additions & 0 deletions scripts/file_script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import os
import os.path
import sys


keyword = "include/"

def getFiles(path):
files = os.listdir(path)
return list(filter(lambda x: x[0] != '.', files))

def gen_all_file_strings(path, files, headers, output):
for file in files:
package = file[:file.find("_")]
f = open(path + file)
for line in f:
idx = line.strip().find(keyword)
if idx >= 0 and line.strip()[-1] != "/":
headers.write(package + ":" + line[idx + len(keyword):])
output.write(package + ":" + line[idx-1:])
elif line.strip()[-1] != "/":
output.write(package + ":" + line[line.find("/"):])
f.close()

def main(path):
try:
os.mkdir("scripts/list_files")
except FileExistsError:
print("Path already exists, continuing...")

headers = open("scripts/list_files/VCPKGHeadersDatabase.txt", mode='w')
output = open("scripts/list_files/VCPKGDatabase.txt", mode='w')
gen_all_file_strings(path, getFiles(path), headers, output)
headers.close()
output.close()

if __name__ == "__main__":
main(sys.argv[1])

7 changes: 7 additions & 0 deletions scripts/vcpkgTools.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?xml version="1.0"?>
<tools version="2">
<tool name="python3" os="windows">
<version>3.8.3</version>
<exeRelativePath>python.exe</exeRelativePath>
<url>https://www.python.org/ftp/python/3.8.3/python-3.8.3-embed-win32.zip</url>
<sha512>8c9078f55b1b5d694e0e809eee6ccf8a6e15810dd4649e8ae1209bff30e102d49546ce970a5d519349ca7759d93146f459c316dc440737171f018600255dcd0a</sha512>
<archiveName>python-3.8.3-embed-win32.zip</archiveName>
</tool>
<tool name="cmake" os="windows">
<version>3.17.2</version>
<exeRelativePath>cmake-3.17.2-win32-x86\bin\cmake.exe</exeRelativePath>
Expand Down