Actions API
A propos de ce document
Les principaux composants des paquets PISI sont les fichiers pspec.xm, actions.py et le code source. actions.py est un script Python qui contient les opérations à effectuer sur le code source. Ce document est une vue d'ensemble de l'API de la librairie Actions qui est utilisé dans le fichier actions.py.
Actions API
L'API d'Actions à une structure modulaire qui permet de créer facilement un paquet. Les principaux modules de l'API sont :
- Autotools: Fonctions standards pour construire et installer les applications.
- Cmaketools: Fonctions pour construire les applications configurées avec cmake.
- Pisitools: Fondamentalement utilisé pour déplacer les fichiers du répertoire de travail au répertoire d'installation, les fonctions incluses dans Pisitools conviennent pour la plupart des opérations : la création de liens symboliques (symlinking), la manipulation de fichier (via sed), et la suppression de fichiers et répertoires.
- Shelltools: Fonctions pour les opérations spécifiques. En dehors de Pisitools, Shelltools est capable d'opérer sur des chemins absolus au lieu de chemins relatifs. Cette capacité à opérer dans les coins les plus sombre du système ammène à utiliser Shelltools de manière responsable.
- Libtools: Opérations de pre-construction (pre-build) et post-construction (post-build) pour configurer les bibliothèques.
- Get: Fonctions pour acquérir des informations sur les variables d'environnement ou les paquets nécessaire pour les phases de construction et d'installation.
- Kde: Fonctions pour configurer, construire et installer des applications KDE.=
- Perlmodules: Fonctions pour installer des modules Perl.
- Pythonmodules: Fonctions pour installer des modules Python.
- Scons: Contre-partie d'autotools pour la nouvelle génération d'outils de construction, Scons.
Pisitools
dobin
(sourceFile, destinationDirectory = '/usr/bin')
Déplacer sourceFile' du répertoire de travail à destinationDirectory. La valeur par défaut de destinationDirectory est /usr/bin.
- pisitools.dobin("sed/sed", "/bin")
- pisitools.dobin("zipsplit")
dodir
(destinationDirectory)
Créer le (destinationDirectory) dans le chemin d'installation.
- pisitools.dodir("/usr/include/awk")
- pisitools.dodir("/usr/" + get.HOST() + "/include")
- pisitools.dodir("/usr/share/doc/%s/examples" % get.srcTAG())
dodoc
(sourceFiles)
Copier sourceFiles dans /usr/share/doc/PACKAGE sous le répertoire d'installation.
- pisitools.dodoc("README")
- pisitools.dodoc("*.html")
- pisitools.dodoc("FAQ", "README", "ChangeLog.*", "algorithm.txt")
doexe
(sourceFile, destinationDirectory)
Copier l'exécutable sourceFile du répertoire de travail au répertoire de destination.
- pisitools.doexe("extras/scsi-devfs.sh", "/etc/udev/scripts/")
- pisitools.doexe("etc/hotplug/*.rc", "/etc/hotplug/")
dohtml
(sourceFiles)
Copier sourceFiles dans /usr/share/doc/PACKAGE/html sous le répertoire d'installation.
- pisitools.dohtml("index.html")
- pisitools.dohtml("doc/*")
doinfo
(sourceFiles)
Copier sourceFiles dans /usr/share/info sous le répertoire d'installation.
- pisitools.doinfo("*.info")
dolib
(sourceFile, destinationDirectory = '/usr/lib')
Copier la bibliothèque sourceFile dans /usr/lib sous le répertoire d'installation.
- pisitools.dolib("libz.a")
- pisitools.dolib("lib/libpci.a")
- pisitools.dolib("libbz2.so.1.0.2", "/lib")
dolib_a
(sourceFile, destinationDirectory = '/usr/lib')
Copier la bibliothèque statique sourceFile dans /usr/lib sous le répertoire d'installation.
- pisitools.dolib_a("lib/libpci.a")
- pisitools.dolib_a("libdb1.a")
dolib_so
(sourceFile, destinationDirectory = '/usr/lib')
Copier la bibliothèque partagée sourceFile dans /usr/lib sous le répertoire d'installation.
- pisitools.dolib_so("libdb1.so.2")
doman
(sourceFiles)
Copier 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.py 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)
