File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change
1
+ use std:: env;
1
2
use std:: io;
2
3
use std:: io:: Write ;
3
4
use std:: process:: Command ;
@@ -12,7 +13,11 @@ fn main() {
12
13
. output ( )
13
14
. unwrap ( ) ;
14
15
let mut result = String :: from_utf8 ( output. stdout ) . unwrap ( ) ;
15
- if !Command :: new ( "git" )
16
+ if result. is_empty ( ) {
17
+ result = env:: var ( "BUILDROOT_COMMIT" ) . unwrap_or_default ( ) ;
18
+ result. truncate ( 7 ) ;
19
+ result = format ! ( "br#{}" , result) ; // add buildroot prefix
20
+ } else if !Command :: new ( "git" )
16
21
. args ( & [ "diff" , "--quiet" ] )
17
22
. status ( )
18
23
. expect ( "failed to execute process" )
@@ -27,6 +32,10 @@ fn main() {
27
32
. output ( )
28
33
. unwrap ( ) ;
29
34
result = String :: from_utf8 ( output. stdout ) . unwrap ( ) . replace ( "-" , "" ) ;
35
+ if result. is_empty ( ) {
36
+ result = env:: var ( "AA_PROXY_COMMIT" ) . unwrap_or_default ( ) ;
37
+ result. truncate ( 7 ) ;
38
+ }
30
39
_ = write ! ( & mut stdout, "cargo:rustc-env=GIT_DATE={}\n " , result) ;
31
40
32
41
output = Command :: new ( "date" )
You can’t perform that action at this time.
0 commit comments