Friday, November 27, 2009

Creating iso image using mkisofs

An ISO image is an archive file (disk image) of an optical disc using a conventional ISO (International Organization for Standardization) format. ISO image files typically have a file extension of .ISO. The name "ISO" is taken from the ISO 9660 file system used with CD-ROM media, but an ISO image can also contain UDF file system because UDF is backward-compatible to ISO 9660.

mkisofs is effectively a pre-mastering program to generate the iso9660 filesystem - it takes a snapshot of a given directory tree, and generates a binary image which will correspond to an iso9660 filesystem when written to a block device.

Here is an example of mkisofs usage ..

mkisofs -r -J -l -d -allow-multidot -allow-leading-dots -hide-rr-moved -disable-deep-relocation -V "EPM-1.1-LINUX-x86_64" -o epm-linux-x86_64.iso Disk1/

where
-r, -rational-rock Generate rationalized Rock Ridge directory information
-J, -joliet Generate Joliet directory information
-l, -full-iso9660-filenames Allow full 31 character filenames for ISO9660 names
-d, -omit-period Omit trailing periods from filenames (violates ISO9660)
-allow-multidot Allow more than one dot in filenames (e.g. .tar.gz) (violates ISO9660)
-allow-leading-dots Allow ISO9660 filenames to start with '.' (violates ISO9660)
-hide-rr-moved Rename RR_MOVED to .rr_moved in Rock Ridge tree
-D, -disable-deep-relocation
Disable deep directory relocation (violates ISO9660)
-V ID, -volid ID Set Volume ID
-o FILE, -output FILE Set output file name


How to mount an ISO image under linux?
mount -o loop -t iso9660 iso-name.iso /mountpoint

Tuesday, November 24, 2009

0509-036 Cannot load program ssh because of the following errors: Dependent module /usr/local/ssl/lib/libcrypto.a(libcrypto.so) could not be loaded.

I installed openssh without any problem, but when I invoked either ssh/sshd, it started giving error ..

> ssh
exec(): 0509-036 Cannot load program ssh because of the following errors:
0509-150 Dependent module /usr/local/ssl/lib/libcrypto.a(libcrypto.so) could not be loaded.
0509-152 Member libcrypto.so is not found in archive

Initially I thought it is openssl version mismatch and re-installed forcefully openssh from rpm, but it didn't solve this problem.

Later I thought of analyzing library /usr/local/ssl/lib/libcrypto.a
Step 1) Copy the libcrypto.a to a temporary directory
Step 2) Extract files in the archive libcrypto.a
ar -xv ./libcrypto.a
Step 3) ls
libcrypto.a libcrypto.so.0 libcrypto.so.0.9.7
I found here that there is no shared library named libcrypto.so. So I thought of creating one
Step 4) cp libcrypto.so.0 libcrypto.so
Step 5) ls
libcrypto.a libcrypto.so libcrypto.so.0 libcrypto.so.0.9.7
Step 6) Append the newly created library libcrypto.so to archive libcrypto.a
ar -qv ./libcrypto.a libcrypto.so
Step 7) copy the newly created archive to desired location
cp ./libcrypto.a /usr/local/ssl/lib/libcrypto.a

Thats it .... my problem got fixed
> ssh
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-e escape_char] [-F configfile]
[-i identity_file] [-L [bind_address:]port:host:hostport]
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
[-R [bind_address:]port:host:hostport] [-S ctl_path]
[-w local_tun[:remote_tun]] [user@]hostname [command]

Thursday, November 5, 2009

Tweak single instance of tinderbox to work on two different perforce servers

Tinderbox is a tool developed by Mozilla, which collects build logs and presents the logs and the result it in a nice, clear and concise way.

But one instance of tinderbox works with one SCM system. In our organization, we have 2 different perforce servers, but we don't want to have two different tinderbox installations for 2 different perforce servers. To make one instance of tinderbox to work on two different perforce servers, following tweak needs to be done Tinderbox code.

File 1: tb_code/lib/TinderDB/VC_Perforce.pm
Add following lines

936a937,942
> if ($filespec =~ /RKM/) { #Here RKM is the depot name, whose p4 server is different
> $ENV{'P4PORT'} = $TinderConfig::RKM_PERFORCE_PORT;
> $ENV{'P4USER'} = $TinderConfig::RKM_PERFORCE_USER;
> $ENV{'P4PASSWD'} = $TinderConfig::RKM_PERFORCE_PASSWD;
> }
>


File 2: tb_code/local_conf/TinderConfig.pm
Add the following lines
62a63,66
> #RKM Perforce variables
> $RKM_PERFORCE_PORT="perforce:1777";
> $RKM_PERFORCE_USER="p4id";
> $RKM_PERFORCE_PASSWD="xxxxxx";

Basically we are defining different set of perforce variables in File2 and making File 1 to use it matching a depot in the alternative perforce server

Wednesday, November 4, 2009

AIX: make: 1254-055 Dependency line needs colon or double

We get this compilation issue "make: 1254-055 Dependency line needs colon or double" while compiling C/C++ code in AIX machines.

It occurs if Makefile written in gmake format and then using native AIX make to compile it.

It can be resolved by installing gmake on AIX machine and then using it to compile.

We can verify whether the installed make is gmake or not by running 'make -v' to find out. If it's GNU, you'll know based on the output. If it gives you an error, then it's not GNU make.

-bash-3.00$ /usr/local/bin/make -v
GNU Make 3.80
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This is GNU Make



-bash-3.00$ make -v
make: Not a recognized flag: v
usage: make [-eiknqrst] [-k|-S] [-d[A|adg[1|2]msv]] [-D variable] [-f makefile ] [-j [jobs]] [variable=value ...] [target ...]

This is not GNU make.

Monday, November 2, 2009

Posting a JIRA bug using Perl Mechanize

Perl provides modules which can be used as command line browser to automate tasks dependent on web pages. Among them LWP and mechanize are important ones. Mechanize is latest module with more features compared to LWP.
Recently I wrote a perl script to integrate a perl tool with JIRA bug tracking tool using mechanize, I just want to document here about mechanize usage with JIRA.
Basically this perl script post a bug in Jira after authentication

#!/usr/bin/perl -w
use WWW::Mechanize;
use HTTP::Cookies;
$mech = WWW::Mechanize->new();

# Authenticate to Jira and get a cookie back for the subsequent post.
$root_uri = "http://your-jira-site.com";

$mech->cookie_jar(HTTP::Cookies->new()); # Don't write cookies to file!
$mech->get($root_uri);
#login to Jira
$mech->form_name('loginform');
$mech->field(os_username => $jira_id);
$mech->field(os_password => $jira_pass);
$mech->click();
my $response = $mech->content();
if ($response !~ m/Dashboard for (\w+) (\w+)/) {
print_error("Failed to add new bug: authentication failed. Below you might find a clue as to what happened.");
print_error("
");
print_error($response);
return;
} else {
$username="$1 $2";
}



print "

creating new Jira bug ...

\n";
my $show_uri = "$root_uri/browse";
# Go to Product page in Jira
$mech->follow_link(text => "$product", n => 1);
#Browse to create new issue form
$mech->follow_link(text => "Create a new issue in project $product", n => 1);
$mech->form_name('jiraform');
$mech->click();

#Create a new bug
$mech->form_name('jiraform');
$mech->field(summary => "$formdata{hotfix}: $formdata{bugtitle}");
$mech->field(components => "$components_map{\"$formdata{component}\"}");
$mech->field(customfield_10044 => "$formdata{platform}"); #OS/Platform
$mech->field(customfield_10054 => "moderate"); #Bug severity
$mech->field(assignee => "$jira_id");
$mech->field(description => "$comment");
$mech->field(customfield_10067 => "$_[0]"); #Found in Version
$mech->field(customfield_10007 => "All"); #Appserver
$mech->field(customfield_10060 => "Support request (CE_Assistance)"); #Type of defect
$mech->field(customfield_10020 => "CS - other"); #Discovered by function
$mech->field(customfield_10019 => "Use in production "); #Discovered by activity
$mech->click();
print "

  posting bug ...\n";
$response = $mech->content();
my $bz_msg;
my $bug_number;
if ($response =~ m/Key:.*?browse\/(\w+)-(\w+)/s) {
$bug_number = "$1-$2";
print "done

\n";
$bz_msg = "

Bug #$bug_number for version $_[0] has been posted to " . "Jira.

\n";
print "$bz_msg";
$bz_donemsg .= $bz_msg;
} else {
$bz_donemsg .= "

No Jira bug was filed for version $_[0]. This will need to be done manually.

\n";
print_error("Failed to add new bug (Jira output follows):\n$response");
}



Reference: http://www.ibm.com/developerworks/linux/library/wa-perlsecure.html