Changeset 1385 for spec/trunk/SPECS/os2-rpm/macros.os2
- Timestamp:
- Apr 23, 2018, 4:59:35 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
spec/trunk/SPECS/os2-rpm/macros.os2
r1207 r1385 17 17 18 18 # Converts back slashes to forward slashes. 19 %os2_fwdslashes() %{lua: print( string.gsub(rpm.expand("%{?**}"), "\\\\", "/"))}19 %os2_fwdslashes() %{lua: print((string.gsub(rpm.expand("%{?**}"), "\\\\", "/")))} 20 20 21 21 # Converts forward lashes to back slashes. 22 %os2_backslashes() %{lua: print( string.gsub(rpm.expand("%{?**}"), "/", "\\\\"))}22 %os2_backslashes() %{lua: print((string.gsub(rpm.expand("%{?**}"), "/", "\\\\")))} 23 23 24 24 # Converts a Unix path to a DOS path (backward slashes) replacing /@unixroot 25 # with %UNIXROOT% if it starts the path. Several paths separated by ';' may be 26 # given to handle them at once (useful for PATH-like env.vars). 25 # with %UNIXROOT% if it starts the path. Note that if %UNIXROOT% per se contains 26 # forward slashes, they are not converted (if you need this, use 27 # os2_expand_unixroot and os2_backslashes). Several paths separated by ';' may 28 # be given to handle them at once (useful for PATH-like env.vars). 27 29 %os2_dos_path() %{lua: 28 30 function conv_path(path) … … 42 44 } 43 45 44 # Same as os2_dos_path but converts backward slashes to forward slashes. 45 %os2_dos_path_f() %{os2_fwdslashes %{os2_dos_path %{?**}}} 46 # Expands /@unixroot to the current value of UNIXROOT if it starts the path 47 # and converts all slashes to forward ones. If you need no fowrard slashes and 48 # using of %UNIXROOT% instead of the real value is fine, use os2_dos_path as 49 # it doesn't reqire -e (see below). Several paths separated by ';' may be 50 # given to handle them at once (useful for PATH-like env.vars). 51 # NOTE: Don't use in install-time scriptlets unless with -e and as %%{...}. 52 %os2_expand_unixroot() %{lua: 53 function conv_path(path) 54 if (string.sub(path, 1, 10) == "/@unixroot" and 55 (string.len(path) == 10 or string.sub(path, 11, 11) == '/')) then 56 path = os.getenv("UNIXROOT") .. string.sub(path, 11) 57 end 58 path = string.gsub(path, "\\\\", "/") 59 return path 60 end 61 path = rpm.expand("%{?**}") 62 seen_first = false 63 for p in string.gmatch(path, "[^;]*") do 64 print((seen_first and ';' or '') .. conv_path(p)) 65 seen_first = seen_first or true 66 end 67 } 46 68 47 69 # Expands DOS-like environment variables (%VAR%) to their current values. … … 55 77 # Current UNIXROOT value in DOS format (backward slashes) 56 78 # NOTE: Don't use in install-time scriptlets unless with -e and as %%{...}. 57 %os2_unixroot_path() %{os2_ expand_dos_vars %{os2_dos_path/@unixroot}}79 %os2_unixroot_path() %{os2_backslashes %{os2_expand_unixroot /@unixroot}} 58 80 59 81 # OS/2 boot drive.
Note:
See TracChangeset
for help on using the changeset viewer.