Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 433
  • Last Modified:

Create a Nightly Build Snapshot achive using svn, tar

Hi,

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  revision_number-day-month-year.zip

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

Thank you in advance.
0
daniaz
Asked:
daniaz
  • 4
  • 3
1 Solution
 
ahoffmannCommented:
sounds like homework, could you pleas post what you've done so far and where you encounter problems
0
 
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 :)

#!/bin/bash
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"
else
        echo "No new revision available"
fi

Thank you in advance.
0
 
daniazAuthor Commented:
I forgot to mention that the 'branch' directory already been checkout earlier for comparison purpose.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
ahoffmannCommented:
ok, and what is the problem now?
0
 
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?
0
 
ahoffmannCommented:
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
0
 
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.
0
 
GranModCommented:
Closed, 500 points refunded.
GranMod
The Experts Exchange
Community Support Moderator of all Ages
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now