ltib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ltib] Fix + Optimization when checking for updated source


From: Jehan Bing
Subject: [Ltib] Fix + Optimization when checking for updated source
Date: Wed, 21 Mar 2012 18:09:15 -0700
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120312 Thunderbird/11.0

Hi


Our ltib setup is currently this:
    package1/
    package2/
    ltib/
        rpm/
            BUILD/
                package1 -> ../../../package1
                package2 -> ../../../package2

because rpm/BUILD/packageX is a symbolic link, "find" returns immediately when checking if the source was changed and doesn't actually check the source. One option is to add a / at the end of the directory name ("find $src_dir/ ..."). But there could also be symlinks inside the directory pointing outside tree so I think use "-L" to follow _all_ symlinks is a better idea (though it can slow down the check quite a bit if the symlink points to a big directory)

Also, find will search for _all_ the files that are newer than the rpm but knowing that one file at least changed is enough and checking the rest is just useless processing. So find should use the "-quit" parameter to stop the search as soon as one file is found.

Patch attached.

Cheers,
    Jehan


diff --git a/ltib b/ltib
index 10134a7..9f66282 100755
--- a/ltib
+++ b/ltib
@@ -904,7 +904,7 @@ TXT
die("'$src_dir' doesn't exist\n") unless -e $src_dir;
                     }
                     # See if the source tree has been touched
-                    $cmd = "find $src_dir -newer $rpms[0] -print";
+                    $cmd = "find -L $src_dir -newer $rpms[0] -print -quit";
                     print "checking if sources have been updated: ";
                     if(`$cmd`) {
                         print "yes\n";





reply via email to

[Prev in Thread] Current Thread [Next in Thread]