Change to project/trunk,tags,branches style

This commit is contained in:
Faik Uygur
2009-10-14 12:42:24 +00:00
commit 54e89f07b4
1121 changed files with 136747 additions and 0 deletions
+84
View File
@@ -0,0 +1,84 @@
#!/usr/bin/python
# -*- 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.
import os
import sys
import exceptions
import pisi
installdb = pisi.db.installdb.InstallDB()
def ask_action(msg, actions, default):
while True:
s = raw_input(msg)
if len(s) == 0:
return default
else:
if s not in actions:
continue
return s
def get_installed_packages():
return installdb.list_installed()
def check_changed_config_files(package):
all_files = installdb.get_files(package)
config_files = filter(lambda x: x.type == 'config', all_files.list)
config_paths = map(lambda x: "/" + str(x.path), config_files)
newconfig = []
for path in config_paths:
if os.path.exists(path) and os.path.exists(path + ".newconfig"):
newconfig.append(path)
return newconfig
def show_changes(package, changed):
prompt = "%s has new config files. Would you like to see them [Y/n] " % package
if ask_action(prompt, ["y","n"], "y") == "n":
return
for file in changed:
answer = "?"
while answer == "?" or answer not in ["n", "y"]:
prompt = " %s has changed. Would you like to overwrite new config file [N/y/?] " % file
answer = ask_action(prompt, ["y", "n", "?"], "n")
if answer == "y":
os.rename(file+".newconfig", file)
if answer == "n":
break
if answer == "?":
os.system("diff -u %s %s | less" % (file, file + ".newconfig"))
def check_package(package):
changed = check_changed_config_files(package)
if changed:
show_changes(package, changed)
def check_changes():
packages = get_installed_packages()
for pkg in packages:
check_package(pkg)
if __name__ == "__main__":
if len(sys.argv) == 1:
print "Checking all packages"
check_changes()
if len(sys.argv) == 2:
check_package(sys.argv[1])
if len(sys.argv) > 2:
for pkg in sys.argv[1:]:
check_package(pkg)
+63
View File
@@ -0,0 +1,63 @@
#!/usr/bin/python
#
# 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 pisi.uri
import pisi.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 = pisi.specfile.SpecFile()
spec.read(os.path.join(package, "pspec.xml"))
URI = pisi.uri.URI(spec.source.archive.uri)
files.append(URI.filename())
archiveFiles = os.listdir("/var/cache/pisi/archives/")
unneededFiles = filter(lambda x:x not in files, archiveFiles)
for i in unneededFiles:
if not clean:
print("/var/cache/pisi/archives/%s" % i)
else:
cleanArchives("/var/cache/pisi/archives/%s" % i)
+103
View File
@@ -0,0 +1,103 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# 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 glob
import string
import shutil
import pisi.util as util
from pisi.version import Version
def findUnneededFiles(listdir):
dict = {}
for f in listdir:
try:
name, version = util.parse_package_name(f)
if dict.has_key(name):
if Version(dict[name]) < Version(version):
dict[name] = version
else:
if version:
dict[name] = version
except:
pass
for f in dict:
listdir.remove("%s-%s" % (f, dict[f]))
return listdir
def doit(root, listdir, clean, suffix = ""):
for f in listdir:
target = os.path.join(root, "%s%s" % (f, suffix))
if os.path.exists(target):
print "%s%s" % (f, suffix)
if clean == True:
try:
if os.path.isdir(target):
shutil.rmtree(target)
else:
os.remove(target)
except OSError,e :
usage("Permission denied: %s" % e)
def cleanPisis(clean, root = '/var/cache/pisi/packages'):
# pisi packages
list = map(lambda x: os.path.basename(x).split(".pisi")[0], glob.glob("%s/*.pisi" % root))
list.sort()
l = findUnneededFiles(list)
doit(root, l, clean, ".pisi")
def cleanBuilds(clean, root = '/var/pisi'):
# Build remnant
list = []
for f in os.listdir(root):
if os.path.isdir(os.path.join(root, f)):
list.append(f)
l = findUnneededFiles(list)
doit(root, l, clean)
def usage(msg):
print """
Error: %s
Usage:
cleanCache --dry-run (Shows unneeded files)
cleanCache --clean (Removes unneeded files)
""" % msg
sys.exit(1)
if __name__ == "__main__":
try:
sys.argv[1]
except IndexError:
usage("Unsufficient arguments...")
if "--dry-run" in sys.argv:
clean = False
elif "--clean" in sys.argv:
clean = True
else:
usage("No command given...")
sys.exit(0)
if "builds" in sys.argv:
cleanBuilds(clean)
else:
cleanPisis(clean)
+84
View File
@@ -0,0 +1,84 @@
#!/usr/bin/python
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)
pisi = doc.documentElement
source = getTags(pisi, "Source")[0]
history = getTags(source, "History")[0]
item = source.removeChild(history)
addText(doc, pisi, "\n ")
fixIndent(doc, item)
fixTags(doc, item)
pisi.appendChild(item)
addText(doc, pisi, "\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"))
+50
View File
@@ -0,0 +1,50 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# 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 glob
import pisi
import pisi.util as util
from pisi.version import Version
from pisi.delta import create_delta_package
def minsandmaxes():
packages = map(lambda x: os.path.basename(x).split(".pisi")[0], set(glob.glob("*.pisi")) - set(glob.glob("*.delta.pisi")))
versions = {}
for file in packages:
name, version = util.parse_package_name(file)
versions.setdefault(name, []).append(Version(version))
mins = {}
maxs = {}
for pkg in versions.keys():
mins[pkg] = min(versions[pkg])
maxs[pkg] = max(versions[pkg])
return mins, maxs
if __name__ == "__main__":
mi, ma = minsandmaxes()
for pkg in mi.keys():
old_pkg = "%s-%s.pisi" % (pkg, str(mi[pkg]))
new_pkg = "%s-%s.pisi" % (pkg, str(ma[pkg]))
name, version = util.parse_package_name(pkg)
if not old_pkg == new_pkg:
# skip if same
if not os.path.exists("%s-%s-%s.delta.pisi" % (name, str(mi[pkg].build), str(ma[pkg].build))):
# skip if delta exists
print "%s --> Min: %s Max: %s \n %s-%s-%s.delta.pisi" % (pkg, old_pkg, new_pkg, name, str(mi[pkg].build), str(ma[pkg].build))
create_delta_package(old_pkg, new_pkg)
+61
View File
@@ -0,0 +1,61 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
import xml.dom.minidom as mdom
import codecs
import os
folder = "/var/lib/pisi"
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)
pisi = dom.documentElement
package = getTags(pisi, "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
Executable
+60
View File
@@ -0,0 +1,60 @@
#!/usr/bin/python
# -*- 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.
import os
import sys
import pisi
def show_info(filename):
metadata, files = pisi.api.info_file(filename)
paths = [fileinfo.path for fileinfo in files.list]
paths.sort()
return paths
def uniq(alist):
set = {}
return [set.setdefault(e, e) for e in alist if e not in set]
def usage(errmsg):
print """
Error: %s
Usage:
lspisi PiSi_package.PiSi (lists the content of package)
lspisi dirs PiSi_package.PiSi (lists directories in the package for the package developer)
""" % (errmsg)
sys.exit(1)
def main():
if len(sys.argv) < 2 or ("dirs" in sys.argv and len(sys.argv) < 3):
usage("PiSi package required...")
if sys.argv[1] == "dirs":
dirlist = []
for file in show_info(sys.argv[2]):
dirlist.append(os.path.dirname(file))
for dir in uniq(dirlist):
print "<Path fileType=\"\">/%s</Path>" % dir
elif not os.path.exists(sys.argv[1]):
print "File %s not found" % sys.argv[1]
else:
for file in show_info(sys.argv[1]):
print "/%s" % file
if __name__ == "__main__":
sys.exit(main())
+236
View File
@@ -0,0 +1,236 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# just put a .pisipackager file in your home and fill it like
#
# name = Onur Küçük
# email = onur@pardus.org.tr
#
import os
import sys
import time
import string
packagerfile = ".pisipackager"
data = {"date": time.strftime("%Y-%m-%d"),
"year": time.strftime("%Y")}
temp_pspec = '''<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pardus.org.tr/projeler/pisi/pisi-spec.dtd">
<PISI>
<Source>
<Name>%(package)s</Name>
<Homepage></Homepage>
<Packager>
<Name>%(packager_name)s</Name>
<Email>%(packager_email)s</Email>
</Packager>
<License>GPLv2</License>
<Icon>%(package)s</Icon>
<IsA>app:gui</IsA>
<Summary></Summary>
<Description></Description>
<Archive sha1sum="" type="targz"></Archive>
<BuildDependencies>
<Dependency versionFrom=""></Dependency>
<Dependency></Dependency>
</BuildDependencies>
<Patches>
<!--
<Patch level="1"></Patch>
-->
</Patches>
</Source>
<Package>
<Name>%(package)s</Name>
<RuntimeDependencies>
</RuntimeDependencies>
<Conflicts>
<Package releaseTo="29">sleep</Package>
</Conflicts>
<Files>
<Path fileType="data">/</Path>
</Files>
<!--
<AdditionalFiles>
<AdditionalFile owner="root" permission="0644" target="/usr/share/applications/%(package)s.desktop">%(package)s.desktop</AdditionalFile>
</AdditionalFiles>
-->
<!--
<Provides>
<COMAR script="package.py">System.Package</COMAR>
<COMAR script="service.py">System.Service</COMAR>
</Provides>
-->
</Package>
<History>
<Update release="1">
<Date>%(date)s</Date>
<Version></Version>
<Comment>First release</Comment>
<Name>%(packager_name)s</Name>
<Email>%(packager_email)s</Email>
</Update>
</History>
</PISI>
'''
temp_actions = '''#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright %(year)s TUBITAK/UEKAE
# Licensed under the GNU General Public License, version 2.
# See the file http://www.gnu.org/copyleft/gpl.txt.
from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import shelltools
from pisi.actionsapi import get
# WorkDir = ""
# NoStrip = "/"
def setup():
autotools.configure()
def build():
autotools.make()
def install():
autotools.rawInstall("DESTDIR=%%s" %% get.installDIR())
pisitools.dodoc("AUTHORS", "ChangeLog", "README*", "NEWS")
'''
temp_desktop = '''[Desktop Entry]
Type=Application
Version=1.0
Encoding=UTF-8
Name=%(package_cap)s
Name[tr]=%(package_cap)s
GenericName=%(package_cap)s
GenericName[tr]=%(package_cap)s
Icon=%(package)s
Exec=%(package)s
Terminal=false
StartupNotify=false
Categories=Application;Game;ArcadeGame;
'''
temp_service = '''
from comar.service import *
serviceType = "local"
serviceConf = "%(package)s"
serviceDefault = "conditional"
serviceDesc = _({"en": "%(package_cap)s",
"tr": "%(package_cap)s"})
@synchronized
def start():
startService(command="/usr/sbin/%(package)s",
args = config.get("args", "destroy"),
donotify=True)
@synchronized
def stop():
stopService(command="/usr/sbin/%(package)s",
donotify=True)
def ready():
import os
status = is_on()
if status == "on" or (status == "conditional" and os.path.exists("/sys/coffee/ready")):
start()
def status():
return checkDaemon("/var/run/%(package)s.pid")
'''
temp_postscript = '''#/usr/bin/python
# -*- coding: utf-8 -*-
import os
def postInstall():
print "FIXME"
'''
temp_translation = '''<?xml version="1.0" ?>
<PISI>
<Source>
<Name>%(package)s</Name>
<Summary xml:lang=""></Summary>
<Description xml:lang=""></Description>
</Source>
</PISI>
'''
def write(filename, data):
try:
f = file("%s/%s" % (target, filename), "w")
f.write(data)
f.close()
except:
print "Could not write file %s/%s" % (target, filename)
def create_dirs():
try:
os.makedirs("%s/files" % target)
os.makedirs("%s/comar" % target)
except:
print "Could not make directory %s" % target
sys.exit(1)
def readConfig():
home = os.getenv("HOME", "")
cfg = "%s/%s" % (home, packagerfile)
d = {"name": "", "email": ""}
if home != "" and os.path.exists(cfg):
for line in file(cfg):
if line != "" and not line.startswith("#") and "=" in line:
l, m = line.split("=", 1)
k = l.strip()
v = m.strip()
if k in ["name", "email"]:
if v.startswith('"') or v.startswith("'"):
v = v[1:-1]
d[k.strip()] = v.strip()
return d["name"], d["email"]
# some checks
if len(sys.argv) < 2:
print "Usage : %s NewPackageDir" % sys.argv[0]
sys.exit(0)
else:
target = sys.argv[1]
data["packagedir"], data["package"] = os.path.split(target)
data["package_cap"] = string.capitalize(data["package"])
if os.path.exists(target):
print "%s already exists, please remove it first" % target
sys.exit(1)
elif " " in data["package"]:
print "You should not use empty space in package name"
sys.exit(1)
# here we go
data["packager_name"], data["packager_email"] = readConfig()
create_dirs()
write("pspec.xml", temp_pspec % data)
write("actions.py", temp_actions % data)
write("translations.xml", temp_translation % data)
write("files/%s.desktop" % data["package"], temp_desktop % data)
write("comar/service.py", temp_service % data)
write("comar/package.py", temp_postscript)
+119
View File
@@ -0,0 +1,119 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 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.
#
import os
import shutil
import subprocess
import sys
import stat
import time
import socket
import getopt
def chroot_comar(image_dir):
if os.fork() == 0:
try:
os.makedirs(os.path.join(image_dir, "var/db"), 0700)
except OSError:
pass
os.chroot(image_dir)
if not os.path.exists("/var/lib/dbus/machine-id"):
run("/usr/bin/dbus-uuidgen --ensure")
run("/sbin/start-stop-daemon -b --start --pidfile /var/run/dbus/pid --exec /usr/bin/dbus-daemon -- --system")
sys.exit(0)
# wait comar to start
timeout = 5
wait = 0.1
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
while timeout > 0:
try:
sock.connect("%s/var/run/dbus/system_bus_socket" % image_dir)
return True
except:
timeout -= wait
time.sleep(wait)
return False
# run command and terminate if something goes wrong
def run(cmd, ignore_error=False):
print cmd
ret = os.system(cmd)
if ret and not ignore_error:
print "%s returned %s" % (cmd, ret)
sys.exit(1)
def create_sandbox(output_dir, repository):
try:
# Add repository of the packages
run('pisi --yes-all --destdir="%s" add-repo pardus %s' % (output_dir, repository))
# Install system.base and system.devel
run('pisi --yes-all --ignore-comar --ignore-file-conflicts -D"%s" it -c system.base -c system.devel' % output_dir)
# Create /etc from baselayout
path = "%s/usr/share/baselayout/" % output_dir
path2 = "%s/etc" % output_dir
for name in os.listdir(path):
run('cp -p "%s" "%s"' % (os.path.join(path, name), os.path.join(path2, name)))
# Create character device
os.mknod("%s/dev/null" % output_dir, 0666 | stat.S_IFCHR, os.makedev(1, 3))
os.mknod("%s/dev/console" % output_dir, 0666 | stat.S_IFCHR, os.makedev(5, 1))
# Create urandom character device
os.mknod("%s/dev/urandom" % output_dir, 0666 | stat.S_IFCHR, os.makedev(1, 9))
# run command in chroot
def chrun(cmd):
run('chroot "%s" %s' % (output_dir, cmd))
chrun("/sbin/ldconfig")
chrun("/sbin/update-environment")
chroot_comar(output_dir)
chrun("/usr/bin/pisi cp baselayout")
chrun("/usr/bin/pisi cp")
chrun("/usr/bin/hav call baselayout User.Manager setUser 0 'Root' '/root' '/bin/bash' 'pardus' '' ")
# Now it is 2009 release
file(os.path.join(output_dir, "etc/pardus-release"), "w").write("Pardus 2009\n")
except KeyboardInterrupt:
run('umount %s/proc' % output_dir, ignore_error=True)
run('umount %s/sys' % output_dir, ignore_error=True)
sys.exit(1)
def mount_sandbox():
run("mkdir -p tmpfs")
run("mount -t tmpfs -o size=1024M,mode=0744 tmpfs tmpfs/")
run("mkdir -p sandbox")
run("mount -t aufs -o br=tmpfs=rw:base=ro none sandbox/")
run('/bin/mount --bind /proc sandbox/proc')
run('/bin/mount --bind /dev sandbox/dev')
def umount_sandbox():
run('/bin/umount sandbox/dev')
run('/bin/umount sandbox/proc')
run('/bin/umount sandbox')
run('/bin/umount tmpfs')
cmd = sys.argv[1]
if cmd == "create":
create_sandbox("base", "http://192.168.3.110/pardus-2009/pisi-index.xml.bz2")
elif cmd == "reset":
umount_sandbox()
elif cmd == "build":
pspec = sys.argv[2]
mount_sandbox()
run('chroot sandbox pisi build %s' % pspec)
umount_sandbox()
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/python
# -*- 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 PiSi to set default repo
import os
import sys
import pisi
import pisi.context as ctx
def usage():
print """
Usage:
pisisdr reponame
"""
sys.exit(1)
def main():
if len(sys.argv) < 2:
usage()
repo = sys.argv[1]
try:
ctx.repodb.set_default_repo(repo)
except pisi.lockeddbshelve.Error, e:
print e
if __name__ == "__main__":
sys.exit(main())
+92
View File
@@ -0,0 +1,92 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005, 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
from pisi.specfile import SpecFile
from pisi.util import join_path
def findPspec(folder):
pspecList = []
for root, dirs, files in os.walk(folder):
if "pspec.xml" in files:
pspecList.append(root)
# dont walk into the versioned stuff
if ".svn" in dirs:
dirs.remove(".svn")
return pspecList
def getVersion(pspecList):
sources = {}
for pspec in pspecList:
specFile = SpecFile(join_path(pspec, "pspec.xml"))
sources[specFile.source.name] = (specFile.source.version, specFile.source.release)
return sources
def listIntersection(firstRepo, secondRepo):
keys = list(set(firstRepo.keys()).__and__(set(secondRepo.keys())))
keys.sort()
for i in keys:
if firstRepo[i] != secondRepo[i]:
print " %s: %s (r%s) -> %s (r%s)" % (i, firstRepo[i][0], firstRepo[i][1], secondRepo[i][0], secondRepo[i][1])
def listComplement(firstRepo, secondRepo):
keys = list(set(firstRepo.keys()) - set(secondRepo.keys()))
keys.sort()
for i in keys:
print " %s" % i
def usage(miniMe):
print """Usage:
%s pathToSvn component (ex: %s /home/caglar/svn/pardus/ system/devel)
""" % (miniMe, miniMe)
sys.exit(1)
if __name__ == "__main__":
try:
svnRoot = sys.argv[1]
except IndexError:
usage(sys.argv[0])
try:
postfix = sys.argv[2]
except IndexError:
postfix = ""
tag = getVersion(findPspec(join_path(svnRoot, "tags/pardus-1.0/", postfix)))
stable = getVersion(findPspec(join_path(svnRoot,"stable/pardus-1/", postfix)))
devel = getVersion(findPspec(join_path(svnRoot, "devel/", postfix)))
print "Tag --> Stable"
listIntersection(tag, stable)
print
print "Tag has, Stable hasn't"
listComplement(tag, stable)
print
print "Stable has, Tag hasn't"
listComplement(stable, tag)
print
print "Stable --> Devel"
listIntersection(stable, devel)
print
print "Stable has, Devel hasn't"
listComplement(stable, devel)
print
print "Devel has, Stable hasn't"
listComplement(devel, stable)
print
+598
View File
@@ -0,0 +1,598 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2007, 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.
#
import sys
import os
import codecs
import re
import getopt
import gettext
__trans = gettext.translation('pisi', fallback=True)
_ = __trans.ugettext
from svn import core, client
sys.path.append('.')
import pisi.specfile
import pisi.uri
import pisi.package
import pisi.metadata
import pisi.files
from pisi.cli import printu
# Main HTML template
html_header = """
<html><head>
<title>%(title)s</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="%(root)sstil.css" rel="stylesheet" type="text/css">
</head><body>
<div id='header-bugzilla'>
</div>
<div class='menu'>
<a href='%(root)sindex.html'>Genel Bilgiler</a>
| <a href='%(root)ssources.html'>Kaynak Paketler</a>
| <a href='%(root)sbinaries.html'>İkili Paketler</a>
| <a href='%(root)spackagers.html'>Paketçiler</a>
</div>
<h1 align='center'>%(title)s</h1>
<div class='content'>
%(content)s
</div>
</body></html>
"""
css_template = """
body {
margin-left:0;
margin-top:0;
margin-right:0;
background-image:url('http://www.pardus.org.tr/styles/images/HeadTile.png');
background-repeat:repeat-x;
background-color: #FFF;
}
#header-bugzilla {
background-image:url('http://www.pardus.org.tr/styles/images/HeadLogo.png');
background-repeat:no-repeat;
background-position: 0px 0px;
height:119px;
padding-bottom:5px;
}
a {
color: #F55400;
text-decoration: none;
}
a:hover {
color: #444;
background-color:#EEE;
}
.menu {
padding-left: 1em;
padding-top: 3px;
padding-bottom: 3px;
border-bottom: 1px solid #CCC;
border-top: 1px solid #CCC;
}
.content {
margin: 0.5em;
}
"""
# default html templates (now obsolete)
def_repo_sizes_html = u"""
<h3>Boyutlar</h3>
<p>Toplam kurulu boyut %(total)s</p>
<p>Dosya tiplerine göre liste:</p>
<table><tbody>
%(sizes)s
</table></tbody>
"""
def svn_uri(path):
# init
core.apr_initialize()
pool = core.svn_pool_create(None)
core.svn_config_ensure(None, pool)
# get commit date
uri = client.svn_client_url_from_path(path, pool)
# cleanup
core.svn_pool_destroy(pool)
core.apr_terminate()
return uri
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 write_html(filename, title, content):
f = codecs.open(filename, "w", "utf-8")
root = "./"
if len(filename.split("/")) > 2:
root = "../"
dict = {
"title": title,
"content": content,
"root": root,
}
f.write(html_header % dict)
f.close()
def make_table(elements, titles=None):
def make_row(element):
return "<td>%s" % "<td>".join(map(str, element))
title_html = ""
if titles:
title_html = """
<thead><tr><th>%s</tr></thead>
""" % "<th>".join(titles)
html = """
<table>%s<tbody>
<tr>%s
</tbody></table>
""" % (title_html, "<tr>".join(map(make_row, elements)))
return html
def make_url(name, path="./"):
if not path.endswith("/"):
path += "/"
return "<a href='%s%s.html'>%s</a>" % (path, name, name)
def mangle_email(email):
return re.sub("@", " [at] ", email)
class Histogram:
def __init__(self):
self.list = {}
def add(self, name, value=None):
if value:
self.list[name] = value
else:
self.list[name] = self.list.get(name, 0) + 1
def note(self, name):
if not self.list.has_key(name):
self.list[name] = 0
def get_list(self, max=0):
items = self.list.items()
items.sort(key=lambda x: x[1], reverse=True)
if max != 0:
return items[:max]
else:
return items
# Dictionary of all source packages keyed by the source name
sources = {}
# Dictionary of all binary packages keyed by the package name
packages = {}
# Dictionary of all packagers keyed by the packager name
packagers = {}
# Dictionary of missing depended binary packages keyed by the package name
missing = {}
# List of all repository problems
errors = []
class Missing:
def __init__(self, name):
missing[name] = self
self.name = name
self.revBuildDeps = []
self.revRuntimeDeps = []
class Package:
def __init__(self, source, pakspec):
name = pakspec.name
if packages.has_key(name):
errors.append(_("Duplicate binary packages:\n%s\n%s\n") % (
source.name, packages[name].source.name))
return
packages[name] = self
self.name = name
self.source = source
self.pakspec = pakspec
self.revBuildDeps = []
self.revRuntimeDeps = []
self.installedSize = 0
def markDeps(self):
# mark reverse build dependencies
for d in self.source.spec.source.buildDependencies:
p = d.package
if packages.has_key(p):
packages[p].revBuildDeps.append(self.name)
else:
if not missing.has_key(p):
Missing(p)
missing[p].revBuildDeps.append(self.name)
# mark reverse runtime dependencies
for d in self.pakspec.packageDependencies:
p = d.package
if packages.has_key(p):
packages[p].revRuntimeDeps.append(self.name)
else:
if not missing.has_key(p):
Missing(p)
missing[p].revRuntimeDeps.append(self.name)
def report_html(self):
source = self.source.spec.source
bDeps = map(lambda x: "<a href='./%s.html'>%s</a>" % (x, x),
(map(lambda x: x.package, source.buildDependencies)))
rDeps = map(lambda x: "<a href='./%s.html'>%s</a>" % (x, x),
(map(lambda x: x.package, self.pakspec.packageDependencies)))
rbDeps = map(lambda x: "<a href='./%s.html'>%s</a>" % (x, x), self.revBuildDeps)
rrDeps = map(lambda x: "<a href='./%s.html'>%s</a>" % (x, x), self.revRuntimeDeps)
html = """
<h1>İkili paket: %s</h1>
<h2>Kaynak versiyon %s, depo sürümü %s</h2>
<h3>Kaynak paket: %s</h3>
<h3>Derlemek için gerekenler:</h3>
<p>%s</p>
<h3>Çalıştırmak için gerekenler:</h3>
<p>%s</p>
<h3>Bağımlı paketler (derlenmek için):</h3>
<p>%s</p>
<h3>Bağımlı paketler (çalışmak için):</h3>
<p>%s</p>
""" % (
self.name,
self.source.spec.getSourceVersion(),
self.source.spec.getSourceRelease(),
make_url(source.name, "../source/"),
", ".join(bDeps),
", ".join(rDeps),
", ".join(rbDeps),
", ".join(rrDeps),
)
write_html("paksite/binary/%s.html" % self.name, self.name, html)
class Source:
def __init__(self, path, spec):
name = spec.source.name
if sources.has_key(name):
errors.append(_("Duplicate source packages:\n%s\n%s\n") % (
path, sources[name].path))
return
sources[name] = self
self.spec = spec
self.name = name
self.path = path
self.uri = svn_uri(path)
for p in spec.packages:
Package(self, p)
def report_html(self):
source = self.spec.source
paks = map(lambda x: "<a href='../binary/%s.html'>%s</a>" % (x, x),
(map(lambda x: x.name, self.spec.packages)))
histdata = map(lambda x: (x.release, x.date, x.version, make_url(x.name, "../packager/"), x.comment), self.spec.history)
ptch = map(lambda x: "<a href='%s/files/%s'>%s</a>" % (self.uri,
x.filename, x.filename), source.patches)
titles = "Sürüm", "Sürüm Tarihi", "Versiyon", "Güncelleyen", "Açıklama"
hist = make_table(histdata, titles)
html = """
<h1>Kaynak paket: %s</h1>
<h2>Kaynak versiyon %s, depo sürümü %s</h2>
<h3><a href='%s'>%s</a></h3>
<h3>Açıklama</h3>
<p>%s</p>
<h3>Lisanslar:</h3>
<p>%s</p>
<h3>İşlemler:</h3>
<p><a href="%s">Paket dosyalarına bak</a></p>
<p><a href="http://bugs.pardus.org.tr/buglist.cgi?product=Paketler&component=%s&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED">Hata kayıtlarına bak</a></p>
<h3>Bu kaynaktan derlenen ikili paketler:</h3>
<p>%s</p>
<h3>Tarihçe</h3>
%s
<h3>Yamalar</h3>
%s
""" % (
self.name,
self.spec.getSourceVersion(),
self.spec.getSourceRelease(),
source.homepage,
source.homepage,
source.summary,
", ".join(source.license),
self.uri,
self.name,
"<br>".join(paks),
"".join(hist),
"<br>".join(ptch),
)
write_html("paksite/source/%s.html" % self.name, self.name, html)
class Packager:
def __init__(self, spec, update=None):
if update:
name = update.name
email = update.email
else:
name = spec.source.packager.name
email = spec.source.packager.email
if packagers.has_key(name):
if email != packagers[name].email:
e = _("Developer '%s <%s>' has another mail address '%s' in source package '%s'") % (
name, packagers[name].email, email, spec.source.name)
packagers[name].errors.append(e)
errors.append(e)
if update:
packagers[name].updates.append((spec.source.name, update.release, update.comment))
else:
packagers[name].sources.append(spec.source.name)
else:
packagers[name] = self
self.name = name
self.email = email
if update:
self.sources = []
self.updates = [(spec.source.name, update.release, update.comment)]
else:
self.sources = [spec.source.name]
self.updates = []
self.errors = []
if not update:
for update in spec.history:
Packager(spec, update)
def report_html(self):
srcs = map(lambda x: ("<a href='../source/%s.html'>%s</a>" % (x, x), ), self.sources)
srcs.sort()
upds = map(lambda x: (u"<b><a href='../source/%s.html'>%s</a> (%s)</b><br>%s<br>" % (
x[0], x[0], x[1], x[2]), ), self.updates)
html = """
<p>Paketçi: %s (%s)</p>
""" % (self.name, mangle_email(self.email))
html += """
<div class='statstat'>
<h3>Sahip olduğu paketler:</h3><p>
%s
</p></div>
""" % make_table(srcs)
html += """
<div class='statstat'>
<h3>Yaptığı güncellemeler:</h3><p>
%s
</p></div>
""" % make_table(upds)
write_html("paksite/packager/%s.html" % self.name, self.name, html)
class Repository:
def __init__(self, path):
self.path = path
self.nr_sources = 0
self.nr_packages = 0
self.nr_patches = 0
self.people = Histogram()
self.licenses = Histogram()
self.mostpatched = Histogram()
self.longpy = Histogram()
self.cscripts = Histogram()
self.total_installed_size = 0
self.installed_sizes = {}
def processPspec(self, path, spec):
# new classes
Packager(spec)
Source(path, spec)
# update global stats
self.nr_sources += 1
self.nr_packages += len(spec.packages)
self.nr_patches += len(spec.source.patches)
# update top fives
self.people.add(spec.source.packager.name)
for u in spec.history:
self.people.note(u.name)
for p in spec.packages:
for cs in p.providesComar:
self.cscripts.add(cs.om)
for L in spec.source.license:
self.licenses.add(L)
self.mostpatched.add(spec.source.name, len(spec.source.patches))
try:
f = file(os.path.join(path, "actions.py"))
L = len(f.readlines())
self.longpy.add(spec.source.name, L)
f.close()
except:
pass
def scan(self):
for pak in find_pspecs(self.path):
spec = pisi.specfile.SpecFile()
try:
spec.read(os.path.join(pak, "pspec.xml"))
except Exception, inst:
errors.append(_("Cannot parse '%s':\n%s\n") % (pak, inst.args[0]))
continue
self.processPspec(pak, spec)
for p in packages.values():
p.markDeps()
def processPisi(self, path):
p = pisi.package.Package(path)
p.extract_files(["metadata.xml", "files.xml"], ".")
md = pisi.metadata.MetaData()
md.read("metadata.xml")
self.total_installed_size += md.package.installedSize
if packages.has_key(md.package.name):
# FIXME: check version/release match too?
packages[md.package.name].installed_size = md.package.installedSize
else:
printu("Binary package '%s' has no source package in repository %s\n" % (path, self.path))
fd = pisi.files.Files()
fd.read("files.xml")
for f in fd.list:
if self.installed_sizes.has_key(f.type):
# Emtpy directories and symlinks has None size
if not f.size is None:
self.installed_sizes[f.type] += int(f.size)
else:
self.installed_sizes[f.type] = int(f.size)
def scan_bins(self, binpath):
for root, dirs, files in os.walk(binpath):
for fn in files:
if fn.endswith(".pisi"):
self.processPisi(os.path.join(root, fn))
def report_html(self):
table = (
("Kaynak paket sayısı", self.nr_sources),
("İkili paket sayısı", self.nr_packages),
("Yama sayısı", self.nr_patches),
("Paketçi sayısı", len(self.people.list)),
)
html = make_table(table)
html += """
<div class='statstat'>
<h3>En fazla yamalanmış beş kaynak paket:</h3><p>
%s
</p></div>
""" % make_table(map(lambda x: (make_url(x[0], "./source/"), x[1]), self.mostpatched.get_list(5)))
html += """
<div class='statstat'>
<h3>En uzun inşa betikli beş kaynak paket:</h3><p>
%s
</p></div>
""" % make_table(map(lambda x: (make_url(x[0], "./source/"), x[1]), self.longpy.get_list(5)))
write_html("paksite/index.html", "Genel Bilgiler", html)
titles = (
"<a href='packagers_by_name.html'>Paketçi</a>",
"<a href='packagers.html'>Paket sayısı</a>"
)
people = self.people.get_list()
people = map(lambda x: ("<a href='./packager/%s.html'>%s</a>" % (x[0], x[0]), x[1]), people)
write_html("paksite/packagers.html", "Paketçiler (paket sayısına göre)", make_table(people, titles))
people.sort(key=lambda x: x[0])
write_html("paksite/packagers_by_name.html", "Paketçiler (isme göre)", make_table(people, titles))
titles = "Paket adı", "Versiyon", "Açıklama"
srclist = map(lambda x: (make_url(x.name, "source/"), x.spec.getSourceVersion(), x.spec.source.summary), sources.values())
srclist.sort(key=lambda x: x[0])
html = make_table(srclist, titles)
write_html("paksite/sources.html", "Kaynak Paketler", html)
binlist = map(lambda x: (make_url(x.name, "binary/"), x.source.spec.getSourceVersion(), x.source.spec.source.summary), packages.values())
binlist.sort(key=lambda x: x[0])
html = make_table(binlist, titles)
write_html("paksite/binaries.html", "İkili Paketler", html)
# command line driver
def usage():
printu(_("Usage: repostats.py [OPTIONS] source-repo-path [binary-repo-path]\n"))
printu(" -t, --test-only: %s" % _("Dont generate the web site.\n"))
sys.exit(0)
if __name__ == "__main__":
try:
opts, args = getopt.gnu_getopt(sys.argv[1:], "ht", ["help", "test-only"])
except:
usage()
if args == []:
usage()
do_web = True
for o, v in opts:
if o in ("-h", "--help"):
usage()
if o in ("-t", "--test-only"):
do_web = False
repo = Repository(args[0])
printu(_("Scanning source repository...\n"))
repo.scan()
if len(args) > 1:
printu(_("Scanning binary packages...\n"))
repo.scan_bins(args[1])
if do_web:
if not os.path.exists("paksite/packager"):
os.makedirs("paksite/packager")
if not os.path.exists("paksite/binary"):
os.makedirs("paksite/binary")
if not os.path.exists("paksite/source"):
os.makedirs("paksite/source")
file("paksite/stil.css", "w").write(css_template)
repo.report_html()
for p in packagers.values():
p.report_html()
for p in packages.values():
p.report_html()
for p in sources.values():
p.report_html()
+206
View File
@@ -0,0 +1,206 @@
#!/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/pisi -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
+3
View File
@@ -0,0 +1,3 @@
#!/bin/bash
rsync -avz --delete rsync://rsync.gentoo.org/gentoo-portage/licenses ../licenses/
Executable
+58
View File
@@ -0,0 +1,58 @@
#!/usr/bin/python
# -*- 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.
import sys
import os
from zipfile import BadZipfile
import pisi
from pisi.archive import ArchiveZip, ArchiveTar
import pisi.context as ctx
import pisi.util as util
def usage(errmsg):
print """
Error: %s
Usage:
unpisi PiSi_package.PiSi
""" % (errmsg)
sys.exit(1)
def main():
if len(sys.argv) < 2:
usage("PiSi package required..")
elif not os.path.exists(sys.argv[1]):
usage("File %s not found" % sys.argv[1])
try:
arc = ArchiveZip(sys.argv[1], 'zip', 'r')
except BadZipfile, e:
print e
sys.exit(1)
arc.unpack_files(['files.xml', 'metadata.xml'], '.')
arc.unpack_files("install.tar.lzma", ctx.config.tmp_dir())
arc.unpack_dir('comar', '.')
tar_file = util.join_path(ctx.config.tmp_dir(), "install.tar.lzma")
tar = ArchiveTar(tar_file, 'tarlzma')
tar.unpack_dir('.')
os.unlink(tar_file)
return 0
if __name__ == "__main__":
sys.exit(main())