Dependency Finder – A Use Case for ElectricAccelerator Annotation Files

A colleague recently asked if there was a way to identify all the source files that went into building a target, i.e. a way to programmatically determine all dependencies for a specific target. The use case my colleague presented was that this list of sources will allow his customer to identify open source files or files that correspond to packages with specific licensing terms.

This is not necessarily the same thing as listing all source files used in the build but instead only specific ones that were read for the purpose of building the specific target. For example, in a full build, we may only be interested in source files that produced an intermediate target which might be a library or a package which eventually got integrated into the final product.

In ElectricAccelerator, this is made possible by two technologies: (1) the ability to generate annotation file for each build and (2) the ability to programmatically dissect this annotation file easily via the “annolib” Tcl package.

You can read about both of those in this blog post by Eric Melski: Data Mining ElectricAccelerator Annotation: Bill of Materials.

The algorithm used to develop the solution looked like this:

1. Find the job(s) that wrote the target file –> [$anno file operations] 2. Find the files read by that job. –> [$anno job operations] 3. Find the jobs that wrote those files –> [$anno file operations] again.
4. Find the files read by those jobs –> [$anno job operations] again.
5. Repeat until you’ve checked every job that precedes the original job in serial order.

Nominally, every file that was read by any job in that set could be considered an “input”, either directly or indirectly.

The resulting Tcl script is available on Electric Cloud’s GitHub community called “electriccommunity” in the public repository called “electricaccelerator” in the folder called “dependencyFinder”.

Usage:
dependencyFinder.tcl <annotation_xml_file> <target_file>

Example:
./dependencyFinder.tcl einsight.demonstration.xml c:/mysql/mysql-4.1.22/sql/mysqld.exe

A demonstration XML file “einsight.demonstration.xml” is provided in the .7z (zipped) format on GitHub’s “dependencyFinder” folder.

Here is the response a user is expected to see:

Adeel Malik

Adeel Malik is the Manager of Professional Services team. He works with customers to scope services engagements as well as implement solutions and mentor customers on Electric Cloud products. He brings over 10 years of experience in test and test automation. Prior to joining Electric Cloud, Adeel served as Professional Services Engineer and Solutions Engineer at The Fanfare Group. Adeel holds a Bachelor of Science degree in Computer Engineering from Rensselaer Polytechnic Institute.

Share this:

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe

Subscribe via RSS
Click here to subscribe to the Electric Cloud Blog via RSS

Subscribe to Blog via Email
Enter your email address to subscribe to this blog and receive notifications of new posts by email.