============================================ Programmed Dialogs with Interactive Programs (PDIP) ============================================ CONTENTS OF THIS FILE ===================== * Introduction * Maintainers * Build suites * Download * Autotools mode * Configuration * Build, installation * Tests * Tests coverage measurement * cmake mode * pdip_install.sh script * Build, installation, cleanup * Tests * Tests coverage measurement * Packaging * Notes about RPM package * Notes about DEB package * Documentation * On line manuals * Articles * References Introduction ============ pdip is a simplified version of the famous expect(1) utility. The PDIP acronym itself comes from the first lines of the manual of expect(1). Like expect(1), it interprets a scripting language to dialog with an interactive program as a human operator would do. But it has not all the bells and whistles of expect(1) which is able to interact with multiple programs at the same time, accept a high level scripting language providing branching and high level control structures or giving back the control to the operator during a session. PDIP also comes with a C language library named libpdip.so providing the ability to control terminal oriented interactive processes by simulating an operator through an API. PDIP is distributed under the GNU GPL license. PDIP library is distributed under the GNU LGPL license. For a full description of the software, visit the project page: http://pdip.sourceforge.net/ The package embeds two other softwares, ISYS and RSYS, which are alternate implementations of the system(3) service based on PDIP. They are described in "doc/system_optimization.odt". ISYS and RSYS are both distributed under the GNU LGPL license. Maintainers =========== To report a bug or design enhancement, please contact: Rachid Koucha Build suites ============ PDIP and ISYS/RSYS comes with two build flavors : AUTOTOOLS and CMAKE. We tried to provide the same features in both frameworks but it is not so obvious. For examples, DEB and RPM packages generation are provided only in cmake mode. Download ======== * The source tree of this package can be downloaded from: https://sourceforge.net/projects/pdip/ ==================================================================================================== AUTOTOOLS MODE ==================================================================================================== Configuration ============= * The very first time after unpacking the sources, enter the following command to setup the autotools environment: $ tar xvfz pdip_src-2.4.7.tgz $ cd (i.e. pdip_src-2.4.7) $ autoreconf * Then, the "configure" script becomes available to provide the following specific options for PDIP: $ ./configure --help [...] --enable-isys enable isys library [default=yes] --enable-rsys enable rsys library [default=yes] --enable-tests build test/example binaries [default=no] --enable-gcov measure test coverage [default=no] [...] Build, installation =================== * For a complete installation in the default /usr/local subtree: $ ./configure $ make $ sudo make install * To uninstall the software: $ sudo make uninstall * If you don't want to install ISYS: $ ./configure --disable-isys $ make $ sudo make install * If you don't want to install RSYS: $ ./configure --disable-rsys $ make $ sudo make install Tests ===== The regression tests are based on CHECK library. The latter must be installed prior to launch the tests. . To launch the unitary tests of the whole software: $ ./configure --enable-tests [...] checking for CHECK... yes [...] $ make clean $ make $ make check ...Wait some minutes... PASS: check_all ============================================================================ Testsuite summary for pdip 2.4.7 ============================================================================ # TOTAL: 1 # PASS: 1 # SKIP: 0 # XFAIL: 0 # FAIL: 0 # XPASS: 0 # ERROR: 0 ============================================================================ . To launch specific tests for PDIP, ISYS or RSYS, executables are located in tests subdirectory: check_all, check_isys, check_rsys. For example: $ tests/check_isys [...] 100%: Checks: 4, Failures: 0, Errors: 0 Tests coverage measurement ========================== . The test coverage measurement is based on GCOV/LCOV tools. It is mandatory to unset CFLAGS or at least suppress any optimization level to make test coverage measurement work accurately. CFLAGS is not set automatically because according to autoconf rules, it is a user variable which must not be set internally by the build system. Without setting CFLAGS, you'll get the following error : $ ./configure --enable-tests --enable-gcov [...] checking for CHECK... yes checking for gcov tool... yes checking for lcov tool... yes checking for genhtml tool... yes [...] configure: error: CFLAGS='-g -O2' contains an optimization option -O2 incompatible with GCOV, retry with 'CFLAGS= configure ...' . So, to launch all the tests and display the coverage results into firefox browser, unset CFLAGS as follow at configuration time (there is a white space between "CFLAGS=" and the rest of the line!): $ CFLAGS= ./configure --enable-tests --enable-gcov . A shell script is provided to launch the test coverage measurement: $ ./coverage.sh -h ./coverage.sh [-h] [-r] [-b browser] [-c] [all | pdip | isys | rsys] -h: This help -r: Reset the counters of previous runs -c: Cleanup all builds before remaking the tests executables -b: Pathname of a browser to display the HTML results . To launch the whole software tests and display the coverage results into firefox browser: $ ./coverage.sh -c -r -b firefox all . To launch the pdip tests and display the coverage results into firefox browser: $ ./coverage.sh -c -r -b firefox pdip . To launch the isys tests and display the coverage results into firefox browser: $ ./coverage.sh -c -r -b firefox isys . To launch the rsys tests and display the coverage results into firefox browser: $ ./coverage.sh -c -r -b firefox rsys * It is also possible to disable ISYS and/or RSYS tests with the --disable-isys and --disable-rsys options of "configure" script ==================================================================================================== CMAKE MODE ==================================================================================================== pdip_install.sh script ====================== This script is a swiss army knife to make several things: $ ./pdip_install.sh -h Usage: pdip_install.sh [-b browser] [-c] [-T|-C ALL|PDIP|ISYS|RSYS] [-d install_dir] [-B] [-I] [-U] [-A] [-P RPM|DEB|TGZ|STGZ] [-h] -b : Browser's pathname to display the test coverage HTML results -c (*): Cleanup built objects -C : Launch test coverage measurement for ALL/PDIP/ISYS/RSYS -T : Launch ALL/PDIP/ISYS/RSYS regression tests -d : Installation directory (default: /usr/local) -P (*): Generate DEB/RPM/TGZ/STGZ packages -B : Build the software -I (*): Install the software -U (*): Uninstall the software -A : Generate an archive of the software (sources) -h : this help (*) Super user rights required Note that some options require super user priviledges to run. Use "sudo" for example. Build, installation, cleanup ============================ * For a complete installation in the default /usr/local subtree: $ sudo ./pdip_install.sh -I * To uninstall the software: $ sudo ./pdip_install.sh -U * To cleanup every generated files to go back to original source tree: $ sudo ./pdip_install.sh -c Tests ===== The regression tests are based on CHECK library. The latter must be installed prior to launch the tests. . To trigger the regression tests for the whole software: $ ./pdip_install.sh -T all 100%: Checks: 47, Failures: 0, Errors: 0 . To trigger the regression tests of PDIP only: $ ./pdip_install.sh -T pdip [...] 100%: Checks: 38, Failures: 0, Errors: 0 . To trigger the regression tests of ISYS only: $ ./pdip_install.sh -T isys [...] 100%: Checks: 4, Failures: 0, Errors: 0 . To trigger the regression tests of RSYS only: $ ./pdip_install.sh -T rsys [...] 100%: Checks: 5, Failures: 0, Errors: 0 Tests coverage measurement ========================== . To trigger test coverage measurement for PDIP only (with a display of the result in firefox): $ ./pdip_install.sh -C pdip -b firefox . To trigger test coverage measurement for ISYS, RSYS or the whole software, run the same with isys, rsys or all respectively Packaging ========= . To make a source package, use the -A option of pdip_install.sh: $ ./pdip_install.sh -A This makes a TGZ file of the complete source tree: pdip_src-2.4.7.tgz . In cmake mode, we provide the ability to generate Debian (DEB), Red-Hat Package Manager (RPM), Tar GZipped (TGZ) and Self Extracting Tar GZipped (STGZ) binary packages. . To build the packages (TGZ, DEB, RPM...): $ sudo ./pdip_install.sh -c -P tgz -P rpm -P deb -P stgz This makes the following binary packages: . PDIP only packages: . pdip_2.4.7_amd64.deb (DEB) . pdip-2.4.7-1.x86_64.rpm (RPM) . pdip-2.4.7-Linux-pdip.tar.gz (TGZ) . pdip-2.4.7-Linux-pdip.sh (STGZ) . ISYS only packages: . isys_2.4.7_amd64.deb (DEB) . isys-2.4.7-1.x86_64.rpm (RPM) . pdip-2.4.7-Linux-isys.tar.gz (TGZ) . pdip-2.4.7-Linux-isys.sh (STGZ) . RSYS only packages: . rsys_2.4.7_amd64.deb (DEB) . rsys-2.4.7-1.x86_64.rpm (RPM) . pdip-2.4.7-Linux-rsys.tar.gz (TGZ) . pdip-2.4.7-Linux-rsys.sh (STGZ) Notes about RPM package ======================= . Use the following to get information on a package file: $ rpm -qp --info pdip-2.4.7-1.x86_64.rpm Name : pdip Version : 2.4.7 Release : 1 Architecture: x86_64 Install Date: (not installed) Group : unknown Size : 311110 License : GPL/LGPL Signature : (none) Source RPM : pdip-2.4.7-1.src.rpm Build Date : jeu. 21 mars 2019 14:25:46 CET Build Host : pc-work Relocations : /usr/local Vendor : Rachid Koucha URL : http://pdip.sourceforge.net Summary : PDIP (Programmed Dialogue with Interactive Programs) Description : Simulation of an operator in front of interactive programs . Use the following to get the pre/post-installation scripts in a package file: $ rpm -qp --scripts rsys-2.4.7-1.x86_64.rpm preinstall program: /bin/sh postinstall scriptlet (using /bin/sh): #!/bin/sh INSTALL_PREFIX=/usr/local FILE=/lib/cmake/FindRsys.cmake chmod 644 [...] . Use following to list the files for an INSTALLED package: $ rpm -ql pdip . Use following to list the files in a package file: $ rpm -ql isys-2.4.7-1.x86_64.rpm /usr/local /usr/local/include /usr/local/include/isys.h /usr/local/lib /usr/local/lib/cmake /usr/local/lib/cmake/FindIsys.cmake /usr/local/lib/libisys.so /usr/local/lib/pkgconfig /usr/local/lib/pkgconfig/isys.pc /usr/local/share /usr/local/share/man /usr/local/share/man/man3 /usr/local/share/man/man3/isys.3.gz /usr/local/share/man/man3/isys_lib_initialize.3.gz /usr/local/share/man/man3/isystem.3.gz . The required package list of an RPM file could be printed with: $ rpm -qp --requires isys-2.4.7-1.x86_64.rpm /bin/sh /bin/sh /bin/sh /bin/sh libc.so.6()(64bit) libc.so.6(GLIBC_2.15)(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3)(64bit) libc.so.6(GLIBC_2.3.2)(64bit) libc.so.6(GLIBC_2.3.4)(64bit) libc.so.6(GLIBC_2.4)(64bit) libpdip.so()(64bit) libpthread.so.0()(64bit) libpthread.so.0(GLIBC_2.2.5)(64bit) libpthread.so.0(GLIBC_2.3.2)(64bit) pdip >= 2.3.0 rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rtld(GNU_HASH) Notes about DEB package ======================= . Use the following to get information on a package file: $ dpkg --info pdip_2.4.7_amd64.deb new Debian package, version 2.0. size 134772 bytes: control archive=1491 bytes. 277 bytes, 10 lines control 4134 bytes, 54 lines md5sums 1072 bytes, 54 lines pdip.postinst #!/bin/sh Package: pdip Version: 2.4.7 Section: devel Priority: optional Architecture: amd64 Homepage: http://pdip.sourceforge.net Installed-Size: 356 Maintainer: Rachid Koucha Description: Simulation of an operator in front of interactive programs . Use following to list the files in a package file: $ dpkg -c rsys_2.4.7_amd64.deb drwxr-xr-x root/root 0 2019-03-21 14:25 ./usr/ drwxr-xr-x root/root 0 2019-03-21 14:25 ./usr/local/ drwxr-xr-x root/root 0 2019-03-21 14:25 ./usr/local/include/ -r--r--r-- root/root 2188 2019-03-19 09:56 ./usr/local/include/rsys.h drwxr-xr-x root/root 0 2019-03-21 14:25 ./usr/local/lib/ drwxr-xr-x root/root 0 2019-03-21 14:25 ./usr/local/lib/cmake/ -r--r--r-- root/root 2043 2018-05-09 10:29 ./usr/local/lib/cmake/FindRsys.cmake -r--r--r-- root/root 31560 2019-03-21 09:31 ./usr/local/lib/librsys.so drwxr-xr-x root/root 0 2019-03-21 14:25 ./usr/local/lib/pkgconfig/ -r--r--r-- root/root 279 2019-03-20 18:45 ./usr/local/lib/pkgconfig/rsys.pc drwxr-xr-x root/root 0 2019-03-21 14:25 ./usr/local/sbin/ -r-xr-xr-x root/root 102192 2019-03-21 09:31 ./usr/local/sbin/rsystemd drwxr-xr-x root/root 0 2019-03-21 14:25 ./usr/local/share/ drwxr-xr-x root/root 0 2019-03-21 14:25 ./usr/local/share/man/ drwxr-xr-x root/root 0 2019-03-21 14:25 ./usr/local/share/man/man3/ -r--r--r-- root/root 1573 2019-03-21 09:31 ./usr/local/share/man/man3/rsys.3.gz -r--r--r-- root/root 58 2019-03-21 09:31 ./usr/local/share/man/man3/rsys_lib_initialize.3.gz -r--r--r-- root/root 46 2019-03-21 09:31 ./usr/local/share/man/man3/rsystem.3.gz drwxr-xr-x root/root 0 2019-03-21 14:25 ./usr/local/share/man/man8/ -r--r--r-- root/root 1457 2019-03-21 09:31 ./usr/local/share/man/man8/rsystemd.8.gz . Use following to install the content of a package file: $ sudo dpkg -i pdip_2.4.7_amd64.deb Preparing to unpack pdip_2.4.7_amd64.deb ... Unpacking pdip (2.4.7) ... Setting up pdip (2.4.7) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ... . Use the following to list the installed packages: $ dpkg -l | grep pdip ii pdip 2.4.7 amd64 Simulation of an operator in front of interactive programs . Use following to uninstall (remove) a package: $ sudo dpkg -r pdip ==================================================================================================== DOCUMENTATION ============= On line manuals =============== . Once pdip or isys or rsys installed, it is possible to access the corresponding manuals with: $ man pdip PDIP(1) Processes access and control PDIP(1) NAME pdip - Programmed Dialogue with Interactive Programs SYNOPSIS pdip [ -s cmdfile ] [ -b buffer-size ] [ -d level ] [ -h ] [ -V ] [ -e ] [ -t ] [ -o ] [ -p ] [ -R ] -- command options parameters... DESCRIPTION [...] . Some of the manuals are available in french: $ man -L fr pdip PDIP(1) Commandes Utilisateur PDIP(1) NOM pdip - Dialogue programmé avec des processus intéractifs SYNOPSIS pdip [ -s fichier-cmd ] [ -b taille-buffer ] [ -d niveau ] [ -h ] [ -V ] [ -e ] [ -t ] [ -o ] [ -p ] [ -R ] -- commande options paramètres... DESCRIPTION [...] Articles ======== . PDIP comes with an HTML page describing some of its internals: doc/index.html. It can be read with any internet browser. For example: $ firefox doc/index.html . ISYS and PDIP are described in a libreoffice document: doc/system_optimization.odt. It can be read with libreoffice tool suite. For example: $ libreoffice doc/system_optimization.odt ==================================================================================================== REFERENCES ========== * Introduction to autotools http://freesoftwaremagazine.com/articles/brief_introduction_to_gnu_autotools/