<commit_before>%% Copyright
-module(ebt_task_rpm_depends).
-author("<NAME> <<EMAIL>>").

-compile({parse_transform, do}).

-behaviour(ebt_task).

%% API
-export([perform/3]).

perform(Target, _Dir, Config) ->
    do([error_m ||
        ebt_task_rpm:prepare_environment(Config),
        LibDir <- ebt_config:find_value(Target, Config, dir),
        Libs <- return(filelib:wildcard(LibDir ++ "/*")),
        ebt_xl_lists:eforeach(fun(Lib) -> build_rpm(Config, Lib) end, Libs)
    ]).

build_rpm(Config, Lib) ->
    do([error_m ||
        RPMBuildDir <- ebt_config:outdir(rpmbuild, Config),
        SpecTemplate <- ebt_xl_file:read_file(Lib ++ "/.ebt-info/rpm.spec"),
        SpecFile <- ebt_task_rpm:spec_file(Config, filename:basename(Lib)),
        ebt_xl_file:write_file(SpecFile, iolist_to_binary([
            "#Spec generated by Erlang Build Tool\n\n",
            "%define _topdir " ++ RPMBuildDir ++ "\n",
            "%define _builddir " ++ Lib ++ "\n",
            SpecTemplate
        ])),
        ebt_task_rpm:rpmbuild(SpecFile)
    ]).<commit_msg>- absname in libdir<commit_after>%% Copyright
-module(ebt_task_rpm_depends).
-author("<NAME> <<EMAIL>>").

-compile({parse_transform, do}).

-behaviour(ebt_task).

%% API
-export([perform/3]).

perform(Target, _Dir, Config) ->
    do([error_m ||
        ebt_task_rpm:prepare_environment(Config),
        LibDir <- ebt_config:find_value(Target, Config, dir),
        Libs <- return(filelib:wildcard(LibDir ++ "/*")),
        ebt_xl_lists:eforeach(fun(Lib) -> build_rpm(Config, filename:absname(Lib)) end, Libs)
    ]).

build_rpm(Config, Lib) ->
    do([error_m ||
        RPMBuildDir <- ebt_config:outdir(rpmbuild, Config),
        SpecTemplate <- ebt_xl_file:read_file(Lib ++ "/.ebt-info/rpm.spec"),
        SpecFile <- ebt_task_rpm:spec_file(Config, filename:basename(Lib)),
        ebt_xl_file:write_file(SpecFile, iolist_to_binary([
            "#Spec generated by Erlang Build Tool\n\n",
            "%define _topdir " ++ RPMBuildDir ++ "\n",
            "%define _builddir " ++ Lib ++ "\n",
            SpecTemplate
        ])),
        ebt_task_rpm:rpmbuild(SpecFile)
    ]).
{'fraction_non_alphanumeric': 0.16542056074766356, 'fraction_numerical': 0.0009345794392523365, 'mean_word_length': 3.109404990403071, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5427620', 'n_tokens_mistral': 783, 'n_tokens_neox': 751, 'n_words': 115}