Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Guillaume Desmottes
gst-plugins-rs
Commits
e0695b63
Commit
e0695b63
authored
Mar 29, 2020
by
Brian Gonzalez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fall back to default unknown COMMIT_ID and BUILD_REL_DATE if unable to find commit in repo
parent
888f98e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
gst-plugin-version-helper/src/lib.rs
gst-plugin-version-helper/src/lib.rs
+10
-8
No files found.
gst-plugin-version-helper/src/lib.rs
View file @
e0695b63
...
...
@@ -93,18 +93,20 @@ pub fn get_info() {
// Otherwise use a 'release.txt' file as fallback, or report the current
// date and an unknown revision.
if
let
Ok
(
repo
)
=
repo
{
let
commit
=
find_last_commit
(
&
repo
)
.expect
(
"Couldn't find last commit"
);
commit_id
=
oid_to_short_sha
(
commit
.id
());
let
timestamp
=
commit
.time
()
.seconds
();
let
dt
=
chrono
::
Utc
.timestamp
(
timestamp
,
0
);
commit_date
=
dt
.format
(
"%Y-%m-%d"
)
.to_string
()
if
let
Ok
(
commit
)
=
find_last_commit
(
&
repo
)
{
commit_id
=
oid_to_short_sha
(
commit
.id
());
let
timestamp
=
commit
.time
()
.seconds
();
let
dt
=
chrono
::
Utc
.timestamp
(
timestamp
,
0
);
commit_date
=
dt
.format
(
"%Y-%m-%d"
)
.to_string
()
}
}
else
if
let
Ok
(
release_file
)
=
fs
::
File
::
open
(
release_file
)
{
let
mut
cargo_toml
=
crate_dir
;
cargo_toml
.push
(
"Cargo.toml"
);
let
cargo_toml
=
fs
::
File
::
open
(
cargo_toml
)
.expect
(
"Can't open Cargo.toml"
);
commit_date
=
read_release_date
(
cargo_toml
,
release_file
);
commit_id
=
"RELEASE"
.into
();
if
let
Ok
(
cargo_toml
)
=
fs
::
File
::
open
(
cargo_toml
)
{
commit_date
=
read_release_date
(
cargo_toml
,
release_file
);
commit_id
=
"RELEASE"
.into
();
}
}
println!
(
"cargo:rustc-env=COMMIT_ID={}"
,
commit_id
);
...
...
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