mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-29 18:52:30 +00:00 
			
		
		
		
	Make GIT_REV logic work in release tarballs
Currently GIT_REV doesn't get set properly when building a release tarball. To fix this we arrange for .gitcommit to contain the (short) commit hash in tarballs generated with git-archive(1) using export-subst in gitattributes. This way the correct commit hash is (reproducibly) included in the release tarballs while not burdening the maintainers with updating it in the git repo. Please note this even works on Github and similar forges as they use git-archive for generating tarballs so this works out quite nicely.
This commit is contained in:
		
							parent
							
								
									cffec1f95f
								
							
						
					
					
						commit
						222e7a2da3
					
				
					 3 changed files with 13 additions and 0 deletions
				
			
		
							
								
								
									
										1
									
								
								.gitattributes
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitattributes
									
										
									
									
										vendored
									
									
								
							|  | @ -1 +1,2 @@ | ||||||
| *.v linguist-language=Verilog | *.v linguist-language=Verilog | ||||||
|  | /.gitcommit export-subst | ||||||
|  |  | ||||||
							
								
								
									
										1
									
								
								.gitcommit
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.gitcommit
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | ||||||
|  | $Format:%h$ | ||||||
							
								
								
									
										11
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								Makefile
									
										
									
									
									
								
							|  | @ -130,7 +130,18 @@ LDLIBS += -lrt | ||||||
| endif | endif | ||||||
| 
 | 
 | ||||||
| YOSYS_VER := 0.17+41 | YOSYS_VER := 0.17+41 | ||||||
|  | 
 | ||||||
|  | # Note: We arrange for .gitcommit to contain the (short) commit hash in
 | ||||||
|  | # tarballs generated with git-archive(1) using .gitattributes. The git repo
 | ||||||
|  | # will have this file in its unexpanded form tough, in which case we fall
 | ||||||
|  | # back to calling git directly.
 | ||||||
|  | TARBALL_GIT_REV := $(shell cat $(YOSYS_SRC)/.gitcommit) | ||||||
|  | ifeq ($(TARBALL_GIT_REV),$$Format:%h$$) | ||||||
| GIT_REV := $(shell git ls-remote $(YOSYS_SRC) HEAD -q | $(AWK) 'BEGIN {R = "UNKNOWN"}; ($$2 == "HEAD") {R = substr($$1, 1, 9); exit} END {print R}') | GIT_REV := $(shell git ls-remote $(YOSYS_SRC) HEAD -q | $(AWK) 'BEGIN {R = "UNKNOWN"}; ($$2 == "HEAD") {R = substr($$1, 1, 9); exit} END {print R}') | ||||||
|  | else | ||||||
|  | GIT_REV := $(TARBALL_GIT_REV) | ||||||
|  | endif | ||||||
|  | 
 | ||||||
| OBJS = kernel/version_$(GIT_REV).o | OBJS = kernel/version_$(GIT_REV).o | ||||||
| 
 | 
 | ||||||
| bumpversion: | bumpversion: | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue