Skip to content

Instantly share code, notes, and snippets.

reqlist() {
{
echo "$1"
rpm -q -l --provides "$1"
} | xargs rpm -q --whatrequires | grep -v '^no package requires'
}
reqlist "$@"
@deryni
deryni / index.html
Created May 5, 2017 11:25
cockpit visibility change weirdness
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Cockpit Visibility Testing</title>
<script src="../base1/cockpit.js"></script>
<script src="test.js"></script>
</head>
+ make -f main.mk -s
main.mk:3: Using make 3.81
main.mk:7: lst is a:simple
main.mk:11: lst is a b:simple
sub.mk:1: MAKEFLAGS:s
sub.mk:2: MAKEOVERRIDES:
sub.mk:3: -*-command-variables-*-:
sub.mk:7: lst is a b $(tmp):recursive
sub.mk:11: lst is a b $(tmp) $(tmp):recursive
+ make -f main.mk -s lst=foo
@deryni
deryni / dirname.sh
Last active October 16, 2015 21:02
POSIX-ly correct shell-only implementation of `dirname` (http://pubs.opengroup.org/onlinepubs/9699919799/utilities/dirname.html).
#!/bin/sh
p=$1
alt=$2
skip78=
stripslashes() {
i=$1
while [ "$i" != "$o" ]; do
o=$i
@deryni
deryni / Makefile
Last active August 29, 2015 14:11
SO 27365859 repro
ver.%: Makefile
touch ver.h
sleep 1
touch ver.cpp
.PHONY: clean all
all: ver.h ver.cpp
clean:
@deryni
deryni / Makefile
Last active August 29, 2015 14:10
make -j2 test
CC=gcc
l.a : l.a(a.o)
ranlib l.a
echo done
l.a(a.o) : a.c
clean::
rm -f l.a a.o
$ set -x
+ set -x
$ k=foo
+ k=foo
$ v='bar baz'
+ v='bar baz'
$ export foo=$v
+ export 'foo=bar baz'
+ foo='bar baz'
$ echo $foo
import sys, os, rpm
def readRpmHeader(ts, filename):
""" Read an rpm header. """
fd = os.open(filename, os.O_RDONLY)
h = None
try:
h = ts.hdrFromFdno(fd)
finally:
os.close(fd)
@deryni
deryni / silent_rules.mk
Created September 3, 2014 16:08
Automake-style Silent Rules support for GNU Make.
SR_PREFIX ?= SR
# Manual automake silent rule stuff
$(SR_PREFIX)_DEFAULT_VERBOSITY = 0
$(SR_PREFIX)_SILENT_VERBOSITY = -1
V ?= $($(SR_PREFIX)_DEFAULT_VERBOSITY)
SILENT := $(and $(filter $($(SR_PREFIX)_SILENT_VERBOSITY),$(V)),silent)
DEFAULT := $(and $(filter $($(SR_PREFIX)_DEFAULT_VERBOSITY),$(V)),default)
@deryni
deryni / worddiff.awk
Last active August 29, 2015 14:06
Line+word diff for git changes. Created for http://stackoverflow.com/a/25620599/258523
BEGIN {
RS="\n?~\n"
FS="\n"
}
# Special case the diff header/chunk header lines.
/^diff --git/ {
print
next
}