Tuesday, December 2, 2014

Makefiles articles collection

Variable assignment types in Makefiles

= or := or ?= or +=

http://stackoverflow.com/questions/448910/makefile-variable-assignment 

Blunders of recursive variables

http://electric-cloud.com/blog/2009/03/makefile-performance-shell/ 

VPATH & vpath

http://www.cmcrossroads.com/article/basics-vpath-and-vpath 

Running external commands using $(shell)

http://electric-cloud.com/blog/2009/03/makefile-performance-shell/ 

Perforce trigger script to enforce JIRA ID (Perl)

A perforce trigger script written in Perl to enforce JIRA ID on Perforce changelist submission. This script also connects to JIRA server to make sure the submitted JIRA ID is a valid one.

Create a properties file p4trigger.properties with required information
cat p4trigger.properties
# Perforce pre-commit trigger to check jira-id configuration file
# %serverport%  It comes from trigger

p4user = **** 
p4port = ****:1666
p4passwd = ************************************
jiraProjects = AAAA BBBB
jiraURL = https://jira.com:8443
jiraLogin = ******
jiraPWD = /export/*****/******/****.txt


Now a perl module Utilities.pm, which consists re-usable functions.


cat Utilities.pm

Perforce to GIT migration with history

Here are the step by step guide to migrate from Perforce to GIT with history ..

  • Install git-p4 : Refer http://answers.perforce.com/articles/KB_Article/Git-P4 , in the end of this URL follow step 2 to Step 4
  • Sync the code from Perforce to a workspace (P4CLIENT).
  • Create a .p4config file with the P4PORT, P4USER & P4CLIENT values in $HOME
         cat .p4config
           P4PORT= 
           P4USER=
           P4CLIENT=
  • mkdir git-migration-root/component
  • cd  git-migration-root/component
  • cp $HOME/.p4config .
  • unset SSH_ASKPASS  # This will disable the git command attempt to open xterm. It is needed if you invoke the below command from putty.
  • git p4 clone //depot/component@all . 
        The above step will clone the code from Perforce Workspace ( with reference to .p4config P4CLIENT value). 
         In the above command "@all" option will copy the entire history. If this option is ignored, only HEAD revision is copied.
  • export GIT_SSL_NO_VERIFY=true  #Disabling SSL cert verification for push command.
  • git remote add origin ${GIT_URL}/component.git #Create a remote to point to STASH/github bare repository
  • git remote set-url origin ${GIT_URL}/component.git
  • git push origin master