[packages/incron] patch to exclude backups from system dir

glen glen at pld-linux.org
Sun Oct 21 18:12:11 CEST 2012


commit 04655dbc27319976d1fe6e11f54226246bb19ebb
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Sun Oct 21 19:11:14 2012 +0300

    patch to exclude backups from system dir
    
    ignore in system incron.d some files: *~, *.rpmnew, *.rpmsave, ...
    
    however, seems systemdir processing itself is broken (before this patch
    as well)

 excludefiles.patch | 31 +++++++++++++++++++++++++++++++
 incron.spec        |  9 ++++++---
 2 files changed, 37 insertions(+), 3 deletions(-)
---
diff --git a/incron.spec b/incron.spec
index 75f7bae..a534e94 100644
--- a/incron.spec
+++ b/incron.spec
@@ -1,10 +1,11 @@
 # TODO:
-# - ignore in system incron.d some files: *~, *.rpmnew, *.rpmsave, ...
-# - directories for incrontab, and many other things
+# - troubles procssing files from /etc/incron.d:
+#   touch /etc/incron.d/ble
+#   haarber incrond[4025]: cannot create watch for system table ble: (2) No such file or directory
 Summary:	incron :: inotify cron system
 Name:		incron
 Version:	0.5.10
-Release:	3
+Release:	4
 License:	GPL v2
 Group:		Daemons
 Source0:	http://inotify.aiken.cz/download/incron/%{name}-%{version}.tar.bz2
@@ -17,6 +18,7 @@ Patch0:		%{name}-DESTDIR.patch
 Patch1:		%{name}-gcc47.patch
 Patch2:		%{name}-man_bugs.patch
 Patch3:		configdir.patch
+Patch4:		excludefiles.patch
 URL:		http://incron.aiken.cz/
 BuildRequires:	rpmbuild(macros) >= 1.644
 Requires:	systemd-units >= 38
@@ -45,6 +47,7 @@ rather than time periods.
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
+%patch4 -p1
 
 %build
 %{__make} \
diff --git a/excludefiles.patch b/excludefiles.patch
new file mode 100644
index 0000000..c191daf
--- /dev/null
+++ b/excludefiles.patch
@@ -0,0 +1,31 @@
+--- incron-0.5.10/usertable.cpp	2012-04-07 01:19:27.000000000 +0300
++++ incron-0.5.10.glen/usertable.cpp	2012-10-21 19:06:15.091453806 +0300
+@@ -177,6 +177,28 @@
+         g_fFinish = true;
+       }
+       else if (!e.GetName().empty()) {
++        const char *fn = e.GetName().c_str();
++        size_t len = strlen(fn);
++
++        /*
++         * skip file names beginning with "." or "#" to skip hidden files
++         */
++        if (fn[0] == '.' || fn[0] == '#') {
++          continue;
++        }
++
++        /* ignore files ending with '~' */
++        if (fn[len - 1] == '~') {
++          continue;
++        }
++
++        /* ignore *.rpmnew, *.rpmsave and *.rpmorig files */
++        if ((len > 7 && strstr(&fn[len - 7], ".rpmnew")) ||
++          (len > 8 && strstr(&fn[len - 8], ".rpmsave")) ||
++          (len > 8 && strstr(&fn[len - 8], ".rpmorig"))) {
++          continue;
++        }
++
+         SUT_MAP::iterator it = g_ut.find(IncronCfg::BuildPath(m_pSys->GetPath(), e.GetName()));
+         if (it != g_ut.end()) {
+           UserTable* pUt = (*it).second;
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/incron.git/commitdiff/04655dbc27319976d1fe6e11f54226246bb19ebb



More information about the pld-cvs-commit mailing list