Changeset 1207 for spec/trunk/SPECS/os2-rpm/macros.os2
- Timestamp:
- Jul 28, 2017, 6:24:07 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
spec/trunk/SPECS/os2-rpm/macros.os2
r1185 r1207 7 7 %_rpmconfigdir_os2 @RPMCONFIGDIR_OS2@ 8 8 9 # OS/2 boot drive10 %os2_ boot_drive %(%{_rpmconfigdir_os2}/getbootdrive.exe)9 # System-wide path for OS/2 language files accessed via DPATH env. variable. 10 %os2_langdir %{_datadir}/os2/lang 11 11 12 # Converts a Unix path to a DOS path (backward slashes) expanding /@unixroot to 13 # a current value of UNIXROOT if it starts the path. 12 # System-wide path for OS/2 INF files accessible via BOOKSHELF env. variable. 13 %os2_bookdir %{_datadir}/os2/book 14 15 # System-wide path for OS/2 HLP files accessible via HELP env. variable. 16 %os2_helpdir %{_datadir}/os2/help 17 18 # Converts back slashes to forward slashes. 19 %os2_fwdslashes() %{lua: print(string.gsub(rpm.expand("%{?**}"), "\\\\", "/"))} 20 21 # Converts forward lashes to back slashes. 22 %os2_backslashes() %{lua: print(string.gsub(rpm.expand("%{?**}"), "/", "\\\\"))} 23 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). 14 27 %os2_dos_path() %{lua: 15 path = rpm.expand("%{?1}") 16 if (string.sub(path, 1, 10) == "/@unixroot" and 17 (string.len(path) == 10 or string.sub(path, 11, 11) == '/')) then 18 path = os.getenv("UNIXROOT") .. string.sub(path, 11) 28 function conv_path(path) 29 if (string.sub(path, 1, 10) == "/@unixroot" and 30 (string.len(path) == 10 or string.sub(path, 11, 11) == '/')) then 31 path = "%UNIXROOT%" .. string.sub(path, 11) 32 end 33 path = string.gsub(path, "/", "\\\\") 34 return path 19 35 end 20 path = string.gsub(path, "/", "\\\\") 21 print(path) 36 path = rpm.expand("%{?**}") 37 seen_first = false 38 for p in string.gmatch(path, "[^;]*") do 39 print((seen_first and ';' or '') .. conv_path(p)) 40 seen_first = seen_first or true 41 end 42 } 43 44 # Same as os2_dos_path but converts backward slashes to forward slashes. 45 %os2_dos_path_f() %{os2_fwdslashes %{os2_dos_path %{?**}}} 46 47 # Expands DOS-like environment variables (%VAR%) to their current values. 48 # NOTE: Don't use in install-time scriptlets unless with -e and as %%{...}. 49 %os2_expand_dos_vars() %{lua: 50 str = rpm.expand("%{?**}") 51 str = string.gsub(str, "%%(%a+)%%", os.getenv) 52 print(str) 22 53 } 23 54 24 55 # Current UNIXROOT value in DOS format (backward slashes) 25 %os2_unixroot_path() %{os2_dos_path /@unixroot} 56 # 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}} 58 59 # OS/2 boot drive. 60 # NOTE: Don't use in install-time scriptlets unless with -e and as %%{...}. 61 %os2_boot_drive %(%{_rpmconfigdir_os2}/getbootdrive.exe) 26 62 27 63 #------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.