Create a Nightly Build Snapshot achive using svn, tar


This probably gonna be a bash shell script run with cron once a day.

The situation would be:
1) Run a svn update (svn update directoryname)
2) Check for svn log for revision or doing md5sum to check whether there's a changes to the current copy against the svn revision or not.
3) If got some changes or updates, remove the .svn directory (find directoryname -name .svn -exec rm -rf {} \;) and archive it into .tar.gz or .zip
4) The archive filename should be in format of revision_number-day-month-year.tar.gz or

The hosted file will be mirrored on different server from the svn server.

Thank you in advance.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sounds like homework, could you pleas post what you've done so far and where you encounter problems
daniazAuthor Commented:
Nope, it's not a homework.

I would love to make a Nightly Build for some package in tar or zip like other OpenSource Nightly Builds package.

Probably there's room for improvement :)

date=`date +%Y-%m-%d`

# SVN checkout
svn co http://localhost trunk

# Archival snapshot
OLD=`svn info branch | grep -r Revision | cut -f 2 -d " "`

# Current development
NEW=`svn info trunk | grep -r Revision | cut -f 2 -d " "`

# Compare for OLD and NEW file
if [ $NEW -gt $OLD ] ; then

        # I wish there's another way to do this
        rm -rf branch tags
        cp -r trunk branch
        cp -r trunk tags

        # Recursively remove all .svn directories
        find tags -name .svn -print0 | xargs -0 rm -rf

        # Create Archive
        tar czf file-revision-$NEW-$date.tar.gz tags
        echo "New revision available"
        echo "No new revision available"

Thank you in advance.
daniazAuthor Commented:
I forgot to mention that the 'branch' directory already been checkout earlier for comparison purpose.
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

ok, and what is the problem now?
daniazAuthor Commented:
Well it's a working code.

But is there any other way, to check for newest revision and compare with the existing copy without removing the directory. My process of comparing 'update' copy and existing is using svn log HEAD and 3 copies of the source instead of using md5sum to compare.

        rm -rf branch tags
        cp -r trunk branch
        cp -r trunk tags

I have to create 3 different folder. trunk is for the newest copy, branch is a copy from previous and tags is without .svn.  Is there any other way to do this that can achive the same result?

Is this how Opensource project do Nightly Builds?
aha, I understand
sorry have no svn handey, but can you not check the date of a checked in delta with cvn?

Or simple use find on the files of svn's repository like
  find /path/to/repository -newer /path/to/timestamp -print  && touch  /path/to/timestamp
daniazAuthor Commented:
Comparing new files with old files using svn log head is far much more better than timestamp afaik.
Well I guess I have to live with it, having 3 working directory for doing the process.
Closed, 500 points refunded.
The Experts Exchange
Community Support Moderator of all Ages

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux OS Dev

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.