Ignore:
Timestamp:
Apr 23, 2018, 4:59:35 PM (7 years ago)
Author:
dmik
Message:

spec: os2-rpm: Release version 1-2.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • spec/trunk/SPECS/os2-rpm/macros.os2

    r1207 r1385  
    1717
    1818# Converts back slashes to forward slashes.
    19 %os2_fwdslashes() %{lua: print(string.gsub(rpm.expand("%{?**}"), "\\\\", "/"))}
     19%os2_fwdslashes() %{lua: print((string.gsub(rpm.expand("%{?**}"), "\\\\", "/")))}
    2020
    2121# Converts forward lashes to back slashes.
    22 %os2_backslashes() %{lua: print(string.gsub(rpm.expand("%{?**}"), "/", "\\\\"))}
     22%os2_backslashes() %{lua: print((string.gsub(rpm.expand("%{?**}"), "/", "\\\\")))}
    2323
    2424# 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).
    2729%os2_dos_path() %{lua:
    2830  function conv_path(path)
     
    4244}
    4345
    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}
    4668
    4769# Expands DOS-like environment variables (%VAR%) to their current values.
     
    5577# Current UNIXROOT value in DOS format (backward slashes)
    5678# 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}}
    5880
    5981# OS/2 boot drive.
Note: See TracChangeset for help on using the changeset viewer.