Projects
Kolab:16:Enterprise
erlang-rpm-macros
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 2
View file
erlang-rpm-macros.spec
Changed
@@ -1,14 +1,25 @@ +%if 0%{?rhel} > 6 || 0%{?fedora} +%global rpmmacrosdir %{_rpmconfigdir}/macros.d +%else +%global rpmmacrosdir %{_sysconfdir}/rpm/ +%endif + Name: erlang-rpm-macros -Version: 0.1.4 +Version: 0.2.2 Release: 1%{?dist} Summary: Macros for simplifying building of Erlang packages Group: Development/Libraries License: MIT URL: https://github.com/lemenkov/erlang-rpm-macros -#VCS: scm:git:https://github.com/lemenkov/erlang-rpm-macros.git +%if 0%{?rhel} > 6 || 0%{?fedora} +VCS: scm:git:https://github.com/lemenkov/erlang-rpm-macros.git +%endif Source0: https://github.com/lemenkov/erlang-rpm-macros/archive/%{version}/%{name}-%{version}.tar.gz BuildArch: noarch -Requires: rpm-build +Requires: rpm-build >= 4.8 +# Requires for BEAM parsing +Requires: python2-pybeam +Requires: rpm-python %description @@ -24,25 +35,56 @@ %install -install -d %{buildroot}%{_rpmconfigdir}/macros.d +install -d %{buildroot}%{_rpmconfigdir}/fileattrs +install -d %{buildroot}%{rpmmacrosdir} install -p -m 0755 erlang-find-provides.escript %{buildroot}%{_rpmconfigdir}/ -install -p -m 0755 erlang-find-provides.sh %{buildroot}%{_rpmconfigdir}/ +install -p -m 0755 erlang-find-provides.py %{buildroot}%{_rpmconfigdir}/ install -p -m 0755 erlang-find-requires.escript %{buildroot}%{_rpmconfigdir}/ -install -p -m 0755 erlang-find-requires.sh %{buildroot}%{_rpmconfigdir}/ -install -p -m 0644 macros.erlang %{buildroot}%{_rpmconfigdir}/macros.d +install -p -m 0755 erlang-find-requires.py %{buildroot}%{_rpmconfigdir}/ +install -p -m 0644 macros.erlang %{buildroot}%{rpmmacrosdir} +install -p -m 0644 erlang.attr %{buildroot}%{_rpmconfigdir}/fileattrs/ %files -%doc README LICENSE -%{_rpmconfigdir}/macros.d/macros.erlang +%if 0%{?fedora} +%license LICENSE +%else +%doc LICENSE +%endif +%doc README %{_rpmconfigdir}/erlang-find-provides.escript -%{_rpmconfigdir}/erlang-find-provides.sh +%{_rpmconfigdir}/erlang-find-provides.py %{_rpmconfigdir}/erlang-find-requires.escript -%{_rpmconfigdir}/erlang-find-requires.sh +%{_rpmconfigdir}/erlang-find-requires.py +%{_rpmconfigdir}/fileattrs/erlang.attr +%{rpmmacrosdir}/macros.erlang +%exclude %{_rpmconfigdir}/*.pyc +%exclude %{_rpmconfigdir}/*.pyo %changelog +* Thu Mar 10 2016 Peter Lemenkov <lemenkov@gmail.com> - 0.2.2-1 +- Ver. 0.2.2 + +* Mon Mar 7 2016 Peter Lemenkov <lemenkov@gmail.com> - 0.2.1-2 +- Allow skippind dependency checking in rebar + +* Sun Mar 6 2016 Peter Lemenkov <lemenkov@gmail.com> - 0.2.1-1 +- Ver. 0.2.1 + +* Tue Mar 1 2016 Peter Lemenkov <lemenkov@gmail.com> - 0.2.0-2 +- Added missing Requires + +* Tue Mar 1 2016 Peter Lemenkov <lemenkov@gmail.com> - 0.2.0-1 +- Ver. 0.2.0 + +* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + * Fri Jun 13 2014 Peter Lemenkov <lemenkov@gmail.com> - 0.1.4-1 - Ver. 0.1.4 - Dropped support for pre-4.11 rpms (EL7 or Fedora is required)
View file
erlang-rpm-macros-0.1.4.tar.gz/erlang-find-provides.sh
Deleted
@@ -1,126 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2009,2010 Peter Lemenkov <lemenkov@gmail.com> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -# This script reads filenames from STDIN and outputs any relevant provides -# information that needs to be included in the package. - -BUILDDIR= - -while true; do - case "$1" in - -b) BUILDDIR="$2"; shift 2;; - --) shift; break;; - *) echo "$0: option error at $1"; exit 1;; - esac -done - -filelist=`sed "s/'\"/\\\&/g"` - -/usr/lib/rpm/rpmdeps --provides $filelist - -# Get the list of *.app files -appfiles=$(echo $filelist | tr :blank: '\n' | grep -o -E '.*/ebin/.*\.app$') - -for f in $appfiles; do - app=`cat $f | tr -d :space: | awk -F '{application,' '{print $2}'|cut -d , -f 1` - ver=`cat $f | tr -d :space: | grep -o -E '\{vsn,\".*0-9\"\}' | sed -e "s,.vsn\,\",,g;s,\".*,,g"` - - # HiPE module is different from others - if "$app" == "hipe" ; - then - # Hardcoded minimal set of HiPE exported functions - echo "erlang(hipe_amd64_main:rtl_to_amd64/3)" - echo "erlang(hipe_arm_main:rtl_to_arm/3)" - echo "erlang(hipe:c/1)" - echo "erlang(hipe:compile/4)" - echo "erlang(hipe_data_pp:pp/4)" - echo "erlang(hipe_icode2rtl:translate/2)" - echo "erlang(hipe_icode_heap_test:cfg/1)" - echo "erlang(hipe_ppc_main:rtl_to_ppc/3)" - echo "erlang(hipe_rtl_arch:endianess/0)" - echo "erlang(hipe_rtl_arch:nr_of_return_regs/0)" - echo "erlang(hipe_rtl_arch:word_size/0)" - echo "erlang(hipe_rtl_cfg:init/1)" - echo "erlang(hipe_rtl_cfg:linearize/1)" - echo "erlang(hipe_rtl_cfg:pp/1)" - echo "erlang(hipe_rtl_cfg:remove_trivial_bbs/1)" - echo "erlang(hipe_rtl_cfg:remove_unreachable_code/1)" - echo "erlang(hipe_rtl_cleanup_const:cleanup/1)" - echo "erlang(hipe_rtl_lcm:rtl_lcm/2)" - echo "erlang(hipe_rtl_ssa_avail_expr:cfg/1)" - echo "erlang(hipe_rtl_ssa:check/1)" - echo "erlang(hipe_rtl_ssa_const_prop:propagate/1)" - echo "erlang(hipe_rtl_ssa:convert/1)" - echo "erlang(hipe_rtl_ssapre:rtl_ssapre/2)" - echo "erlang(hipe_rtl_ssa:remove_dead_code/1)" - echo "erlang(hipe_rtl_ssa:unconvert/1)" - echo "erlang(hipe_rtl_symbolic:expand/1)" - echo "erlang(hipe_sparc_main:rtl_to_sparc/3)" - echo "erlang(hipe_tagscheme:fixnum_val/1)" - echo "erlang(hipe_tagscheme:is_fixnum/1)" - echo "erlang(hipe_x86_main:rtl_to_x86/3)" - fi - - echo "erlang($app) = $ver" -done - -# Check for two special cases by inspecting path to ebin directory -basedirs=$(echo $filelist | tr :blank: '\n' | grep -o -E 'erlang\/lib\/a-zA-Z_0-9*-0-9.*\/ebin' | cut -d \/ -f 3 | sort | uniq) -for bd in $basedirs; do - basename=`echo $bd | cut -d \- -f 1` - basever=`echo $bd | cut -d \- -f 2` - case $basename in - "erts") - echo "erlang($basename) = $basever" - - # BIFs from erts - this module is very specific - cat $BUILDDIR/erts/emulator/*/erl_bif_list.h 2>/dev/null |\ - grep -v am__AtomAlias |\ - grep -o -E 'am_.*\,am_.*\,.\,' |\ - sed s,am_,,g |\ - sed -e "s,Plus,+,g;s,Minus,-,g;s,Neqeq,=\/=,g;s,Neq,\/=,g;s,Div,\/,g;s,Eqeq,=\:=,g;s,Eq,==,g;s,Ge,>=,g;s,Gt,>,g;s,Le,=<,g;s,Lt,<,g;s,Times,*,g;s,subtract,--,g;s,append\,,++\,,g" |\ - awk -F \, '{print "erlang(" $1 ":" $2 "/" $3 ")" }' - - # Add BIFs for HiPE - grep "bif " $BUILDDIR/erts/emulator/hipe/*.tab | awk -F "bif " '{print "erlang(" $2 ")"}' - - ERL_DRV_MAJOR=`grep "^#define ERL_DRV_EXTENDED_MAJOR_VERSION" erts/emulator/beam/erl_driver.h | cut -f 2` - ERL_DRV_MINOR=`grep "^#define ERL_DRV_EXTENDED_MINOR_VERSION" erts/emulator/beam/erl_driver.h | cut -f 2` - echo "erlang(erl_drv_version) = $ERL_DRV_MAJOR.$ERL_DRV_MINOR" - - ERL_NIF_MAJOR=`grep "^#define ERL_NIF_MAJOR_VERSION" erts/emulator/beam/erl_nif.h | cut -d " " -f 3` - ERL_NIF_MINOR=`grep "^#define ERL_NIF_MINOR_VERSION" erts/emulator/beam/erl_nif.h | cut -d " " -f 3` - echo "erlang(erl_nif_version) = $ERL_NIF_MAJOR.$ERL_NIF_MINOR" - ;; - "wx") - # wx module doesn't contain app-file. - echo "erlang($basename) = $basever" - ;; - *) - ;; - esac -done - -# Get the list of *.beam files -beamfiles=$(echo $filelist | tr :blank: '\n' | grep -o -E '.*/ebin/.*\.beam$') -/usr/lib/rpm/erlang-find-provides.escript $beamfiles | sed s,\',,g -
View file
erlang-rpm-macros-0.1.4.tar.gz/erlang-find-requires.sh
Deleted
@@ -1,46 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2009,2010 Peter Lemenkov <lemenkov@gmail.com> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -# This script reads filenames from STDIN and outputs any relevant requires -# information that needs to be included in the package. - -filelist=`sed "s/'\"/\\\&/g"` - -/usr/lib/rpm/rpmdeps --requires $filelist - -# Check for possible Port- and NIF-libraries -sofiles==$(echo $filelist | tr :blank: '\n' | grep -o -E '.*/priv/.*\.so$') -if "$sofiles" != "" -then - ERL_DRV_MAJOR=`grep "^#define ERL_DRV_EXTENDED_MAJOR_VERSION" /usr/lib*/erlang/usr/include/erl_driver.h | cut -f 2` - ERL_DRV_MINOR=`grep "^#define ERL_DRV_EXTENDED_MINOR_VERSION" /usr/lib*/erlang/usr/include/erl_driver.h | cut -f 2` - echo "erlang(erl_drv_version) = $ERL_DRV_MAJOR.$ERL_DRV_MINOR" - - ERL_NIF_MAJOR=`grep "^#define ERL_NIF_MAJOR_VERSION" /usr/lib*/erlang/usr/include/erl_nif.h | cut -d " " -f 3` - ERL_NIF_MINOR=`grep "^#define ERL_NIF_MINOR_VERSION" /usr/lib*/erlang/usr/include/erl_nif.h | cut -d " " -f 3` - echo "erlang(erl_nif_version) = $ERL_NIF_MAJOR.$ERL_NIF_MINOR" -fi - -# Get the list of built *.beam files -beamfiles=$(echo $filelist | tr :blank: '\n' | grep -o -E '.*/ebin/.*\.beam$') -/usr/lib/rpm/erlang-find-requires.escript $beamfiles | sort | uniq -
View file
erlang-rpm-macros-0.2.2.tar.gz/.gitignore
Added
@@ -0,0 +1,5 @@ +*.diff +*.orig +*.patch +*.rej +*~
View file
erlang-rpm-macros-0.2.2.tar.gz/erlang-find-provides.py
Added
@@ -0,0 +1,222 @@ +#!/usr/bin/python + +# Copyright (c) 2016 Peter Lemenkov <lemenkov@gmail.com> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +# This script reads filenames from STDIN and outputs any relevant provides +# information that needs to be included in the package. + +import getopt +import glob +import pybeam +import re +import sys + +BUILDDIR="" + +opts, args = getopt.getopt(sys.argv1:,"b:","builddir=") + +for opt, arg in opts: + if opt in ("-b", "--builddir"): + BUILDDIR=arg + +# All the files and directories from the package mentioned in erlang.attr as +# %__erlang_path +rawcontent = sys.stdin.readlines() + +# See $BUILDDIR/erts/emulator/*/erl_bif_list.h +ErtsBIFProvides = + "erlang(erlang:*/2)", + "erlang(erlang:++/2)", + "erlang(erlang:+/1)", + "erlang(erlang:+/2)", + "erlang(erlang:--/2)", + "erlang(erlang:-/1)", + "erlang(erlang:-/2)", + "erlang(erlang://2)", + "erlang(erlang:/=/2)", + "erlang(erlang:</2)", + "erlang(erlang:=/=/2)", + "erlang(erlang:=:=/2)", + "erlang(erlang:=</2)", + "erlang(erlang:==/2)", + "erlang(erlang:>/2)", + "erlang(erlang:>=/2)", + "erlang(erlang:and/2)", + "erlang(erlang:band/2)", + "erlang(erlang:bnot/1)", + "erlang(erlang:bor/2)", + "erlang(erlang:bsl/2)", + "erlang(erlang:bsr/2)", + "erlang(erlang:bxor/2)", + "erlang(erlang:div/2)", + "erlang(erlang:not/1)", + "erlang(erlang:or/2)", + "erlang(erlang:rem/2)", + "erlang(erlang:xor/2)" + +HipeBIFprovides = + "erlang(hipe_bifs:add_ref/2)", + "erlang(hipe_bifs:alloc_data/2)", + "erlang(hipe_bifs:array/2)", + "erlang(hipe_bifs:array_length/1)", + "erlang(hipe_bifs:array_sub/2)", + "erlang(hipe_bifs:array_update/3)", + "erlang(hipe_bifs:atom_to_word/1)", + "erlang(hipe_bifs:bif_address/3)", + "erlang(hipe_bifs:bitarray/2)", + "erlang(hipe_bifs:bitarray_sub/2)", + "erlang(hipe_bifs:bitarray_update/3)", + "erlang(hipe_bifs:bytearray/2)", + "erlang(hipe_bifs:bytearray_sub/2)", + "erlang(hipe_bifs:bytearray_update/3)", + "erlang(hipe_bifs:call_count_clear/1)", + "erlang(hipe_bifs:call_count_get/1)", + "erlang(hipe_bifs:call_count_off/1)", + "erlang(hipe_bifs:call_count_on/1)", + "erlang(hipe_bifs:check_crc/1)", + "erlang(hipe_bifs:code_size/1)", + "erlang(hipe_bifs:constants_size/0)", + "erlang(hipe_bifs:debug_native_called/2)", + "erlang(hipe_bifs:enter_code/2)", + "erlang(hipe_bifs:enter_sdesc/1)", + "erlang(hipe_bifs:find_na_or_make_stub/2)", + "erlang(hipe_bifs:fun_to_address/1)", + "erlang(hipe_bifs:gc_info/0)", + "erlang(hipe_bifs:gc_info_clear/0)", + "erlang(hipe_bifs:gc_timer/0)", + "erlang(hipe_bifs:gc_timer_clear/0)", + "erlang(hipe_bifs:get_fe/2)", + "erlang(hipe_bifs:get_hrvtime/0)", + "erlang(hipe_bifs:get_rts_param/1)", + "erlang(hipe_bifs:incremental_gc_info/0)", + "erlang(hipe_bifs:invalidate_funinfo_native_addresses/1)", + "erlang(hipe_bifs:in_native/0)", + "erlang(hipe_bifs:llvm_fix_pinned_regs/0)", + "erlang(hipe_bifs:mark_referred_from/1)", + "erlang(hipe_bifs:merge_term/1)", + "erlang(hipe_bifs:message_info/0)", + "erlang(hipe_bifs:message_info_clear/0)", + "erlang(hipe_bifs:message_sizes/0)", + "erlang(hipe_bifs:misc_timer/0)", + "erlang(hipe_bifs:misc_timer_clear/0)", + "erlang(hipe_bifs:modeswitch_debug_off/0)", + "erlang(hipe_bifs:modeswitch_debug_on/0)", + "erlang(hipe_bifs:nstack_used_size/0)", + "erlang(hipe_bifs:patch_call/3)", + "erlang(hipe_bifs:patch_insn/3)", + "erlang(hipe_bifs:pause_times/0)", + "erlang(hipe_bifs:primop_address/1)", + "erlang(hipe_bifs:process_info/0)", + "erlang(hipe_bifs:process_info_clear/0)", + "erlang(hipe_bifs:redirect_referred_from/1)", + "erlang(hipe_bifs:ref/1)", + "erlang(hipe_bifs:ref_get/1)", + "erlang(hipe_bifs:ref_set/2)", + "erlang(hipe_bifs:remove_refs_from/1)", + "erlang(hipe_bifs:send_timer/0)", + "erlang(hipe_bifs:send_timer_clear/0)", + "erlang(hipe_bifs:set_funinfo_native_address/3)", + "erlang(hipe_bifs:set_native_address/3)", + "erlang(hipe_bifs:set_native_address_in_fe/2)", + "erlang(hipe_bifs:shared_gc_info/0)", + "erlang(hipe_bifs:shared_gc_timer/0)", + "erlang(hipe_bifs:show_estack/1)", + "erlang(hipe_bifs:show_heap/1)", + "erlang(hipe_bifs:show_nstack/1)", + "erlang(hipe_bifs:show_pcb/1)", + "erlang(hipe_bifs:show_term/1)", + "erlang(hipe_bifs:stop_hrvtime/0)", + "erlang(hipe_bifs:system_crc/0)", + "erlang(hipe_bifs:system_timer/0)", + "erlang(hipe_bifs:system_timer_clear/0)", + "erlang(hipe_bifs:term_to_word/1)", + "erlang(hipe_bifs:trap_count_clear/0)", + "erlang(hipe_bifs:trap_count_get/0)", + "erlang(hipe_bifs:update_code_size/3)", + "erlang(hipe_bifs:write_u32/2)", + "erlang(hipe_bifs:write_u64/2)", + "erlang(hipe_bifs:write_u8/2)" + + +Provides = + +rawcontent = map(lambda x: x.rstrip('\n'), rawcontent) + +# Check for a specific cases +appmask = re.compile(".*/ebin/.*\.app") +# There should be only one app-file or none +for appfile in sorted(p for p in rawcontent if appmask.match(p)): + f = open(appfile, 'r') + appcontents = f.read() + f.close() + # module erlang-erts (Erlang VM) + if appcontents.split(",")1.lstrip().rstrip() == "erts": + # Export DRV version + f = open("%s/erts/emulator/beam/erl_nif.h" % BUILDDIR, 'r') + ERL_DRV_EXTENDED_MAJOR_VERSION = None + ERL_DRV_EXTENDED_MINOR_VERSION = None + for line in f: + ms = re.search("(?<=^#define\sERL_DRV_EXTENDED_MAJOR_VERSION\s)0-9+(?=$)", line) + if ms: + ERL_DRV_EXTENDED_MAJOR_VERSION = ms.group(0) + for line in f: + ms = re.search("(?<=^#define\sERL_DRV_EXTENDED_MINOR_VERSION\s)0-9+(?=$)", line) + if ms: + ERL_DRV_EXTENDED_MINOR_VERSION = ms.group(0) + # FIXME die here if ERL_DRV_EXTENDED_MAJOR_VERSION or ERL_DRV_EXTENDED_MINOR_VERSION is None + Provides += "erlang(erl_drv_version) = %s.%s" % (ERL_DRV_EXTENDED_MAJOR_VERSION, ERL_DRV_EXTENDED_MINOR_VERSION) + f.close() + + # Export NIF version + f = open("%s/erts/emulator/beam/erl_nif.h" % BUILDDIR, 'r') + ERL_NIF_MAJOR_VERSION = None + ERL_NIF_MINOR_VERSION = None + for line in f: + ms = re.search("(?<=^#define\sERL_NIF_MAJOR_VERSION\s)0-9+(?=$)", line) + if ms: + ERL_NIF_MAJOR_VERSION = ms.group(0) + for line in f: + ms = re.search("(?<=^#define\sERL_NIF_MINOR_VERSION\s)0-9+(?=$)", line) + if ms: + ERL_NIF_MINOR_VERSION = ms.group(0)
View file
erlang-rpm-macros-0.2.2.tar.gz/erlang-find-requires.py
Added
@@ -0,0 +1,245 @@ +#!/usr/bin/python + +# Copyright (c) 2016 Peter Lemenkov <lemenkov@gmail.com> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +# This script reads filenames from STDIN and outputs any relevant requires +# information that needs to be included in the package. + +import getopt +import glob +import pybeam +import re +import rpm +import sys + +# See $BUILDROOT/erts/emulator/*/erl_bif_list.h +# erlang:F/A +ErtsBIFProvides = + ("*", 2, 0), + ("++", 2, 0), + ("+", 1, 0), + ("+", 2, 0), + ("--", 2, 0), + ("-", 1, 0), + ("-", 2, 0), + ("/", 2, 0), + ("/=", 2, 0), + ("<", 2, 0), + ("=/=", 2, 0), + ("=:=", 2, 0), + ("=<", 2, 0), + ("==", 2, 0), + (">", 2, 0), + (">=", 2, 0), + ("and", 2, 0), + ("band", 2, 0), + ("bnot", 1, 0), + ("bor", 2, 0), + ("bsl", 2, 0), + ("bsr", 2, 0), + ("bxor", 2, 0), + ("div", 2, 0), + ("not", 1, 0), + ("or", 2, 0), + ("rem", 2, 0), + ("xor", 2, 0) + + +# See $BUILDROOT/erts/emulator/*/erl_bif_list.h +# hipe_bifs:F/A +HipeBIFSprovides = + ("add_ref", 2, 0), + ("alloc_data", 2, 0), + ("array", 2, 0), + ("array_length", 1, 0), + ("array_sub", 2, 0), + ("array_update", 3, 0), + ("atom_to_word", 1, 0), + ("bif_address", 3, 0), + ("bitarray", 2, 0), + ("bitarray_sub", 2, 0), + ("bitarray_update", 3, 0), + ("bytearray", 2, 0), + ("bytearray_sub", 2, 0), + ("bytearray_update", 3, 0), + ("call_count_clear", 1, 0), + ("call_count_get", 1, 0), + ("call_count_off", 1, 0), + ("call_count_on", 1, 0), + ("check_crc", 1, 0), + ("code_size", 1, 0), + ("constants_size", 0, 0), + ("debug_native_called", 2, 0), + ("enter_code", 2, 0), + ("enter_sdesc", 1, 0), + ("find_na_or_make_stub", 2, 0), + ("fun_to_address", 1, 0), + ("gc_info", 0, 0), + ("gc_info_clear", 0, 0), + ("gc_timer", 0, 0), + ("gc_timer_clear", 0, 0), + ("get_fe", 2, 0), + ("get_hrvtime", 0, 0), + ("get_rts_param", 1, 0), + ("incremental_gc_info", 0, 0), + ("invalidate_funinfo_native_addresses", 1, 0), + ("in_native", 0, 0), + ("llvm_fix_pinned_regs", 0, 0), + ("mark_referred_from", 1, 0), + ("merge_term", 1, 0), + ("message_info", 0, 0), + ("message_info_clear", 0, 0), + ("message_sizes", 0, 0), + ("misc_timer", 0, 0), + ("misc_timer_clear", 0, 0), + ("modeswitch_debug_off", 0, 0), + ("modeswitch_debug_on", 0, 0), + ("nstack_used_size", 0, 0), + ("patch_call", 3, 0), + ("patch_insn", 3, 0), + ("pause_times", 0, 0), + ("primop_address", 1, 0), + ("process_info", 0, 0), + ("process_info_clear", 0, 0), + ("redirect_referred_from", 1, 0), + ("ref", 1, 0), + ("ref_get", 1, 0), + ("ref_set", 2, 0), + ("remove_refs_from", 1, 0), + ("send_timer", 0, 0), + ("send_timer_clear", 0, 0), + ("set_funinfo_native_address", 3, 0), + ("set_native_address", 3, 0), + ("set_native_address_in_fe", 2, 0), + ("shared_gc_info", 0, 0), + ("shared_gc_timer", 0, 0), + ("show_estack", 1, 0), + ("show_heap", 1, 0), + ("show_nstack", 1, 0), + ("show_pcb", 1, 0), + ("show_term", 1, 0), + ("stop_hrvtime", 0, 0), + ("system_crc", 0, 0), + ("system_timer", 0, 0), + ("system_timer_clear", 0, 0), + ("term_to_word", 1, 0), + ("trap_count_clear", 0, 0), + ("trap_count_get", 0, 0), + ("update_code_size", 3, 0), + ("write_u32", 2, 0), + ("write_u64", 2, 0), + ("write_u8", 2, 0) + + +# sort + uniq +# see http://www.peterbe.com/plog/uniqifiers-benchmark +def sort_and_uniq(List): + return list(set(List)) + +def check_for_mfa(Path, Dict, (M, F, A)): + Provides = + Beams = glob.glob("%s/erlang/lib/*/ebin/%s.beam" % (Path, M)) + if Beams != : + Provides = Dict.get(Beams0) + if not Provides: + # Check if a module actually has required function + b = pybeam.BeamFile(Beams0) + # Two special cases: + # * eunit_test - add "erlang(eunit_test:nonexisting_function/0)" + # * wx - add "erlang(demo:start/0)" + Provides = b.exports + if M == "erlang": + Provides += ErtsBIFProvides + DictBeams0 = Provides + + for (F0, A0, Idx) in Provides: + if F0 == F and A0 == A: + # Always return first match + return Beams0 + + return None + +# We return more than one match since there could be situations where the same +# object belongs to more that one package. +def get_rpms_by_path(Path): + Packages = + ts = rpm.TransactionSet() + mi = ts.dbMatch('basenames', Path) + for h in mi: + Packages += hrpm.RPMTAG_NAME + + return Packages + +BUILDROOT="" +ISA="" +LIBDIR="" + +opts, args = getopt.getopt(sys.argv1:,"b:i:l:","builddir=", "isa=", "libdir=") + +for opt, arg in opts: + if opt in ("-b", "--builddir"): + BUILDROOT=arg
View file
erlang-rpm-macros-0.2.2.tar.gz/erlang.attr
Added
@@ -0,0 +1,5 @@ +# Disable Erlang provides until we decide how to store it effectively +#%__erlang_provides %{_rpmconfigdir}/erlang-find-provides.py -b %{_builddir}/%{buildsubdir} +%__erlang_requires %{_rpmconfigdir}/erlang-find-requires.py -b %{buildroot} -i %{?_isa} -l %{_libdir} +%__erlang_magic ^Erlang BEAM file$ +%__erlang_path ^/usr/lib(64)?/erlang/lib/.*/ebin/.*\\.(beam|app)$
View file
erlang-rpm-macros-0.1.4.tar.gz/macros.erlang -> erlang-rpm-macros-0.2.2.tar.gz/macros.erlang
Changed
@@ -3,15 +3,6 @@ %_erldir %{_libdir}/erlang %_erllibdir %{_erldir}/lib -%__erlang_provides %{_rpmconfigdir}/erlang-find-provides.sh -b %{_builddir}/%{buildsubdir} -- -%__erlang_requires %{_rpmconfigdir}/erlang-find-requires.sh - -%__erlang_provides_requires \ -%global _use_internal_dependency_generator 0\ -%global __find_provides %__erlang_provides\ -%global __find_requires %__erlang_requires\ -%{nil} - %__rebar /usr/bin/rebar %rebar_compile \ @@ -20,6 +11,105 @@ FFLAGS="${FFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FFLAGS ; \ FCFLAGS="${FCFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FCFLAGS ; \ %{?__global_ldflags:LDFLAGS="${LDFLAGS:-%__global_ldflags}" ; export LDFLAGS ;} \ - %__rebar compile -vv + VSN="%{version}" ; export VSN ; \ + IGNORE_MISSING_DEPS="TRUE" ; export IGNORE_MISSING_DEPS ; \ + %__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 ; \ + 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 ct skip_deps=true -vv %{-C:-C %{-C*}} \ +%{nil} + +%rebar_doc \ + if -f doc/overview.edoc ; then \ + %__rebar doc -vv \ + else \ + echo "No 'doc/overview.edoc' file was found, so docs aren't generated." \ + fi \ +%{nil} + +%rebar_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 eunit skip_deps=true -vv %{-C:-C %{-C*}} \ +%{nil} + +# +# More generic macros +# + +# Define any of these but not all at the same time +%__erlappname %{?realname}%{?srcname}%{?erlappname} + +#%__erlappname %(eval \ +# if "%{?realname}" != "" ; then \ +# echo -n "%{realname}" +# elif "%{?srcname}" != "" ; then \ +# echo -n "%{srcname}" \ +# else \ +# echo -n "%{erlappname}" \ +# fi \ +#) +# + +%erlang_ensure_app_src \ + if ! -f src/%{__erlappname}.app.src -a ! -f src/%{__erlappname}.app -a ! -f ebin/%{__erlappname}.app ; then \ + echo "{application, %{__erlappname}, {description, \\\"%{summary}\\\"}, {vsn, \\\"%{version}\\\"}, {modules, }}." > src/%{__erlappname}.app.src \ + else \ + echo "*.app file (or *.app.src template) was found." \ + fi \ +%{nil} + +%erlang_compile \ + %erlang_ensure_app_src \ + %rebar_compile \ + %rebar_doc + +%erlang_test(C:) \ + %rebar_eunit %{-C:-C %{-C*}} \ + %rebar_ct %{-C:-C %{-C*}} + +%erlang_install \ +if "%{__erlappname}" != "" ; then \ + %{__mkdir} -p %{buildroot}%{_erllibdir}/%{__erlappname}-%{version}/ \ + %{__mkdir} -p %{buildroot}%{_erllibdir}/%{__erlappname}-%{version}/ebin/ \ + if -f ebin/%{__erlappname}.app ; then \ + %{__install} -m 0644 -p ebin/%{__erlappname}.app %{buildroot}%{_erllibdir}/%{__erlappname}-%{version}/ebin/ \ + fi \ + %{__install} -m 0644 -p 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} + +%erlang_appdir %{_erllibdir}/%{__erlappname}-%{version} +%_erlang_appdir %erlang_appdir + +%__erlang_nif_version %(eval \ + rpm -q erlang-erts --provides | grep --color=no erl_nif_version \ +) + +%__erlang_drv_version %(eval \ + rpm -q erlang-erts --provides | grep --color=no erl_drv_version \ +)
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
.