I need to create a cron job on my Linux machine to automatically check for new versions of some system-critical software that is maintained via Subversion. I already did the checkout so now I’d just need to update the local copy of the source code and build from the latest versions periodically with a cron script.
Hence is the question, is there an easy way of determining whether a new version of the software has appeared in the local repository, probably having the option of choosing to look into either branches or tags subdirectory, as well as getting the path to the subdirectory with the latest version (within either branches or tags), maybe also applying a custom keyword, for example, “secur” to filter out any non-security updates?
You can write a script which calls
svn infoand parses out the revision and/or timestamps to determine if there has been an update. Example output:You could easily include a branch/tag in the URL, and use the
-Rswitch to get a list of paths underneath those. From there, you could loop through the first-level paths and check the revision of each to determine if there’s a new one. Notice the output contains comments, last changed timestamp, revision and node kind; that should be everything you need to get your script working.