Kaydet (Commit) 251a03c9 authored tarafından Suleyman Poyraz's avatar Suleyman Poyraz

Python3'e uygun olarak duzenlendi, eklendi filan

üst db4bb8ce
This diff is collapsed.
COMAR API package offers modules for accessing COMAR over D-Bus without pain and
common methods/classes for COMAR scripts.
SCOM API package offers modules for accessing COMAR over D-Bus without pain and
common methods/classes for SCOM scripts.
Here are some examples for accessing COMAR:
Here are some examples for accessing SCOM:
import comar
link = comar.Link()
import scom
link = scom.Link()
# Localize strings
link.setLocale()
......@@ -28,8 +28,8 @@ Asynchronous calls:
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
mainloop = gobject.MainLoop()
import comar
link = comar.Link()
import scom
link = scom.Link()
# Localize strings
link.setLocale()
......@@ -40,22 +40,22 @@ Asynchronous calls:
# Make an asynchronous call to get service information
def handler(package, exception, result):
if exception:
print "%s error: %s" % (package, exception)
print ("%s error: %s" % (package, exception))
else:
print "%s result: %s" % (package, result)
print ("%s result: %s" % (package, result))
link.System.Service.info(async=handler)
mainloop.run()
Connecting COMAR service on alternate destination:
Connecting SCOM service on alternate destination:
import comar
link = comar.Link(alternate=True)
import scom
link = scom.Link(alternate=True)
This will simply try to connect tr.org.pardus.comar2 instead
of tr.org.pardus.comar
This will simply try to connect tr.org.pardus.scom2 instead
of tr.org.pardus.scom
Connecting to alternative DBus server:
import comar
link = comar.Link(socket="/mnt/target/var/run/dbus/system_bus_socket")
import scom
link = scom.Link(socket="/mnt/target/var/run/dbus/system_bus_socket")
......@@ -5,7 +5,7 @@ import sys
from qt import *
import comar
import scom
from dbus.mainloop.qt3 import DBusQtMainLoop
import mainform
......@@ -14,7 +14,7 @@ class Window(mainform.mainForm):
def __init__(self, parent=None):
mainform.mainForm.__init__(self, parent)
self.link = comar.Link()
self.link = scom.Link()
self.connect(self.buttonServices, SIGNAL("clicked()"), self.getServices)
......
......@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
import sys
import comar
import scom
import mainform
from PyQt4 import QtGui
......@@ -19,7 +19,7 @@ class Window(QtGui.QWidget):
self.ui.setupUi(self)
# Call Comar
self.link = comar.Link()
self.link = scom.Link()
# Connect button click event to getServices method
self.connect(self.ui.buttonServices, SIGNAL("clicked()"), self.getServices)
......@@ -31,7 +31,7 @@ class Window(QtGui.QWidget):
self.ui.textServices.append("%s - %s - %s - %s" % (package, serviceName, serviceDesc, serviceState))
def getServices(self):
# Get service list from comar link
# Get service list from scom link
self.link.System.Service.info(async=self.handleServices)
def main():
......
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2009, TUBITAK/UEKAE
# Copyright (C) 2016-2018, AquilaNipalensis
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
......
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2009, TUBITAK/UEKAE
# Copyright (C) 2016-2018, AquilaNipalensis
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
......
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2009, TUBITAK/UEKAE
# Copyright (C) 2016-2018, AquilaNipalensis
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
......
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2009, TUBITAK/UEKAE
# Copyright (C) 2016-2018, AquilaNipalensis
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
......
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2007, TUBITAK/UEKAE
# Copyright (C) 2016-2017, AquilaNipalensis
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
......
Suleyman POYRAZ < nipalensisaquila [at] gmail.com >
AquilaNipalensis (Suleyman POYRAZ) < nipalensisaquila [at] gmail.com >
Mudur
------
Mudur is the first component of Pardus initialization system. It's the main startup script which is
called by init and handles basic initialization and shutdown.
# mudur
sysvinit booting scripts replacement for Lupus
Current Maintainer:
Fatih Aşıcı <fatih [at] pardus.org.tr>
Other Developers:
Onur Küçük <onur [at] pardus.org.tr>
2010-03-03 Fatih Aşıcı <fatih@pardus.org.tr>
* sorg/config.py:
Use "Disable" option for disable outputs.
2010-01-06 Fatih Aşıcı <fatih@pardus.org.tr>
* sorg-cli:
-d parameter can take an empty string as the driver name
that means the driver will be selected by the X server.
2009-11-17 Fatih Aşıcı <fatih@pardus.org.tr>
* data/DriversDB:
Remove nvidia71 driver as it doesn't work with new X servers.
* sorg/hwdata.py:
Remove names of old nvidia packages.
2009-10-30 Fatih Aşıcı <fatih@pardus.org.tr>
* data/DriversDB:
Add new NVIDIA cards.
2009-10-26 Fatih Aşıcı <fatih@pardus.org.tr>
* data/DriversDB:
Add new ATI cards.
2009-05-01 Fatih Aşıcı <fatih@pardus.org.tr>
* sorg/probe.py:
Implement a simplified version of getPrimaryCard.
2009-04-23 Fatih Aşıcı <fatih@pardus.org.tr>
* setup.py:
Do not install modprobe.d config file.
2009-03-30 Fatih Aşıcı <fatih@pardus.org.tr>
* data/DriversDB:
Prefer nvidia-drivers package for 10de:0242.
2009-03-28 Fatih Aşıcı <fatih@pardus.org.tr>
* sorg/parser.py:
Do case-insensitive comparison for entry names
2009-03-20 Fatih Aşıcı <fatih@pardus.org.tr>
* sorg/config.py, zorg/consts.py, zorg/hwdata.py, zorg/probe.py:
- Refactor variable names to increase consistency.
- Add configuredBus function to get last configured card by
sorg. This will be used at boot.
- Use an empty string for xkb variant as not all layouts have
"basic" variant.
* sorg/utils.py:
- Cleanup unused utils.
* setup.py:
- Get config and data dirs from sorg module instead of
hardcoding.
2009-03-08 Fatih Aşıcı <fatih@pardus.org.tr>
* sorg/utils.py:
- Improve backup function to keep last 3 backups.
- Use pardus-python's new get_kernel_option function. Remove
the internal one.
* sorg/config.py, zorg/consts.py, zorg/probe.py:
- Let Xorg decide most of the configurations. Make
Screen, Display, Layout and Monitor sections optional.
- Disable framebuffer size calculation since it tries
to parse mode name and mode names do not have to be in
format "WidthxHeight". Also drivers should be clever
to calcute fb size.
- Add a flag to indicate the initial config.
- Remove monitor query stuff.
- Cleanup unused bits.
* sorg/ddc, zorg/modeline.py:
- Remove ddc and modeline modules.
2009-03-05 Fatih Aşıcı <fatih@pardus.org.tr>
* sorg/config.py:
- Do not create InputDevice sections. We will use
new input hotplug mechanism for all input devices.
- Do not create Files section. We will use
catalogue paths.
- Do not create redundant dri section.
* sorg/__init__.py:
- Remove unused __all__ list.
2009-02-19 Fatih Aşıcı <fatih@pardus.org.tr>
* sorg/hwdata.py:
Copy hwdata module from display manager.
Add vboxvideo driver to the driver list.
2009-02-02 Fatih Aşıcı <fatih@pardus.org.tr>
* data/DriversDB, sorg/{config,probe}.py:
Add support for VirtualBox video and mouse drivers.
2009-01-22 Fatih Aşıcı <fatih@pardus.org.tr>
* sorg/parser.py:
Fix a regression introduced with
type/instance changes.
2009-01-21 Fatih Aşıcı <fatih@pardus.org.tr>
* sorg/probe.py:
Fixed framebuffer device node name.
* data/DriversDB:
Added new PCI IDs for nvidia-180.
2008-11-01 Fatih Aşıcı <fatih@pardus.org.tr>
* data/DriversDB:
Renamed nvidia packages.
Added new cards.
* data/modprobe.d/sorg:
Added new module names for nvidia.
* sorg/__init__.py:
Bumped version to 1.1.1.
2008-10-04 Fatih Aşıcı <fatih@pardus.org.tr>
* sorg/__init__.py:
Bumped version to 1.1.
* sorg/config.py:
Added support to create InputDevice sections
for wacom devices.
2008-09-24 Fatih Aşıcı <fatih@pardus.org.tr>
* sorg/probe.py:
Added a high timeout value for dbus calls since
enabling a driver package might take a long time on slow
machines.
2008-09-17 Fatih Aşıcı <fatih@pardus.org.tr>
* AUTHORS, ChangeLog:
Added AUTHORS and ChangeLog.
recursive-include sorg/ddc *.h
include sorg-loadmodule
include data/*DB data/modprobe.d/sorg
include AUTHORS ChangeLog COPYING README TODO
What is sorg?
-------------
sorg consists of python scripts and modules which
automate the configuration of Xorg.
Requirements
------------
* sulin-python > 0.3.3
Installing & Running
--------------------
1. Register the Scom script comes with sorg package:
hav register Xorg.Display sorg scom/xorg.display.py
2. Install:
./setup.py install --install-lib=/usr/lib/sulin
3. Run: sorg-cli
sorg TODO List
==============
Legend:
- Todo
? Not determined if/how we have to do
/ In progress
+ Accomplished
Scom Methods:
/ configuration setup on boot
+ check config files
+ check hardware changes
+ read kernel options (xorg=...)
+ do pending jobs
? compatibility check between kernel and xorg driver versions (e.g. nvidia-kernel and nvidia-glx issue)
- i18n support
- DPI setup
- INF file installation
- method to test server
? fall back to safeConfigure if something goes wrong while auto-probing
- improve debug stuff (maybe a log file)
Modules:
- try to get preferred resolution and use it by default
- parser to get monitor vendor/model list
Command Line Tool:
- test option
? DPI selection
? Xorg log file verbosity selection
? bug report option/tool
This diff is collapsed.
This diff is collapsed.
install fglrx /sbin/sorg-loadmodule $CMDLINE_OPTS
install nvidia /sbin/sorg-loadmodule $CMDLINE_OPTS
install nvidia_new /sbin/sorg-loadmodule $CMDLINE_OPTS
install nvidia_old /sbin/sorg-loadmodule $CMDLINE_OPTS
install nvidia_173 /sbin/sorg-loadmodule $CMDLINE_OPTS
install nvidia_177 /sbin/sorg-loadmodule $CMDLINE_OPTS
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# inf2mondb.py: convert .inf files for monitors to MonitorDB
#
# Matt Wilson <msw@redhat.com>
#
# Copyright 2002 Red Hat, Inc.
#
# Some fixes by Onur Küçük <onur@pardus.org.tr>
#
# This software may be freely redistributed under the terms of the GNU
# library public license.
import sys
import string
import re
def usage():
print("Usage: inf2mondb.py filename.inf")
sys.exit(1)
if len(sys.argv) < 2:
usage()
try:
f = open(sys.argv[1], 'r')
except IOError as xxx_todo_changeme:
(errno, str) = xxx_todo_changeme.args
print("Unable to open %s: %s" % (sys.argv[1], str))
sys.exit(1)
lines = f.readlines()
f.close()
# the current section
section = None
# monitors - a dictionary keyed off manufacturers
monitors = {}
# a dictionary of manufacturers we're looking at
manufacturers = {}
# registry sections mapped back to the install sections
regsections = {}
# install sections that map back to monitor definitions
instsections = {}
# a big fat dictionary of strings to use later on.
strings = {}
class Monitor:
def __repr__(self):
return "%s; %s; %s; %s; %s" % (self.man,
self.descr,
self.edid,
self.hsync,
self.vsync)
def __init__(self, man, id, edid):
self.descr = ""
self.man = man
self.hsync = ""
self.vsync = ""
self.id = id
self.edid = edid
sectRe = re.compile(r'\[*\]')
sectSplit = re.compile(r'[\[\]]')
infoSplit = re.compile(r'[%=\\;]')
# This RE is for EISA info lines
# %D5259A%=D5259A, Monitor\HWP0487
monitor1Re = re.compile(r'%*.%.*=.*,.*Monitor\\')
# This one is for legacy entries
# %3020% =PB3020, MonID_PB3020
monitor2Re = re.compile(r'%*.%.*=.*,.*MonID_')
# sync values that might be in the strings section
sync_keys = {}
for line in lines:
tmp = string.strip(line)
if tmp and tmp[0] == ';':
continue
if sectRe.search (line, 1):
section = string.lower(sectSplit.split (line)[1])
continue
if section == "manufacturer":
tmp = infoSplit.split (line)
if len(tmp) > 1:
manufacturer = string.lower(tmp[1])
if tmp[1] in manufacturers:
raise RuntimeError("Duplicate manufacturer entries")
else:
manufacturers[string.lower(string.strip(tmp[3].split(",")[0]))] = string.lower(string.strip(tmp[1]))
# if we're in a manufacturer section, we need to jot down
# the devices
elif section in manufacturers:
# Find monitor inf IDs and EISA ids:
monre = None
# EISA entries
# %D5259A%=D5259A, Monitor\HWP0487
if monitor1Re.search(line, 1):
monre = monitor1Re
# older non EISA entries
# %3020% =PB3020, MonID_PB3020
elif monitor2Re.search(line, 1):
monre = monitor2Re
if monre:
end = monre.search(line, 1).end()
id = string.strip(string.split(line, '%')[1])
if monre == monitor1Re:
# all EDID ID strings are 7 chars
edid = string.strip(line[end:])[0:7]
else:
edid = "0"
# we need to get the install section for this device
rhs = string.strip(string.split (line, '=')[1])
install = string.lower(string.strip(string.split (rhs, ',')[0]))
if install in instsections:
instsections[install].append ((section, id))
else:
instsections[install] = [ (section, id) ]
if section not in monitors:
monitors[section] = {}
monitors[section][id] = Monitor(section, id, edid)
elif section == "strings":
tmp = string.strip(tmp)
if not tmp:
continue
tmp = string.split (line, '=')
if len (tmp) < 2:
continue
key = string.lower(string.strip(tmp[0]))
tmp = string.split(string.strip(tmp[1]), '"')
if len (tmp) > 1:
value = tmp[1]
else:
value = tmp[0]
strings[key] = string.strip(value)
# Deal with sync lines in the strings section
if key in sync_keys:
sync = string.split(value, ",")
for (man, mon) in sync_keys[key]:
monitors[man][mon].hsync = string.strip(sync[0])
monitors[man][mon].vsync = string.strip(sync[1])
# these are the sections that tell us which AddReg to use
# AddReg=PBCOM14L.AddReg, 1024, DPMS
elif section in instsections:
if string.find (line, "AddReg=") >= 0:
rhs = string.split (line, '=')[1]
# PBCOM14L.AddReg, 1024, DPMS
registry = string.lower(string.strip(string.split(rhs, ',')[0]))
# add this monitor to the list of monitors that will
# use this registry entry
if registry in regsections:
regsections[registry].append (section)
else:
regsections[registry] = [ section ]
# these are the actual AddReg entries. Look up in our table
# to find which
elif section in regsections:
if string.find(line, 'HKR') >= 0:
ids = regsections[section]
# make a list of all the monitors pointing to
# this registry section via install sections
mons = []
for id in ids:
mons = mons + instsections[id]
if string.find(line, 'HKR,"MODES') >= 0:
modes = string.split(line, '"')
sync = string.split(modes[3], ',')
for (man, mon) in mons:
monitors[man][mon].hsync = string.strip(sync[0])
monitors[man][mon].vsync = string.strip(sync[1])
else:
# Sync lines must be somewhere else, maybe in the strings section
keyval = None
try:
keyval = string.split(line,",")[4]
except IndexError:
pass
if keyval and string.find(keyval, "KeyValue") >= 0:
keyval = string.replace(string.strip(keyval), "%", "").lower()
sync_keys[keyval] = mons
for man in list(manufacturers.keys()):
for monitor in list(monitors[man].values()):
# OK, I know it's hacked up to look up these strings way down
# here, but .inf format is CRAP.
try:
monitor.descr = strings[string.lower(monitor.id)]
except KeyError:
monitor.descr = monitor.id
try:
monitor.man = strings[string.lower(manufacturers[man])]
except:
monitor.man = manufacturers[man]
print(monitor)
#!/usr/bin/python
#-*- coding: utf-8 -*-
import os
from distutils.core import setup
from distutils.command.install import install
import sorg
from sorg import consts
class Install(install):
def run(self):
install.run(self)
if not self.root:
self.root = "/"
target = os.path.join(self.root, consts.config_dir.lstrip("/"))
if not os.path.exists(target):
os.makedirs(target, 0o755)
setup(name="sorg",
version=sorg.versionString(),
description="Python Modules for sorg",
license="GNU GPL2",
url="http://www.pardus.org.tr/",
packages = ["sorg"],
scripts = ["sorg-cli", "inf2mondb"],
data_files = [
(consts.data_dir, ["data/DriversDB", "data/MonitorsDB"]),
("/sbin", ["sorg-loadmodule"]),
],
cmdclass = {"install": Install}
)
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2010 TUBITAK/UEKAE
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# Please read the COPYING file.
import sys
import optparse
import scom
import sorg
from sorg.consts import package_sep
from sorg.utils import *
sorg_info = " Xorg AutoConfiguration tool"
link = scom.Link()
def safe():
if link.Xorg.Display["sorg"].safeConfig():
link.Xorg.Display["sorg"].syncConfigs()
print("Initialized a safe configuration using VESA driver.")
else:
print("Failed to create a safe configuration with VESA driver.")
def probe(opts):
if link.Xorg.Display["sorg"].initialConfig():
link.Xorg.Display["sorg"].syncConfigs()
print("Created an initial configuration for your video device.")
else:
print("An error occured while creating an initial configuration.")
def setDriver(driver):
# Needed for compatibility with old sorg versions
oldnames = {
"fglrx/ati-drivers": "fglrx",
"nvidia/xorg-video-nvidia96": "nvidia96",
"nvidia/xorg-video-nvidia173": "nvidia173",
"nvidia/xorg-video-nvidia185": "nvidia185",
}
if driver in oldnames:
driver = oldnames[driver]
if package_sep in driver:
drv, pkg = driver.split(package_sep, 1)
if pkg.replace("-", "_") not in list(link.Xorg.Driver):
print("Package is not installed: %s" % pkg)
sys.exit(1)
link.Xorg.Display["sorg"].setDriver(driver)
link.Xorg.Display["sorg"].syncConfigs()
if driver:
print("The video driver is set to '%s'." % driver)
else:
print("The video driver will be selected by the X server.")
if __name__ == "__main__":
parser = optparse.OptionParser(description = "%s version %s"
% (sorg_info, zorg.versionString()))
parser.add_option("-s", "--safe", action="store_true",
dest="safe", default=False,
help="setup VESA config without probing hardware")
parser.add_option("-p", "--probe", action="store_true",
dest="probe", default=False,
help="force probing all devices, even if xorg.conf exists")
parser.add_option("-d", "--driver", action="store", type="string",
dest="driver", default=None, metavar="DRIVER[%sPACKAGE]" % package_sep,
help="set video card driver to DRIVER")
parser.add_option("-k", "--keymap", action="store", type="string",
dest="keymap", default=None, metavar="LAYOUT[/VARIANT]",
help="changes keyboard map")
opts, args = parser.parse_args()
if opts.safe:
safe()
elif opts.probe:
probe(opts)
elif opts.driver is not None:
setDriver(opts.driver)
elif opts.keymap:
if "/" in opts.keymap:
layout, variant = opts.keymap.split("/", 1)
else:
layout, variant = opts.keymap, ""
link.Xorg.Display["sorg"].setKeymap(layout, variant)
else:
parser.print_help()
#!/bin/sh
kernel_module=/var/lib/sorg/kernel_module
if [ -e $kernel_module ]; then
/sbin/modprobe --ignore-install $(cat $kernel_module) $@
fi
#-*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009, TUBITAK/UEKAE
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# Please read the COPYING file.
#