[httrack/f21] Update to 3.48.20 Enhance %pretrans script

Christopher Meng cicku at fedoraproject.org
Fri Feb 27 09:48:55 UTC 2015


commit 4e8ee9bee22ee5525040dd95481096bd973611f6
Author: Christopher Meng <i at cicku.me>
Date:   Fri Feb 27 17:47:53 2015 +0800

    Update to 3.48.20
    Enhance %pretrans script

 .gitignore   |  1 +
 httrack.spec | 83 ++++++++++++++++++++++++++++++++++++++++++------------------
 sources      |  2 +-
 3 files changed, 61 insertions(+), 25 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 9d97248..e0e65c0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,4 @@ httrack-3.43-9C.tar.gz
 /httrack-3.48.17.tar.gz
 /httrack-3.48.18.tar.gz
 /httrack-3.48.19.tar.gz
+/httrack-3.48.20.tar.gz
diff --git a/httrack.spec b/httrack.spec
index f5554ac..fe62260 100644
--- a/httrack.spec
+++ b/httrack.spec
@@ -1,6 +1,6 @@
 Name:           httrack
-Version:        3.48.19
-Release:        3%{?dist}
+Version:        3.48.20
+Release:        1%{?dist}
 Summary:        Website copier and offline browser
 License:        GPLv2+
 URL:            http://www.httrack.com
@@ -38,37 +38,41 @@ iconv --from-code ISO8859-1 --to-code UTF-8 ./html/contact.html \
   --output contact.utf-8 && mv contact.utf-8 ./html/contact.html
 
 %build
-%configure --disable-static --disable-online-unit-tests
+%configure  --disable-static \
+            --disable-online-unit-tests \
+            --htmldir=%{_pkgdocdir}/html
+
 # Remove rpaths.
 rm -f ./libtool
 cp %{_bindir}/libtool .
 
 # Omit unused direct shared library dependencies.
-sed --in-place --expression 's! -shared ! -Wl,--as-needed\0!g' libtool
+sed -i -e 's! -shared ! -Wl,--as-needed\0!g' libtool
 
 %make_build
 
 %install
 %make_install
 
+# Remove static libraries.
 find %{buildroot} -type f -name "*.*a" -delete -print
 
-# Remove unnecessary dynamic libraries from %%{_libdir}/httrack.
+# Remove unnecessary dynamic libraries from %%{_libdir}/httrack. These come
+# from libtest, just a sample project from upstream.
 rm -frv %{buildroot}%{_libdir}/%{name}
 
 # Use %%doc instead.
-rm -frv %{buildroot}%{_docdir}/%{name}
+find %{buildroot}%{_pkgdocdir}/html -type f -name "*.txt" -delete -print
 
 # Move libtest and templates from %%{_datadir}/httrack to RPM_BUILD_DIR.
 # To be later listed against %%doc.
-rm -rf ./libtest ./templates
+rm -frv libtest templates
 mv %{buildroot}%{_datadir}/%{name}/libtest .
 mv %{buildroot}%{_datadir}/%{name}/templates .
 
-# We need to have a copy of html in %%{_datadir}/httrack.
-# The other is to be listed against %%doc.
-rm -rf ./html
-cp -ar %{buildroot}%{_datadir}/%{name}/html .
+# Use %%license here since Fedora 21 to install license texts.
+# Thus duplicates should be dropped.
+rm -frv %{buildroot}%{_pkgdocdir}/license.txt
 
 desktop-file-install --delete-original \
   --dir %{buildroot}%{_datadir}/applications \
@@ -79,15 +83,34 @@ desktop-file-install --delete-original \
   %{buildroot}%{_datadir}/applications/WebHTTrack-Websites.desktop
 
 %check
-make -C tests/ check
-
-%pretrans
-if [ $1 = 0 ]; then
-	# workaround rpm bug (replacing directory with symlink fails)
-	[ ! -h %{_datadir}/%{name}/html -a -d %{_datadir}/%{name}/html ] && \
-		rm -rf %{_datadir}/%{name}/html
-	exit 0
-fi
+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,
+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.
+
+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)
+    end
+    os.rename(path, path .. ".rpmmoved")
+  end
+end
 
 %post
 /sbin/ldconfig
@@ -100,12 +123,20 @@ if [ $1 -eq 0 ] ; then
     gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
 fi
 
-%posttrans
-gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
+%posttrans -p <lua>
+require "os"
+
+local path = "%{_datadir}/httrack/html"
+os.execute("gtk-update-icon-cache".." %{_datadir}/icons/hicolor ".."&>/dev/null ".."|| "..":")
+os.execute("rm ".." -fr".." "..path..".rpmmoved*")
 
 %files
-%doc AUTHORS COPYING README *.txt
-%doc html %{name}-doc.html templates
+# There is an unofficial but widespread french translation of gpl
+# text(gpl-fr.txt) shipped in the tarball from upstream, I decide to exclude it
+# per http://www.gnu.org/licenses/translations.html
+%doc AUTHORS README greetings.txt history.txt
+%doc %{name}-doc.html templates
+%license COPYING license.txt
 %{_bindir}/htsserver
 %{_bindir}/%{name}
 %{_bindir}/proxytrack
@@ -129,6 +160,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
 %{_libdir}/libhttrack.so
 
 %changelog
+* Tue Feb 24 2015 Christopher Meng <rpm at cicku.me> - 3.48.20-1
+- Update to 3.48.20
+- Fix %%pretrans scriptlet bug.
+
 * Sat Aug 16 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 3.48.19-3
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
 
diff --git a/sources b/sources
index c8d6f52..0d782d8 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-db07a1a3e41eff1123606c444f8f267d  httrack-3.48.19.tar.gz
+de70fde68f2322d0b572cb52ca0ffe12  httrack-3.48.20.tar.gz


More information about the scm-commits mailing list