stop using git commit date as version
This turns out to have been prolimatic because building from a git tag would make a git-annex that claimed a different version than the tag's version. The git rev is still included in the version, and people who want to know the exact tree that was built can just use that, so there's no real benefit to automatically advancing the date part of the version.
This commit is contained in:
		
					parent
					
						
							
								87b329e451
							
						
					
				
			
			
				commit
				
					
						7ecbb6bc20
					
				
			
		
					 2 changed files with 11 additions and 9 deletions
				
			
		
							
								
								
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							|  | @ -5,7 +5,6 @@ Setup | ||||||
| tmp | tmp | ||||||
| test | test | ||||||
| Build/SysConfig | Build/SysConfig | ||||||
| Build/SysConfig.hs |  | ||||||
| Build/InstallDesktopFile | Build/InstallDesktopFile | ||||||
| Build/EvilSplicer | Build/EvilSplicer | ||||||
| Build/Standalone | Build/Standalone | ||||||
|  |  | ||||||
|  | @ -22,12 +22,11 @@ type Version = String | ||||||
| isReleaseBuild :: IO Bool | isReleaseBuild :: IO Bool | ||||||
| isReleaseBuild = (== Just "1") <$> catchMaybeIO (getEnv "RELEASE_BUILD") | isReleaseBuild = (== Just "1") <$> catchMaybeIO (getEnv "RELEASE_BUILD") | ||||||
| 
 | 
 | ||||||
| {- Version is usually based on the major version from the changelog,  | {- Version comes from the CHANGELOG, plus the git rev of the last commit. | ||||||
|  - plus the date of the last commit, plus the git rev of that commit. |  | ||||||
|  - This works for autobuilds, ad-hoc builds, etc. |  - This works for autobuilds, ad-hoc builds, etc. | ||||||
|  - |  - | ||||||
|  - If git or a git repo is not available, or something goes wrong, |  - If git or a git repo is not available, or something goes wrong, | ||||||
|  - or this is a release build, just use the version from the changelog. -} |  - or this is a release build, just use the version from the CHANGELOG. -} | ||||||
| getVersion :: IO Version | getVersion :: IO Version | ||||||
| getVersion = do | getVersion = do | ||||||
| 	changelogversion <- getChangelogVersion | 	changelogversion <- getChangelogVersion | ||||||
|  | @ -35,13 +34,17 @@ getVersion = do | ||||||
| 		( return changelogversion | 		( return changelogversion | ||||||
| 		, catchDefaultIO changelogversion $ do | 		, catchDefaultIO changelogversion $ do | ||||||
| 			let major = takeWhile (/= '.') changelogversion | 			let major = takeWhile (/= '.') changelogversion | ||||||
| 			autoversion <- takeWhile (\c -> isAlphaNum c || c == '-') <$> readProcess "sh" | 			gitversion <- takeWhile (\c -> isAlphaNum c) <$> readProcess "sh" | ||||||
| 				[ "-c" | 				[ "-c" | ||||||
| 				, "git log -n 1 --format=format:'%ci %h'| sed -e 's/-//g' -e 's/ .* /-g/'" | 				, "git log -n 1 --format=format:'%h'" | ||||||
| 				] "" | 				] "" | ||||||
| 			if null autoversion | 			return $ if null gitversion | ||||||
| 				then return changelogversion | 				then changelogversion | ||||||
| 				else return $ concat [ major, ".", autoversion ] | 				else concat | ||||||
|  | 					[ changelogversion | ||||||
|  | 					, "-g" | ||||||
|  | 					, gitversion | ||||||
|  | 					] | ||||||
| 		) | 		) | ||||||
| 	 | 	 | ||||||
| getChangelogVersion :: IO Version | getChangelogVersion :: IO Version | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Joey Hess
				Joey Hess