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
set_trap "$LLIST.3_rebuild"
LD_MASK="\\( $(echo "$LD_LIBRARY_MASK" | sed 's/\./\\./g;s/ / \\| /g') \\)"
echo -n >$LLIST.3_rebuild
cat $LIST.1_files | while read FILE ; do
# Note: double checking seems to be faster than single
# with complete path (special add ons are rare).
if ldd "$FILE" 2>/dev/null | grep -v "$LD_MASK" |
$SONAME_GREP -q "$SONAME_SEARCH" ; then
if $SEARCH_BROKEN ; then
if LD_LIBRARY_PATH="$COMPLETE_LD_LIBRARY_PATH" \
ldd "$FILE" 2>/dev/null | grep -v "$LD_MASK" |
$SONAME_GREP -q "$SONAME_SEARCH" ; then
echo "$FILE" >>$LLIST.3_rebuild
echo_v " broken $FILE (requires $(ldd "$FILE" | sed -n 's/ \(.*\) => not found$/\1/p' | tr '\n' ' ' | sed 's/ $//' ))"
fi
else
echo "$FILE" >>$LLIST.3_rebuild
echo_v " found $FILE"
fi
fi
done
echo -e " done.\n ($LLIST.3_rebuild)"
fi
echo
echo -n -e "${GR}Determining package names$WORKING_TEXT...${NO}"
if [ -f $LLIST.4_names ] ; then
echo " using existing $LLIST.4_names."
else
echo_v
set_trap "$LLIST.4_names"
for i in `cat $LLIST.3_rebuild`
do
/usr/bin/inary -q search-file $i >> $LLIST.tmp
done
cat $LLIST.tmp | uniq | sort > $LLIST.4_names
rm -f $LLIST.tmp
echo -e " done.\n ($LIST.4_names)"
fi
cat $LLIST.4_names
#! /usr/bin/env python3
#
# a script to prepare INARY source tarball from any svn directory you specify
# in any revision you want.
# author: sdalgic
#
# any comments and feedbacks are welcomed : dalgic.srdr [AT] gmail [DOT] com
#
# inspired from http://svn.pardus.org.tr/uludag/trunk/inary/tools/svndist.py written by exa.
import sys
import os
import shutil
import datetime
import inary
from optparse import OptionParser
def run(cmd):
print(('running', cmd))
os.system(cmd)
if __name__ == "__main__":
sys.path.insert(0, '.')
ver = inary.__version__
inarySVNpath = "http://svn.uludag.org.tr/uludag/trunk/inary"
svndist = "svndist"
usage = "usage: %s [options] " % os.path.basename(sys.argv[0])
parser = OptionParser(usage = usage)
parser.add_option("-r", "--revision", dest="rev", default = "HEAD",
help="Select a revision to export. \
Default is the HEAD value. \
")
parser.add_option("-o", "--out-dir", dest="svndist", default = svndist, type="string",
help="Select the output directory to export. \
Default is the `svndist` directory. ")
parser.add_option("-p", "--path", dest="inarySVNpath", default=inarySVNpath, type="string",
help="Select the SVN Path which is going to be exported. It can be a local copy too. \
Default is http://svn.uludag.org.tr/uludag/trunk/inary ")
parser.add_option("--with-date", action="store_true", dest="date", default=False,
help="Add date tag to the tar file name. ")
(opts, args) = parser.parse_args()
print('Exporting svn directory')
if not os.path.exists(opts.svndist):
os.makedirs(opts.svndist)
if opts.rev == "HEAD":
if os.path.exists(opts.svndist+'/inary-%s' % ver):
shutil.rmtree(svndist+'/inary-%s' % ver)
run('svn export %s %s/inary-%s' % (opts.inarySVNpath, opts.svndist, ver))
os.chdir(opts.svndist)
run('tar cjvf inary-%s.tar.bz2 inary-%s' % (ver,ver))
if opts.date == True :
time = datetime.datetime.now()
os.rename('inary-%s.tar.bz2' % ver , 'inary-%s.%s.%s-%s.tar.bz2' % (time.year, time.month, time.day, ver))
else:
if os.path.exists(opts.svndist+'/inary-r%s' % opts.rev):
shutil.rmtree(opts.svndist+'/inary-r%s' % opts.rev)
run('svn export -r %s %s %s/inary-r%s' % (opts.rev, opts.inarySVNpath, opts.svndist, opts.rev))
os.chdir(opts.svndist)
run('tar cjvf inary-r%s.tar.bz2 inary-r%s' % (opts.rev,opts.rev))
if opts.date == True :
time = datetime.datetime.now()
os.rename('inary-r%s.tar.bz2' % opts.rev , 'inary-r%s-%s.%s.%s.tar.bz2' % (opts.rev, time.year, time.month, time.day))
print(('Have a look at %s directory' % opts.svndist))
#!/usr/bin/env python3
# a script to preare INARY source tarball from svn
# author: exa
#TODO: arguments for svn snapshot with rev number, or a tag to override default
import sys
import os
import shutil
def run(cmd):
print(('running', cmd))
os.system(cmd)
sys.path.insert(0, '.')
import inary
if not os.path.exists('svndist'):
os.makedirs('svndist')
ver = inary.__version__
if os.path.exists('svndist/inary-%s' % ver):
shutil.rmtree('svndist/inary-%s' % ver)
print('Exporting svn directory')
run('svn export http://svn.uludag.org.tr/uludag/trunk/inary svndist/inary-%s' % ver)
os.chdir('svndist')
run('tar cjvf inary-%s.tar.bz2 inary-%s' % (ver, ver))
print('Have a look at svndist directory')
This diff is collapsed.
#!/usr/bin/python
import sys
import os
data = ""
inaryfile=str(sys.argv[1])
sys.argv.append("")
kontrol=str(sys.argv[2])
#make workspace
os.system("rm -rf /tmp/uninary/")
os.system("mkdir /tmp/uninary/")
os.system("unzip " + inaryfile + " -d /tmp/uninary/")
#manipule xml file
os.system('sed -i "s/<\//:/" /tmp/uninary/metadata.xml')
os.system('sed -i "s/<//" /tmp/uninary/metadata.xml')
os.system('sed -i "s/>/:/" /tmp/uninary/metadata.xml')
os.system('sed -i "s/> //" /tmp/uninary/metadata.xml')
os.system('echo "--dosya-sonu--" >> /tmp/uninary/metadata.xml')
metadata = open("/tmp/uninary/metadata.xml")
os.system("rm -f /tmp/uninary/control")
os.system("touch /tmp/uninary/control")
def bul(aranacak,yazilacak ,i=1,value=1):
durum = "devam"
while durum == "devam":
data = metadata.readline()
if aranacak in data:
durum = "dur"
data=data.split(":")
if value == 1:
data=data[i]
if data == "x86_64":
data = "amd64"
data = yazilacak + data
kod= 'echo "'+ data + '" >> /tmp/uninary/control'
print kod
os.system(kod)
if "--dosya-sonu--" in data:
durum = "dur"
#write control
bul("Package:","x",1,0)
sayi=metadata.tell()
bul("Name:","Package: ")
metadata.seek(sayi)
bul("PartOf:","Priority: ")
os.system('echo "Section: inarylinux" >> /tmp/uninary/control')
metadata.seek(sayi)
bul("InstalledSize","Installed-Size: ")
metadata.seek(sayi)
bul("Update","x",1,0)
bul("Name:","Maintainer: ")
metadata.seek(sayi)
bul("Architecture:","Architecture: ")
metadata.seek(sayi)
bul("Update","x",1,0)
bul("Version","Version: ")
metadata.seek(sayi)
bul("Dependency release","Depends: ")
metadata.seek(sayi)
bul("Summary xml","Description: ",2)
metadata.seek(sayi)
bul("Description xml"," ",2)
#remove metadata.xml
os.system("rm -f /tmp/uninary/metadata.xml")
#remove files.xml
os.system("rm -f /tmp/uninary/files.xml")
#make debian dir
os.system("mkdir /tmp/uninary/DEBIAN/")
#move control
os.system("mv -f /tmp/uninary/control /tmp/uninary/DEBIAN/")
print "control Dosyasi olusturuldu. Simdi gerekli betikleri olusturunuz."
if kontrol == "x":
print "kontrol edildigi kabul edildi."
else:
bekleme=input()
os.system("cd /tmp/uninary/ ; tar -xf /tmp/uninary/*.tar.*")
os.system("rm -f /tmp/uninary/install.tar.*")
print "Paketlemeden onceki son kontrollerinizi yapiniz."
if kontrol == "x":
print "kontrol edildigi kabul edildi."
else:
bekleme=input()
os.system("dpkg -b /tmp/uninary/")
inaryfile=inaryfile.split("/")
debfile = inaryfile[len(inaryfile) - 1]
os.system("mv /tmp/uninary.deb ./"+ inaryfile[len(inaryfile) - 1] + ".deb")
#!/usr/bin/env python
# a script to preare INARY source tarball from svn
# author: Eray Ozkural (exa) <eray.ozkural@gmail.com>
#TODO: arguments for svn snapshot with rev number, or a tag to override default
import sys
import os
import shutil
def run(cmd):
print 'running', cmd
os.system(cmd)
sys.path.insert(0, '.')
import inary
if not os.path.exists('svndist'):
os.makedirs('svndist')
ver = inary.__version__
if os.path.exists('svndist/inary-%s' % ver):
shutil.rmtree('svndist/inary-%s' % ver)
print 'Exporting svn directory'
run('svn export http://svn.uludag.org.tr/uludag/trunk/inary svndist/inary-%s' % ver)
os.chdir('svndist')
run('tar cjvf inary-%s.tar.bz2 inary-%s' % (ver, ver))
print 'Have a look at svndist directory'
find inary -iname '*.py' | grep -v inary/cli/commands.py >exclude
pygettext -D -X exclude -o po/inary.pot inary inary-cli scripts
msgmerge -U po/tr.po po/inary.pot
rm exclude
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment