Actions API

From PardusWiki
Revision as of 13:11, 15 August 2007 by Ahmet (Talk | contribs)
Jump to: navigation, search

Contents

About the document

The main components of a PISI package are the pspec.xml, actions.py files and the source code. actions.py is a python script that contains information of the operations to be executed on the source code. This document is an overview of the Actions API library which includes the functions that are available for use in actions.py scripts.The document is currently being developed by A. Murat Eren, please mail your ideas and suggestions to meren@ @.pngpardus.org.tr instead of directly editing for keeping exactness.

Actions API

Actions API has a modular structure that makes the packaging process easier for the packager. The major modules of the Actions API are:

  • Autotools: Standard functions for building and installing applications.
  • Cmaketools: Functions for building the applications that are configured with cmake.
  • Pisitools: Fundamentally used for moving files to install directory from work directory, the functions included in pisitools are convenient for most operations i.e. symlinking, file manipulation via sed, deleting files or directories.
  • Shelltools: Functions for specific operations. Apart from pisitools, shelltools is capable of operating in absolute paths instead of relative paths. Granting the ability to operate in the darkest corners of the system to the packager shelltools has to be used responsibly.
  • Libtools: Pre-build and post-build operations for configuring libraries.
  • Get: Functions for getting information about evnironment variables or packages needed in building and installation phases.
  • Kde: Functions for configuring, building and installing KDE applications.
  • Perlmodules: Functions for installing perl modules.
  • Pythonmodules: Functions for installing python modules.
  • Scons: Counterpart of autotools for the new generation building tools, scons.

Pisitools

dobin

(sourceFile, destinationDirectory = '/usr/bin')

Moves the sourceFile' in work directory to destinationDirectory. The default value for destinationDirectory is /usr/bin.

  • pisitools.dobin("sed/sed", "/bin")
  • pisitools.dobin("zipsplit")


dodir

(destinationDirectory)

Creates the (destinationDirectory) in the install path.

  • pisitools.dodir("/usr/include/awk")
  • pisitools.dodir("/usr/" + get.HOST() + "/include")
  • pisitools.dodir("/usr/share/doc/%s/examples" % get.srcTAG())


dodoc

(sourceFiles)

Copies the sourceFiles into /usr/share/doc/PACKAGE under the install directory.

  • pisitools.dodoc("README")
  • pisitools.dodoc("*.html")
  • pisitools.dodoc("FAQ", "README", "ChangeLog.*", "algorithm.txt")


doexe

(sourceFile, destinationDirectory)

Copies the sourceFile executable from work directory to destination directory.

  • pisitools.doexe("extras/scsi-devfs.sh", "/etc/udev/scripts/")
  • pisitools.doexe("etc/hotplug/*.rc", "/etc/hotplug/")


dohtml

(sourceFiles)

Copies the sourceFiles into /usr/share/doc/PACKAGE/html under the install directory.

  • pisitools.dohtml("index.html")
  • pisitools.dohtml("doc/*")


doinfo

(sourceFiles)

Copies the sourceFiles into /usr/share/info under the install directory.

  • pisitools.doinfo("*.info")


dolib

(sourceFile, destinationDirectory = '/usr/lib')

Copies the sourceFile library to /usr/lib under the install directory.

  • pisitools.dolib("libz.a")
  • pisitools.dolib("lib/libpci.a")
  • pisitools.dolib("libbz2.so.1.0.2", "/lib")


dolib_a

(sourceFile, destinationDirectory = '/usr/lib')

Copies the sourceFile static library to /usr/lib under the install directory.

  • pisitools.dolib_a("lib/libpci.a")
  • pisitools.dolib_a("libdb1.a")


dolib_so

(sourceFile, destinationDirectory = '/usr/lib')

Copies the sourceFile shared library to /usr/lib under the install directory.

  • pisitools.dolib_so("libdb1.so.2")


doman

(sourceFiles)

Copies the sourceFile manual to /usr/share/man/ under the install directory.

  • pisitools.doman("logrotate.8")
  • pisitools.doman("doc/bash.1", "doc/bashbug.1", "doc/builtins.1", "doc/rbash.1")
  • pisitools.doman("*.[1-8]")


domo

(sourceFile, locale, destinationFile )

Makes a mo destinationFile for locale language from the sourceFile po file in /usr/share/locale/LOCALE/LC_MESSAGES.

  • pisitools.domo("po/tr.po", "tr", "pam_login.mo")


domove

(sourceFile, destination, destinationFile)

Moves the sourceFile to destination directory.

  • pisitools.domove("/usr/bin/passwd", "/bin/")
  • pisitools.domove("/usr/bin/yacc", "/usr/bin", "yacc.bison")
  • pisitools.domove("/usr/docs/", "/usr/share/doc/%s/html/" % get.srcTAG())


dosed

(sourceFile, findPattern, replacePattern)

Replaces the findPattern to replacePattern in sourceFile via sed.

  • pisitools.dosed("gcc/version.c", "<URL:http://gcc.gnu.org/bugs.html>" , "<URL:http://bugs.uludag.org.tr>")
  • pisitools.dosed("sshd_config", "(?m)(#UsePAM ).*", r"UsePAM yes")
  • pisitools.dosed("unix/Makefile", "-O3", get.CFLAGS())
  • pisitools.dosed("Make.Rules", "HAVE_NDBM_H=yes", "HAVE_NDBM_H=no")
  • pisitools.dosed("Makefile.def", "CC=cc", "CC=%s" % get.CC())
  • pisitools.dosed("automake.texi", "(?m)(@setfilename.*)automake", r"\1automake1.7")


dosbin

(sourceFile, destinationDirectory = '/usr/sbin')

Moves the sourceFile' in work directory to destinationDirectory. The default value for destinationDirectory is /usr/sbin.

  • pisitools.dosbin("traceroute6")
  • pisitools.dosbin("extras/scsi_id/scsi_id", "/sbin")


dosym

(sourceFile, destinationFile)

Creates a symlink of the sourceFile as destinationFile.

  • pisitools.dosym("gzip", "/bin/gunzip")
  • pisitools.dosym("libdb1.so.2", "/usr/lib/libdb.so.2")
  • pisitools.dosym("../bin/lsmod", "/sbin/lsmod")
  • pisitools.dosym("/usr/X11R6/include/X11", "/usr/include/X11")


insinto

 (destinationDirectory, sourceFile,  destinationFile)

Copies the sourceFile to destinationDirectory. destinationFile parameter is optional and changes the name of the copy if used.

  • pisitools.insinto("/opt/rar/bin", "rar")
  • pisitools.insinto("/etc/", "doc/nanorc.sample", "nanorc")
  • pisitools.insinto("/etc/hotplug", "etc/hotplug/*map")


newdoc

(sourceFile, destinationFile)

Copies the sourceFile to /usr/share/doc/PACKAGE/.

  • pisitools.newdoc("extras/volume_id/README", "README_volume_id")
  • pisitools.newdoc("gprof/ChangeLog.linux", "gprof/ChangeLog.linux")
  • pisitools.newdoc("bfd/PORTING", "bfd/PORTING")


newman

(sourceFile, destinationFile)

Copies the sourceFile to /usr/share/man/manPREFIX/.

  • pisitools.newman("less.nro", "less.1")


remove

(sourceFile)

Deletes the sourceFile under the install directory.

  • pisitools.remove("/usr/lib/libdb_cxx.so")


rename

(sourceFile, destinationFile)

Renames the sourceFile as destinationFile.

  • pisitools.rename("/usr/bin/bash", "bash.old")


removeDir

(destinationDirectory)

Deletes the 'destinationDirectory and all files inside.

  • pisitools.removeDir("/usr/lib")


Autotools

configure

(parameters)

Configures the package according to the parameters given by the user and PISI's default parameters.

  • autotools.configure()
  • autotools.configure("--prefix=/usr")


rawConfigure

(parameters)

Configures the package according to the parameters given by the user.

  • autotools.rawConfigure()
  • autotools.rawConfigure("--prefix %s/usr --with-doxywizard" % get.installDIR())
  • autotools.rawConfigure("--enable-nls --enable-freetype --disable-xmltest)


compile

(parameters)


make

(parameters)

Builds the package according to the parameters given by the user.

  • autotools.make()
  • autotools.make("local-all")
  • autotools.make("LIBS=%s" % get.LDFLAGS())
  • autotools.make("-j1")


install

(parameters)

Install the package according to the parameters given by the user and PISI's default parameters.

  • autotools.install()
  • autotools.install("libdir=%s/usr/lib" % get.installDIR())


rawInstall

(parameters)

Install the package according to the parameters given by the user.

  • autotools.rawInstall("DESTDIR=%s" % get.installDIR())
  • autotools.rawInstall("DESTDIR=\"%s\" docdir=/usr/share/doc/%s/html" % (get.installDIR(), get.srcTAG()))


aclocal

(parameters)

Creates an aclocal.m4 file according to the configure.in file.

  • autotools.aclocal("-I cmulocal -I config")
  • autotools.aclocal("-I m4")
  • autotools.aclocal()


autoconf

(parameters)

Creates the configure script.

  • autotools.autoconf()


autoreconf

(parameters)

Recreates the configure script.

  • autotools.autoreconf()


automake

(parameters)

Creates the makefile.

  • autotools.automake("-afc")
  • autotools.automake("--add-missing")
  • autotools.automake()


autoheader

(parameters)

Creates the header file for the configure script.

  • autotools.autoheader()


Cmaketools

configure

(parameters, sourceDir, installPrefix = '%s' % get.defaultprefixDIR())

Configures the source with the given parameters.

  • cmaketools.configure()
  • cmaketools.configure(installPrefix = "%s" % (get.kdeDIR()))
  • cmaketools.configure("-DCMAKE_BUILD_TYPE=None -DKDEDIR=%s" % get.kdeDIR(), sourceDir = "..")


make

(parameters)

Builds the source with the given parameters.

  • cmaketools.make()
  • cmaketools.make("LIBS=%s" % get.LDFLAGS())
  • cmaketools.make("-j1")


install

(parameters, argument = 'install')

Installs the source with the parameters given by the user and PISI's default parameters.


  • cmaketools.install()
  • cmaketools.install("libdir=%s/usr/lib" % get.installDIR())


rawInstall

(parameters, argument = 'install')

Installs the source with the parameters given by the user.

  • cmaketools.rawInstall("PREFIX=%s" % get.installDIR())


Libtools

preplib

(sourceDirectory)

Executes ldconfig command in the sourceDirectory.


gnuconfig_update

Copies the newest config.* files to the source.


libtoolize

(parameters)

Makes it possible to execute libtool on the source.


gen_usr_ldscript

(dynamicLib)


Shelltools

can_access_file

(sourceFile)

Checks if the sourceFile is accessible.

  • shelltools.can_access_file("/usr/share/terminfo/%s" % termfile)


can_access_directory

(destinationDirectory)

Checks if the destinationDirectory is accessible.


makedirs

(destinationDirectory)

Creates the destinationDirectory.

  • shelltools.makedirs("%s/build" % get.workDIR())
  • shelltools.makedirs("%s/build-default-i686-pc-linux-gnu-nptl" % get.workDIR())


chmod

(sourceFile, mode)

Changes permissions of sourceFile.

  • shelltools.chmod("config/config.sub")
  • shelltools.chmod(get.installDIR() + "/lib/libz.so.*")
  • shelltools.chmod("%s/usr/lib/misc/pt_chown" % get.installDIR(), 4711)
  • shelltools.chmod(get.installDIR() + "/etc/ssh/sshd_config", 0600)


unlink

(sourceFile)

Deletes the sourceFile.

  • shelltools.unlink(get.workDIR() + '/' + get.srcDIR() + "/missing")


unlinkDir

(sourceDirectory)

Deletes the sourceDirectory and all subdirectories.

  • shelltools.unlinkDir(get.workDIR() + "/tmpbuild")


move

(sourceFile, destinationFile)

Moves the sourceFile to destinationFile.

  • shelltools.move("ac-wrapper.sh", "%s/usr/lib/misc/" % get.installDIR())
  • shelltools.move("proc/*.h", "%s/usr/include/proc/" % get.installDIR())


copy

(sourceFile, destinationFile)

Copies the sourceFile to destinationFile.

  • shelltools.copy("Makefile.pre.in", "%s/usr/lib/python2.3/config/" % get.installDIR())
  • shelltools.copy("scripts/*", "%s/usr/bin/" % get.installDIR())


copytree

(source, destination, sym=False)

Copies the source directory to destination directory.

  • shelltools.copytree("include/linux/", "%s/usr/include/linux/" % get.installDIR())
  • shelltools.copytree("include/asm-generic/", "%s/usr/include/asm-generic/" % get.installDIR())


touch

(sourceFile)

Sets the last access date of sourceFile to current time.

  • shelltools.touch(get.workDIR() + "aclocal.m4")
  • shelltools.touch("gcc/c-gperf.h")


cd

(directoryName)

Changes the current working directory to directoryName.

  • shelltools.cd("build_unix")
  • shelltools.cd("%s/build-default-i686-pc-linux-gnu-nptl" % get.workDIR())


ls

(source)

Returns a list of all files and directories in the source directory.

  • shelltools.ls(get.installDIR() + "/usr/lib/*w.*")


export

(key, value)

Sets the value for key environment variable to value.

  • shelltools.export("WANT_AUTOCONF", "2.5")
  • shelltools.export("CXX", get.CXX())
  • shelltools.export("LDFLAGS", get.LDFLAGS() + "-Wl,-z,now")
  • shelltools.export("LC_ALL", "C")


system

(command)

Executes the command in the system shell.

  • shelltools.system("./update-pciids.sh &> /dev/null")


isLink

(sourceFile)

Checks if the sourceFile is a link.

  • shelltools.isLink(get.installDIR() + '/maybe/link')


realPath

(sourceFile)

Returns the real path of the sourceFile link.

  • shelltools.realPath(get.installDIR() + link)


baseName

(sourceName)

Returns the name of the sourceName real path.

  • shelltools.baseName(shelltools.realPath(link))


dirName

(sourceName)

Returns the directory of sourceName.


sym

(sourceFile, destinationFile)

Links the destinationFile to sourceFile.


Get

curDIR

(None) 
  • get.curDIR()


curKERNEL

(None)
  • get.curKERNEL()


curPERL

(None)
  • get.curPERL()


pkgDIR

(None)

Returns the paths of work and install directories of the package.

  • get.pkgDIR()


workDIR

(None)

Returns the path of work directory.

  • get.workDIR()


installDIR

(None)

Returns the path of install directory.

  • get.installDIR()


srcNAME

(None)

Returns the name of source package.


srcVERSION

(None)

Returns the version of source package.


srcRELEASE

(None)

Returns the release number of source package.


srcTAG

(None)

Returns the name, version and release number of source package.


srcDIR

(None)


HOST

(None)


CFLAGS

(None)


CXXFLAGS

(None)


LDFLAGS

(None)


docDIR

(None)


sbinDIR

(None)


infoDIR

(None)


manDIR

(None)


dataDIR

(None)


confDIR

(None)


localstateDIR

(None)


defaultprefixDIR

(None)


kdeDIR

(None)


qtDIR

(None)


qtLIBDIR

(None)


AR

(None)


AS

(None)


CC

(None)


CXX

(None)

LD

(None)


NM

(None)


RANLIB

(None)


F77

(None)


GCJ

(None)


Kde

configure

(parameters)


make

(None)


install

(None)


Perlmodules

configure

(parameters)

Configures the perl source code with the given parameters.

  • perlmodules.configure("/usr")
  • perlmodules.configure()


make

(parameters)

Builds the perl source code with the given parameters.

  • perlmodules.make()


install

(parameters)

Installs the perl source code with the given parameters.

  • perlmodules.install()


Pythonmodules

compile

(parameters)

Compiles the python source code with the given parameters.


install

(parameters)

Executes python setup.opy install command in the install directory with the given parameters.


run

(parameters)

Runs the python script with the given parameters.


Scons

make

(parameters)


install

(parameters)
Personal tools
Namespaces
Variants
Actions
Navigation
Print/export
Toolbox