Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic SYNERGY (steve huntington)
Decrease font size
Increase font size
Topic Title: Recursive query for contents of directory
Topic Summary: Recursive query for contents of directory
Created On: 20-Jan-2005 16:26
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 20-Jan-2005 16:26
User is offline View Users Profile Print this message


Leslie Larsen

Posts: 9
Joined: 24-Feb-2004

Hello all,

I'm interested in finding out if there is a recursive query much like "recursive_is_memeber_of", but for a directory structure instead of a project structure. I need a listing of the contents of one project directory (with many subdirectories), and the "is_child_of('obj_name','projname-version')", is not sufficient.

Does such a query exist? It seems like it would be a basic thing, but I haven't found any documentation on it.

Thanks!
L.Larsen
Report this to a Moderator Report this to a Moderator
 18-Feb-2005 16:19
User is offline View Users Profile Print this message


Brenda Beagi

Posts: 2
Joined: 17-Feb-2005

Hi,

I build up the directory structure by performing a "ccm export" on the project and then using Unix commands to extract all the parent child relations from the "bindings" files created on the "ccm export".

Of course I'm using the "ccm export" command in a manner other that what it was intended for, but it gets the job done.  

NOTE: I've had trouble with the recursive feature of "ccm export" not recursing down into projects that are subprojects of other projects, so I collect a list of all the "projects" of my main project and then spin off the collection of parent-child relations (structures of object) in each project so that they all run simultaneously and then collect the results at the end.

Finding all my projects/subprojects:
ccm query -u -type project -version $VER -f "%name,%version" > $TMP_FILE_ALL_PROJECTS

Separate logic that I simultaneous run all the projects/subprojects through to collect the parent-child releations:
         ccm export -t ${TARGET_PROJ_DIR} -p $TARGET_PROJECT > /dev/null; echo $? | read EXPORT_RESULT
         if [ "$EXPORT_RESULT" != "0" ]
         then
            echo "EXPORT_RESULT=$EXPORT_RESULT" >> $TARGET_FILE.export_failure
         fi

         ### The "ccm export" has created one binding file per project/subproject.
         ### The script uses those binding_files to formulate the each "parent child" relationships
         ### for the directory structure of the project and then pieces them together.

         ### Find all parent/child relationships for the target project.
         ### WARNING: Tab in logic below
         grep -E 'child|parent' ${TARGET_PROJ_DIR}/*/bindings \
            | sed -e "s/       //g" | sed -e "s/ //g" | sed -e "s/.*>://g" | paste -s -d" \n" - \
            | sed -e "s/\//:/g" > $PROJ_ALL_SETS_FILE

         ### Segregate all the parent/child relationships for the "dir to project" or
         ### "project to dir" sets.
         grep -e " .*roject:.*:.*$" -e " .*ir:.*:.*$" $PROJ_ALL_SETS_FILE \
                > $PROJ_DIR_SETS_FILE

         ### Segregate all the parent/child relationships for the "dir/project to source object" sets.
         grep -v " .*roject:.*:.*$"  $PROJ_ALL_SETS_FILE | grep -v " .*ir:.*:.*$" \
                > $PROJ_OBJ_SETS_FILE

         ### So as not to max out the space on the tmp directory,
         ### clean up all the directories/files created by the "ccm export" immediately.
         nohup rm -rf $PROJ_ALL_SETS_FILE $TARGET_PROJ_DIR/1* $TARGET_PROJ_DIR/2* $TARGET_PROJ_DIR/3* $TARGET_PROJ_DIR/4* $TARGET_PROJ_DIR/5* $TARGET_PROJ_DIR/6* $TARGET_PROJ_DIR/7* $TARGET_PROJ_DIR/8* $TARGET_PROJ_DIR/9* > /dev/null 2>&1 &

I hope this is helpful to you.

Good Luck,
Brenda Beagi

Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic SYNERGY forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 15:34.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.