Skip to content
Snippets Groups Projects
Select Git revision
  • 9e23534ec365158768bb68699724b9ed559d1331
  • experimental default protected
  • v2023.2.5-ffs
  • nrb/ex400-remove-wps
  • nrb/airmax-test
  • v2023.2.4-ffs
  • nrb/ar9344-reset-sequence
  • autinerd/experimental-openwrt-24.10
  • v2023.2.3-ffs
  • v2023.2.2-ffs
  • v2023.2-ffs
  • v2023.1-ffs
  • v2022.1.4-ffs
  • feature/addMikrotikwAP
  • v2022.1.3-ffs
  • v2021.1.2-ffs
  • v2022.1.1-ffs
  • master protected
  • v2021.1.1-ffs
  • nrb/gluon-master-cpe510
  • v2021.1-ffs
  • experimental-2025-07-04
  • experimental-2025-07-04-base
  • experimental-2025-07-01
  • experimental-2025-07-01-base
  • experimental-2025-06-25
  • experimental-2025-06-25-base
  • experimental-2025-06-24
  • experimental-2025-06-24-base
  • experimental-2025-06-22
  • experimental-2025-06-22-base
  • v2023.2.5-ffs0.1
  • experimental-2025-06-08
  • experimental-2025-06-08-base
  • experimental-2025-06-06
  • experimental-2025-06-06-base
  • experimental-2025-05-27
  • experimental-2025-05-27-base
  • experimental-2025-05-18
  • experimental-2025-05-18-base
  • experimental-2025-05-15
41 results

target_config_lib.lua

Blame
    • Matthias Schiffer's avatar
      9e23534e
      build: rework config generation · 9e23534e
      Matthias Schiffer authored
      So far, we were using a sort operation on the generated .config to
      implement precedence of =y packages over =m, and =m over unset.
      Unfortunately, this sort not only used for packages, but for all config
      lines. This made it impossible to override settings from targets/generic
      in a target config when the new setting was sorted before the generic
      setting.
      
      To fix this, track configurations by their keys, so we can properly
      override config keys that were set before. Value-based precedence is
      only preserved for package configuration.
      
      The config() and try_config() calls always take key and value as
      separate arguments now. Strings are quoted automatically; the values
      true, nil and false map to y, m and unset for tristate options. config()
      can take an optional third argument to override the error message to
      display when the setting fails to apply.
      
      All existing target configs generate the same .config with the old and the
      new code. The new code is also a bit faster on targets with many devices.
      build: rework config generation
      Matthias Schiffer authored
      So far, we were using a sort operation on the generated .config to
      implement precedence of =y packages over =m, and =m over unset.
      Unfortunately, this sort not only used for packages, but for all config
      lines. This made it impossible to override settings from targets/generic
      in a target config when the new setting was sorted before the generic
      setting.
      
      To fix this, track configurations by their keys, so we can properly
      override config keys that were set before. Value-based precedence is
      only preserved for package configuration.
      
      The config() and try_config() calls always take key and value as
      separate arguments now. Strings are quoted automatically; the values
      true, nil and false map to y, m and unset for tristate options. config()
      can take an optional third argument to override the error message to
      display when the setting fails to apply.
      
      All existing target configs generate the same .config with the old and the
      new code. The new code is also a bit faster on targets with many devices.
    update-modules.sh 1.95 KiB
    #!/usr/bin/env bash
    # shellcheck enable=check-unassigned-uppercase
    
    set -eo pipefail
    
    # move to basedir, in case the script is not executed via `make update-modules`
    cd "$(dirname "$0")/.." || exit 1
    
    # shellcheck source=./modules
    source ./modules
    
    git diff --quiet ./modules || {
    	1>&2 echo "Your modules file is dirty, aborting."
    	exit 1
    }
    
    LOCAL_BRANCH=$(git branch --show-current)
    [[ $LOCAL_BRANCH != *-updates ]] && LOCAL_BRANCH+=-updates
    
    for MODULE in "OPENWRT" ${GLUON_FEEDS}; do
    	if [[ $MODULE != "OPENWRT" ]]; then
    		MODULE=PACKAGES_${MODULE^^}
    	fi
    
    	_REMOTE_URL=${MODULE}_REPO
    	_REMOTE_BRANCH=${MODULE}_BRANCH
    	_LOCAL_HEAD=${MODULE}_COMMIT
    
    	REMOTE_URL="${!_REMOTE_URL}"
    	REMOTE_BRANCH="${!_REMOTE_BRANCH}"
    	LOCAL_HEAD="${!_LOCAL_HEAD}"
    
    	# get default branch name if none is set
    	[ -z "${REMOTE_BRANCH}" ] && {
    		REMOTE_BRANCH=$(git ls-remote --symref "${REMOTE_URL}" HEAD | awk '/^ref:/ { sub(/refs\/heads\//, "", $2); print $2 }')
    	}
    
    	# fetch the commit id for the HEAD of the module
    	REMOTE_HEAD=$(git ls-remote "${REMOTE_URL}" "${REMOTE_BRANCH}" | awk '{ print $1 }')
    
    	# skip ahead if the commit id did not change
    	[ "$LOCAL_HEAD" == "$REMOTE_HEAD" ] && continue 1
    
    	# switch to local working branch, if we found changes
    	[ "$(git branch --show-current)" != "${LOCAL_BRANCH}" ] && {
    		git switch -c "${LOCAL_BRANCH}" || git switch "${LOCAL_BRANCH}"
    	}
    
    	CHECKOUT=$(mktemp -d)
    
    	# clone the target branch
    	git clone --bare "${REMOTE_URL}" --branch="${REMOTE_BRANCH}" "${CHECKOUT}"
    
    	# prepare the commit message
    	# shellcheck disable=SC2001
    	MODULE=$(echo "${MODULE,,}" | sed 's/packages_//')
    	TITLE="modules: update ${MODULE}"
    	MESSAGE="$(mktemp)"
    	{
    		echo "${TITLE}"
    		printf '\n\n'
    		git -C "${CHECKOUT}" log --oneline --no-decorate --no-merges "${LOCAL_HEAD}..${REMOTE_HEAD}" | cat
    	} > "$MESSAGE"
    
    	# modify modules file
    	sed -i "s/${LOCAL_HEAD}/${REMOTE_HEAD}/" ./modules
    	git add ./modules
    
    	git commit -F "${MESSAGE}"
    
    	# remove the checkout
    	rm -fr "${CHECKOUT}"
    done