Skip to content

Commit

Permalink
Fix memd_creation file input and output paths
Browse files Browse the repository at this point in the history
Change-Id: Ie1147e0b44263a1a75b999b099bbcb131d287c35
CQ:SW406277
CMVC-Coreq:1037546
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/48958
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Tested-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
cvswen authored and dcrowell77 committed Oct 30, 2017
1 parent 8b06214 commit 887d17b
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/build/buildpnor/memd_creation.pl
Expand Up @@ -43,20 +43,35 @@

my $memd_dir = "";
my $memd_output = "";
my @memd_files = "";
my $help = 0;
my $man = 0;

GetOptions(
"memd_dir=s" => \$memd_dir,
"memd_output=s" => \$memd_output,
"memd_files=s" => \@memd_files,
"help" => \$help,
"man" => \$man) || pod2usage(-verbose=>0);

# The remaining parms will be memd files
push(@memd_files,@ARGV);

pod2usage(-verbose => 1) if $help;
pod2usage(-verbose => 2) if $man;

# Find files
my @memd_files = glob($memd_dir . '/*');
if($memd_dir)
{
print "Reading files from $memd_dir\n";
@memd_files = glob($memd_dir . '/*');
}
elsif(@memd_files)
{
# Remove the empty first element
shift(@memd_files);
print "Reading memd files @memd_files\n";
}

# Get the max file size - offset for each file binary
my $max_file_size = 0;
Expand Down Expand Up @@ -115,13 +130,12 @@
}

# Removing the first byte of the MEMD binary
my $new_file = "$memd_dir/edited_memd.dat";
my $new_file = File::Basename::basename "$file.tmp";
run_command("tail -c +2 $file > $new_file");
run_command("mv $new_file $file");

seek($fh, $offset, 0);
print "Writing the file $file...\n";
open(my $in_file, '<', $file) or die "Could not open file '$file' $!";
print "Writing the file $new_file...\n";
open(my $in_file, '<', $new_file) or die "Could not open file '$new_file' $!";

while ( <$in_file> )
{
Expand Down

0 comments on commit 887d17b

Please sign in to comment.