From 712971ef4bfaed2e9d52ed400fe4d1c2ec50c0dc Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Fri, 18 Jun 2010 17:14:11 +0200 Subject: [PATCH] [server/scripts] add check_la and bump_vbox scripts --- server/scripts/bump_vbox | 30 ++++++++++++++++++ server/scripts/check_la | 66 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100755 server/scripts/bump_vbox create mode 100755 server/scripts/check_la diff --git a/server/scripts/bump_vbox b/server/scripts/bump_vbox new file mode 100755 index 000000000..e6e62678e --- /dev/null +++ b/server/scripts/bump_vbox @@ -0,0 +1,30 @@ +#!/bin/sh + +kernels="2.6.31-sabayon 2.6.32-sabayon 2.6.33-sabayon 2.6.34-sabayon" +running_kernel="2.6.34-sabayon" +packages="app-emulation/virtualbox-guest-additions app-emulation/virtualbox-modules x11-drivers/xf86-video-virtualbox" + +export ETP_REPO="sabayonlinux.org" + +# build for latest kernel +KERNEL_DIR="/usr/src/linux-${running_kernel}" emerge xf86-input-virtualbox $packages virtualbox-bin +echo -5 | etc-update +reagent update + +for kernel in $kernels; do + if [ "${kernel}" = "${running_kernel}" ]; then + continue + fi + rm -rf /usr/portage/packages/* + KERNEL_DIR="/usr/src/linux-${kernel}" emerge -B ${packages} || ( echo "ouch unable to build" && exit 1 ) + built_pkgs=$(find /usr/portage/packages -name "*.tbz2" | xargs echo) + [[ -z "${built_pkgs}" ]] && echo "ouch no kernel pkgs" && exit 2 + reagent inject ${built_pkgs} || ( echo "ouch unable to inject" && exit 3 ) + echo + reagent query tags ${kernel} -qv | sort + echo +done + +echo "Now you should remove old packages:" +echo ETP_REPO=sabayonlinux.org reagent repo remove `reagent query search virtualbox -qv | grep MY_OLD_VER | xargs echo` +echo diff --git a/server/scripts/check_la b/server/scripts/check_la new file mode 100755 index 000000000..e52203654 --- /dev/null +++ b/server/scripts/check_la @@ -0,0 +1,66 @@ +#!/usr/bin/python2 +import sys + +la_patterns = sys.argv[1:] +if not la_patterns: + print sys.argv[0], "<.la files patterns>" + raise SystemExit(1) + +import os +import re +import tempfile +import shutil +from entropy.server.interfaces import Server +import entropy.tools + +la_compiled_patterns = dict((x, re.compile(x)) for x in la_patterns) +print la_compiled_patterns + +repo_id = os.getenv("ETP_REPO", "sabayonlinux.org") +srv = Server() +dbconn = srv.open_repository(repo_id) +pkg_ids = dbconn.listAllIdpackages(order_by="atom") +for pkg_id in pkg_ids: + # get pkg path + pkg_path = srv._get_package_path(repo_id, dbconn, pkg_id) + if not os.path.isfile(pkg_path): + print "WTF, not a package file =>", pkg_path + continue + # now extract + tmp_dir = tempfile.mkdtemp() + rc = entropy.tools.uncompress_tarball(pkg_path, extract_path = tmp_dir, + catch_empty = True) + if rc != 0: + print "WTF, cannot extract file", pkg_path, "at dir", tmp_dir + continue + + + la_paths = [] + for cur_dir, subdirs, files in os.walk(tmp_dir): + for file in files: + path = os.path.join(cur_dir, file) + if path.endswith(".la") and os.path.isfile(path) and os.access(path, os.R_OK): + la_paths.append(path) + + if not la_paths: + continue + + # print "pkg:", dbconn.retrieveAtom(pkg_id), "la:", la_paths + found = False + for la_path in la_paths: + # apply regexps + la_f = open(la_path, "r") + la_content = la_f.read() + la_f.close() + for la_pattern, cm_pattern in la_compiled_patterns.items(): + if cm_pattern.search(la_content): + found = True + break + if found: + print dbconn.retrieveKeySlotAggregated(pkg_id) + break + + shutil.rmtree(tmp_dir, True) + +srv.shutdown() +raise SystemExit(0)