Projects
openEuler:Mainline
erlang-rpm-macros
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 5
View file
_service:tar_scm:erlang-rpm-macros.spec
Changed
@@ -1,5 +1,5 @@ Name: erlang-rpm-macros -Version: 0.3.1 +Version: 0.3.6 Release: 1 Summary: Macros for simplifying building of Erlang packages License: MIT @@ -38,5 +38,8 @@ %{_rpmconfigdir}/macros.d/macros.erlang %changelog +* Fri May 05 2023 Jia Chao <jiac13@chinaunicom.cn> - 0.3.6-1 +- Update to 0.3.6. + * Sat Sep 19 2020 huanghaitao <huanghaitao8@huawei.com> - 0.3.1-1 - package init
View file
_service:tar_scm:erlang-rpm-macros-0.3.1.tar.gz/erlang-find-requires.py -> _service:tar_scm:erlang-rpm-macros-0.3.6.tar.gz/erlang-find-requires.py
Changed
@@ -32,6 +32,10 @@ from elftools.elf.elffile import ELFFile +# Globals +ERLLIBDIR = "" +ERLSHRDIR = "/usr/share/erlang/lib" + # See $BUILDROOT/erts/emulator/*/erl_bif_list.h # erlang:F/A ErtsBIFProvides = @@ -205,7 +209,7 @@ return None -# Compatibility function for the upcomint RPM Python3 API +# Compatibility function for the upcoming RPM Python3 API # See https://bugzilla.redhat.com/1693771 def b2s(data): if isinstance(data, bytes): @@ -213,10 +217,6 @@ return data def inspect_beam_file(ISA, filename): - # Get the main Erlang directory - ERLLIBDIR = glob.glob("/usr/lib*/erlang/lib")0 - ERLSHRDIR = "/usr/share/erlang/lib" - b = pybeam.BeamFile(filename) # (M,F,A),... BeamMFARequires = sort_and_uniq(b.imports) @@ -244,7 +244,7 @@ # let's find RPM-packets to which these modules belongs # We return more than one match since there could be situations where the same - # object belongs to more that one package. + # object belongs to more than one package. ts = rpm.TransactionSet() RPMRequires = item for sublist in map( lambda x: (b2s(hrpm.RPMTAG_NAME), b2s(hrpm.RPMTAG_ARCH)) for h in ts.dbMatch('basenames', x), @@ -283,6 +283,10 @@ else: ISA="noarch" + # Get the main Erlang directory + prog = re.compile("/usr/lib(64)?/erlang/lib") + ERLLIBDIR = prog.match(glob.glob("/usr/lib*/erlang/lib/erts-*/ebin/erts.app")0)0 + # All the Erlang files matched by erlang.attr specification from the # package. Modern RPM version passes files one by one (a list # containing one filename prefixed by '\n'. We do not support older RPM
View file
_service:tar_scm:erlang-rpm-macros-0.3.1.tar.gz/macros.erlang -> _service:tar_scm:erlang-rpm-macros-0.3.6.tar.gz/macros.erlang
Changed
@@ -1,9 +1,68 @@ # handy macros for erlang-related packages %_erldir %{_libdir}/erlang -%_erllibdir %(a=%{buildarch}; if "$a" == "noarch" ; then echo %{_datadir}/erlang/lib; else echo %{_erldir}/lib; fi) +%_erllibdir %(if "%{_target_cpu}" == "noarch" ; then echo %{_datadir}/erlang/lib; else echo %{_erldir}/lib; fi) %__rebar /usr/bin/rebar +%__rebar2 /usr/bin/rebar +%__rebar3 /usr/bin/rebar3 + +## +## Rebar3 macros +## + +%rebar3_compile \ + CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \ + CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \ + FFLAGS="${FFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FFLAGS ; \ + FCFLAGS="${FCFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FCFLAGS ; \ + %{?__global_ldflags:LDFLAGS="${LDFLAGS:-%__global_ldflags}" ; export LDFLAGS ;} \ + VSN="%{version}" ; export VSN ; \ + REBAR_VSN_CACHE_FILE="%{_builddir}/%{buildsubdir}/vsn.cache" ; export REBAR_VSN_CACHE_FILE ; \ + echo "{{git, \\\"%{_builddir}/%{buildsubdir}\\\"}, \\\"%{version}\\\"}." > %{_builddir}/%{buildsubdir}/vsn.cache ; \ + REBAR_DEPS_PREFER_LIBS="TRUE" ; export REBAR_DEPS_PREFER_LIBS ; \ + IGNORE_MISSING_DEPS="TRUE" ; export IGNORE_MISSING_DEPS ; \ + ERL_LIBS="%{_datadir}/erlang/lib/" ; export ERL_LIBS ; \ + %__rebar3 compile skip_deps=true -vv \ +%{nil} + +%rebar3_ct(C:) \ + CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \ + CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \ + FFLAGS="${FFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FFLAGS ; \ + FCFLAGS="${FCFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FCFLAGS ; \ + %{?__global_ldflags:LDFLAGS="${LDFLAGS:-%__global_ldflags}" ; export LDFLAGS ;} \ + VSN="%{version}" ; export VSN ; \ + REBAR_VSN_CACHE_FILE="%{_builddir}/%{buildsubdir}/vsn.cache" ; export REBAR_VSN_CACHE_FILE ; \ + REBAR_DEPS_PREFER_LIBS="TRUE" ; export REBAR_DEPS_PREFER_LIBS ; \ + IGNORE_MISSING_DEPS="TRUE" ; export IGNORE_MISSING_DEPS ; \ + %__rebar3 ct skip_deps=true -vv %{-C:-C %{-C*}} \ +%{nil} + +%rebar3_doc \ + if -f doc/overview.edoc ; then \ + %__rebar3 edoc -vv \ + else \ + echo "No 'doc/overview.edoc' file was found, so docs aren't generated." \ + fi \ +%{nil} + +%rebar3_eunit(C:) \ + CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \ + CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \ + FFLAGS="${FFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FFLAGS ; \ + FCFLAGS="${FCFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FCFLAGS ; \ + %{?__global_ldflags:LDFLAGS="${LDFLAGS:-%__global_ldflags}" ; export LDFLAGS ;} \ + VSN="%{version}" ; export VSN ; \ + REBAR_VSN_CACHE_FILE="%{_builddir}/%{buildsubdir}/vsn.cache" ; export REBAR_VSN_CACHE_FILE ; \ + REBAR_DEPS_PREFER_LIBS="TRUE" ; export REBAR_DEPS_PREFER_LIBS ; \ + IGNORE_MISSING_DEPS="TRUE" ; export IGNORE_MISSING_DEPS ; \ + %__rebar3 eunit skip_deps=true -vv %{-C:-C %{-C*}} \ +%{nil} + +## +## These are going to be deprecated (renamed to rebar2 ones) +## %rebar_compile \ CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \ @@ -20,9 +79,6 @@ %__rebar compile skip_deps=true -vv \ %{nil} -# deprecated backwards compatibility -%__rebar_compile %rebar_compile - %rebar_ct(C:) \ CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \ CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \ @@ -81,6 +137,45 @@ fi \ %{nil} +## +## Rebar3 macros +## + +%erlang3_compile \ + %erlang_ensure_app_src \ + %rebar3_compile \ + %rebar3_doc + +%erlang3_test(C:) \ + %rebar3_eunit %{-C:-C %{-C*}} \ + %rebar3_ct %{-C:-C %{-C*}} + +%erlang3_install \ +if "%{__erlappname}" != "" ; then \ + %{__mkdir} -p %{buildroot}%{_erllibdir}/%{__erlappname}-%{version}/ \ + %{__mkdir} -p %{buildroot}%{_erllibdir}/%{__erlappname}-%{version}/ebin/ \ + if -f _build/default/lib/%{__erlappname}/ebin/%{__erlappname}.app ; then \ + %{__install} -m 0644 -p _build/default/lib/%{__erlappname}/ebin/%{__erlappname}.app %{buildroot}%{_erllibdir}/%{__erlappname}-%{version}/ebin/ \ + fi \ + %{__install} -m 0644 -p _build/default/lib/%{__erlappname}/ebin/*.beam %{buildroot}%{_erllibdir}/%{__erlappname}-%{version}/ebin/ \ + if -d include/ ; then \ + for erlincludefile in `ls include/*.hrl` ; do \ + %{__install} -D -m 0644 -p $erlincludefile %{buildroot}%{_erllibdir}/%{__erlappname}-%{version}/$erlincludefile \ + done \ + fi \ + if -d priv/ ; then \ + for solibfile in `ls priv/*.so` ; do \ + %{__install} -D -m 0755 -p $solibfile %{buildroot}%{_erllibdir}/%{__erlappname}-%{version}/$solibfile \ + done \ + fi \ +fi \ +%{nil} + + +## +## These are going to be deprecated (renamed to rebar2 ones) +## + %erlang_compile \ %erlang_ensure_app_src \ %rebar_compile \
View file
_service:tar_scm:erlang-rpm-macros-0.3.1.tar.gz/testing.py -> _service:tar_scm:erlang-rpm-macros-0.3.6.tar.gz/testing.py
Changed
@@ -1,4 +1,5 @@ import glob +import re import rpm import unittest @@ -12,9 +13,8 @@ def test_check_for_mfa(self): # This test requires erlang-erts RPM package installed - ERLLIBDIR = glob.glob("/usr/lib*/erlang/lib")0 filepath = glob.glob('/usr/lib*/erlang/lib/erts-*/ebin/erlang.beam')0 - self.assertEqual(M.check_for_mfa("%s/*/ebin" % ERLLIBDIR, {}, ('erlang', 'load_nif', 2)), filepath) + self.assertEqual(M.check_for_mfa("%s/*/ebin" % M.ERLLIBDIR, {}, ('erlang', 'load_nif', 2)), filepath) def test_inspect_so_library_nif(self): # This test requires erlang-crypto RPM package installed @@ -34,6 +34,12 @@ Deps = 'erlang-erts', 'erlang-kernel', 'erlang-stdlib' self.assertEqual(M.inspect_beam_file('noarch', "./test.beam"), Deps) + def test_check_for_absense_of_buildarch_macro(self): + self.assertEqual(rpm.expandMacro("%{buildarch}"), "%{buildarch}") + + def test_check_for_target_cpu_macro(self): + self.assertNotEqual(rpm.expandMacro("%{_target_cpu}"), "%{_target_cpu}") + if __name__ == "__main__": M = __import__("erlang-find-requires") @@ -44,4 +50,7 @@ ErlDrvDep = "erlang(erl_drv_version) = %s" % ds'erlang(erl_drv_version)' ErlNifDep = "erlang(erl_nif_version) = %s" % ds'erlang(erl_nif_version)' + prog = re.compile("/usr/lib(64)?/erlang/lib") + M.ERLLIBDIR = prog.match(glob.glob("/usr/lib*/erlang/lib/erts-*/ebin/erts.app")0)0 + unittest.main()
View file
_service:tar_scm:erlang-rpm-macros-0.3.1.tar.gz/travis-ci/fedora_30/Dockerfile -> _service:tar_scm:erlang-rpm-macros-0.3.6.tar.gz/travis-ci/fedora_30/Dockerfile
Changed
@@ -1,4 +1,4 @@ -FROM fedora:29 +FROM fedora:30 RUN dnf -y update
View file
_service:tar_scm:erlang-rpm-macros-0.3.1.tar.gz/travis-ci/fedora_31/Dockerfile -> _service:tar_scm:erlang-rpm-macros-0.3.6.tar.gz/travis-ci/fedora_31/Dockerfile
Changed
@@ -1,4 +1,4 @@ -FROM fedora:29 +FROM fedora:31 RUN dnf -y update
View file
_service:tar_scm:erlang-rpm-macros-0.3.1.tar.gz/travis-ci/fedora_32/Dockerfile -> _service:tar_scm:erlang-rpm-macros-0.3.6.tar.gz/travis-ci/fedora_32/Dockerfile
Changed
@@ -1,4 +1,4 @@ -FROM fedora:29 +FROM fedora:32 RUN dnf -y update
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2