<commit_before>SUMMARY = "netcf"
DESCRIPTION = "netcf is a cross-platform network configuration library."
HOMEPAGE = "https://fedorahosted.org/netcf/"
SECTION = "libs"
LICENSE = "LGPLv2.1"

LIC_FILES_CHKSUM = "file://COPYING;md5=bbb461211a33b134d42ed5ee802b37ff"

SRCREV = "9158278ad35b46ce9a49b2e887483c6d8c287994"
PV = "0.2.8+git${SRCPV}"

SRC_URI = "git://git.fedorahosted.org/netcf.git;protocol=git \
"

DEPENDS += "augeas libnl libxslt libxml2 gnulib"

S = "${WORKDIR}/git"

inherit gettext autotools pkgconfig systemd

EXTRA_OECONF_append_class-target = " --with-driver=redhat"

PACKAGECONFIG ??= "${<EMAIL>.contains("DISTRO_FEATURES", "systemd", "systemd", "", d)}"
PACKAGECONFIG[systemd] = "--with-sysinit=systemd,--with-sysinit=initscripts,"

do_configure_prepend() {
    currdir=`pwd`
    cd ${S}

    # avoid bootstrap cloning gnulib on every configure
    # the rmdir acts as a sentinel to let us know if the pkg ever changes
    # the path for GNUlib or populates the dir making it non-empty.
    rmdir ${S}/.gnulib
    cp -rf ${STAGING_DATADIR}/gnulib ${S}/.gnulib

    # --force to avoid errors on reconfigure e.g if recipes changed we depend on
    # | bootstrap: running: libtoolize --quiet
    # | libtoolize:   error: 'libltdl/COPYING.LIB' exists: use '--force' to overwrite
    # | ...
    ./bootstrap --force --no-git --gnulib-srcdir=.gnulib

    cd $currdir
}

do_install_append() {
    if ${<EMAIL>('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
       install -d ${D}${systemd_unitdir}/system
       if [ -d "${D}${libdir}/systemd/system" ]; then
           mv ${D}${libdir}/systemd/system/* ${D}${systemd_unitdir}/system/
           rm -rf ${D}${libdir}/systemd/
       else
           mv ${D}${nonarch_libdir}/systemd/system/* ${D}${systemd_unitdir}/system/
           rm -rf ${D}${nonarch_libdir}/systemd/
       fi
    else
       mv ${D}${sysconfdir}/rc.d/init.d/ ${D}${sysconfdir}
       rm -rf ${D}${sysconfdir}/rc.d/
    fi
}

FILES_${PN} += " \<commit_msg>netcf: unconditionally remove gnulib dir to support reconfigure<commit_after>SUMMARY = "netcf"
DESCRIPTION = "netcf is a cross-platform network configuration library."
HOMEPAGE = "https://fedorahosted.org/netcf/"
SECTION = "libs"
LICENSE = "LGPLv2.1"

LIC_FILES_CHKSUM = "file://COPYING;md5=bbb461211a33b134d42ed5ee802b37ff"

SRCREV = "9158278ad35b46ce9a49b2e887483c6d8c287994"
PV = "0.2.8+git${SRCPV}"

SRC_URI = "git://git.fedorahosted.org/netcf.git;protocol=git \
"

DEPENDS += "augeas libnl libxslt libxml2 gnulib"

S = "${WORKDIR}/git"

inherit gettext autotools pkgconfig systemd

EXTRA_OECONF_append_class-target = " --with-driver=redhat"

PACKAGECONFIG ??= "${<EMAIL>.contains("DISTRO_FEATURES", "systemd", "systemd", "", d)}"
PACKAGECONFIG[systemd] = "--with-sysinit=systemd,--with-sysinit=initscripts,"

do_configure_prepend() {
    currdir=`pwd`
    cd ${S}

    # avoid bootstrap cloning gnulib on every configure
    # the dir starts out empty from the pkg, but unconditionally blow it
    # away so if we reconfigure due to gnulib sysroot sig changes, we will
    # get the newer gnulib content into the build here.
    rm -rf ${S}/.gnulib
    cp -rf ${STAGING_DATADIR}/gnulib ${S}/.gnulib

    # --force to avoid errors on reconfigure e.g if recipes changed we depend on
    # | bootstrap: running: libtoolize --quiet
    # | libtoolize:   error: 'libltdl/COPYING.LIB' exists: use '--force' to overwrite
    # | ...
    ./bootstrap --force --no-git --gnulib-srcdir=.gnulib

    cd $currdir
}

do_install_append() {
    if ${<EMAIL>.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
       install -d ${D}${systemd_unitdir}/system
       if [ -d "${D}${libdir}/systemd/system" ]; then
           mv ${D}${libdir}/systemd/system/* ${D}${systemd_unitdir}/system/
           rm -rf ${D}${libdir}/systemd/
       else
           mv ${D}${nonarch_libdir}/systemd/system/* ${D}${systemd_unitdir}/system/
           rm -rf ${D}${nonarch_libdir}/systemd/
       fi
    else
       mv ${D}${sysconfdir}/rc.d/init.d/ ${D}${sysconfdir}
       rm -rf ${D}${sysconfdir}/rc.d/
    fi
}

FILES_${PN} += " \
{'fraction_non_alphanumeric': 0.15849514563106795, 'fraction_numerical': 0.02669902912621359, 'mean_word_length': 3.426423200859291, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '7243351', 'n_tokens_mistral': 1638, 'n_tokens_neox': 1555, 'n_words': 332}