Hi,

I added a small function to make oscar-packager a little more convenient and 
efficient.

Previously there is no way to specify a certain package to build only the 
specified one.
By using the --included, --core, or --all option with the specific package 
name, we can build only that package.

e.g., )
oscar-packager --included openmpi unstable

Of course, if there is no package specified in the option, it would do the 
exactly same thing as it has done previously.

I hope that this is a little helpful to others.

Regards,

--
- DongInn

On Mar 8, 2013, at 1:00 PM, di...@cs.indiana.edu wrote:

> Author: dikim
> Date: 2013-03-08 13:00:00 EST (Fri, 08 Mar 2013)
> New Revision: 9683
> URL: https://svn.oscar.openclustergroup.org/trac/oscar/changeset/9683
> 
> Log:
> Add a subroutine to make oscar-packager a little more convenient and 
> efficient.
> 
> Text files modified: 
>   trunk/lib/OSCAR/ConfigFile.pm |    34 ++++++++++++++++++++++++++++++++++    
>   
>   1 files changed, 34 insertions(+), 0 deletions(-)
> 
> Modified: trunk/lib/OSCAR/ConfigFile.pm
> ==============================================================================
> --- trunk/lib/OSCAR/ConfigFile.pm     Fri Mar  8 12:59:04 2013        (r9682)
> +++ trunk/lib/OSCAR/ConfigFile.pm     2013-03-08 13:00:00 EST (Fri, 08 Mar 
> 2013)      (r9683)
> @@ -5,6 +5,10 @@
> #                         Oak Ridge National Laboratory
> #                         All rights reserved.
> #
> +# Copyright (c) 2013 Indiana University Bloomington
> +#                    DongInn Kim <di...@cs.indiana.edu>
> +#                    All rights reserved.
> +#
> #   $Id$
> #
> #   This program is free software; you can redistribute it and/or modify
> @@ -46,6 +50,7 @@
> @EXPORT = qw(
>             get_all_values
>             get_block_list
> +            get_list_values
>             get_value
>             set_value
>             );
> @@ -122,6 +127,35 @@
>     return @final_blocks;
> }
> 
> +# Return the hash list of blocks and sources within a config file.
> +#
> +# Input: the path to the config file to parse and the key value in a config 
> file.
> +# Return: a hash  with blocks' names and sources or undef if no blocks or 
> errors.
> +sub get_list_values ($$){
> +    my ($config_file, $key) = @_;
> +
> +    if (! -f $config_file) {
> +        carp "ERROR: the config file ($config_file) does not exist";
> +        return undef;
> +    }
> +
> +    my $list_blocks = `grep '\\[' $config_file`;
> +
> +    my @blocks = split ("\n", $list_blocks);
> +    my %final_blocks = ();
> +    for (my $i=0; $i < scalar(@blocks); $i++) {
> +        if (!OSCAR::Utils::is_a_valid_string ($blocks[$i]) 
> +            || OSCAR::Utils::is_a_comment($blocks[$i])) {
> +            next;
> +        }
> +        $blocks[$i] =~ s/\[//g;
> +        $blocks[$i] =~ s/\]//g;
> +        $final_blocks{$blocks[$i]} = get_value($config_file, $blocks[$i], 
> $key); 
> +    }
> +    return %final_blocks;
> +}
> +
> +
> # Return: 0 if success, -1 else.
> sub set_value ($$$$) {
>     my ($config_file, $block, $key, $value) = @_;
> 
> ------------------------------------------------------------------------------
> Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
> Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
> endpoint security space. For insight on selecting the right partner to 
> tackle endpoint security challenges, access the full report. 
> http://p.sf.net/sfu/symantec-dev2dev
> _______________________________________________
> Oscar-checkins mailing list
> oscar-check...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oscar-checkins

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
Oscar-devel mailing list
Oscar-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oscar-devel

Reply via email to