我的buildspec.yml
中有两个env变量 Imports System
Imports System.IO
Imports System.Runtime.InteropServices
Namespace SqlServerTypes
Public Class Utilities
<DllImport("kernel32.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
Public Shared Function LoadLibrary(ByVal libname As String) As IntPtr
End Function
Public Shared Sub LoadNativeAssemblies(ByVal rootApplicationPath As String)
Dim nativeBinaryPath = If(IntPtr.Size > 4, Path.Combine(rootApplicationPath, "SqlServerTypes\x64\"), Path.Combine(rootApplicationPath, "SqlServerTypes\x86\"))
LoadNativeAssembly(nativeBinaryPath, "msvcr120.dll")
LoadNativeAssembly(nativeBinaryPath, "SqlServerSpatial140.dll")
End Sub
Private Shared Sub LoadNativeAssembly(ByVal nativeBinaryPath As String, ByVal assemblyName As String)
Dim path = System.IO.Path.Combine(nativeBinaryPath, assemblyName)
Dim ptr = LoadLibrary(path)
If ptr = IntPtr.Zero Then
Throw New Exception(String.Format("Error loading {0} (ErrorCode: {1})", assemblyName, Marshal.GetLastWin32Error()))
End If
End Sub
End Class
End Namespace
我想将它们传递给env:
variables:
BUILD_VERSION: "0.0.1"
BUILD_RELEASE: "1"
命令,但似乎无法使语法正确。
rpmbuild
我已经尝试了其他几个版本而没有运气。非常感谢这里的协助。
答案 0 :(得分:2)
你应该可以使用
rpmbuild --define '_version 0.0.1'
但在这种情况下,您需要在spec文件中定义变量_version;类似的东西:
%{!?_version: %define _version 0.0.0 }
Version: %{_version}
答案 1 :(得分:0)
我也遇到了这个问题,并且能够使用这种语法解决
rpmbuild --bb --define "_topdir ${rpmdir}" --define "PRODUCT_VERSION 1.0" --buildroot /home/devuser/buildTest/buildroot --target x86_64 ./SPECS/html5.spec
请注意,双引号很重要。