rpms/jpackage-utils/F-13 abs2rel.lua, NONE, 1.1 abs2rel.sh, NONE, 1.1 jpackage-utils.spec, 1.50, 1.51

Michel Alexandre Salim salimma at fedoraproject.org
Sat May 8 12:01:27 UTC 2010


Author: salimma

Update of /cvs/pkgs/rpms/jpackage-utils/F-13
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv17689/F-13

Modified Files:
	jpackage-utils.spec 
Added Files:
	abs2rel.lua abs2rel.sh 
Log Message:
Bring rawhide addition of abs2rel.lua script to F-13, for use by
  java-1.5.0-gcj and java-1.6.0-openjdk



--- NEW FILE abs2rel.lua ---
--[[
abs2rel for Lua

split and split_path taken from "Split a string with a pattern, Take Two"
  http://lua-users.org/wiki/SplitJoin
--]]

function split(str, pat)
   local t = {}  -- NOTE: use {n = 0} in Lua-5.0
   local fpat = "(.-)" .. pat
   local last_end = 1
   local s, e, cap = str:find(fpat, 1)
   while s do
      if s ~= 1 or cap ~= "" then
	 table.insert(t,cap)
      end
      last_end = e+1
      s, e, cap = str:find(fpat, last_end)
   end
   if last_end <= #str then
      cap = str:sub(last_end)
      table.insert(t, cap)
   end
   return t
end

function split_path(str)
   return split(str,'[\\/]+')
end

-- parts = split_path("/usr/local/bin")
--> {'usr','local','bin'}

function join(words, sep)
   local s = ""
   for i,v in ipairs(words) do
      s = s .. sep .. v
   end
   return string.sub (s, string.len(sep)+1)
end

function abs2rel (path, base)
   if path == base then return "." end
   local pathdirs = split_path (path)
   local basedirs = split_path (base)
   local i = 1
   local rem_i = math.min(#pathdirs, #basedirs)

   -- remove common parts of both paths
   while (rem_i > 0) and (pathdirs[i] == basedirs[i]) do
      rem_i = rem_i - 1
      table.remove(pathdirs, 1)
      table.remove(basedirs, 1)
   end

   -- now for each remaining basedirs, replace them with ..
   if #basedirs > 0 then
      for i, v in ipairs(basedirs) do
	 basedirs[i] = ".."
      end
   end
   for i, v in ipairs(pathdirs) do
      basedirs[#basedirs+1] = v
   end
   return join(basedirs, "/")
end


--- NEW FILE abs2rel.sh ---
#!/bin/sh
(cd `dirname $0` && lua -l abs2rel -e "print(abs2rel(\"$1\", \"$2\"))")



Index: jpackage-utils.spec
===================================================================
RCS file: /cvs/pkgs/rpms/jpackage-utils/F-13/jpackage-utils.spec,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -p -r1.50 -r1.51
--- jpackage-utils.spec	21 Sep 2009 21:47:39 -0000	1.50
+++ jpackage-utils.spec	8 May 2010 12:01:27 -0000	1.51
@@ -34,15 +34,18 @@
 
 Name:           jpackage-utils
 Version:        1.7.5
-Release:        3.8%{?dist}
+Release:        3.10%{?dist}
 Epoch:          0
 Summary:        JPackage utilities
 License:        BSD
 URL:            http://www.jpackage.org/
 Source0:        %{name}-%{version}.tar.bz2
 Source1:        %{name}-README
+Source2:        abs2rel.sh
+Source3:        abs2rel.lua
 Patch0:         %{name}-enable-gcj-support.patch
 Patch1:         %{name}-own-mavendirs.patch
+Patch2:         %{name}-prefer-jre.patch
 Group:          Utilities
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-buildroot
 
@@ -62,8 +65,9 @@ information.
 %setup -q
 %patch0 -p0
 %patch1 -p1
+%patch2 -p1
 
-cp %{SOURCE1} .
+cp -p %{SOURCE1} %{SOURCE2} %{SOURCE3} .
 
 %build
 echo "JPackage release %{distver} (%{distribution}) for %{buildarch}" \
@@ -116,6 +120,10 @@ install -dm 755 ${RPM_BUILD_ROOT}${_mave
 install -pm 755 bin/* ${RPM_BUILD_ROOT}%{_bindir}
 install -pm 644 etc/font.properties ${RPM_BUILD_ROOT}%{_sysconfdir}/java
 
+# Install abs2rel scripts
+install -pm 755 abs2rel.sh  ${RPM_BUILD_ROOT}%{_javadir}-utils
+install -pm 644 abs2rel.lua ${RPM_BUILD_ROOT}%{_javadir}-utils
+
 # Create an initial (empty) depmap
 echo -e "<dependencies>\\n" \
   > ${RPM_BUILD_ROOT}${_mavendepmapdir}/maven2-depmap.xml
@@ -203,6 +211,12 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Tue May  4 2010 Michel Salim <salimma at fedoraproject.org> - 0:1.7.5-3.10
+- Add Lua abs2rel script
+
+* Fri Apr 30 2010 Deepak Bhole <dbhole at redhat.com> - 0:1.7.5-3.9
+- Stopgap fix for rhbz#461683 from Ville Skyttä.
+
 * Mon Sep 21 2009 Orion Poplawski <orion at cora.nwra.com> - 0:1.7.5-3.8
 - Add Requires: coreutils because we provide scripts that are being executed
   in rpm %%post scriptlets that require it.



More information about the scm-commits mailing list