[httrack] Fix pretrans scriptlet, remove symlink underneath %_pkgdocdir

Christopher Meng cicku at fedoraproject.org
Mon Mar 2 12:59:26 UTC 2015


commit 66b4676a6b64962019dadc3ac252781a39a1d96e
Author: Christopher Meng <i at cicku.me>
Date:   Mon Mar 2 07:58:13 2015 -0500

    Fix pretrans scriptlet, remove symlink underneath %_pkgdocdir

 httrack.spec | 46 ++++++++++++++++++++++++++++++++--------------
 1 file changed, 32 insertions(+), 14 deletions(-)
---
diff --git a/httrack.spec b/httrack.spec
index fe62260..92dd94a 100644
--- a/httrack.spec
+++ b/httrack.spec
@@ -87,8 +87,8 @@ make check -C tests
 
 %pretrans -p <lua>
 --[[Script below fixes some crufts introduced in httrack < 3.47.26-1, to
-cleanup file symlinks in old httrack packages.
-In the past it's a shell script it worked but another problem came in,
+cleanup wrong symlinks in old httrack packages.
+In the past it's a shell script, it worked but another problem came in,
 as if users are installing a fresh Fedora then they will fail at here.
 This is because coreutils is not installed in pretrans stage although
 fresh Fedora doesn't contain directory we want to remove.
@@ -98,17 +98,31 @@ https://fedoraproject.org/wiki/Packaging:Directory_Replacement
 require "os"
 require "posix"
 
-local path = "%{_datadir}/httrack/html"
-local st = posix.stat(path)
-if st and st.type == "directory" then
-  local status = os.rename(path, path .. ".rpmmoved")
-  if not status then
-    local suffix = 0
-    while not status do
-      suffix = suffix + 1
-      status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix)
+local path1 = "%{_datadir}/httrack/html"
+local st1 = posix.stat(path1)
+if st1 and st1.type == "directory" then
+  local status1 = os.rename(path1, path1..".rpmmoved")
+  if not status1 then
+    local suffix1 = 0
+    while not status1 do
+      suffix1 = suffix1 + 1
+      status1 = os.rename(path1..".rpmmoved", path1..".rpmmoved."..suffix1)
     end
-    os.rename(path, path .. ".rpmmoved")
+    os.rename(path1, path1..".rpmmoved")
+  end
+end
+
+local path2 = "%{_pkgdocdir}/html"
+local st2 = posix.stat(path2)
+if st2 and st2.type == "directory" then
+  local status2 = os.rename(path2, path2..".rpmmoved")
+  if not status2 then
+    local suffix2 = 0
+    while not status2 do
+      suffix2 = suffix2 + 1
+      status2 = os.rename(path2..".rpmmoved", path2..".rpmmoved."..suffix2)
+    end
+    os.rename(path2, path2..".rpmmoved")
   end
 end
 
@@ -126,9 +140,10 @@ fi
 %posttrans -p <lua>
 require "os"
 
-local path = "%{_datadir}/httrack/html"
+local path1 = "%{_datadir}/httrack/html"
+local path2 = "%{_pkgdocdir}/html"
 os.execute("gtk-update-icon-cache".." %{_datadir}/icons/hicolor ".."&>/dev/null ".."|| "..":")
-os.execute("rm ".." -fr".." "..path..".rpmmoved*")
+os.execute("rm".." -fr".." "..path1..".rpmmoved*".." "..path2..".rpmmoved*")
 
 %files
 # There is an unofficial but widespread french translation of gpl
@@ -160,6 +175,9 @@ os.execute("rm ".." -fr".." "..path..".rpmmoved*")
 %{_libdir}/libhttrack.so
 
 %changelog
+* Mon Mar 02 2015 Christopher Meng <rpm at cicku.me> - 3.48.20-2
+- Fix %%pretrans scriptlet bug again.
+
 * Tue Feb 24 2015 Christopher Meng <rpm at cicku.me> - 3.48.20-1
 - Update to 3.48.20
 - Fix %%pretrans scriptlet bug.


More information about the scm-commits mailing list