Verified Commit 1fc8a049 authored by Hartmut Goebel's avatar Hartmut Goebel
Browse files

TEMP Add some scripts for maintaining KDE packages.

parent 7abeca20
#!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
#!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
#!/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)
#!/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
#!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'
#!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
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