Server: appserver-7f0f8755-nginx-15961cad18524ec5a9db05f2a6a7e440
Current directory: /usr/lib/rpm
Software: nginx/1.27.5
Shell Command
Create a new file
Upload file
File: ocamldeps.sh
#!/bin/bash # This is a helper for rpm which collects 'Provides' and 'Requires' information from OCaml files. # It reads a list of filenames from STDIN. # It expects as argument either '--provides|-P' or '--requires|-R'. # Additional optional arguments are: # -f "ocamlobjinfo command" # -c # ignored, recognized just for compat reasons # -i NAME # omit the Requires/Provides for this bytecode unit name # -x NAME # omit the Requires/Provides for this native unit name # # OCaml object files contain either bytecode or native code. # Each bytecode variant provides a certain interface, which is represented by a hash. # Each native variant provides a certain interface and a certain implementation, which are represented by hashes. # Each variant may also require a certain interface and/or implementation provided by other files. # The details for each file can be inspected with 'ocamlobjinfo'. # # Each file contains at least one module. # Information about each module follows after a line starting with "Name:" or "Unit name:": # # cma/cmi/cmo (bytecode): # Unit name: NAME # Interfaces imported: # HASH NAME # HASH NAME_FROM_OTHER_MODULE # # cmx/cmxa/cmxs (native): # Name: NAME # CRC of implementation: HASH # Interfaces imported: # HASH NAME # HASH NAME_FROM_OTHER_MODULE # Implementations imported: # HASH NAME_FROM_OTHER_MODULE # # cmxs files are recoqnized, but need to be ignored. # They contain references of the interfaces and implementations # compiled into them. # # The hash may contain just '-', in which case it is ignored. # # Output: # ocaml(NAME) = HASH # for interfaces (bytecode and native) # ocamlx(NAME) = HASH # for implementations (native) set -e # OCAMLOBJINFO=ocamlobjinfo rpm_prefix_interface='ocaml' rpm_prefix_implementation='ocamlx' # parse() { local filename="$1" ${OCAMLOBJINFO} "${filename}" | awk ' BEGIN { debug=0 mode=ENVIRON["mode"] RPM_BUILD_ROOT=ENVIRON["RPM_BUILD_ROOT"] rpm_prefix_interface=ENVIRON["rpm_prefix_interface"] rpm_prefix_implementation=ENVIRON["rpm_prefix_implementation"] state="find" unit="" split(ENVIRON["ignore_implementation"], ignore_implementation_a) for (i in ignore_implementation_a) { val=ignore_implementation_a[i] if (debug) printf "INFO: ignore_implementation %s\n", val > "/dev/stderr" ignore_implementation[val]=1 } split(ENVIRON["ignore_interface"], ignore_interface_a) for (i in ignore_interface_a) { val=ignore_interface_a[i] if (debug) printf "INFO: ignore_interface %s\n", val > "/dev/stderr" ignore_interface[val]=1 } } /^File / { if (RPM_BUILD_ROOT != "" ) { file=substr($2,length(RPM_BUILD_ROOT)+1) } else { file=$2 } state="file" next } /^Unit name:/ { unit=$3 state="cma" next } /^Name:/ { unit=$2 state="cmx" next } /^CRC of implementation:/ { if (state == "cmx") { if (ignore_implementation[unit] != "") { if (ignore_implementation[unit] != "seen") { printf "INFO: ignoring Provides %s(%s)=%s from %s\n", rpm_prefix_implementation, unit, $4, file > "/dev/stderr" ignore_implementation[unit]="seen" } } else { implementation_provides[unit]=$4 } } else { printf "WARN: state %s, expected cmx, got %s\n", state, $0 > "/dev/stderr" } state="crc" next } /^Interfaces imported:/ { state="interface" next } /^Implementations imported:/ { state="implementation" next } /^\t/ { if (state == "interface" && NF > 1 && match($1, "^-") == 0) { if (unit == $2) { if (ignore_interface[unit] != "") { if (ignore_interface[unit] != "seen") { printf "INFO: ignoring Provides %s(%s)=%s from %s\n", rpm_prefix_interface, unit, $1, file > "/dev/stderr" ignore_interface[unit]="seen" } } else { interface_provides[unit]=$1 } } else { if (ignore_interface[$2] != "") { if (ignore_interface[$2] != "seen") { printf "INFO: ignoring Requires %s(%s)=%s from %s\n", rpm_prefix_interface, $2, $1, file > "/dev/stderr" ignore_interface[$2]="seen" } } else { interface_requires[$2]=$1 } } next } else if (state == "implementation" && NF > 1 && match($1, "^-") == 0) { if (unit == $2) { if (ignore_implementation[unit] != "") { if (ignore_implementation[unit] != "seen") { printf "INFO: ignoring Provides %s(%s)=%s from %s\n", rpm_prefix_implementation, unit, $1, file > "/dev/stderr" ignore_implementation[unit]="seen" } } else { implementation_provides[unit]=$1 } } else { if (ignore_implementation[$2] != "") { if (ignore_implementation[$2] != "seen") { printf "INFO: ignoring Requires %s(%s)=%s from %s\n", rpm_prefix_implementation, $2, $1, file > "/dev/stderr" ignore_implementation[$2]="seen" } } else { implementation_requires[$2]=$1 } } next } else { next } } /^.*/ { state="find" } END { if (mode == "provides") { for (i in interface_provides) { printf "%s(%s) = %s\n", rpm_prefix_interface, i, interface_provides[i] } for (i in implementation_provides) { printf "%s(%s) = %s\n", rpm_prefix_implementation, i, implementation_provides[i] } } if (mode == "requires") { for (i in interface_requires) { printf "%s(%s) = %s\n", rpm_prefix_interface, i, interface_requires[i] } for (i in implementation_requires) { printf "%s(%s) = %s\n", rpm_prefix_implementation, i, implementation_requires[i] } } } ' } # # usage() { echo >&2 "Usage: ${0##*/} -provides|-requires [-f 'ocamlobjinfo cmd']" } # mode= ignore_implementation_a=() ignore_interface_a=() while test "$#" -gt 0 do : "${1}" "${2}" case "${1}" in -P|--provides) mode='provides' ;; -R|--requires) mode='requires' ;; -i) ignore_interface_a+=("$2") ; shift ;; -x) ignore_implementation_a+=("$2") ; shift ;; -f) OCAMLOBJINFO="$2"; shift ;; -h|--help) usage ; exit 0 ;; -c) ;; # ignored --) break ;; *) usage ; exit 1 ;; esac shift done if test -z "${mode}" then usage exit 1 fi # export rpm_prefix_interface export rpm_prefix_implementation export mode export ignore_implementation="${ignore_implementation_a[@]}" export ignore_interface="${ignore_interface_a[@]}" # while read filename do case "${filename}" in *.cma) parse "${filename}" ;; *.cmi) parse "${filename}" ;; *.cmo) parse "${filename}" ;; *.cmx) parse "${filename}" ;; *.cmxa) parse "${filename}" ;; *.cmxs) ;; *) continue ;; esac done # vim: tw=666 ts=2 shiftwidth=2 et
.
40 Items
Change directory
Remove directory
Rename directory
..
72 Items
Change directory
Remove directory
Rename directory
brp-compress
1.77 KB
Edit
Delete
Copy
Move
Remame
brp-elfperms
0.42 KB
Edit
Delete
Copy
Move
Remame
brp-python-bytecompile
3.81 KB
Edit
Delete
Copy
Move
Remame
brp-python-hardlink
0.62 KB
Edit
Delete
Copy
Move
Remame
brp-remove-la-files
0.32 KB
Edit
Delete
Copy
Move
Remame
brp-strip
0.51 KB
Edit
Delete
Copy
Move
Remame
brp-strip-comment-note
0.79 KB
Edit
Delete
Copy
Move
Remame
brp-strip-static-archive
0.48 KB
Edit
Delete
Copy
Move
Remame
check-buildroot
1.29 KB
Edit
Delete
Copy
Move
Remame
check-files
1.03 KB
Edit
Delete
Copy
Move
Remame
check-prereqs
0.41 KB
Edit
Delete
Copy
Move
Remame
check-rpaths
1.06 KB
Edit
Delete
Copy
Move
Remame
check-rpaths-worker
5.19 KB
Edit
Delete
Copy
Move
Remame
elfdeps
22.23 KB
Edit
Delete
Copy
Move
Remame
fileattrs
13 Items
Change directory
Remove directory
Rename directory
find-lang.sh
8.84 KB
Edit
Delete
Copy
Move
Remame
find-provides
0.09 KB
Edit
Delete
Copy
Move
Remame
find-requires
0.09 KB
Edit
Delete
Copy
Move
Remame
fontconfig.prov
0.48 KB
Edit
Delete
Copy
Move
Remame
macros
41.63 KB
Edit
Delete
Copy
Move
Remame
macros.d
0 Items
Change directory
Remove directory
Rename directory
mkinstalldirs
3.46 KB
Edit
Delete
Copy
Move
Remame
ocamldeps.sh
6.8 KB
Edit
Delete
Copy
Move
Remame
perl.prov
6.28 KB
Edit
Delete
Copy
Move
Remame
perl.req
8.91 KB
Edit
Delete
Copy
Move
Remame
pkgconfigdeps.sh
1.34 KB
Edit
Delete
Copy
Move
Remame
platform
67 Items
Change directory
Remove directory
Rename directory
pythondistdeps.py
27.53 KB
Edit
Delete
Copy
Move
Remame
rpm.daily
0.3 KB
Edit
Delete
Copy
Move
Remame
rpm.supp
0.67 KB
Edit
Delete
Copy
Move
Remame
rpm2cpio.sh
1.56 KB
Edit
Delete
Copy
Move
Remame
rpm_macros_provides.sh
1.27 KB
Edit
Delete
Copy
Move
Remame
rpmdb_dump
0.04 KB
Edit
Delete
Copy
Move
Remame
rpmdb_load
0.04 KB
Edit
Delete
Copy
Move
Remame
rpmdeps
18.9 KB
Edit
Delete
Copy
Move
Remame
rpmpopt-4.18.0
10.54 KB
Edit
Delete
Copy
Move
Remame
rpmrc
17.45 KB
Edit
Delete
Copy
Move
Remame
rpmuncompress
14.9 KB
Edit
Delete
Copy
Move
Remame
script.req
0.31 KB
Edit
Delete
Copy
Move
Remame
tgpg
0.91 KB
Edit
Delete
Copy
Move
Remame