Epics@GSI Webhome
EPICS site GSI | Projects & Activities | EPICS site

Developers' Corner

Tips & Tricks and Examples

By setting the EPICS_CA_ADDR_LIST, the EPICS Channel Access (Client) Address List on the client site.
E.g. for MEDM:
  1. export EPICS_CA_ADDR_LIST and start medm in the same session
    $> export EPICS_CA_ADDR_LIST && medm &

-- PeterZumbruch - 2018-01-08

<div style="text-align:right;font-size:smaller">EpicsTipsAndTricksCrisAxisAddtionForSeveralEpicsApplications <a href="/edit/Epics/EpicsTipsAndTricksCrisAxisAddtionForSeveralEpicsApplications">(edit)</a></div>

cris-axis addition for several EPICS applications

HOWTO build flex (libfl) for cris-axis crisv32-axis

Since some of the EPICS extensions and modules rely on libfl flex and the standard distribution of AXIS SDK doesn't contain the libfl.a this has to be added:
Prerequisites
  • Axis SDK
  • cross compiler

Build & Installation

  1. set some helper variables:
    export SRC_DIR=<Source Directory>
    export DOWNLOAD_DIR=<Download Directory>
    # provided cross compiler and SDK are installed here export ETRAX_DIR=<ETRAX Tools Directory>
  2. download sources from http://sourceforge.net/projects/flex/ (version 2.5.35) via direct link to $DOWNLOAD_DIR
    mkdir -p ${DOWNLOAD_DIR:?undefined} &&
    wget http://prdownloads.sourceforge.net/flex/flex-2.5.35.tar.bz2?download
  3. unpack to $SRC_DIR
    mkdir -p ${SRC_DIR:?undefined} &&
    cd SRC_DIR &&
    tar -jxvf flex-2.5.35.tar.bz
  4. Source cris-axis-setup.sh ,defining environment variables, e.g. AXIS_TOP_DIR, and extending PATH, needs ETRAX_DIR to be defined. or just take its main code:
    oldpwd=$OLDPWD
    base=$(pwd)
    cd ${ETRAX_DIR:?undefined)/SDK && cd $(ls --color=never -t -1 -d devbo* | head -n 1) && . ./init_env
    cd $base
    cd ${ETRAX_DIR:?undefined)/ETRAX/compiler && . ./setup.sh
    cd $oldpwd
    cd $base
    unset scriptname base oldpwd epicsDir
  5. Change to source directory $SRC_DIR
    cd ${SRC_DIR:?undefined}
  6. Since configure automatically sets for cross-compilers 'ac_cv_func_malloc_0_nonnull' and 'ac_cv_func_realloc_0_nonnull' to 'no', (since it cannot check it) those have to be configured by hand:
    1. cris-axis
      1. export myTARGET=cris-axis-linux-gnu
      2. make clean
      3. ./configure --prefix=${AXIS_TOP_DIR:?undefined}/target/${myTARGET:?defined}/usr --host=${myTARGET} --build=i686-pc-linux-gnu ac_cv_func_realloc_0_nonnull=yes ac_cv_func_malloc_0_nonnull=yes
      4. make
      5. make install
    2. crisv32-axis
      1. export myTARGET=crisv32-axis-linux-gnu
      2. make clean
      3. ./configure --prefix=${AXIS_TOP_DIR:?undefined}/target/${myTARGET:?defined}/usr --host=${myTARGET} --build=i686-pc-linux-gnu ac_cv_func_realloc_0_nonnull=yes ac_cv_func_malloc_0_nonnull=yes
      4. make
      5. make install

    Compact
      export SRC_DIR=<Source Directory>
      export DOWNLOAD_DIR=<Download Directory>
      # provided cross compiler and SDK are installed here
      export ETRAX_DIR=<ETRAX Tools Directory>

      mkdir -p ${DOWNLOAD_DIR:?undefined} &&
      wget http://prdownloads.sourceforge.net/flex/flex-2.5.35.tar.bz2?download

      mkdir -p ${SRC_DIR:?undefined} &&
      cd SRC_DIR &&
      tar -jxvf flex-2.5.35.tar.bz

      oldpwd=$OLDPWD
      base=$(pwd)
      cd ${ETRAX_DIR:?undefined)/SDK && cd $(ls --color=never -t -1 -d devbo* | head -n 1) && . ./init_env
      cd $base
      cd ${ETRAX_DIR:?undefined)/ETRAX/compiler && . ./setup.sh
      cd $oldpwd
      cd $base
      unset scriptname base oldpwd epicsDir

      # crisv-axis
      export myTARGET=cris-axis-linux-gnu
      cd ${SRC_DIR:?undefined} &&
      make clean
      ./configure --prefix=${AXIS_TOP_DIR:?undefined}/target/${myTARGET:?defined}/usr --host=${myTARGET} --build=i686-pc-linux-gnu ac_cv_func_realloc_0_nonnull=yes ac_cv_func_malloc_0_nonnull=yes &&
      make && make install

      # crisv32-axis
      export myTARGET=crisv32-axis-linux-gnu
      cd ${SRC_DIR:?undefined} &&
      make clean
      ./configure --prefix=${AXIS_TOP_DIR:?undefined}/target/${myTARGET:?defined}/usr --host=${myTARGET} --build=i686-pc-linux-gnu ac_cv_func_realloc_0_nonnull=yes ac_cv_func_malloc_0_nonnull=yes &&
      make && make install

-- PeterZumbruch - 09 Apr 2009

-- PeterZumbruch - 2017-03-31

<div style="text-align:right;font-size:smaller">EpicsTipsAndTricksNewIocCommand <a href="/edit/Epics/EpicsTipsAndTricksNewIocCommand">(edit)</a></div>

new IOC command

The general way how to add a new IOC command, which can be used inside the IOC Shell is described in Chapter 18.3 IOC Shell - IOC Shell Programming of the IOC Application Developer's Guide (3.14.9).

Here is an example (with the help of BK) to make the command dumpTable(mbo, dac, channel, type) available at the IOC shell.

  • application.c
      #include <epicsExport.h>
      
      /* ... */ 
      
      /***************************************************************************/
      static void dumpTable(int mbo, int dac, int channel, short type)
      {
        /* some function code */
        /* ... */ 
      }
      /***************************************************************************/
      
      /* Information needed by iocsh */
      /* Argument definition */
      static const iocshArg  dumpTableArg0 = {"mbo number",     iocshArgInt};
      static const iocshArg  dumpTableArg1 = {"dac number",     iocshArgInt};
      static const iocshArg  dumpTableArg2 = {"channel number", iocshArgInt};
      static const iocshArg  dumpTableArg3 = {"table type",     iocshArgInt};
      static const iocshArg  *dumpTableArgs[] = 
      {
        &dumpTableArg0,
        &dumpTableArg1,
        &dumpTableArg2,
        &dumpTableArg3
      };
      /* Function definition */
      static const iocshFuncDef dumpTableFuncDef = {"dumpTable", 4, dumpTableArgs};
      
      /* Wrapper called by iocsh, selects the argument types that dumpTable needs */
      static void dumpTableCallFunc(const iocshArgBuf *args) {
        dumpTable(args[0].ival, args[1].ival, args[2].ival, args[3].ival);
      }
      
      /* Registration routine, runs at startup */
      static void dumpTableRegister(void) {
          iocshRegister(&dumpTableFuncDef, dumpTableCallFunc);
      }
      epicsExportRegistrar(dumpTableRegister);
      

  • application.dbd
      variable(mySubDebug)
      ...
      registrar(dumpTableRegister)
      
-- PeterZumbruch - 08 May 2008
Back to top

-- PeterZumbruch - 2018-01-08

<div style="text-align:right;font-size:smaller">EpicsTipsAndTricksUseOfMsiWithMultipleTempleateFiles <a href="/edit/Epics/EpicsTipsAndTricksUseOfMsiWithMultipleTempleateFiles">(edit)</a></div>

use of msi with multiple template files

To produce a single db file from multiple template files it is sufficient to include in the Makefile in the app/Db directory the line with the name of the db. This should be a not existing file (because it will be produced). Existing must be the corresponding substitutions file and the template file(s). In case that the substitutions file calls to a multiple template files is necessary to have an independent name from them, otherwise the generated db file will be only based on the same name template file.

Be aware that none of the template files should have the same name as the substitutions file.

Example: To make a db called vulom_1.db use a file vulom_1.substitutions which references for instance vulom.template, vulomreg.template, and vulomreg1.template

vulom_1.substitutions:
    file vulom.template {
    { PRE=HAD, NN="0", MM="1"}
    }
    file vulomreg.template {
    { PRE=HAD, NN="0", MM="1", CC="Del_0", AA="0", LIM="49.5", GAIN="3.3", LLIM="0"}
    { PRE=HAD, NN="0", MM="1", CC="Del_1", AA="1", LIM="49.5", GAIN="3.3", LLIM="0"}
    }
    file vulomreg1.template {
    { PRE=HAD, NN="0", MM="1", CC="Down_0", AA="7", LIM="15", GAIN="1"}
    { PRE=HAD, NN="0", MM="1", CC="Down_1", AA="8", LIM="15", GAIN="1"}
    }
    

The Makefile should contain a line
    DB += vulom_1.db
    

additional Dependencies

Adding the line in the Makefile
    vulom_1_DEPENDS ?= $(shell perl -n -e 'if (/file\s+(\w+.template)/) {print "$$1 \n";}' vulom_1.substitutions )
    
right after the previous
    DB += vulom_1.db
    
enables EPICS to check for dependencies (q.v. IOC Application Developer's Guide - 3.14.9 Chapter 4.6.4):
    If a <name> substitutions file contains "file" references to other input files, these referenced files should be made dependencies of the created <name>.db by adding a dependency definition line:
    <name>_DEPENDS = <filename1> <filename2> ...
-- PeterZumbruch - 09 May 2008

-- MartinMitkov - 2017-03-31

-- PeterZumbruch - 2018-01-08

-- PeterZumbruch - 2017-03-31
Back to top

Applications & Use Cases

Back to top

Windows tricks & tips

    <div style="text-align:right"><a style="font-size:smaller" href="/edit/Epics/WindowsTricksTips">edit</a></div>

    %FOREACH{"item" in="TippsWindowsResizeRawImgFileUsingVirtualBox"}%

    Resize Raw Img File Using VirtualBox

    edit

    Following the recommendation on http://raspberrypi.stackexchange.com/questions/4943/resize-image-file-before-writing-to-sd-card:
    • e.g. to resize to 15.5GB, approx. size 15500
    set VBOXMANAGE="C:\Program Files\Oracle\VirtualBox\VBoxManage.exe"
    IF NOT EXIST %VBOXMANAGE% (
       echo %VBOXMANAGE% does not exist ... exiting)
    )
    ELSE (
       IF EXIST input.vdi   ( %VBOXMANAGE% closemedium disk input.vdi --delete)
       IF EXIST output.vdi ( %VBOXMANAGE% closemedium disk output.vdi --delete) 
       IF EXIST output.img (%VBOXMANAGE% closemedium disk output.img)
        
       REM  use without .img
       set /p INPUT_NAME="Enter input file name without .img: "; 
       set OUTPUT_NAME=%INPUT_NAME%_resized 
       set /p OUTPUT_SIZE="Enter Size (MB) (e.g. 15000): "  
        
       ECHO "=========================================================================" 
       %VBOXMANAGE% convertfromraw %INPUT_NAME%.img input.vdi -format VDI --variant Standard 
       ECHO "=========================================================================" 
       %VBOXMANAGE% createhd --filename output.vdi --size %OUTPUT_SIZE% --format VDI --variant Standard 
       ECHO "=========================================================================" 
       %VBOXMANAGE% clonehd input.vdi output.vdi --existing 
       ECHO "=========================================================================" 
       %VBOXMANAGE% clonehd output.vdi output.img --format RAW 
       copy output.img %OUTPUT_NAME%.img 
       %VBOXMANAGE% closemedium disk input.vdi --delete 
       %VBOXMANAGE% closemedium disk output.vdi --delete 
       %VBOXMANAGE% closemedium disk output.img 
    )
    

    -- WikiGuest - 1970-01-01
    Back to top

    %NEXT{"item"}%

    %FOREACH{"item" in="TipsWindowsHowToCloneASDCard"}%

    Windows: How To Clone A SD Card

    <div style="text-align:right"><a style="font-size:smaller" href="/edit/Epics/TipsWindowsHowToCloneASDCard">edit</a></div>

    Following the help of page https://startingelectronics.org/articles/raspberry-PI/ten-things-raspberry-PI chapter 10.

    This video View on YouTube → shows how to clone a SD card in Windows

    -- WikiGuest - 1970-01-01
    Back to top

    %NEXT{"item"}%

    -- WikiGuest - 1970-01-01
Back to top

Linux tricks & tips

    <div style="text-align:right"><a style="font-size:smaller" href="/edit/Epics/LinuxTricksTips">edit</a></div>

    serial device settings - switch off every possible hidden manipulation feature

    edit

    $> stty -F /dev/ttySx -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke 19200

      • Output settings:
        -opost
        do not post-process output
        -onlcr
        do not translate newline to carriage return-newline
      • Local settings:
        -isig
        do not enable interrupt, quit, and suspend special characters
        -icanon
        do not enable erase, kill, werase, and rprnt special characters
        -iexten
        do not enable non-POSIX special characters
        -echo
        do not echo input characters
        -echoe
        do not echo erase characters as backspace-space-backspace
        -echok
        do not echo a newline after a kill character
        -echoctl
        do not echo control characters in hat notation ('^c')
        -echoke
        kill all line by obeying the echoctl and echok setting
        19200
        sets the speed to 19200 Bit/s

      Summarizing the settings prevent any additional manipulation of input or output.

    -- PeterZumbruch - 2020-11-09
    Back to top

    udev/udevadm allows to automatically assign (fixed) symbolic links for USB devices connected to the system pointing the current /dev entry point.

    edit

    Prerequisites
    you have to have admin rights.

    How to
    • edit/create /etc/udev/rules.d/99-serial-permissions.rules
      • add the follwing line for general includes
        SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", SYMLINK+="$env{ID_SERIAL}", GROUP="users", MODE="0666"
        creates for every connected device of vendor id 0403 a symbolic link /dev/ to the connected device
      • for special devices those lines can be added in addition
        SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ENV{ID_SERIAL}=="FTDI_FT232R_USB_UART_A100dQ2B", SYMLINK+="hadcon2", GROUP="users", MODE="0666"
        SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ENV{ID_SERIAL}=="FTDI_FT232R_USB_UART_A600801P", SYMLINK+="olimex", GROUP="users", MODE="0666"

      • for special devices (e.g. HadCon2) those lines can be added in addition
        • SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ENV{ID_SERIAL}=="FTDI_FT232R_USB_UART_A100*", RUN+="/usr/bin/stty -F /dev/$kernel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke 115200 "
        • SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ENV{ID_SERIAL}=="FTDI_FT232R_USB_UART_A801*", RUN+="/usr/bin/stty -F /dev/$kernel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke 115200 "
    • to find out the IDs of connected systems
      udevadm info --export-db| grep FTDI| grep ID_SERIAL

    • Finally reload rules and trigger a reconnect:
      udevadm control --reload-rules
      udevadm trigger

    Links
    "Writing udev rules"
    http://reactivated.net/writing_udev_rules.html
    udev
    https://wiki.ubuntuusers.de/udev/
    "Tutorial on how to write basic udev rules in Linux"
    https://linuxconfig.org/tutorial-on-how-to-write-basic-udev-rules-in-linux

    -- PeterZumbruch - 2020-11-09
    Back to top

    SSH config: Host Specific Identity

    Using ssh config files in ~/.ssh/config allows to specify per host / host alias different user/identity to connect with and more necessary options.

    edit

    Using the features of the config file of ssh in ~/.ssh one can specify host specific ssh options, including varying identities and users.

    from: http://www.gelato.unsw.edu.au/archives/git/0611/31044.html

    Example:
    • connecting to a specific host using a different identity file and user
      $> cat ~/.ssh/config
         Host private.host.com
            User myname
            Hostname host.com
            IdentityFile ~/.ssh/private-identity
         Host public.host.com
            User anotherName
            Hostname host.com
            IdentityFile ~/.ssh/public-identity
         Host git.host.com
            User git
            Hostname host.com
            IdentityFile ~/.ssh/git-identity
           
    • allows to replace:
      • ssh host.com -l myname -i ~/.ssh/private-identity
        by
        ssh host.com
      • commands which internally use ssh but do not allow to pass ssh options, e.g. git
        git clone git.host.com

    -- PeterZumbruch - 2020-11-09
    Back to top

    Linux: dhclient - dynamic hostname

    Using dhclient exit hooks scripts allows to set e.g. the hostname dynamically

    edit

    Based on the articles: and its own origin

    dhclient and its scripting capabilities on enter and exit hooks allows to react on dynamic network environments.

    Provided you have root privileges this can be achieved by creating a script file hostname created in /etc/dhcp/dhclient-exit-hooks.d/ (on Debian), which is sourced by dhclient after having updated/received its DHCP informations.

    #!/bin/sh
       # Filename:     /etc/dhcp/dhclient-exit-hooks.d/hostname
       # Purpose:      Used by dhclient-script to set the hostname of the system
       #               to match the DNS information for the host as provided by
       #               DHCP.
       #
          
       # Do not update hostname for virtual machine IP assignments
       if [ "$interface" != "eth0" ] && [ "$interface" != "eth1" ] && [ "$interface" != "wlan0" ]
       then
               return
       fi
          
       if [ "$reason" != BOUND ] && [ "$reason" != RENEW ] && [ "$reason" != REBIND ] && [ "$reason" != REBOOT ]
       then
          return
       fi
       
       echo dhclient-exit-hooks.d/hostname: Dynamic IP address = $new_ip_address
       hostname=$(a=$(host $new_ip_address) || { false; } && { echo -n $a | cut -d ' ' -f 5 | cut -d "." -f 1; true; }) || unset hostname &&
       echo ${hostname?} > /etc/hostname &&
       hostname $hostname &&
       export HOSTNAME=$hostname &&
       echo dhclient-exit-hooks.d/hostname: Dynamic Hostname = $hostname
    

    Applying those code lines: %FOREACH{"file" in="/etc/dhcp/dhclient-exit-hooks.d/hostname"}%
    sudo curl -s https://wiki.gsi.de/pub/Epics/TipsLinuxDhclientDynamicHostname/_etc_dhcp_dhclient-exit-hooks.d_hostname -o $file && 
      sudo dos2unix $file && 
      sudo chmod a+r $file
    
    %NEXT{"file"}%

    Local testing at the prompt:
    dhclient

    -- PeterZumbruch - 2020-11-09
    Back to top

    Linux: dhclient - dynamic mount point

    Using dhclient exit hooks scripts allows to set a mount point depending on the network environment, in this example for the HADES setup

    edit

    Based on the articles: and its own origin

    dhclient and its scripting capabilities on enter and exit hooks allows to react on dynamic network environments.

    Provided you have root privileges this can be achieved by creating a script file mount_var_diskless created in /etc/dhcp/dhclient-exit-hooks.d/ (on Debian), which is sourced by dhclient after having updated/received its DHCP informations.

    #!/bin/sh
        # Filename:     /etc/dhcp/dhclient-exit-hooks.d/mount_var_diskless
        # Purpose:      Used by dhclient-script to set mount HADES's var/diskless filesystem 
        #               from either the local net (preferred) or the GSI network
        #
        
        # Do not update hostname for virtual machine IP assignments
        if [ "$interface" != "eth0" ] && [ "$interface" != "eth1" ] && [ "$interface" != "wlan0" ]
        then
            return
        fi
        
        if [ "$reason" != BOUND ] && [ "$reason" != RENEW ] && [ "$reason" != REBIND ] && [ "$reason" != REBOOT ]
        then
                return
        fi
        
        var_diskless_hades=192.168.100.50
        var_diskless_gsi=140.181.75.158 
        var_diskless_path=/var/diskless/dreamplug
        var_diskless_mount=/var/diskless/dreamplug
        
        echo dhclient-exit-hooks.d/mount_var_diskless: new domain-name-servers: $new_domain_name_servers 
        
        echo "$new_domain_name_servers" | grep -q $var_diskless_hades && var_diskless_addr=$var_diskless_hades || var_diskless_addr=$var_diskless_gsi
        
        #clean up, but only different mounts
        grep -v "$var_diskless_addr:$var_diskless_path" /etc/mtab | grep -q "$var_diskless_mount" && umount $var_diskless_mount 
        
        #mount
        [ -d "$var_diskless_mount" ] || mkdir -p $var_diskless_mount
        grep "$var_diskless_addr:$var_diskless_path" /etc/mtab | grep -q "$var_diskless_mount" || mount $var_diskless_addr:$var_diskless_path $var_diskless_mount
        
        echo dhclient-exit-hooks.d/mount_var_diskless: mounted $var_diskless_addr:$var_diskless_path
        
        unset var_diskless_hades 
        unset var_diskless_gsi 
        unset var_diskless_path 
        unset var_diskless_mount
        
    Finally make sure the file is readable:
    chmod a+r /etc/dhcp/dhclient-exit-hooks.d/mount_var_diskless

    Local testing at the prompt:
    dhclient -v

    -- PeterZumbruch - 2020-11-09
    Back to top

    %FOREACH{"item" in="TipsLinuxHadesNetworkAllowClientToConnectViaGateway"}%

    Linux: Hades Network - Allow Client To Connect Via Gateway

    edit

    To allow clients to connect outside of Hades network:
    • with root privileges
    ip r a default via 192.168.100.90 dev eth0

    -- WikiGuest - 1970-01-01
    Back to top

    %NEXT{"item"}%

    %FOREACH{"item" in="TipsLinuxHowToCloneASDCard"}%

    Linux: How To Clone A SD Card

    edit

    Following the help of page https://startingelectronics.org/articles/raspberry-PI/ten-things-raspberry-PI chapter 10.

    This video View on YouTube → shows how to clone an SD card in Linux using the dd command line application.

    The command for copying an SD card to an image file on your computer is:
    sudo dd if=/dev/mmcblk0 of=~/raspi.img
    The command for copying an SD card image to a new SD card is:
    sudo dd if=~/raspi.img of=/dev/mmcblk0
    Where:
    • ~/raspi.img is the location and file name of the image file.
    • /dev/mmcblk0 is the SD card device on the Linux system.

    -- WikiGuest - 1970-01-01
    Back to top

    %NEXT{"item"}%

    %FOREACH{"item" in="TippsLinuxResizeRawImgFile"}%

    Linux: Resize Raw Img File

    edit

    see: http://www.vk3erw.com/index.php/16-software/33-raspberry-pi-how-to-resize-sd-card-image

    -- WikiGuest - 1970-01-01
    Back to top

    %NEXT{"item"}%

    %FOREACH{"item" in="TippsLinuxRebootingTheMagicWay"}%

    /sbin/reboot: Input/output error

    edit

    LinuxJournal-ReBootingTheMagicWay.png

    -- WikiGuest - 1970-01-01
    Back to top

    %NEXT{"item"}%

    %FOREACH{"item" in="TippsLinuxProcServRemoteKillViaNetcat"}%

    ProcServ: Remote Kill Via netcat

    ProcServ usually needs a login to its port to execute a "CTRL+X" sequence to kill/restart the current child process. Thanks to this cmdline it is also able without. Thanks to J.Michel / M.Traxler, afaik.

    edit

    Solution

    Assuming that procServ is running its telnet session on port 12345 on localhost
    echo -en "\x18" | netcat -w1 localhost 12345;
    

    -- WikiGuest - 1970-01-01
    Back to top

    %NEXT{"item"}%

    -- WikiGuest - 1970-01-01
Back to top

Hardware collection, evaluation

Back to top

Git Tips & Tricks

    <div style="text-align:right"><a style="font-size:smaller" href="/edit/Epics/GitTricksTips">edit</a></div>

    Importing cvs into git, including history

    How to "Import a CVS repository into a bare git repository"

    <div style="text-align:right"><a style="font-size:smaller" href="/edit/Epics/GitTricksTipsImportCvsIntoGitIncludingHistory">edit</a></div>

      # External CVSROOT, e.g. scs@lx-pool.gsi.de:/misc/hadesprojects/slowcontrol/cvsroot/
      URL_CVSROOT_EXTERNAL=<[User@]external CVSROOT directory>,
      CVSROOT_LOCAL=<local CVSROOT directory>
      # Git repository path: e.g. "hadesprojects-slowcontrol.git"
      GIT_TARGET_DIR=<New Git Repository>,
      # CVS Module to import MODULE=<CVS Module to extract>

      [ ! -z "$CVSROOT_LOCAL" ] mkdir -p "$CVSROOT_LOCAL" &&
      [ ! -z "$URL_CVSROOT_EXTERNAL" ] && rsync --progress -a "$URL_CVSROOT_EXTERNAL/" $CVSROOT_LOCAL
      [ ! -z "$GIT_TARGET_DIR" ] && GIT_TARGET_REPOSITORY=${GIT_TARGET_DIR%%.git}.git && mkdir -p $GIT_TARGET_REPOSITORY &&
      cd $GIT_TARGET_REPOSITORY &&
      git init --bare &&
      [ ! -z "$MODULE" ] && time git cvsimport -i -o cvshead -p xv -v -k -d $CVSROOT_LOCAL -C $GIT_TARGET_REPOSITORY $MODULE >&/tmp/cvsimport.log ||
      echo "import of module \'$MODULE\' of CVS repository \'$URL_CVSROOT_EXTERNAL\' into \'$GIT_TARGET_REPOSITORY\' failed"

    -- PeterZumbruch - 2014-11-03
    Back to top

    Submodule

    git submodule
    , illustrated in a few command line examples.
    TIP These examples require at least version 1.7.

    <div style="text-align:right"><a style="font-size:smaller" href="/edit/Epics/GitTricksTipsSubmodule">edit</a></div>

    adding a submodule to a git directory

    • git submodule add
    • git submodule
    • git submodule init

    retrieving a repository with submodules

    • git clone
    • git submodule update

    converting a repository into projects with submodules

    (H.Brand)
    • create new branch
    • go into sub directory
    • git init
    • create remote bare repository
    • push to (final) remote repository
    • delete local sub directory and
    • replace by add submodule pointing to remote,
    • commit
    • checkout and test
    • merge new branch into current "master"

    -- PeterZumbruch - 2014-11-03
    Back to top

    Git Workflow

    <div style="text-align:right"><a style="font-size:smaller" href="/edit/Epics/GitTricksTipsWorkflow">edit</a></div>

    Possible Git Workflow

    (https://raw.githubusercontent.com/AnarManafov/GitWorkflow/master/GitWorkflow_fig1.png)

    GitWorkflow_fig1.png

    -- PeterZumbruch - 2014-11-14
    Back to top

    -- PeterZumbruch - 2014-11-14
Back to top

-- PeterZumbruch - 11 Jun 2015
-- PeterZumbruch - 2017-03-31
I Attachment Action Size Date Who Comment
cris-axis-setup.shsh cris-axis-setup.sh manage 826 bytes 2009-04-09 - 11:11 PeterZumbruch cris-axis-setup.sh: Bash script for cris-axis setup
This topic: Epics > WebHome > DevelopersCorner
Topic revision: 2017-03-31, PeterZumbruch
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding GSI Wiki? Send feedback | Legal notice | Privacy Policy (german)