guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

12/45: TEMP Add some scripts for maintaining KDE packages.


From: guix-commits
Subject: 12/45: TEMP Add some scripts for maintaining KDE packages.
Date: Sun, 31 Jan 2021 10:27:22 -0500 (EST)

htgoebel pushed a commit to branch wip-kde-plasma
in repository guix.

commit 7ecc2c2ab27bbc5cd6d85424c49ee689e828e8f5
Author: Hartmut Goebel <h.goebel@crazy-compilers.com>
AuthorDate: Wed Jun 12 11:43:11 2019 +0200

    TEMP Add some scripts for maintaining KDE packages.
---
 kde-build.sh           | 16 +++++++++
 kde-clean.sh           | 15 ++++++++
 kde-diff-buildlog.py   | 62 +++++++++++++++++++++++++++++++++
 kde-filter-buildlog.py | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++
 kde-graph.sh           | 13 +++++++
 kde-update.sh          | 37 ++++++++++++++++++++
 6 files changed, 237 insertions(+)

diff --git a/kde-build.sh b/kde-build.sh
new file mode 100644
index 0000000..6ca6165
--- /dev/null
+++ b/kde-build.sh
@@ -0,0 +1,16 @@
+#!bash
+#
+# Copyright © 2016-2019 Hartmut Goebel <h.goebel@crazy-compilers.com>
+# License: GPLv3
+
+
+build () {
+    WHICH=$1 ; shift
+    ./pre-inst-env guix package -A | grep $WHICH | \
+       cut -f 1 | xargs ./pre-inst-env guix build -K "$@"
+}
+
+#build /qt.scm --fallback
+build /kde-frameworks.scm --fallback
+#build /kde.scm --fallback
+build /kde-plasma.scm --fallback
diff --git a/kde-clean.sh b/kde-clean.sh
new file mode 100755
index 0000000..3648a1c
--- /dev/null
+++ b/kde-clean.sh
@@ -0,0 +1,15 @@
+#!bash
+#
+# Copyright © 2016-2019 Hartmut Goebel <h.goebel@crazy-compilers.com>
+# License: GPLv3
+#
+# remove obviously old builds
+
+./pre-inst-env guix package -A | grep /kde-framework | \
+    cut -f 1,2 \
+| while read name version ; do
+    find /gnu/store -maxdepth 1 -name \*-$name-\* \
+       -not -name \*-$version\* \
+       -not -name \*.patch
+done | \
+    xargs guix gc -d
diff --git a/kde-diff-buildlog.py b/kde-diff-buildlog.py
new file mode 100644
index 0000000..17decd9
--- /dev/null
+++ b/kde-diff-buildlog.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python3
+#
+# GNU Guix --- Functional package management for GNU
+# Copyright © 2017,2019 Hartmut Goebel <h.goebel@crazy-compilers.com>
+#
+# License: GPLv3
+
+import sys
+import tempfile, bz2
+import subprocess
+
+def find_unknow_properties(filename):
+    if filename.endswith('.bz2'):
+        fh = bz2.open(filename, mode="rt")
+    else:
+        fh = open(filename, mode="rt")
+    store = []
+    for l in fh.readlines():
+        if l.startswith(("About to parse service type file ",
+                         "Found property definition ",
+                         "Unknown property type for ")):
+            store.append(l) #.rstrip())
+        elif l.startswith('Generated  "'):
+            yield l.split('/build/', 1)[1].rstrip(), store
+            store = []
+    if store:
+        yield 'zzzzz', store
+    fh.close()
+
+def strip_same_entries(me, there):
+    for k in list(me.keys()):
+        if k in there and me[k] == there[k]:
+            del me[k]
+            del there[k]
+    
+
+def make_diff(me, there):
+    def write_data(data):
+       fh = tempfile.NamedTemporaryFile('wt')
+       for k in sorted(list(data.keys())):
+           print(k, file=fh)
+           fh.writelines(data[k])
+           print(file=fh) # seperator
+       print(file=fh) # enforce newline end end of file
+       fh.flush()
+       return fh
+       
+    me_fh = write_data(me)
+    there_fh = write_data(there)
+    import pdb ; pdb.set_trace()
+    #subprocess.call('hexdump %s | tail' % me_fh.name, shell=True)
+    #subprocess.call('hexdump %s | tail' % there_fh.name, shell=True)
+    subprocess.call(['emacs-diff', me_fh.name, there_fh.name])
+    me_fh.close()
+    there_fh.close()
+    
+
+me, there = sys.argv[1:3]
+me = dict(find_unknow_properties(me))
+there = dict(find_unknow_properties(there))
+strip_same_entries(me, there)
+make_diff(me, there)
diff --git a/kde-filter-buildlog.py b/kde-filter-buildlog.py
new file mode 100755
index 0000000..133b2fa
--- /dev/null
+++ b/kde-filter-buildlog.py
@@ -0,0 +1,94 @@
+#!/usr/bin/env python3
+#
+# GNU Guix --- Functional package management for GNU
+# Copyright © 2017,2019 Hartmut Goebel <h.goebel@crazy-compilers.com>
+#
+# License: GPLv3
+
+"""Filter the guix buildlog for some KDE package to find relevant information.
+
+Main features:
+* Print all the output of phases `check` and `configure`.
+* For phase `build': filter out warnings we are not interested in
+
+Usage example::
+  
+  ./kde-filter-buildlog.py /var/log/guix/drvs/ay/…-kconfig-5.49.0.drv.bz2
+"""
+
+import sys
+import tempfile, bz2
+import subprocess
+
+def strip_log(filename):
+    if filename.endswith('.bz2'):
+        fh = bz2.open(filename, mode="rt")
+    else:
+        fh = open(filename, mode="rt")
+    state = 0
+    for l in fh.readlines():
+        if not state and l.startswith(("starting phase `check'",
+                                       "starting phase `configure'",)):
+            state = 1
+            yield l.rstrip()
+        elif not state and l.startswith("starting phase `build'"):
+            state = 2
+            yield l.rstrip()
+        elif state and l.startswith(("phase `",)):
+            if state:
+                yield l.rstrip()
+            state = 0
+        elif state == 2:
+            if l.startswith(("About to parse service type file ",)):
+                yield  '' ; yield l.rstrip()
+            elif l.startswith(("Found property definition ",
+                               "Unknown property type for ",
+                               'Generated  "')):
+                yield l.rstrip()
+            else:
+                l = l.replace(' -Wl,--fatal-warnings ', ' ')
+                if 'warn' in l or 'Warn' in l:
+                    if ('[-Wdeprecated-declarations]' in l or
+                        '[-Wcpp]' in l or
+                        '[-Wswitch]' in l or
+                        '[-Wunused-' in l or
+                        '[-Wunknown-pragmas]' in l or
+                        '[-Wreorder]' in l or
+                        '[-Wsign-compare]' in l or                       
+                        '[-Wsuggest-override]' in l or
+                        '[-Wpedantic]' in l or
+                        '[-Wmaybe-uninitialized]' in l or
+                        '[-Wextra]' in l or
+                        '[-Woverloaded-' in l or
+                        '[-Wignored-' in l or
+                        '[-Wint-to-pointer-cast]' in l or
+                        'Warning: deprecated annotation' in l):
+                        continue
+                    yield l.rstrip()
+        elif state:
+            if l.startswith(("-- Could NOT find",)):
+                yield  '####' ; yield l.rstrip() ; yield  ''
+            else:
+                yield l.rstrip()
+    fh.close()
+    
+
+me = sys.argv[1]
+#for l in strip_log(me):
+#    print(l)
+
+try:
+    # args stolen fron git source, see `man less`
+    pager = subprocess.Popen(['less', '-cFRSi'], stdin=subprocess.PIPE)
+    has_output = False
+    for l in strip_log(me):
+        pager.stdin.write(l.encode('utf-8')+b'\n')
+        has_output = True
+        #print(l.encode('utf-8'), file=pager.stdin)
+    #if not has_output:
+    #    pager.stdin.write('all lines have been filtered'.encode('utf-8'))
+    pager.stdin.close()
+    pager.wait()
+except KeyboardInterrupt:
+    # let less handle this, -K will exit cleanly
+    pass
diff --git a/kde-graph.sh b/kde-graph.sh
new file mode 100644
index 0000000..e55c43e
--- /dev/null
+++ b/kde-graph.sh
@@ -0,0 +1,13 @@
+#!bash
+#
+# Copyright © 2016-2019 Hartmut Goebel <h.goebel@crazy-compilers.com>
+# License: GPLv3
+
+graph () {
+    WHICH="$1" ; shift
+    ./pre-inst-env guix package -A | grep -E "$WHICH" | \
+       head | cut -f 1 | xargs ./pre-inst-env guix graph | dot -Tpdf > 
kde-graph.pdf
+}
+
+#graph '/kde(|-frameworks|-plasma)\.scm'
+graph '/kde-frameworks.scm'
diff --git a/kde-update.sh b/kde-update.sh
new file mode 100644
index 0000000..436ab19
--- /dev/null
+++ b/kde-update.sh
@@ -0,0 +1,37 @@
+#!bash
+#
+# Copyright © 2016-2019 Hartmut Goebel <h.goebel@crazy-compilers.com>
+# License: GPLv3
+
+
+refresh () {
+    WHICH="$1" ; shift
+    ./pre-inst-env guix package -A | grep -E "$WHICH" | \
+       cut -f 1 | xargs ./pre-inst-env guix refresh --update
+}
+
+
+refresh_to_version () {
+    WHICH="$1" ; shift
+    VERSION="$1" ; shift
+    packages=$(./pre-inst-env guix package -A | grep -E "$WHICH" | \
+                     cut -f 1)
+    url=https://download.kde.org/stable/plasma/$VERSION
+    for pkg in $packages ; do
+       hash=$(guix download $url/$pkg-$VERSION.tar.xz 2>/dev/null | tail -1)
+       echo $pkg $hash
+    done
+}
+
+
+download_src () {
+    WHICH="$1" ; shift
+    ./pre-inst-env guix package -A | grep -E "$WHICH" |\
+       cut -f 1 | xargs ./pre-inst-env guix build --source -K
+}
+
+#refresh '/kde(|-frameworks|-plasma).scm'
+#download_src '/kde(|-frameworks|-plasma)\.scm'
+#refresh '/kde-frameworks.scm'
+#refresh '/kde-plasma.scm'
+refresh_to_version '/kde-plasma.scm' 5.13.5



reply via email to

[Prev in Thread] Current Thread [Next in Thread]