Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
steam-runtime-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
steamrt
steam-runtime-tools
Commits
fe4f23c8
Commit
fe4f23c8
authored
5 years ago
by
Simon McVittie
Browse files
Options
Downloads
Patches
Plain Diff
Add srt_system_info_set_environ()
Signed-off-by:
Simon McVittie
<
smcv@collabora.com
>
parent
95d36fe3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
steam-runtime-tools/system-info.c
+52
-1
52 additions, 1 deletion
steam-runtime-tools/system-info.c
steam-runtime-tools/system-info.h
+3
-0
3 additions, 0 deletions
steam-runtime-tools/system-info.h
with
55 additions
and
1 deletion
steam-runtime-tools/system-info.c
+
52
−
1
View file @
fe4f23c8
...
...
@@ -77,6 +77,8 @@ struct _SrtSystemInfo
GObject
parent
;
/* "" if we have tried and failed to auto-detect */
gchar
*
expectations
;
/* Fake environment variables, or %NULL to use the real environment */
gchar
**
env
;
Tristate
can_write_uinput
;
/* (element-type Abi) */
GPtrArray
*
abis
;
...
...
@@ -348,6 +350,15 @@ library_compare (SrtLibrary *a, SrtLibrary *b)
return
g_strcmp0
(
srt_library_get_soname
(
a
),
srt_library_get_soname
(
b
));
}
static
gchar
**
get_environ
(
SrtSystemInfo
*
self
)
{
if
(
self
->
env
!=
NULL
)
return
self
->
env
;
else
return
environ
;
}
static
gboolean
ensure_expectations
(
SrtSystemInfo
*
self
)
{
...
...
@@ -357,7 +368,7 @@ ensure_expectations (SrtSystemInfo *self)
const
char
*
sysroot
=
"/"
;
gchar
*
def
;
runtime
=
g_
getenv
(
"STEAM_RUNTIME"
);
runtime
=
g_
environ_getenv
(
get_environ
(
self
),
"STEAM_RUNTIME"
);
if
(
runtime
!=
NULL
&&
runtime
[
0
]
==
'/'
)
sysroot
=
runtime
;
...
...
@@ -658,3 +669,43 @@ srt_system_info_check_library (SrtSystemInfo *self,
return
ret
;
}
/*
* Forget whether we can load libraries.
*/
static
void
forget_libraries
(
SrtSystemInfo
*
self
)
{
gsize
i
;
for
(
i
=
0
;
i
<
self
->
abis
->
len
;
i
++
)
{
Abi
*
abi
=
g_ptr_array_index
(
self
->
abis
,
i
);
g_hash_table_remove_all
(
abi
->
cached_results
);
abi
->
cached_combined_issues
=
SRT_LIBRARY_ISSUES_NONE
;
abi
->
libraries_cache_available
=
FALSE
;
}
}
/**
* srt_system_info_set_environ:
* @self: The #SrtSystemInfo
* @env: (nullable) (array zero-terminated=1) (element-type filename) (transfer none): An
* array of environment variables
*
* Use @env instead of the real environment variable block `environ`
* when locating the Steam Runtime.
*
* If @env is %NULL, go back to using the real environment variables.
*/
void
srt_system_info_set_environ
(
SrtSystemInfo
*
self
,
gchar
*
const
*
env
)
{
g_return_if_fail
(
SRT_IS_SYSTEM_INFO
(
self
));
forget_libraries
(
self
);
g_strfreev
(
self
->
env
);
self
->
env
=
g_strdupv
((
gchar
**
)
env
);
}
This diff is collapsed.
Click to expand it.
steam-runtime-tools/system-info.h
+
3
−
0
View file @
fe4f23c8
...
...
@@ -58,3 +58,6 @@ SrtLibraryIssues srt_system_info_check_library (SrtSystemInfo *self,
const
gchar
*
multiarch_tuple
,
const
gchar
*
soname
,
SrtLibrary
**
more_details_out
);
void
srt_system_info_set_environ
(
SrtSystemInfo
*
self
,
gchar
*
const
*
env
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment