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
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# standard python modules
|
||||
import os
|
||||
from pisi.context import const
|
||||
|
||||
# actions api modules
|
||||
from config import config
|
||||
|
||||
def configure(parameters = ''):
|
||||
''' FIXME: Düzgün hale getirilecek '''
|
||||
''' parameters = '--with-nls --with-libusb --with-something-usefull '''
|
||||
dirs = config.dirs
|
||||
flags = config.flags
|
||||
|
||||
configure_string = './configure --prefix=/usr \
|
||||
--host=i686-pc-linux-gnu \
|
||||
--mandir=/usr/share/man \
|
||||
--infodir=/usr/share/info \
|
||||
--datadir=/usr/share \
|
||||
--sysconfdir=/etc \
|
||||
--localstatedir=/var/lib \
|
||||
%s' % parameters
|
||||
configure_string = './configure --prefix=%s \
|
||||
--host=%s \
|
||||
--mandir=%s \
|
||||
--infodir=%s \
|
||||
--datadir=%s \
|
||||
--sysconfdir=%s \
|
||||
--localstatedir=%s \
|
||||
%s' % (dirs.defaultprefix,
|
||||
flags.host,
|
||||
dirs.man,
|
||||
dirs.info,
|
||||
dirs.data,
|
||||
dirs.conf,
|
||||
dirs.localstate,
|
||||
parameters)
|
||||
|
||||
os.system(configure_string)
|
||||
|
||||
@@ -26,17 +38,23 @@ def make():
|
||||
def install():
|
||||
''' FIXME: Düzgün hale getirilecek '''
|
||||
''' dir_suffix = /var/tmp/pisi/ _paket_adı_ /image/ '''
|
||||
global const
|
||||
dirs = config.dirs
|
||||
|
||||
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 \
|
||||
datadir=%(prefix)s/usr/share \
|
||||
infodir=%(prefix)s/usr/share/info \
|
||||
localstatedir=%(prefix)s/var/lib \
|
||||
mandir=%(prefix)s/usr/share/man \
|
||||
sysconfdir=%(prefix)s/etc \
|
||||
install' % {'prefix': dir_suffix}
|
||||
install_string = 'make prefix=%(prefix)s/%(defaultprefix)s \
|
||||
datadir=%(prefix)s/%(data)s \
|
||||
infodir=%(prefix)s/%(info)s \
|
||||
localstatedir=%(prefix)s/%(localstate)s \
|
||||
mandir=%(prefix)s/%(man)s \
|
||||
sysconfdir=%(prefix)s/%(conf)s \
|
||||
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)
|
||||
|
||||
@@ -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
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os, string, re, shutil
|
||||
from shell import *
|
||||
# standard python modules
|
||||
import os
|
||||
import string
|
||||
import re
|
||||
import shutil
|
||||
|
||||
# pisi modules
|
||||
from pisi.ui import ui
|
||||
|
||||
# actions api modules
|
||||
from shell import *
|
||||
|
||||
def gnuconfig_findnewest():
|
||||
''' find the newest config.* file according to
|
||||
timestamp and return it'''
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# standard python modules
|
||||
import os
|
||||
from pisi.context import const
|
||||
|
||||
# actions api modules
|
||||
from config import config
|
||||
|
||||
# Global variables for compiling KDE programs...
|
||||
kde_dir = os.getenv('KDEDIR')
|
||||
@@ -14,13 +17,13 @@ def configure(parameters = ''):
|
||||
''' parameters = '--with-nls --with-libusb --with-something-usefull '''
|
||||
|
||||
configure_string = './configure --prefix=%s \
|
||||
--host=i686-pc-linux-gnu \
|
||||
--host=%s \
|
||||
--with-x \
|
||||
--enable-mitshm \
|
||||
--with-qt-dir=%s \
|
||||
--enable-mt \
|
||||
--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)
|
||||
|
||||
@@ -31,10 +34,9 @@ def make():
|
||||
def install():
|
||||
''' FIXME: Düzgün hale getirilecek '''
|
||||
''' dir_suffix = /var/tmp/pisi/ _paket_adı_ /image/ '''
|
||||
global const
|
||||
|
||||
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)
|
||||
os.system(install_string)
|
||||
|
||||
@@ -1,52 +1,67 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os, shutil
|
||||
# standard python modules
|
||||
import os
|
||||
import shutil
|
||||
import gzip
|
||||
|
||||
# actions api modules
|
||||
from config import config
|
||||
|
||||
def dodoc(*documentList):
|
||||
env = config.env
|
||||
dirs = config.dirs
|
||||
|
||||
install_dir = os.getenv('INSTALL_DIR')
|
||||
src_name = os.getenv('SRC_NAME')
|
||||
src_version = os.getenv('SRC_VERSION')
|
||||
src_release = os.getenv('SRC_RELEASE')
|
||||
|
||||
srcTag = src_name + '-' + src_version + '-' + src_release
|
||||
srcTag = env.src_name + '-' \
|
||||
+ env.src_version + '-' \
|
||||
+ env.src_release
|
||||
|
||||
try:
|
||||
os.makedirs(install_dir + '/' + 'usr/share/doc/' + srcTag)
|
||||
os.makedirs(os.path.join(env.install_dir,
|
||||
dirs.doc,
|
||||
srcTag))
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
for document in documentList:
|
||||
if os.access(document, os.F_OK):
|
||||
shutil.copyfile(document, os.path.join(install_dir, \
|
||||
'usr/share/doc/' + srcTag + '/' + os.path.basename(document)))
|
||||
shutil.copyfile(document,
|
||||
os.path.join(env.install_dir,
|
||||
dirs.doc,
|
||||
srcTag,
|
||||
os.path.basename(document)))
|
||||
|
||||
def dosed(filename, *sedPattern):
|
||||
#FIXME: Convert to python
|
||||
for pattern in sedPattern:
|
||||
os.system('sed -i -e \'' + pattern + '\' ' + filename)
|
||||
|
||||
def dosbin(filename, destination='/usr/sbin'):
|
||||
install_dir = os.getenv('INSTALL_DIR')
|
||||
def dosbin(filename, destination=None):
|
||||
env = config.env
|
||||
|
||||
if not destination:
|
||||
destination = config.dirs.sbin
|
||||
|
||||
try:
|
||||
os.makedirs(install_dir + destination)
|
||||
os.makedirs(env.install_dir + destination)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
if os.access(filename, os.F_OK):
|
||||
shutil.copyfile(filename, install_dir + destination + '/' \
|
||||
+ os.path.basename(filename))
|
||||
shutil.copyfile(filename,
|
||||
os.path.join(env.install_dir,
|
||||
destination,
|
||||
os.path.basename(filename)))
|
||||
|
||||
def doman(filename):
|
||||
install_dir = os.getenv('INSTALL_DIR')
|
||||
|
||||
man, postfix = filename.split('.')
|
||||
env = config.env
|
||||
dirs = config.dirs
|
||||
|
||||
man, postfix = filename.split('.')
|
||||
destDir = os.path.join(env.install_dir, dirs.man, "man"+postfix)
|
||||
try:
|
||||
os.makedirs(install_dir + '/usr/share/man/man' + postfix)
|
||||
os.makedirs(destDir)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
@@ -55,6 +70,7 @@ def doman(filename):
|
||||
gzfile.close()
|
||||
|
||||
if os.access(filename, os.F_OK):
|
||||
shutil.copyfile(filename + '.gz', install_dir + '/usr/share/man/man' \
|
||||
+ postfix + '/' + os.path.basename(filename))
|
||||
shutil.copyfile(filename + '.gz',
|
||||
os.path.join(destDir,
|
||||
os.path.basename(filename)))
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys, re
|
||||
# standard python modules
|
||||
import sys
|
||||
import re
|
||||
from itertools import izip, imap, count, ifilter, ifilterfalse
|
||||
|
||||
def cat(filename):
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# stadard python modules
|
||||
import os
|
||||
import time
|
||||
from tempfile import mkstemp, mkdtemp
|
||||
|
||||
Reference in New Issue
Block a user