Kaydet (Commit) 4576c62b authored tarafından Suleyman Poyraz's avatar Suleyman Poyraz

Gereksizler silindi, bazilari ismail abiye atildi

üst ea65b849
2018-01-29 Suleyman Poyraz <nipalensisaquila@gmail.com>
* Gereksiz toolar temizlendi:
Bazıları ismail abiye yüklenecek, İsmail abi kim mi?
ÇOK YAKINDAAAA....
2018-01-28 Suleyman Poyraz <nipalensisaquila@gmail.com>
* distupdate komutu eklendi:
Upgrade komutu buyuk capta guncellemeler için biraz
......
......@@ -16,6 +16,7 @@ import shutil
import string
import pwd
import grp
import sys
import gettext
__trans = gettext.translation('inary', fallback=True)
......@@ -244,11 +245,11 @@ def dirName(filePath):
'''return the directory name of pathname path'''
return os.path.dirname(filePath)
##Fix me:there are an important error in here please##
##FIXME:there are an important error in here please##
## fix here tomorrow (don't forget) ##
def system(command):
#command an list but should be an str
print(command)
sys.stdout.write(command)
# command = str.join(str.split(command))
retValue = run_logged(command)
......
# -*- coding: utf-8 -*-
import hashlib
import os
import inary
import sys
import time
IGNORE_DIRS = ('/root',
'/tmp',
'/home',
'/media',
'/mnt',
'/proc',
'/sys',
'/dev',
'/var/run',
'/var/inary',
'/var/lib/inary',
'/var/tmp',
'/var/log',
'/var/db/sudo',
'/var/lock/subsys',
'/var/spool',
'/var/cache',
'/var/db/comar3/scripts',
'/var/db/comar3/apps',
'/var/lib/mysql/mysql',
'/etc/mudur/services')
IGNORE_EXTS = ('.pyc',
'.pid')
def get_hash(filepath):
def _hash(_str):
return hashlib.sha1(_str.encode('utf-8')).hexdigest()
if os.path.islink(filepath):
data = os.path.realpath(filepath)
else:
data = open(filepath).read()
return _hash(data)
def find_unowned(rootdir, last_unowned):
db = inary.db.installdb.InstallDB()
all_files = []
for package in inary.api.list_installed():
files = ['/' + x.path for x in db.get_files(package).list]
all_files.extend(files)
filepaths = []
for root, dirs, files in os.walk(rootdir):
if root in IGNORE_DIRS:
while len(dirs):
dirs.pop()
continue
for name in files:
if name.endswith(IGNORE_EXTS):
continue
filepath = os.path.join(root, name)
if filepath not in all_files and filepath not in last_unowned:
sys.stdout.write("UNOWNED %s\n" % filepath)
sys.stdout.flush()
def find_corrupted(rootdir, last_changed):
for package in inary.api.list_installed():
check = inary.api.check(package)
for filepath in check['corrupted']:
filepath = '/' + filepath
if not filepath.startswith(rootdir):
continue
if filepath not in last_changed or last_changed[filepath] != get_hash(filepath):
sys.stdout.write("CHANGED %s %s %s\n" % (get_hash(filepath), package, filepath))
sys.stdout.flush()
for filepath in check['missing']:
filepath = '/' + filepath
if not filepath.startswith(rootdir):
continue
sys.stdout.write("MISSING %s %s\n" % (package, filepath))
sys.stdout.flush()
def forensics(rootdir='/',logfile=logfile):
if not rootdir.endswith('/'):
rootdir += '/'
if logfile:
pass
else:
logfile = None
last_unowned = []
last_changed = {}
if logfile:
for line in open(logfile):
line = line.strip()
if line.startswith("UNOWNED"):
_type, _filepath = line.split(' ', 1)
last_unowned.append(_filepath)
elif line.startswith("CHANGED"):
_type, _hash, _package,_filepath = line.split(' ', 3)
last_changed[_filepath] = _hash
find_unowned(rootdir, last_unowned)
find_corrupted(rootdir, last_changed)
#!/usr/bin/env python3
#
# Copyright (C) 2005, 2006 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 os
import sys
import inary.uri
import inary.specfile
def scanPSPEC(folder):
packages = []
for root, dirs, files in os.walk(folder):
if "pspec.xml" in files:
packages.append(root)
# dont walk into the versioned stuff
if ".svn" in dirs:
dirs.remove(".svn")
return packages
def cleanArchives(file):
try:
os.remove(file)
except OSError:
print("Permission denied...")
if __name__ == "__main__":
try:
packages = scanPSPEC(sys.argv[1])
except:
print("Usage: cleanArchives.py path2repo")
sys.exit(1)
if "--dry-run" in sys.argv:
clean = False
elif "--clean" in sys.argv:
clean = True
else:
sys.exit(0)
files = []
for package in packages:
spec = inary.specfile.SpecFile()
spec.read(os.path.join(package, "pspec.xml"))
URI = inary.uri.URI(spec.source.archive.uri)
files.append(URI.filename())
archiveFiles = os.listdir("/var/cache/inary/archives/")
unneededFiles = [x for x in archiveFiles if x not in files]
for i in unneededFiles:
if not clean:
print(("/var/cache/inary/archives/%s" % i))
else:
cleanArchives("/var/cache/inary/archives/%s" % i)
#!/usr/bin/env python3
import sys
import os
import codecs
import xml.dom.minidom as mdom
def find_pspecs(folder):
paks = []
for root, dirs, files in os.walk(folder):
if "pspec.xml" in files:
paks.append(root)
# dont walk into the versioned stuff
if ".svn" in dirs:
dirs.remove(".svn")
return paks
def addText(doc, parent, text):
cdata =doc.createTextNode(text)
parent.appendChild(cdata)
def getTags(parent, childName):
return [x for x in parent.childNodes if x.nodeType == x.ELEMENT_NODE if x.tagName == childName]
def getNodeText(node, tag, default=None):
try:
c = getTags(node, tag)[0].firstChild.data
except:
c = default
return c
def newNode(doc, tag, text):
node = doc.createElement(tag)
cdata = doc.createTextNode(text)
node.appendChild(cdata)
return node
def fixIndent(doc, node):
for x in node.childNodes:
if x.nodeType == x.ELEMENT_NODE:
if x.tagName == "Update":
fixIndent(doc, x)
else:
x.data = "\n" + x.data[5:]
def fixTags(doc, hist):
for update in hist.childNodes:
if update.nodeType == update.ELEMENT_NODE:
rno = getNodeText(update, "Release")
update.setAttribute("release", rno)
if rno == "1":
comment = newNode(doc, "Comment", "First release.")
paker = getTags(getTags(doc.documentElement, "Source")[0], "Packager")[0]
name = newNode(doc, "Name", getNodeText(paker, "Name"))
email = newNode(doc, "Email", getNodeText(paker, "Email"))
else:
comment = newNode(doc, "Comment", "FIXHISTORY")
name = newNode(doc, "Name", "FIXHISTORY")
email = newNode(doc, "Email", "FIXHISTORY")
update.replaceChild(comment, getTags(update, "Release")[0])
addText(doc, update, " ")
update.appendChild(name)
addText(doc, update, "\n ")
update.appendChild(email)
addText(doc, update, "\n ")
def fixPspec(path):
doc = mdom.parse(path)
inary = doc.documentElement
source = getTags(inary, "Source")[0]
history = getTags(source, "History")[0]
item = source.removeChild(history)
addText(doc, inary, "\n ")
fixIndent(doc, item)
fixTags(doc, item)
inary.appendChild(item)
addText(doc, inary, "\n")
f = codecs.open(path,'w', "utf-8")
f.write(doc.toxml())
f.close()
pakages = find_pspecs(sys.argv[1])
for pak in pakages:
fixPspec(os.path.join(pak, "pspec.xml"))
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import xml.dom.minidom as mdom
import codecs
import os
folder = "/var/lib/inary"
def saveMetadata(data, file):
if data:
f = codecs.open(file, 'w', "utf-8")
f.write(data)
f.close()
return True
def getNodeText(node, tag, default=None):
try : c = getTags(node, tag)[0].firstChild.data
except: c = default
return c
def getTags(parent, childName):
return [x for x in parent.childNodes if x.nodeType == x.ELEMENT_NODE if x.tagName == childName]
def addText(dom, parent, text):
cdata = dom.createTextNode(text)
parent.appendChild(cdata)
def fixMetadata(metadata):
dom = mdom.parse(metadata)
inary = dom.documentElement
package = getTags(inary, "Package")[0]
history = getTags(package, "History")[0]
item = package.removeChild(history)
for update in history.childNodes:
if update.nodeType == update.ELEMENT_NODE:
try:
rno = getNodeText(update, "Release")[6:-5]
except TypeError:
return None
update.setAttribute("release", rno)
release = getTags(update, "Release")[0]
update.removeChild(release)
addText(dom, package, " ")
package.appendChild(item)
addText(dom, package, "\n ")
return dom.toxml()
def findMetadata():
for root, dirs, files in os.walk(folder):
if "metadata.xml" in files:
yield (root + '/metadata.xml')
for file in findMetadata():
if saveMetadata(fixMetadata(file), file):
print(("Güncellendi : ", file))
else:
print(("Hiç bir şey yapılmadı: ", file))
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006, 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.
# a Simple helper script for INARY to set default repo
import os
import sys
import inary
import inary.context as ctx
def usage():
print("""
Usage:
inarysdr reponame
""")
sys.exit(1)
def main():
if len(sys.argv) < 2:
usage()
repo = sys.argv[1]
try:
ctx.repodb.set_default_repo(repo)
except inary.lockeddbshelve.Error as e:
print(e)
if __name__ == "__main__":
sys.exit(main())
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2005, TUBITAK/UEKAE
#
......@@ -10,32 +10,33 @@
#
# Authors: Eray, Baris
import sys
import locale
import traceback
import signal
import os
import locale
import traceback
import signal
import os
import inary.ui
import inary.context as ctx
from inary.cli.inarycli import InaryCLI
import gettext
__trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext
def exit(retval = 0):
inary.api.finalize()
sys.exit(retval)
if __name__ == "__main__":
locale.setlocale(locale.LC_ALL, '')
print ("""Welcome to the interactive INARY shell.
ctx.ui.info(_("""Welcome to the interactive INARY shell.
Type "help" to see a list of commands.
To end the session, type "exit".
You can run system commands by prefixing with '!' as in '!ls'.
Copyright 2017 (c) AquilaNipalensis and Sulin Community. """)
Copyright 2018 (c) Zaryob and Sulin Community. """))
while 1:
cmd = input('inary> ')
if cmd.strip()=='exit':
print ('Bye!')
ctx.ui.info(_('Bye!'))
exit()
if cmd.startswith('!'):
cmd = cmd[1:]
......@@ -45,7 +46,7 @@ if __name__ == "__main__":
cli = InaryCLI(cmd.split())
cli.run_command()
except inary.Exception as e:
print (_('Inary has been upgraded.'))
ctx.ui.info(_('Inary has been upgraded.'))
except Exception as value:
signal.signal(signal.SIGINT, signal.SIG_IGN) # disable further interrupts
ui = inary.cli.CLI() # make a temporary UI
......@@ -63,14 +64,14 @@ if __name__ == "__main__":
# For any other exception (possibly Python exceptions) show the traceback!
show_traceback = ctx.get_option('debug')
ui.error(_("System Error. Program Terminated."))
if ctx.get_option('debug'):
ui.error(u"%s: %s" % (exception, value))
ui.error(u"{}: {}".format(exception, value))
else:
ui.error(str(value))
ui.info(_("Please type 'help' for general help."))
if show_traceback:
ui.info(_("Traceback:"))
traceback.print_tb(sys.exc_traceback)
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import urllib.request, urllib.error, urllib.parse
import piksemel
first_revision = "27898"
accounts_url = "http://svn.pardus.org.tr/uludag/trunk/common/accounts"
authors = {}
def get_author_name_mail(author):
if not authors:
accounts = urllib.request.urlopen(accounts_url)
for line in accounts:
if line.startswith("#"):
continue
elif line.count(":") != 3:
continue
account, name, mail, jabber = line.split(":")
mail = mail.replace(" [at] ", "@")
authors[account] = "%s <%s>" % (name, mail)
return authors[author]
def cleanup_msg_lines(lines):
result = []
for line in lines:
if line.startswith("BUG:FIXED:"):
bug_number = line.split(":")[2]
line = "Fixes the bug reported at http://bugs.pardus.org.tr/%s." % bug_number
elif line.startswith("BUG:COMMENT:"):
bug_number = line.split(":")[2]
line = "See http://bugs.pardus.org.tr/%s." % bug_number
elif line.startswith("Changes since "):
return result[:-1]
result.append(line)
return result
def strip_empty_lines(msg):
result = []
for line in msg.splitlines():
if not line.strip():
line = ""
result.append(line)
return "\n".join(result)
def create_log_entry(author, date, msg):
if author == "transifex":
return None
author = get_author_name_mail(author)
date = date.split("T", 1)[0]
lines = msg.splitlines()
lines = cleanup_msg_lines(lines)
lines[0] = "\t* %s" % lines[0]
msg = "\n\t".join(lines)
msg = strip_empty_lines(msg)
entry = "%s %s\n%s" % (date, author, msg)
return entry
if __name__ == "__main__":
p = os.popen("svn log -r%s:HEAD --xml" % first_revision)
doc = piksemel.parseString(p.read())
entries = []
for log_entry in doc.tags("logentry"):
author = log_entry.getTagData("author")
date = log_entry.getTagData("date")
msg = log_entry.getTagData("msg")
entry = create_log_entry(author, date, msg.strip())
if entry:
entries.append(entry)
entries.reverse()
open("ChangeLog", "w").write("\n\n".join(entries))
This diff is collapsed.
#!/bin/bash
# revdep-rebuild: Reverse dependency rebuilder.
# Author: Stanislav Brabec <utx@gentoo.org>
# Adapt to Pardus
# Author: Ozan Caglayan <ozan@pardus.org.tr>
# Mask of specially evaluated libraries (exactly one space separated).
LD_LIBRARY_MASK="libodbcinst.so libodbc.so libjava.so libjvm.so"
# List of directories to be searched (feel free to edit it)
# Note /usr/libexec and /usr/local/subprefix contradicts FHS, but are present
SEARCH_DIRS="/lib /bin /sbin /usr/lib /usr/bin /usr/sbin /usr/libexec /usr/local /usr/qt* /usr/kde/*/bin /usr/lib/MozillaFirefox /usr/kde/*/lib /usr/*-*-linux-gnu /opt"
EXCLUDE_DIRS="/opt/ptsp /usr/lib/xorg/nvidia* /usr/lib/debug"
# Base of temporary files names.
LIST=~/.revdep-rebuild
shopt -s nullglob
shopt -s expand_aliases
unalias -a
NO="\x1b[0;0m"
BR="\x1b[0;01m"
CY="\x1b[36;01m"
GR="\x1b[32;01m"
RD="\x1b[31;01m"
YL="\x1b[33;01m"
BL="\x1b[34;01m"
alias echo_v=echo
SONAME="not found"
SONAME_GREP=fgrep
SEARCH_BROKEN=true
while : ; do
case "$1" in
-h | --help )
echo "Usage: $0 [OPTIONS] [--]"
echo
echo "Broken reverse dependency checker."
echo
echo
echo " --force remove old revdep-rebuild files"
echo
echo " --soname SONAME recompile packages using library with SONAME instead"
echo " of broken library (SONAME providing library must be"
echo " present in the system)"
echo " --soname-regexp SONAME"
echo " the same as --soname, but accepts grep-style regexp"
echo " -q, --quiet be less verbose"
echo
exit 0
;;
-q | --quiet )
alias echo_v=:
shift
;;
--soname=* )
SONAME="${1#*=}"
SEARCH_BROKEN=false
shift
;;
--soname )
SONAME="$2"
SEARCH_BROKEN=false
shift 2
;;
--soname-regexp=* )
SONAME="${1#*=}"
SONAME_GREP=grep
SEARCH_BROKEN=false
shift
;;
--soname-regexp )
SONAME="$2"
SONAME_GREP=grep
SEARCH_BROKEN=false
shift 2
;;
--force )
FORCE=true
shift
;;
-- )
shift
break
;;
* )
break
;;
esac
done
function set_trap () {
trap "rm_temp $1" SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
}
function rm_temp () {
echo " terminated."
echo "Removing incomplete $1."
rm $1
echo
exit 1
}
if $FORCE ; then
rm -f /root/.revdep-rebuild*
fi
if $SEARCH_BROKEN ; then
SONAME_SEARCH="$SONAME"
LLIST=$LIST
HEAD_TEXT="broken by any package update"
OK_TEXT="Dynamic linking on your system is consistent"
WORKING_TEXT=" consistency"
else
SONAME_SEARCH=" $SONAME "
LLIST=${LIST}_$(echo "$SONAME_SEARCH$SONAME" | md5sum | head -c 8)
HEAD_TEXT="using given shared object name"
OK_TEXT="There are no dynamic links to $SONAME"
WORKING_TEXT=""
fi
echo
echo "Checking reverse dependencies..."
echo
echo -n -e "${GR}Collecting system binaries and libraries...${NO}"
if [ -f $LIST.1_files ] ; then
echo " using existing $LIST.1_files."
else
set_trap "$LIST.1_files"
EXCLUDED_DIRS=
for d in $EXCLUDE_DIRS; do
EXCLUDED_DIRS+="-path $d -prune -o "
done
find $SEARCH_DIRS $EXCLUDED_DIRS -type f \( -perm /+u+x -o -name '*.so' -o -name '*.so.*' \) 2>/dev/null >$LIST.1_files
echo -e " done.\n ($LIST.1_files)"
fi
if $SEARCH_BROKEN ; then
echo
echo -n -e "${GR}Collecting complete LD_LIBRARY_PATH...${NO}"
if [ -f $LIST.2_ldpath ] ; then
echo " using existing $LIST.2_ldpath."
else
set_trap "$LIST.2_ldpath"
(
grep '.*\.so\(\|\..*\)$' <$LIST.1_files | sed 's:/[^/]*$::'
sed '/^#/d;s/#.*$//' </etc/ld.so.conf
) | sort -u |
tr '\n' : | tr -d '\r' | sed 's/:$//' >$LIST.2_ldpath
echo -e " done.\n ($LIST.2_ldpath)"
fi
export COMPLETE_LD_LIBRARY_PATH="$(cat $LIST.2_ldpath)"
fi
echo
echo -n -e "${GR}Checking dynamic linking$WORKING_TEXT...${NO}"
if [ -f $LLIST.3_rebuild ] ; then
echo " using existing $LLIST.3_rebuild."
else
echo_v