Bugün söylediğim gibi actions API'ye biraz dokundurdum.
DİKKAT: Özellikle buradaki tüm modüllerin ve fonksiyonların çok çok iyi belgelenmesi gerekiyor. Daha sonra belgeleriz diye düşünmemek lazım. Bir süre sonra işin içinden çıkılmaz bir hal alabilir. Bu yüzden fonksiyonları/modülleri yazdıkça belgelerini de yazalım!
This commit is contained in:
@@ -1,21 +1,33 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# standard python modules
|
||||||
import os
|
import os
|
||||||
from pisi.context import const
|
|
||||||
|
# actions api modules
|
||||||
|
from config import config
|
||||||
|
|
||||||
def configure(parameters = ''):
|
def configure(parameters = ''):
|
||||||
''' FIXME: Düzgün hale getirilecek '''
|
''' FIXME: Düzgün hale getirilecek '''
|
||||||
''' parameters = '--with-nls --with-libusb --with-something-usefull '''
|
''' parameters = '--with-nls --with-libusb --with-something-usefull '''
|
||||||
|
dirs = config.dirs
|
||||||
|
flags = config.flags
|
||||||
|
|
||||||
configure_string = './configure --prefix=/usr \
|
configure_string = './configure --prefix=%s \
|
||||||
--host=i686-pc-linux-gnu \
|
--host=%s \
|
||||||
--mandir=/usr/share/man \
|
--mandir=%s \
|
||||||
--infodir=/usr/share/info \
|
--infodir=%s \
|
||||||
--datadir=/usr/share \
|
--datadir=%s \
|
||||||
--sysconfdir=/etc \
|
--sysconfdir=%s \
|
||||||
--localstatedir=/var/lib \
|
--localstatedir=%s \
|
||||||
%s' % parameters
|
%s' % (dirs.defaultprefix,
|
||||||
|
flags.host,
|
||||||
|
dirs.man,
|
||||||
|
dirs.info,
|
||||||
|
dirs.data,
|
||||||
|
dirs.conf,
|
||||||
|
dirs.localstate,
|
||||||
|
parameters)
|
||||||
|
|
||||||
os.system(configure_string)
|
os.system(configure_string)
|
||||||
|
|
||||||
@@ -26,17 +38,23 @@ def make():
|
|||||||
def install():
|
def install():
|
||||||
''' FIXME: Düzgün hale getirilecek '''
|
''' FIXME: Düzgün hale getirilecek '''
|
||||||
''' dir_suffix = /var/tmp/pisi/ _paket_adı_ /image/ '''
|
''' dir_suffix = /var/tmp/pisi/ _paket_adı_ /image/ '''
|
||||||
global const
|
dirs = config.dirs
|
||||||
|
|
||||||
dir_suffix = os.path.dirname(os.path.dirname(os.getcwd())) + \
|
dir_suffix = os.path.dirname(os.path.dirname(os.getcwd())) + \
|
||||||
const.install_dir_suffix
|
config.const.install_dir_suffix
|
||||||
|
|
||||||
install_string = 'make prefix=%(prefix)s/usr \
|
install_string = 'make prefix=%(prefix)s/%(defaultprefix)s \
|
||||||
datadir=%(prefix)s/usr/share \
|
datadir=%(prefix)s/%(data)s \
|
||||||
infodir=%(prefix)s/usr/share/info \
|
infodir=%(prefix)s/%(info)s \
|
||||||
localstatedir=%(prefix)s/var/lib \
|
localstatedir=%(prefix)s/%(localstate)s \
|
||||||
mandir=%(prefix)s/usr/share/man \
|
mandir=%(prefix)s/%(man)s \
|
||||||
sysconfdir=%(prefix)s/etc \
|
sysconfdir=%(prefix)s/%(conf)s \
|
||||||
install' % {'prefix': dir_suffix}
|
install' % {'prefix': dir_suffix,
|
||||||
|
'defaultprefix': dirs.defaultprefix,
|
||||||
|
'man': dirs.man,
|
||||||
|
'info': dirs.info,
|
||||||
|
'localstate': dirs.localstate,
|
||||||
|
'conf': dirs.conf,
|
||||||
|
'data': dirs.data}
|
||||||
|
|
||||||
os.system(install_string)
|
os.system(install_string)
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# standard python modules
|
||||||
|
import os
|
||||||
|
|
||||||
|
# pisi modules
|
||||||
|
import pisi.config
|
||||||
|
import pisi.constants
|
||||||
|
|
||||||
|
|
||||||
|
# Set individual information, that are generally needed for actions
|
||||||
|
# api.
|
||||||
|
|
||||||
|
class Env:
|
||||||
|
"""General environment variables used in actions API"""
|
||||||
|
install_dir = os.getenv('INSTALL_DIR')
|
||||||
|
src_name = os.getenv('SRC_NAME')
|
||||||
|
src_version = os.getenv('SRC_VERSION')
|
||||||
|
src_release = os.getenv('SRC_RELEASE')
|
||||||
|
|
||||||
|
class Dirs:
|
||||||
|
"""General directories used in actions API."""
|
||||||
|
# TODO: Eventually we should consider getting these from a/the
|
||||||
|
# configuration file
|
||||||
|
doc = "usr/share/doc"
|
||||||
|
sbin = "usr/sbin"
|
||||||
|
man = "usr/share/man"
|
||||||
|
info = "usr/share/info"
|
||||||
|
data = "usr/share"
|
||||||
|
conf = "etc"
|
||||||
|
localstate = "var/lib"
|
||||||
|
defaultprefix = "usr"
|
||||||
|
|
||||||
|
class Flags:
|
||||||
|
"""General flags used in actions API"""
|
||||||
|
# TODO: Eventually we should consider getting these from a/the
|
||||||
|
# configuration file
|
||||||
|
|
||||||
|
# bu çok çirkin, bunu burada yazmamak gerekiyor, yine de actions
|
||||||
|
# api içerisinde tekrarlanmasından iyidir. Yeri geldiğinde
|
||||||
|
# standart config dosyasından build-arch'ı alıp ona göre
|
||||||
|
# oluştururuz...
|
||||||
|
host = "i686-pc-linux-gnu"
|
||||||
|
|
||||||
|
class ActionsConfig(pisi.config.Config):
|
||||||
|
const = pisi.constants.const
|
||||||
|
env = Env()
|
||||||
|
dirs = Dirs()
|
||||||
|
flags = Flags()
|
||||||
|
|
||||||
|
config = ActionsConfig()
|
||||||
@@ -1,11 +1,18 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os, string, re, shutil
|
# standard python modules
|
||||||
from shell import *
|
import os
|
||||||
|
import string
|
||||||
|
import re
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
# pisi modules
|
||||||
from pisi.ui import ui
|
from pisi.ui import ui
|
||||||
|
|
||||||
|
# actions api modules
|
||||||
|
from shell import *
|
||||||
|
|
||||||
def gnuconfig_findnewest():
|
def gnuconfig_findnewest():
|
||||||
''' find the newest config.* file according to
|
''' find the newest config.* file according to
|
||||||
timestamp and return it'''
|
timestamp and return it'''
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# standard python modules
|
||||||
import os
|
import os
|
||||||
from pisi.context import const
|
|
||||||
|
# actions api modules
|
||||||
|
from config import config
|
||||||
|
|
||||||
# Global variables for compiling KDE programs...
|
# Global variables for compiling KDE programs...
|
||||||
kde_dir = os.getenv('KDEDIR')
|
kde_dir = os.getenv('KDEDIR')
|
||||||
@@ -14,13 +17,13 @@ def configure(parameters = ''):
|
|||||||
''' parameters = '--with-nls --with-libusb --with-something-usefull '''
|
''' parameters = '--with-nls --with-libusb --with-something-usefull '''
|
||||||
|
|
||||||
configure_string = './configure --prefix=%s \
|
configure_string = './configure --prefix=%s \
|
||||||
--host=i686-pc-linux-gnu \
|
--host=%s \
|
||||||
--with-x \
|
--with-x \
|
||||||
--enable-mitshm \
|
--enable-mitshm \
|
||||||
--with-qt-dir=%s \
|
--with-qt-dir=%s \
|
||||||
--enable-mt \
|
--enable-mt \
|
||||||
--with-qt-libraries=%s \
|
--with-qt-libraries=%s \
|
||||||
%s' % (kde_dir, qt_dir, qt_libdir, parameters)
|
%s' % (kde_dir, config.flags.host, qt_dir, qt_libdir, parameters)
|
||||||
|
|
||||||
os.system(configure_string)
|
os.system(configure_string)
|
||||||
|
|
||||||
@@ -31,10 +34,9 @@ def make():
|
|||||||
def install():
|
def install():
|
||||||
''' FIXME: Düzgün hale getirilecek '''
|
''' FIXME: Düzgün hale getirilecek '''
|
||||||
''' dir_suffix = /var/tmp/pisi/ _paket_adı_ /image/ '''
|
''' dir_suffix = /var/tmp/pisi/ _paket_adı_ /image/ '''
|
||||||
global const
|
|
||||||
|
|
||||||
dir_suffix = os.path.dirname(os.path.dirname(os.getcwd())) + \
|
dir_suffix = os.path.dirname(os.path.dirname(os.getcwd())) + \
|
||||||
const.install_dir_suffix
|
config.const.install_dir_suffix
|
||||||
|
|
||||||
install_string = 'make prefix=%s/%s install' % (dir_suffix, kde_dir)
|
install_string = 'make prefix=%s/%s install' % (dir_suffix, kde_dir)
|
||||||
os.system(install_string)
|
os.system(install_string)
|
||||||
|
|||||||
@@ -1,52 +1,67 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os, shutil
|
# standard python modules
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
import gzip
|
import gzip
|
||||||
|
|
||||||
|
# actions api modules
|
||||||
|
from config import config
|
||||||
|
|
||||||
def dodoc(*documentList):
|
def dodoc(*documentList):
|
||||||
|
env = config.env
|
||||||
|
dirs = config.dirs
|
||||||
|
|
||||||
install_dir = os.getenv('INSTALL_DIR')
|
srcTag = env.src_name + '-' \
|
||||||
src_name = os.getenv('SRC_NAME')
|
+ env.src_version + '-' \
|
||||||
src_version = os.getenv('SRC_VERSION')
|
+ env.src_release
|
||||||
src_release = os.getenv('SRC_RELEASE')
|
|
||||||
|
|
||||||
srcTag = src_name + '-' + src_version + '-' + src_release
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.makedirs(install_dir + '/' + 'usr/share/doc/' + srcTag)
|
os.makedirs(os.path.join(env.install_dir,
|
||||||
|
dirs.doc,
|
||||||
|
srcTag))
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
for document in documentList:
|
for document in documentList:
|
||||||
if os.access(document, os.F_OK):
|
if os.access(document, os.F_OK):
|
||||||
shutil.copyfile(document, os.path.join(install_dir, \
|
shutil.copyfile(document,
|
||||||
'usr/share/doc/' + srcTag + '/' + os.path.basename(document)))
|
os.path.join(env.install_dir,
|
||||||
|
dirs.doc,
|
||||||
|
srcTag,
|
||||||
|
os.path.basename(document)))
|
||||||
|
|
||||||
def dosed(filename, *sedPattern):
|
def dosed(filename, *sedPattern):
|
||||||
#FIXME: Convert to python
|
#FIXME: Convert to python
|
||||||
for pattern in sedPattern:
|
for pattern in sedPattern:
|
||||||
os.system('sed -i -e \'' + pattern + '\' ' + filename)
|
os.system('sed -i -e \'' + pattern + '\' ' + filename)
|
||||||
|
|
||||||
def dosbin(filename, destination='/usr/sbin'):
|
def dosbin(filename, destination=None):
|
||||||
install_dir = os.getenv('INSTALL_DIR')
|
env = config.env
|
||||||
|
|
||||||
|
if not destination:
|
||||||
|
destination = config.dirs.sbin
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.makedirs(install_dir + destination)
|
os.makedirs(env.install_dir + destination)
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if os.access(filename, os.F_OK):
|
if os.access(filename, os.F_OK):
|
||||||
shutil.copyfile(filename, install_dir + destination + '/' \
|
shutil.copyfile(filename,
|
||||||
+ os.path.basename(filename))
|
os.path.join(env.install_dir,
|
||||||
|
destination,
|
||||||
|
os.path.basename(filename)))
|
||||||
|
|
||||||
def doman(filename):
|
def doman(filename):
|
||||||
install_dir = os.getenv('INSTALL_DIR')
|
env = config.env
|
||||||
|
dirs = config.dirs
|
||||||
man, postfix = filename.split('.')
|
|
||||||
|
|
||||||
|
man, postfix = filename.split('.')
|
||||||
|
destDir = os.path.join(env.install_dir, dirs.man, "man"+postfix)
|
||||||
try:
|
try:
|
||||||
os.makedirs(install_dir + '/usr/share/man/man' + postfix)
|
os.makedirs(destDir)
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -55,6 +70,7 @@ def doman(filename):
|
|||||||
gzfile.close()
|
gzfile.close()
|
||||||
|
|
||||||
if os.access(filename, os.F_OK):
|
if os.access(filename, os.F_OK):
|
||||||
shutil.copyfile(filename + '.gz', install_dir + '/usr/share/man/man' \
|
shutil.copyfile(filename + '.gz',
|
||||||
+ postfix + '/' + os.path.basename(filename))
|
os.path.join(destDir,
|
||||||
|
os.path.basename(filename)))
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import sys, re
|
# standard python modules
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
from itertools import izip, imap, count, ifilter, ifilterfalse
|
from itertools import izip, imap, count, ifilter, ifilterfalse
|
||||||
|
|
||||||
def cat(filename):
|
def cat(filename):
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# stadard python modules
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from tempfile import mkstemp, mkdtemp
|
from tempfile import mkstemp, mkdtemp
|
||||||
|
|||||||
Reference in New Issue
Block a user