Perl/ClearCase Programming With an emphasis on UNIX/Windows interoperation David Boyce.

Slides:



Advertisements
Similar presentations
COP 3530 JDK Environment Variables. COP 3530 JDK Environment Variables Environment Variables Environment variables are a set of dynamic values that can.
Advertisements

1 CS345 Operating Systems Φροντιστήριο Άσκησης 1.
Perl/ClearCase Programming With an emphasis on UNIX/Windows interoperation David Boyce BMRCCUG 9/25/2001.
LINUX-WINDOWS INTERACTION. One software allowing interaction between Linux and Windows is WINE. Wine allows Linux users to load Windows programs while.
Lecture 2 Shell environment I: - command line interface & basic commands; - directories & files; - standard I/O & file descriptors; CSE4251 The Unix Programming.
Managing User Settings with Group Policy
Find Command Characteristics –Locate files descending from multiple starting points –Employs regular expressions Examples On entire system: >find / -name.
CS 497C – Introduction to UNIX Lecture 22: - The Shell Chin-Chih Chang
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
Linux+ Guide to Linux Certification, Second Edition
Shell Basics CS465 - Unix. Shell Basics Shells provide: –Command interpretation –Multiple commands on a single line –Expansion of wildcard filenames –Redirection.
23-Jun-15Advanced Programming Spring 2002 bash Henning Schulzrinne Department of Computer Science Columbia University.
Guide To UNIX Using Linux Third Edition
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
The Basic Tools Presented by: Robert E., & Jonathan Chase.
DEiXTo.
Julie McEnery1 Installing the ScienceTools The release manager automatically compiles each release of the Science Tools, it creates a set of wrapper scripts.
2 $ command Command Line Options ls –a –l hello hi Command Arguments.
7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE1 Unix Comp-145 C HAPTER 2.
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
Agenda  Terminal Handling in Unix File Descriptors Opening/Assigning & Closing Sockets Types of Sockets – Internal(Local) vs. Network(Internet) Programming.
Introduction to Shell Script Programming
Portable perl How to write code that will work everywhere.
University of Maryland parseThat: A Robust Arbitrary-Binary Tester for Dyninst Ray Chen.
Process Management. Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication.
– Introduction to the Shell 10/1/2015 Introduction to the Shell – Session Introduction to the Shell – Session 2 · Permissions · Users.
An Introduction to Unix Shell Scripting
Linux Shell Programming Tutorial 3 ENGR 3950U / CSCI 3020U Operating Systems Instructor: Dr. Kamran Sartipi.
Introduction to Programming the WWW I CMSC Summer 2004 Lecture 6.
Computer Programming for Biologists Oct 30 th – Dec 11 th, 2014 Karsten Hokamp  Fill out.
Managing User Desktops with Group Policy
FTP Server and FTP Commands By Nanda Ganesan, Ph.D. © Nanda Ganesan, All Rights Reserved.
Module 6: Configuring User Environments Using Group Policy.
Linux+ Guide to Linux Certification, Third Edition
UNIX Commands. Why UNIX Commands Are Noninteractive Command may take input from the output of another command (filters). May be scheduled to run at specific.
1 Week 2 The Crunchy Shell to the Soft and Chewy Kernel… Sarah Diesburg 8/3/2010 COP4610 / CGS5765.
Real-time multimedia and communication in packet networks Asterisk AGI and Manager Interface.
Shell Advanced Features. Module 8 Shell Advanced Features ♦ Introduction In Linux systems, the shells are often referred to as command line interfaces.
CSC 360- Instructor: K. Wu Interfaces to OS Services.
Chapter Twelve sed, awk & perl1 System Programming sed, awk & perl.
Chapter Six Introduction to Shell Script Programming.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
File and Folder CLI Commands 12/24/ Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.
ClearQuest XML Server with ClearCase Integration Northwest Rational User’s Group February 22, 2007 Frank Scholz Casey Stewart
CSCI 330 UNIX and Network Programming Unit III Shell, Part 1.
UNIX Review CS 2204 Class meeting 15. (C) S. S. Gifford, Virginia Tech, Study Hints You should have: Read all required material Finished all labs.
Chapter 16 Advanced Bourne Shell Programming. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. Objectives To discuss numeric data processing.
Linux Administration Working with the BASH Shell.
Rexx for Shell Scripting or “We don't need no stinkin' bashes...”
Implementation of a simple shell, xssh
Prof. Bhushan Trivedi Director GLS Institute of Computer Technology
Chapter 4: Threads.
C-Shell with Functions
UNIX Review CS 2204 Class meeting 15.
Shell Features CSCI N321 – System and Network Administration
Implementation of a simple shell, xssh (Section 1 version)
Bash Introduction (adapted from chapters 1 and 2 of bash Cookbook by Albing, Vossing, & Newham) CPTE 440 John Beckett.
CST8177 sed The Stream Editor.
Implementation of a simple shell, xssh
Esencia Technologies Inc.
Running external programs
Process Management Presented By Aditya Gupta Assistant Professor
CSC1018F: Functional Programming
Introduction to Programming the WWW I
Bash 101 Intro to Shell Scripting; Lightning
John Carelli, Instructor Kutztown University
David Boyce David Darby
Module 4 Command Line Skills
CST8177 Scripting 2: What?.
Chapter 3 The UNIX Shells
Presentation transcript:

Perl/ClearCase Programming With an emphasis on UNIX/Windows interoperation David Boyce

General Notes Me Focus: Scripting vs Programming Portability vs Interoperability Perl vs Java (philosophy)

Sharing modules Make use of SMB symlink translation Must be on UNIX/Samba/TAS/NAS Some SMB’s require symlink switch Even WIN32 binary modules work Share /usr/local/bin (\\server\ulb)\\server\ulb or /usr/local (\\server\local).\\server\local All maintenance from UNIX.

A Co-Operating Win32 Perl ClearCase bundled perl (ccperl) Local-only WIN32 build Local with network modules Networked standard build Networked ActiveState build

Sharing and executing scripts Choices: executing scripts on Windows Register the.pl/.plx extension Use pl2bat Use a off \\server\perl\bin\perl \\server\ulb\whence %* Local.bat, remote/shared perl script (ulb) Use perl’s bin directory UNC path entries must be user and at end

Trigger Definition % ct lstype -l trtype:mkelem_post trigger type "mkelem_post" 02-Aug-99.18:35:01 by [VOB Admin] owner: vobadm group: ccusers all element trigger post-operation mkelem action: -execunix /usr/local/bin/perl /data/ccase/triggers/mkelem_post.tgr action: -execwin perl //ultra10/triggers/mkelem_post.tgr excluded users: vobadm

Interop Tips and Tricks use constant MSWIN => $^O =~ /MSWin32|Windows_NT/i; Quoting: make use of qq() and q() Especially in –e scripts No single quote (‘) in cmd.exe Remember: 2>&1 works on Windows -e Useful for testing dynamic-vs-snapshot Follow with ct desc for snapshot support

Interop Tips and Tricks (cont) Make a DNS alias “usr” for the fileserver Enables e.g. “//usr/local/bin” anywhere Useful for includes in cspecs etc. Use the notify command for (4.0) Beware of PERL5LIB et al (CC bug) Use binmode on all binary files Cleartool returns native version paths

Interop Tips and Tricks (cont) Use s%\\%/%g if MSWIN; File::Spec 0.82 (abstract pathnames) File::Spec->rel2abs($path); # native fmt File::Spec::Unix->rel2abs($path); # force Unix fmt my $nul = MSWIN ? ‘NUL’ : ‘/dev/null’; system(“cmd >$nul 2>&1”);

Interop: system() and exec() The documentation lies! system() always uses a shell exec() always exits Perl emulates fork but not exec emulation: exit(system(“cmd”)!=0)); Best: use ClearCase::Argv for complex/long-running programs

My Perl Modules ClearCase::ClearPrompt ClearCase::Wrapper ClearCase::SyncTree ClearCase::CRDB Env::Path IPC::ClearTool ClearCase::Argv

ClearCase::ClearPrompt Handles temp files automatically Capable of asynchronous operation Handles trigger series automatically Captures/ s error msgs (*CC 4.2) use ClearCase::ClearPrompt qw(clearprompt +TRIGGERSERIES +CAPTURE=vobadm); clearprompt(‘proceed’, ‘-prompt’, ‘Hi!’)); $bug = clearprompt(qw(text -def 0 –prompt), “Bug #?”);

ClearCase::Wrapper Not an API, a program in module form Potentially wraps all cleartool access Cannot affect Windows GUI Many cmdline features (-rec/-all/-dir)

ClearCase::SyncTree Analogous to citree, clearfsimport Preserves CR’s Maps filenames Takes or derives file lists Regular expression filtering Comes with synctree program

ClearCase::CRDB Unreleased CR analysis (impact analysis) Comes with whouses program Forward or backward analysis

Env::Path Simply adds methods to existing EV’s Prepend, Append, Remove InsertBefore, InsertAfter Uniqify, DeleteNonexistent Replace, Whence (take RE’s) Comes with envpath program Comes with whence program for Windows use Env::Path ‘PATH’; PATH->Remove(‘/usr/ucb’);

IPC::ClearTool Interop Speedup: order of magnitude, or none. Significant constant overhead CAL on Windows, coprocess on UNIX Preferred interface via ClearCase::Argv

ClearCase::Argv Features Command line as object Advance Option Parsing (option sets) Interoperability Prog, opts, args Attributes: Verbosity (debug, quiet) Execution exceptions (autofail) –Can exit or call exception handler

ClearCase::Argv for Interop Quoting (->autoquote) Path normalization (->ccpathnorm) Output (->stdout, ->stderr) Globbing (->autoglob) Xargs behavior (->qxargs, ->syxargs)

ClearCase::Argv examples my $ct = ClearCase::Argv->new; $ct->autochomp(1); = $ct->lsco([‘-s’, ‘-all’], ‘.’)->qx; $ct->ci([‘-c’, = ctqx(“lsco –s –all.”); ctsystem(qw(mkelem –c

Special-purpose Objects my $ct = ClearCase::Argv->new; $ct->autofail(1); $ct->autochomp(1); my $ctq = ClearCase::Argv->new; $ct->stdout(0); $ct->stderr(0);

Setting attributes Per-object: $ct->stderr(1); Globally: ClearCase::Argv->stderr(1); export ARGV_STDERR=1 ClearCase::Argv->attropts; -/dbg=1 -/quiet=1 -/ipc=1

Question Time