Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
glslang
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
glslang
Commits
a6e55436
Commit
a6e55436
authored
Oct 31, 2017
by
John Kessenich
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'kg1' into 'master'
Fix gitlab known-good to correct commits for 1.1 SDK See merge request !28
parents
f5da6fa4
9fc9b0f2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
154 additions
and
2 deletions
+154
-2
known_good_khr.json
known_good_khr.json
+2
-2
update_glslang_sources_khr.py
update_glslang_sources_khr.py
+152
-0
No files found.
known_good_khr.json
View file @
a6e55436
...
@@ -5,14 +5,14 @@
...
@@ -5,14 +5,14 @@
"site"
:
"gitlab"
,
"site"
:
"gitlab"
,
"subrepo"
:
"spirv/spirv-tools"
,
"subrepo"
:
"spirv/spirv-tools"
,
"subdir"
:
"External/spirv-tools"
,
"subdir"
:
"External/spirv-tools"
,
"commit"
:
"
063dbea0f19a3926b81a34fa8dc5479fa7969739
"
"commit"
:
"
65457244d0135e91815fef57dc662f9b39232284
"
},
},
{
{
"name"
:
"spirv-tools/external/spirv-headers"
,
"name"
:
"spirv-tools/external/spirv-headers"
,
"site"
:
"gitlab"
,
"site"
:
"gitlab"
,
"subrepo"
:
"spirv/SPIRV-Headers"
,
"subrepo"
:
"spirv/SPIRV-Headers"
,
"subdir"
:
"External/spirv-tools/external/spirv-headers"
,
"subdir"
:
"External/spirv-tools/external/spirv-headers"
,
"commit"
:
"
77240d9e86c6ff135f6de8c7b89a0099a2d90e16
"
"commit"
:
"
854b5dda6149c481d6faf0b9c760c311ab45b05d
"
}
}
]
]
}
}
update_glslang_sources_khr.py
0 → 100755
View file @
a6e55436
#!/usr/bin/env python
# Copyright 2017 The Glslang Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.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.
"""Get source files for Glslang and its dependencies from public repositories.
"""
from
__future__
import
print_function
import
argparse
import
json
import
distutils.dir_util
import
os.path
import
subprocess
import
sys
KNOWN_GOOD_FILE
=
'known_good_khr.json'
# Maps a site name to its hostname.
SITE_TO_HOST
=
{
'github'
:
'github.com'
,
'gitlab'
:
'gitlab.khronos.org'
}
VERBOSE
=
True
def
command_output
(
cmd
,
directory
,
fail_ok
=
False
):
"""Runs a command in a directory and returns its standard output stream.
Captures the standard error stream.
Raises a RuntimeError if the command fails to launch or otherwise fails.
"""
if
VERBOSE
:
print
(
'In {d}: {cmd}'
.
format
(
d
=
directory
,
cmd
=
cmd
))
p
=
subprocess
.
Popen
(
cmd
,
cwd
=
directory
,
stdout
=
subprocess
.
PIPE
)
(
stdout
,
_
)
=
p
.
communicate
()
if
p
.
returncode
!=
0
and
not
fail_ok
:
raise
RuntimeError
(
'Failed to run {} in {}'
.
format
(
cmd
,
directory
))
if
VERBOSE
:
print
(
stdout
)
return
stdout
def
command_retval
(
cmd
,
directory
):
"""Runs a command in a directory and returns its return value.
Captures the standard error stream.
"""
p
=
subprocess
.
Popen
(
cmd
,
cwd
=
directory
,
stdout
=
subprocess
.
PIPE
)
(
stdout
,
_
)
=
p
.
communicate
()
return
p
.
returncode
class
GoodCommit
(
object
):
"""Represents a good commit for a repository."""
def
__init__
(
self
,
json
):
"""Initializes this good commit object.
Args:
'json': A fully populated JSON object describing the commit.
"""
self
.
_json
=
json
self
.
name
=
json
[
'name'
]
self
.
site
=
json
[
'site'
]
self
.
subrepo
=
json
[
'subrepo'
]
self
.
subdir
=
json
[
'subdir'
]
if
(
'subdir'
in
json
)
else
'.'
self
.
commit
=
json
[
'commit'
]
def
GetUrl
(
self
,
style
=
'https'
):
"""Returns the URL for the repository."""
host
=
SITE_TO_HOST
[
self
.
site
]
sep
=
'/'
if
(
style
is
'https'
)
else
':'
return
'{style}://{host}{sep}{subrepo}'
.
format
(
style
=
style
,
host
=
host
,
sep
=
sep
,
subrepo
=
self
.
subrepo
)
def
AddRemote
(
self
):
"""Add the remote 'known-good' if it does not exist."""
print
(
'Ignore "fatal" errors for missing known-good remote:'
)
if
command_retval
([
'git'
,
'remote'
,
'show'
,
'known-good'
],
self
.
subdir
)
!=
0
:
command_output
([
'git'
,
'remote'
,
'add'
,
'known-good'
,
self
.
GetUrl
()],
self
.
subdir
)
def
HasCommit
(
self
):
"""Check if the repository contains the known-good commit."""
return
0
==
subprocess
.
call
([
'git'
,
'rev-parse'
,
'--verify'
,
'--quiet'
,
self
.
commit
+
"^{commit}"
],
cwd
=
self
.
subdir
)
def
Clone
(
self
):
distutils
.
dir_util
.
mkpath
(
self
.
subdir
)
command_output
([
'git'
,
'clone'
,
self
.
GetUrl
(),
'.'
],
self
.
subdir
)
def
Fetch
(
self
):
command_output
([
'git'
,
'fetch'
,
'known-good'
],
self
.
subdir
)
def
Checkout
(
self
):
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
self
.
subdir
,
'.git'
)):
self
.
Clone
()
self
.
AddRemote
()
if
not
self
.
HasCommit
():
self
.
Fetch
()
command_output
([
'git'
,
'checkout'
,
self
.
commit
],
self
.
subdir
)
def
GetGoodCommits
():
"""Returns the latest list of GoodCommit objects."""
with
open
(
KNOWN_GOOD_FILE
)
as
known_good
:
return
[
GoodCommit
(
c
)
for
c
in
json
.
loads
(
known_good
.
read
())[
'commits'
]]
def
main
():
parser
=
argparse
.
ArgumentParser
(
description
=
'Get Glslang source dependencies at a known-good commit'
)
parser
.
add_argument
(
'--dir'
,
dest
=
'dir'
,
default
=
'.'
,
help
=
"Set target directory for Glslang source root. Default is
\'
.
\'
."
)
args
=
parser
.
parse_args
()
commits
=
GetGoodCommits
()
distutils
.
dir_util
.
mkpath
(
args
.
dir
)
print
(
'Change directory to {d}'
.
format
(
d
=
args
.
dir
))
os
.
chdir
(
args
.
dir
)
# Create the subdirectories in sorted order so that parent git repositories
# are created first.
for
c
in
sorted
(
commits
,
key
=
lambda
x
:
x
.
subdir
):
print
(
'Get {n}
\n
'
.
format
(
n
=
c
.
name
))
c
.
Checkout
()
sys
.
exit
(
0
)
if
__name__
==
'__main__'
:
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment