From a0f533460bcb41a04d592345303348575f2e23e2 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Sun, 11 Apr 2010 02:14:56 +0200 Subject: auto-generate package/Config.in The algorithm in package/pkgmaker works as follows: 1) for all package/*/Makefile a) parse PKG_NAME and PKG_SECTION b) skip if PKG_SECTION is 'kernel' (special ones) c) check if Config.in{,.lib,.manual} contain something d) fetch the first word of the first prompt from any result from c) e) fetch the verbose section name from package/SECTIONS.list based on PKG_SECTION, or just 'libs' if it's about Config.in.lib f) write results to package/package_section_list, in the form: ' ' 2) sort package/package_section_list first by , next by 3) create package/Config.in.auto using the result from 2) --- package/pkgmaker | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-) (limited to 'package/pkgmaker') diff --git a/package/pkgmaker b/package/pkgmaker index ea89424e7..bb91dbe37 100644 --- a/package/pkgmaker +++ b/package/pkgmaker @@ -71,7 +71,7 @@ for dn in */Makefile; do typeset -u dnu=${dn//-/_} dnu=${dnu//+/X} - ( # fd 4 = Config.in; fd 5 = Config.in.lib + ( # fd 4 = Config.in; fd 5 = Config.in.lib; fd 6 = Config.in.kmod g5=0 # Handle master package (directory) @@ -264,3 +264,79 @@ EOF ) 4>Config.in 5>Config.in.lib 6>Config.in.kmod cd .. done + +# return good if given file exists and is non-empty +function non_empty_file() { + [[ -f "$1" ]] || return 1 + [[ -n "$(cat "$1")" ]] || return 1 + return 0 +} + +# print the verbose section name for a given section tag +function lookup_section_string() { + str="$(grep ^$1\ SECTIONS.list | cut -d ' ' -f '2-')" + [[ -n $str ]] && { echo $str; return; } + echo $1 +} + +# print the first prompt's first word's value in a given Config.in file +function get_first_prompt() { + prompt="$(grep -m 1 "prompt " $1 | sed -n 's/.*"\([^ \.]*\)[ \.].*"/\1/p')" + [[ -n $prompt ]] && echo $prompt +} + +# collect packages along with their section and +# create a list of '
' for later sorting +rm -f package_section_list +for dn in */Makefile; do + dn=${dn%/*} + pbar="Pass 3: $dn ..." + print -nu2 "$pbar\r" + + cd $dn + eval $($GMAKE dump="PKG_NAME PKG_SECTION") + cd .. + + # ignore section kernel, these are included inside target/config + [[ $PKG_SECTION = kernel ]] && continue + + PKG_SECTION=${PKG_SECTION:-none} + + has_config_in=false + if non_empty_file $dn/Config.in; then + prompt="$(get_first_prompt $dn/Config.in)" + prompt="${prompt:-$PKG_NAME}" + echo "$prompt $dn/Config.in $(lookup_section_string $PKG_SECTION)" + has_config_in=true + fi + if non_empty_file $dn/Config.in.lib; then + prompt="$(get_first_prompt $dn/Config.in.lib)" + prompt="${prompt:-$PKG_NAME}" + echo "$prompt $dn/Config.in.lib $(lookup_section_string libs)" + has_config_in=true + fi + if non_empty_file $dn/Config.in.manual; then + prompt="$(get_first_prompt $dn/Config.in.manual)" + prompt="${prompt:-$PKG_NAME}" + echo "$prompt $dn/Config.in.manual $(lookup_section_string $PKG_SECTION)" + has_config_in=true + fi + $has_config_in || print -u2 "$dn: No Config.in file found?!" +done >package_section_list + +# create the Config.in.auto from the sorted list from above +cursec="" +sort -k 3 -k 1 -f package_section_list | while read name file section; do + pbar="Pass 4: $name ..." + print -nu2 "$pbar\r" + + if [[ $cursec != $section ]]; then + [[ -n $cursec ]] && print "endmenu\n" + + print "menu \"$section\"" + cursec="$section" + fi + print "source \"package/$file\"" +done >Config.in.auto +print "endmenu\n" >>Config.in.auto +rm -f package_section_list -- cgit v1.2.3 From 2c5f2d9b3b3b26ecf783f30112fc6019c1c17167 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Sat, 12 Jun 2010 17:35:44 +0200 Subject: massive rewrite of the pkgmaker logic When adjusting for auto-generated package/Config.in, I found out that the splitting into Config.in{,.lib,.kmod} done by pkgmaker was rather subversive to my approach. Categorisation of packages and subpackages should be done via package section, which is enabled by this patch for subpackages, too. Instead of filling up the package subdirectories, use a common directory package/pkgconfigs.d/ to contain all auto-generated Config.in files. In order to allow simple assumption from config symbol to actual package from within menuconfig (the path to the Config.in file containing the current config symbol is printed as part of the help text), put all generated Config.in files for a certain package into a common subdirectory. pkgmaker now saves each generated config symbol (excluding the flavours) into it's own file, therefore allowing to sort subpackages of a package into a different section. --- package/pkgmaker | 81 +++++++++++++++++++------------------------------------- 1 file changed, 27 insertions(+), 54 deletions(-) (limited to 'package/pkgmaker') diff --git a/package/pkgmaker b/package/pkgmaker index bb91dbe37..5a4707937 100644 --- a/package/pkgmaker +++ b/package/pkgmaker @@ -40,12 +40,14 @@ for dn in */Makefile; do done # build Config.in files and resolve dependencies +rm -f package_sections +rm -rf pkgconfigs.d +mkdir pkgconfigs.d for dn in */Makefile; do dn=${dn%/*} - # skip if we take care of this one manually - [[ $dn != "base-files" ]] && [[ -s $dn/Config.in.manual ]] && continue pbar="Pass 2: $dn ..." print -nu2 "$pbar\r" + mkdir pkgconfigs.d/$dn cd $dn # PKG_NAME: package name (directory, free-format) @@ -61,9 +63,9 @@ for dn in */Makefile; do # CFLINE_*: one free-format Config.in line per subpackage option # PKGFD_*: flavour description, per package flavour option # PKG_{HOST,TARGET}_DEPENDS: add host or target dependencies - eval $($GMAKE dump="PKG_NAME PKG_FLAVOURS PKG_DESCR PKG_URL PKG_MULTI PKG_CXX \ + eval $($GMAKE dump="PKG_NAME PKG_FLAVOURS PKG_DESCR PKG_SECTION PKG_URL PKG_MULTI PKG_CXX \ ALL_PKGOPTS \$(foreach x,\${ALL_PKGOPTS},PKGNAME_\${x} \ - PKGDESC_\${x} PKGDEPS_\${x} PKGDFLT_\${x} CFLINE_\${x}) \ + PKGDESC_\${x} PKGDEPS_\${x} PKGDFLT_\${x} PKGSECT_\${x} CFLINE_\${x}) \ \$(foreach x,\${PKG_FLAVOURS},PKGFD_\${x}) \ PKG_HOST_DEPENDS PKG_TARGET_DEPENDS") @@ -71,8 +73,13 @@ for dn in */Makefile; do typeset -u dnu=${dn//-/_} dnu=${dnu//+/X} - ( # fd 4 = Config.in; fd 5 = Config.in.lib; fd 6 = Config.in.kmod - g5=0 + echo "pkgconfigs.d/$dn/Config.in ${PKG_SECTION:=none}" >>../package_sections + echo "$dn/Config.in.manual ${PKG_SECTION:=none}" >>../package_sections + + # skip if we take care of this one manually + [[ $dn != "base-files" ]] && [[ -s Config.in.manual ]] && { cd ..; continue; } + + exec 4>../pkgconfigs.d/$dn/Config.in # Handle master package (directory) print -u4 "config ADK_COMPILE_$dnu" @@ -165,20 +172,15 @@ for dn in */Makefile; do eval sppn=\$PKGNAME_$spcu # sppn: subpackage (ipkg) name eval desc=\$PKGDESC_$spcu # desc: subpackage description : ${desc:=$PKG_DESCR} # take from main pkg if empty + eval sect=\$PKGSECT_$spcu # sect: subpackage section + : ${sect:=$PKG_SECTION} # take from main pkg if empty eval deps=\$PKGDEPS_$spcu # deps: subpackage dependencies eval dflt=\$PKGDFLT_$spcu # dflt: config 'default' opt. eval xline=\$CFLINE_$spcu # xline: one free-format line - if [[ $spcu = LIB* ]]; then - h=5 # divert to Config.in.lib - (( g5++ )) && print -u5 # been here before - elif [[ $spcu = KMOD* ]]; then - h=6 - (( g6++ )) && print -u6 - else - h=4 # divert to Config.in - print -u4 - fi + echo "pkgconfigs.d/$dn/Config.in.$sppn $sect" >>../package_sections + exec 4>../pkgconfigs.d/$dn/Config.in.$sppn + h=4 print -u$h config ADK_PACKAGE_$spcu spnf=$sppn # spnf: subpackage name, filled @@ -261,7 +263,6 @@ EOF print "\t flavour ADK_PACKAGE_${dnu}_$pfcu for $PKG_NAME" done >&4 - ) 4>Config.in 5>Config.in.lib 6>Config.in.kmod cd .. done @@ -285,44 +286,16 @@ function get_first_prompt() { [[ -n $prompt ]] && echo $prompt } -# collect packages along with their section and -# create a list of '
' for later sorting -rm -f package_section_list -for dn in */Makefile; do - dn=${dn%/*} - pbar="Pass 3: $dn ..." +# prepare Config.in list for sorting +while read config_in section; do + pbar="Pass 3: $config_in ..." print -nu2 "$pbar\r" - cd $dn - eval $($GMAKE dump="PKG_NAME PKG_SECTION") - cd .. - - # ignore section kernel, these are included inside target/config - [[ $PKG_SECTION = kernel ]] && continue - - PKG_SECTION=${PKG_SECTION:-none} - - has_config_in=false - if non_empty_file $dn/Config.in; then - prompt="$(get_first_prompt $dn/Config.in)" - prompt="${prompt:-$PKG_NAME}" - echo "$prompt $dn/Config.in $(lookup_section_string $PKG_SECTION)" - has_config_in=true - fi - if non_empty_file $dn/Config.in.lib; then - prompt="$(get_first_prompt $dn/Config.in.lib)" - prompt="${prompt:-$PKG_NAME}" - echo "$prompt $dn/Config.in.lib $(lookup_section_string libs)" - has_config_in=true - fi - if non_empty_file $dn/Config.in.manual; then - prompt="$(get_first_prompt $dn/Config.in.manual)" - prompt="${prompt:-$PKG_NAME}" - echo "$prompt $dn/Config.in.manual $(lookup_section_string $PKG_SECTION)" - has_config_in=true - fi - $has_config_in || print -u2 "$dn: No Config.in file found?!" -done >package_section_list + non_empty_file $config_in || continue + prompt="$(get_first_prompt $config_in)" + [[ -n $prompt ]] || continue + echo "$prompt $config_in $(lookup_section_string $section)" +done package_section_list # create the Config.in.auto from the sorted list from above cursec="" @@ -339,4 +312,4 @@ sort -k 3 -k 1 -f package_section_list | while read name file section; do print "source \"package/$file\"" done >Config.in.auto print "endmenu\n" >>Config.in.auto -rm -f package_section_list +rm -f package_sections package_section_list -- cgit v1.2.3 From 18d98330bdc4891b4a04de2492e6542f601cdc3c Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Sat, 19 Jun 2010 15:54:54 +0200 Subject: pkgmaker: warn on unreachable dependency This is what actually should have happened whenever you saw 'cannot open $() input' error message, which was quite useless when it comes to tracking the source of the error down. --- package/pkgmaker | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'package/pkgmaker') diff --git a/package/pkgmaker b/package/pkgmaker index 4cf2181ef..677a44d08 100644 --- a/package/pkgmaker +++ b/package/pkgmaker @@ -216,6 +216,10 @@ for dn in */Makefile; do (*) # produce dependency on regular package # where the symbol is cached (see above) + if [[ ! -f ../pkglist.d/"$dep" ]]; then + print -u2 "Warning: $PKG_NAME: unreachable dependency '$dep'" + continue + fi print -u$h '\tselect' \ ADK_PACKAGE_$(<../pkglist.d/"$dep") ;; -- cgit v1.2.3 From 47e110abbf0d3142d737e753833d0d6239965b2a Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Tue, 22 Jun 2010 13:46:25 +0200 Subject: fix package names and package flavour dependencies ipkg does not allow package names with uppercase, so revert some of phil changes. dependency handling of package flavours were broken, because of a chicken and egg problem. implement a new variable (PKGFS_XXX) containing flavour dependent package dependencies. --- package/pkgmaker | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'package/pkgmaker') diff --git a/package/pkgmaker b/package/pkgmaker index 677a44d08..cd40ccb94 100644 --- a/package/pkgmaker +++ b/package/pkgmaker @@ -66,6 +66,7 @@ for dn in */Makefile; do ALL_PKGOPTS \$(foreach x,\${ALL_PKGOPTS},PKGNAME_\${x} \ PKGDESC_\${x} PKGDEPS_\${x} PKGDFLT_\${x} CFLINE_\${x}) \ \$(foreach x,\${PKG_FLAVOURS},PKGFD_\${x}) \ + \$(foreach x,\${PKG_FLAVOURS},PKGFS_\${x}) \ \$(foreach x,\${PKG_CHOICES},PKGCD_\${x}) \ \$(foreach x,\${PKG_CHOICES},PKGCS_\${x}) \ PKG_HOST_DEPENDS PKG_TARGET_DEPENDS") @@ -280,11 +281,16 @@ EOF # Handle flavours (per directory) for pfcu in $PKG_FLAVOURS; do # pfcu: pkg flavour conf opt. eval pfd=\$PKGFD_$pfcu # pfd: pkg flavour description + eval pfs=\$PKGFS_$pfcu # pfs: pkg flavour dependencies print print config ADK_PACKAGE_${dnu}_$pfcu print "\tbool \"${pfd:-$PKG_NAME -> flavour $pfcu}\"" print \\tdefault n print \\tdepends on ADK_COMPILE_$dnu + for pfso in $pfs; do + typeset -u pfso=${pfso#!} + print \\tselect ADK_PACKAGE_${pfso} + done print \\thelp print "\t flavour ADK_PACKAGE_${dnu}_$pfcu for $PKG_NAME" done >&4 -- cgit v1.2.3 From da28ccc6f848695609d32090142f1b4af0e27b17 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Tue, 6 Jul 2010 12:31:39 +0200 Subject: massive whitespace cleanup (EOL), suggested by j.seitter --- package/pkgmaker | 3 +++ 1 file changed, 3 insertions(+) (limited to 'package/pkgmaker') diff --git a/package/pkgmaker b/package/pkgmaker index cd40ccb94..0e8e21372 100644 --- a/package/pkgmaker +++ b/package/pkgmaker @@ -11,6 +11,9 @@ GMAKE="$GMAKE --no-print-directory" (( x_cols = (COLUMNS > 10) ? COLUMNS - 2 : 80 )) typeset -L$x_cols pbar +# check for trailing whitespace +grep -H "[[:space:]]$" */Makefile && print "Found trailing whitespace, please fix" + # build a cache of “ipkg package name” → “package conf option” for # use with dependency resolution rm -rf pkglist.d -- cgit v1.2.3 From 3c70077f308437281c72431223b532f6f427e1d0 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 7 Jul 2010 23:58:22 +0200 Subject: add support for hso umts modems if you like to use an usb umts modem with hso chipset, this is the support for it. use following in /etc/network/interfaces: auto hso0 iface hso0 inet manual pin xxxx apn foo.bar credentials go to freewrt 1.0 supporters... --- package/pkgmaker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package/pkgmaker') diff --git a/package/pkgmaker b/package/pkgmaker index 0e8e21372..3ec2dd4d8 100644 --- a/package/pkgmaker +++ b/package/pkgmaker @@ -12,7 +12,7 @@ GMAKE="$GMAKE --no-print-directory" typeset -L$x_cols pbar # check for trailing whitespace -grep -H "[[:space:]]$" */Makefile && print "Found trailing whitespace, please fix" +grep -H '[[:space:]]$' */Makefile && print "Found trailing whitespace, please fix" # build a cache of “ipkg package name” → “package conf option” for # use with dependency resolution -- cgit v1.2.3 From 7f6502e41b71005d3239b47dfa6415fba4b547a3 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Mon, 12 Jul 2010 16:23:10 +0200 Subject: modify many PKG_DESCR variables to fit better into 80 width terminal window --- package/pkgmaker | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'package/pkgmaker') diff --git a/package/pkgmaker b/package/pkgmaker index 169b05643..f4d8355ef 100644 --- a/package/pkgmaker +++ b/package/pkgmaker @@ -94,7 +94,7 @@ for dn in */Makefile; do # pseudo package, does not produce an ipkg package ppnf=$PKG_NAME # ppnf: pseudopkg name, filled if [[ -n $PKG_DESCR ]]; then - while (( ${#ppnf} < 34 )); do + while (( ${#ppnf} < 23 )); do ppnf=$ppnf. done ppnf="$ppnf $PKG_DESCR" @@ -192,7 +192,7 @@ for dn in */Makefile; do print -u$h config ADK_PACKAGE_$spcu spnf=$sppn # spnf: subpackage name, filled if [[ -n ${desc:-$PKG_NAME} ]]; then - while (( ${#spnf} < 34 )); do + while (( ${#spnf} < 23 )); do spnf=$spnf. done spnf="$spnf ${desc:-$PKG_NAME}" -- cgit v1.2.3 From 33209d1b19689ace6a3def68e995c81bdfcc9a40 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 14 Jul 2010 20:09:02 +0200 Subject: older mksh versions seems to have a problem with function keyword --- package/pkgmaker | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'package/pkgmaker') diff --git a/package/pkgmaker b/package/pkgmaker index f4d8355ef..225d47f47 100644 --- a/package/pkgmaker +++ b/package/pkgmaker @@ -303,21 +303,21 @@ EOF done # return good if given file exists and is non-empty -function non_empty_file() { +non_empty_file() { [[ -f "$1" ]] || return 1 [[ -n "$(cat "$1")" ]] || return 1 return 0 } # print the verbose section name for a given section tag -function lookup_section_string() { +lookup_section_string() { str="$(grep ^$1\ sections.lst | cut -d ' ' -f '2-')" [[ -n $str ]] && { echo $str; return; } echo $1 } # print the first prompt's first word's value in a given Config.in file -function get_first_prompt() { +get_first_prompt() { prompt="$(grep -m 1 "prompt " $1 | sed -n 's/.*"\([^ \.]*\)[ \.].*"/\1/p')" [[ -n $prompt ]] && echo $prompt } -- cgit v1.2.3 From 8b9035c32ec7c907f89b8f2012efdbc4ebac6a8d Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 14 Jul 2010 21:05:21 +0200 Subject: grep -m is not portable --- package/pkgmaker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package/pkgmaker') diff --git a/package/pkgmaker b/package/pkgmaker index 225d47f47..e9e0abff5 100644 --- a/package/pkgmaker +++ b/package/pkgmaker @@ -318,7 +318,7 @@ lookup_section_string() { # print the first prompt's first word's value in a given Config.in file get_first_prompt() { - prompt="$(grep -m 1 "prompt " $1 | sed -n 's/.*"\([^ \.]*\)[ \.].*"/\1/p')" + prompt="$(grep "prompt " $1 |head -1| sed -n 's/.*"\([^ \.]*\)[ \.].*"/\1/p')" [[ -n $prompt ]] && echo $prompt } -- cgit v1.2.3 From 365066d25eaed1f5e47030d593888b922a84c11c Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Fri, 16 Jul 2010 13:53:32 +0200 Subject: fix strongswan package, ESP now works. --- package/pkgmaker | 3 --- 1 file changed, 3 deletions(-) (limited to 'package/pkgmaker') diff --git a/package/pkgmaker b/package/pkgmaker index e9e0abff5..ac5fab8f8 100644 --- a/package/pkgmaker +++ b/package/pkgmaker @@ -336,9 +336,6 @@ done package_section_list # create the Config.in.auto from the sorted list from above cursec="" sort -k 3 -k 1 -f package_section_list | while read name file section; do - pbar="Pass 4: $name ..." - print -nu2 "$pbar\r" - if [[ $cursec != $section ]]; then [[ -n $cursec ]] && print "endmenu\n" -- cgit v1.2.3 From 932272554e1fdd5ef1b15e55b30786595b5d212e Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Fri, 16 Jul 2010 14:24:02 +0200 Subject: use manual config for base-files, fix fancy prompt --- package/pkgmaker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package/pkgmaker') diff --git a/package/pkgmaker b/package/pkgmaker index e9e0abff5..2975da22b 100644 --- a/package/pkgmaker +++ b/package/pkgmaker @@ -84,7 +84,7 @@ for dn in */Makefile; do echo "$dn/Config.in.manual ${PKG_SECTION:=none}" >>../package_sections # skip if we take care of this one manually - [[ $dn != "base-files" ]] && [[ -s Config.in.manual ]] && { cd ..; continue; } + [[ -s Config.in.manual ]] && { cd ..; continue; } exec 4>../pkgconfigs.d/$dn/Config.in -- cgit v1.2.3