Hello community,
here is the log from the commit of package ocaml-rpm-macros for
openSUSE:Factory checked in at 2019-11-07 23:14:11
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ocaml-rpm-macros (Old)
and /work/SRC/openSUSE:Factory/.ocaml-rpm-macros.new.2990 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ocaml-rpm-macros"
Thu Nov 7 23:14:11 2019 rev:3 rq:745385 version:20191101
Changes:
--------
--- /work/SRC/openSUSE:Factory/ocaml-rpm-macros/ocaml-rpm-macros.changes
2019-10-14 14:52:36.710276019 +0200
+++
/work/SRC/openSUSE:Factory/.ocaml-rpm-macros.new.2990/ocaml-rpm-macros.changes
2019-11-07 23:14:11.900381774 +0100
@@ -1,0 +2,17 @@
+Fri Nov 1 12:34:56 UTC 2019 - [email protected]
+
+- Moved ocaml-findlib.rpm.prov_req.attr.sh from ocaml to provide
+ ocamlfind() in ocaml itself
+- Handle license separately because sed w truncates output
+- Document individual file extensions
+- Move cmxs and so files to devel packages because they are not
+ used at runtime. Also, cmxs dependencies in main pkg are
+ not covered by ocaml-find-requires.sh (bsc#1154874)
+- Set VERSION unconditionally for each patch, sometimes dune picks it up
+- Pass --for-release-of-packages to dune via dune_release_pkgs=
+- Print potential BuildRequires during build
+- Package sml for camlp5
+- SLE_12 has still no license macro, package as doc instead
+- Use _smp_mflags instead of nproc for parallel build
+
+-------------------------------------------------------------------
New:
----
ocaml-findlib.rpm.prov_req.attr.sh
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ocaml-rpm-macros.spec ++++++
--- /var/tmp/diff_new_pack.Q03Kgj/_old 2019-11-07 23:14:12.372382290 +0100
+++ /var/tmp/diff_new_pack.Q03Kgj/_new 2019-11-07 23:14:12.376382295 +0100
@@ -12,18 +12,18 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: ocaml-rpm-macros
-Version: 20191009
+Version: 20191101
Release: 0
Summary: RPM macros for building OCaml source packages
License: GPL-2.0-only
Group: Development/Languages/OCaml
Url: https://build.opensuse.org/project/show/devel:languages:ocaml
-#
-# keep the following macros in sync with ocaml.spec:
+Source1: ocaml-findlib.rpm.prov_req.attr.sh
+
%define do_opt 0
# macros to be set in prjconf:
#Macros:
@@ -60,6 +60,17 @@
%build
%install
+# map findlib names to rpm Provides/Requires
+tag="ocamlfind"
+mkdir -vp %{buildroot}%{_rpmconfigdir}/fileattrs
+tee %{buildroot}%{_rpmconfigdir}/fileattrs/${tag}.attr <<_EOF_
+%__${tag}_provides %%{_rpmconfigdir}/${tag}.sh -prov
+%__${tag}_requires %%{_rpmconfigdir}/${tag}.sh -req
+%__${tag}_path ^%%{_libdir}/ocaml/.*/META$|^%%{_libdir}/ocaml/META$
+_EOF_
+#
+tee %{buildroot}%{_rpmconfigdir}/${tag}.sh < %{SOURCE1}
+
# install OCaml macros
mkdir -vp %{buildroot}%{_rpmmacrodir}
tee %{buildroot}%{_rpmmacrodir}/macros.%{name} <<'_EOF_'
@@ -91,8 +102,9 @@
> %%{name}.files ;\
> %%{name}.files.devel ;\
> %%{name}.files.ldsoconf ;\
+ > %%{name}.files.license ;\
> %%{name}.files.unhandled ;\
- for i in \\\
+ for license in \\\
COPYING \\\
COPYING.txt \\\
COPYRIGHT \\\
@@ -103,50 +115,87 @@
LICENSE.txt \\\
;\
do\
- test -f "$i" && echo "%%%%license $i" >> %%{name}.files ;\
+%if 0%{?suse_version} > 1315
+ license_macro='license' ;\
+%else
+ license_macro='doc' ;\
+%endif
+ test -f "${license}" && echo "%%%%${license_macro} ${license}" >>
'%%{name}.files.license' ;\
done ;\
find %%{buildroot}$(ocamlc -where) | sed -ne '\
s@^%%{buildroot}@@\
- /\\/\\(META\\|dune-package\\|opam\\)$/{\
- w %%{name}.files.devel\
- s@\\/[^/]\\+$@@\
- s@^@%%dir @\
- w %%{name}.files.devel\
- s@\\/[^/]\\+$@@\
- w %%{name}.files.devel\
+ #\
+ # for findlib, describing a package\
+ /\\/META$/{ b files_devel }\
+ # stub ELF library\
+ /\\/[^/]\\+\\.so$/{ b files_ldsoconf }\
+ # stub ELF library\
+ /\\/[^/]\\+\\.so.owner$/{ b files_ldsoconf }\
+ # ELF archive with object files\
+ /\\/[^/]\\+\\.a$/{ b files_devel }\
+ # OCaml legacy source code annotations, produced via -annot\
+ /\\/[^/]\\+\\.annot$/{ b files_devel }\
+ # OCaml library file with bytecode\
+ /\\/[^/]\\+\\.cma$/{ b files_devel }\
+ # OCaml compiled header file\
+ /\\/[^/]\\+\\.cmi$/{ b files_devel }\
+ # OCaml object file with bytecode\
+ /\\/[^/]\\+\\.cmo$/{ b files_devel }\
+ # OCaml source code annotations, produced via -bin-annot from source
files\
+ /\\/[^/]\\+\\.cmt$/{ b files_devel }\
+ # OCaml source code annotations, produced via -bin-annot from header
files\
+ /\\/[^/]\\+\\.cmti$/{ b files_devel }\
+ # OCaml object file with native code\
+ /\\/[^/]\\+\\.cmx$/{ b files_devel }\
+ # OCaml library file with native code\
+ /\\/[^/]\\+\\.cmxa$/{ b files_devel }\
+ # ELF shared library with native code\
+ /\\/[^/]\\+\\.cmxs$/{ b files_devel }\
+ # Some helper binary\
+ /\\/[^/]\\+\\.exe$/{ b files_devel }\
+ # C header\
+ /\\/[^/]\\+\\.h$/{ b files_devel }\
+ #\
+ /\\/[^/]\\+\\.js$/{ b files_devel }\
+ # OCaml source code, source file\
+ /\\/[^/]\\+\\.ml$/{ b files_devel }\
+ # OCaml source code, header file\
+ /\\/[^/]\\+\\.mli$/{ b files_devel }\
+ # ELF object file\
+ /\\/[^/]\\+\\.o$/{ b files_devel }\
+ #\
+ /\\/[^/]\\+\\.sml$/{ b files_devel }\
+ #\
+ /\\/dune-package$/{ b files_devel }\
+ #\
+ /\\/opam$/{ b files_devel }\
+ #\
+ # record unknown paths\
+ w %%{name}.files.unhandled\
d\
- }\
-
/\\/[^/]\\+\\.\\(a\\|annot\\|cmx\\|cmxa\\|cma\\|cmi\\|cmo\\|cmt\\|cmti\\|exe\\|h\\|js\\|ml\\|mli\\|o\\)$/{\
+ #\
+ : files_devel\
+ # full path for file\
w %%{name}.files.devel\
+ # tag + dirname\
s@\\/[^/]\\+$@@\
+ : tag_dirname\
s@^@%%dir @\
w %%{name}.files.devel\
+ # parent directory\
s@\\/[^/]\\+$@@\
w %%{name}.files.devel\
d\
- }\
- /\\/[^/]\\+\\.\\(so\\|so.owner\\)$/{\
- w %%{name}.files\
+ #\
+ : files_ldsoconf\
+ # full path for file\
+ w %%{name}.files.devel\
+ # dirname for ld.so.conf\
s@\\/[^/]\\+$@@\
w %%{name}.files.ldsoconf\
- s@^@%%dir @\
- w %%{name}.files\
- s@\\/[^/]\\+$@@\
- w %%{name}.files\
- d\
- }\
- /\\/[^/]\\+\\.\\(cmxs\\)$/{\
- w %%{name}.files\
- s@\\/[^/]\\+$@@\
- s@^@%%dir @\
- w %%{name}.files\
- s@\\/[^/]\\+$@@\
- w %%{name}.files\
- d\
- }\
- w %%{name}.files.unhandled\
- d\
+ b tag_dirname\
' ;\
+ cat '%%{name}.files.license' >> '%%{name}.files' ; \
for i in \\\
%%{name}.files \\\
%%{name}.files.devel \\\
@@ -238,17 +287,55 @@
%ifarch ppc64 ppc64le
ulimit -s $((1024 * 64)) ; \
%endif
+ echo '%%{version}' | tee VERSION ; \
+ dune_for_release= ; \
+ : dune_release_pkgs \
+ if test -n "${dune_release_pkgs}" ; \
+ then \
+ echo "${dune_release_pkgs}" >
dune_release_pkgs-%%{name}-%%{version}-%%{release} ; \
+
dune_for_release="--for-release-of-packages=${dune_release_pkgs}" ; \
+ fi ; \
dune installed-libraries $OCAML_DUNE_INSTALLED_LIBRARIES_ARGS ; \
- dune external-lib-deps @install $OCAML_DUNE_EXTERNAL_LIB_DEPS_ARGS ; \
- dune external-lib-deps @runtest $OCAML_DUNE_EXTERNAL_LIB_DEPS_ARGS ; \
+ dune external-lib-deps \\\
+ ${dune_for_release} \\\
+ '@install' \\\
+ $OCAML_DUNE_EXTERNAL_LIB_DEPS_ARGS ; \
+ dune external-lib-deps \\\
+ ${dune_for_release} \\\
+ '@runtest' \\\
+ $OCAML_DUNE_EXTERNAL_LIB_DEPS_ARGS ; \
+ dune external-lib-deps \\\
+ ${dune_for_release} \\\
+ '@install' '@runtest' \\\
+ $OCAML_DUNE_EXTERNAL_LIB_DEPS_ARGS \\\
+ | awk '/^-[[:blank:]]/{ printf "BuildRequires:
ocamlfind(%%s)\\n", $2}' | sort -u ; \
%%{nil}
%%ocaml_dune_build \
- dune build --verbose @install $OCAML_DUNE_BUILD_INSTALL_ARGS
+ dune build \\\
+ --verbose \\\
+ ${dune_for_release} \\\
+ %%{?_smp_mflags} \\\
+ '@install' \\\
+ $OCAML_DUNE_BUILD_INSTALL_ARGS
%%ocaml_dune_install \
%ifarch ppc64 ppc64le
ulimit -s $((1024 * 64)) ; \
%endif
- dune install --verbose --destdir=%%{buildroot} $OCAML_DUNE_INSTALL_ARGS
; \
+ dune_for_release= ; \
+ if test -f dune_release_pkgs-%%{name}-%%{version}-%%{release} ; \
+ then \
+ read dune_release_pkgs <
dune_release_pkgs-%%{name}-%%{version}-%%{release} ; \
+
dune_for_release="--for-release-of-packages=${dune_release_pkgs}" ; \
+ fi ; \
+ dune install \\\
+ --verbose \\\
+ ${dune_for_release} \\\
+ %%{?_smp_mflags} \\\
+ --prefix=%%{_prefix} \\\
+ --libdir=$(ocamlc -where) \\\
+ --destdir=%%{buildroot} \\\
+ ${dune_release_pkgs//,/ } \\\
+ $OCAML_DUNE_INSTALL_ARGS ; \
rm -rfv %%{buildroot}%%{_prefix}/doc ; \
if test -d %%{buildroot}%%{_prefix}/man ; then \
mkdir -vp %%{buildroot}%%{_datadir} ; \
@@ -258,12 +345,36 @@
%ifarch ppc64 ppc64le
ulimit -s $((1024 * 64)) ; \
%endif
- dune runtest --verbose $OCAML_DUNE_RUNTEST_ARGS
+ dune_for_release= ; \
+ if test -f dune_release_pkgs-%%{name}-%%{version}-%%{release} ; \
+ then \
+ read dune_release_pkgs <
dune_release_pkgs-%%{name}-%%{version}-%%{release} ; \
+
dune_for_release="--for-release-of-packages=${dune_release_pkgs}" ; \
+ fi ; \
+ if dune runtest \\\
+ --verbose \\\
+ ${dune_for_release} \\\
+ $OCAML_DUNE_RUNTEST_ARGS ; \
+ then \
+ echo "dune runtest succeeded" ; \
+ else \
+ echo "dune runtest failed" ; \
+ if test -n "${dune_test_tolerate_fail}" ; \
+ then \
+ echo "ignored" ; \
+ else \
+ echo "aborting" ; \
+ exit 1 ; \
+ fi ; \
+ fi
+
#
#
_EOF_
%files
%{_rpmmacrodir}/*
+%{_rpmconfigdir}/fileattrs
+%attr(755,root,root) %{_rpmconfigdir}/*.sh
%changelog
++++++ ocaml-findlib.rpm.prov_req.attr.sh ++++++
#!/bin/bash
set -e
prov_req_name="ocamlfind"
td=`mktemp --directory`
test -n "${td}"
_x() {
rm -rf "${td}"
}
trap _x EXIT
cmd=
test "$1" = "-prov" && cmd=prov
test "$1" = "-req" && cmd=req
do_work() {
local f=$1
local pkg_name
local pkg_prov_req
local pkg_prov
local pkg_req
local elem req
pkg_name="${f##*/}"
if test "${pkg_name}" = "META"
then
pkg_name="${f%/*}"
pkg_name="${pkg_name##*/}"
else
pkg_name="${pkg_name#META.}"
fi
pkg_prov_req="`
env \
pkg_name="${pkg_name}" \
cmd="${cmd}" \
awk '
BEGIN {
dbg=1;
count=1;
depth=0;
pkg_name=ENVIRON["pkg_name"];
cmd=ENVIRON["cmd"];
if(dbg) printf "bEGIN \\"%s\\" cmd: %s\n", pkg_name, cmd >
"/dev/stderr" ;
reqs[pkg_name]=""
pkg_names[depth]=pkg_name
}
{
if(dbg) printf "line: %s\n", $0 > "/dev/stderr"
}
/^[[:blank:]]*directory[[:blank:]]*=/ {
if(dbg) printf "GOT: %s\n", $0 > "/dev/stderr" ;
if (depth == 0) {
x = split($0, a, "\\"");
if ( a[2] ) {
candidate = a[2];
if(dbg) printf "dir: %s %s\n", x, candidate > "/dev/stderr" ;
if (candidate ~ /^\^/) {
next
}
if (candidate ~ /^\+/) {
candidate = substr(candidate, 2);
}
if (candidate ~ /^\//) {
x = split(candidate, a, "/");
if ( x )
candidate = a[x];
}
if (candidate ~ /^\.\.\//) {
x = split(candidate, a, "/");
if ( x )
candidate = a[x];
}
if(dbg) printf "dir: %s %s\n", x, candidate > "/dev/stderr" ;
if (candidate != pkg_name) {
reqs[candidate] = reqs[pkg_name];
delete reqs[pkg_name];
pkg_name = candidate;
if(dbg) printf "new pkg_name %s %s\n", x, pkg_name >
"/dev/stderr" ;
pkg_names[depth]=pkg_name
} else {
if(dbg) printf "pkg_name remains %s\n", pkg_name > "/dev/stderr" ;
}
}
}
next
}
/^[[:blank:]]*requires.*[[:blank:]]*=/ {
if(dbg) printf "GOT: %s\n", $0 > "/dev/stderr" ;
x = split($0, a, "\\"");
if ( a[2] ) {
if(dbg) printf "req2 %s %s\n", x, a[2] > "/dev/stderr" ;
x = gsub("[[:blank:]]+", ",", a[2]);
if(dbg) printf "req2 %s %s\n", x, a[2] > "/dev/stderr" ;
reqs[pkg_name] = a[2];
}
next
}
/^[[:blank:]]*package[[:blank:]]/ {
if(dbg) printf "GOT: %s\n", $0 > "/dev/stderr" ;
depth = depth + 1;
if(dbg) printf "depth %s\n", depth > "/dev/stderr" ;
x = split($0, a, "\\"");
if ( a[2] ) {
if(dbg) printf "req2 %s %s\n", x, a[2] > "/dev/stderr" ;
pkg_name = pkg_name"."a[2];
reqs[pkg_name]=""
pkg_names[depth]=pkg_name
if(dbg) printf "new pkg_name %s %s\n", x, pkg_name > "/dev/stderr" ;
}
next
}
/^[[:blank:]]*)/ {
if(dbg) printf "GOT: %s\n", $0 > "/dev/stderr" ;
depth = depth -1;
if(dbg) printf "depth %s\n", depth > "/dev/stderr" ;
pkg_name=pkg_names[depth]
if(dbg) printf "old pkg_name %s %s\n", x, pkg_name > "/dev/stderr" ;
next
}
END {
if(dbg) printf "eND \\"%s\\"\n", pkg_name > "/dev/stderr" ;
for (req in reqs) {
if(dbg)printf "eNd \\"%s\\"\n", req > "/dev/stderr";
# format: provides:requires
printf "%s:%s\n", req, reqs[req];
}
if(dbg) printf "ENd \\"%s\\"\n", pkg_name > "/dev/stderr" ;
}
' \"${f}\"
`"
for elem in ${pkg_prov_req}
do
pkg_prov="${elem%%:*}"
pkg_req="${elem#*:}"
pkg_req="${pkg_req//,/ }"
if test -n "${pkg_prov}" && test "${cmd}" = "prov"
then
echo "${prov_req_name}($pkg_prov)"
fi
if test "${cmd}" = "req"
then
for i in ${pkg_req}
do
echo "${prov_req_name}(${i})"
done
fi
done
}
while read filename
do
case "${filename}" in
*/META*) do_work "${filename}" ;;
*) ;;
esac
done