Bitbake specifying a dependency on a variable so that when the variable changes a task runs

I am using DEY (digi embedded yocto) to produce an linux image. I have been playing around with the networkwork manager recipe so that I can inject multiple IP addresses into ethernet config files in the image via local.conf.

In a bbappend file I have this code to get variables from the local.conf file using d.getVar. The logic in the code is not important, just know that I am using getvar to get a variable from local.conf

#
# NetworkManager only accepts IP addresses in CIDR format
#
def ipaddr_to_cidr(iface, d):
    ipaddr = d.getVar('%s_STATIC_IP' % iface.upper(), True)
    netmask = d.getVar('%s_STATIC_NETMASK' % iface.upper(), True)
    if ipaddr is None or netmask is None:
        return "NONE"

    binary_str = ''
    for byte in netmask.split('.'):
        binary_str += bin(int(byte))[2:].zfill(8)
    return ipaddr + '/' + str(len(binary_str.rstrip('0')))

ETH0_STATIC_CIDR = "${@ipaddr_to_cidr('eth0', d)}"
ETH1_STATIC_CIDR = "${@ipaddr_to_cidr('eth1', d)}"
WLAN0_STATIC_CIDR = "${@ipaddr_to_cidr('wlan0', d)}"

ETH0_0_STATIC_CIDR = "${@ipaddr_to_cidr('eth0_0', d)}"
ETH0_1_STATIC_CIDR = "${@ipaddr_to_cidr('eth0_1', d)}"
ETH0_2_STATIC_CIDR = "${@ipaddr_to_cidr('eth0_2', d)}"
ETH0_3_STATIC_CIDR = "${@ipaddr_to_cidr('eth0_3', d)}"

ETH1_0_STATIC_CIDR = "${@ipaddr_to_cidr('eth1_0', d)}"
ETH1_1_STATIC_CIDR = "${@ipaddr_to_cidr('eth1_1', d)}"
ETH1_2_STATIC_CIDR = "${@ipaddr_to_cidr('eth1_2', d)}"
ETH1_3_STATIC_CIDR = "${@ipaddr_to_cidr('eth1_3', d)}"

The variables listed are then used to modify the ethernet config file on the resulting image. The code modifying the resulting image is in a task in the same append file:

do_install:append() {
    install -d ${D}${sysconfdir}/init.d ${D}${sysconfdir}/NetworkManager
    install -m 0644 ${WORKDIR}/NetworkManager.conf ${D}${sysconfdir}/NetworkManager/
    install -m 0755 ${WORKDIR}/networkmanager-init ${D}${sysconfdir}/init.d/networkmanager

    #
    # Customize NetworkManager
    #
    sed -i -e "s,##UNMANAGED_DEVICES##,${UNMANAGED_DEVICES},g" ${D}${sysconfdir}/NetworkManager/NetworkManager.conf

    #
    # Connections config files
    #
    install -d ${D}${sysconfdir}/NetworkManager/system-connections/

    # Ethernet
    install -m 0600 ${WORKDIR}/nm.eth0.${ETH0_MODE} ${D}${sysconfdir}/NetworkManager/system-connections/nm.eth0

    if [ "${ETH0_0_STATIC_CIDR}" = "NONE" ]; then
        sed -i "s/eth0_0//" ${D}${sysconfdir}/NetworkManager/system-connections/nm.eth0
    else
        sed -i "s/eth0_0/address1=${ETH0_0_STATIC_CIDR}n/" ${D}${sysconfdir}/NetworkManager/system-connections/nm.eth0
    fi
    if [ "${ETH0_1_STATIC_CIDR}" = "NONE" ]; then
        sed -i "s/eth0_1//" ${D}${sysconfdir}/NetworkManager/system-connections/nm.eth0
    else
        sed -i "s/eth0_1/address2=${ETH0_1_STATIC_CIDR}n/" ${D}${sysconfdir}/NetworkManager/system-connections/nm.eth0
    fi
    if [ "${ETH0_2_STATIC_CIDR}" = "NONE" ]; then
        sed -i "s/eth0_2//" ${D}${sysconfdir}/NetworkManager/system-connections/nm.eth0
    else
        sed -i "s/eth0_2/address3=${ETH0_2_STATIC_CIDR}n/" ${D}${sysconfdir}/NetworkManager/system-connections/nm.eth0
    fi
    if [ "${ETH0_3_STATIC_CIDR}" = "NONE" ]; then
        sed -i "s/eth0_3//" ${D}${sysconfdir}/NetworkManager/system-connections/nm.eth0
    else
        sed -i "s/eth0_3/address4=${ETH0_3_STATIC_CIDR}n/" ${D}${sysconfdir}/NetworkManager/system-connections/nm.eth0
    fi

The idea behind this is that you can just set variables in the local.conf file so that the configuration is all in one place. However, I notice that when I modify local.conf and add the ETH## variables, the python function and the task are not being ran. I would like to somehow specify a dependency saying that when the ETH# variables are modified/added, rerun the task (similar to how makefiles will remake when files are modified), but I don’t know how to set a dependency based on a variable.

I tried looking up bitbake documentation on dependencies, but all I could find was specifying dependencies between two tasks, and I couldn’t find anything on specifying a dependency on a variable

New contributor

Alec You is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật