[OpenWrt-Devel] [PATCH] ppp: activate PIE ASLR by default

2020-02-20 Thread Petr Štetiar
This activates PIE ASLR support by default when the regular option is
selected.

Size increase on imx6:

 112681 ppp_2.4.8-2_arm_cortex-a9_neon.ipk
 121879 ppp_2.4.8-2_arm_cortex-a9_neon.ipk
 = 9198 diff

Signed-off-by: Petr Štetiar 
---
 package/network/services/ppp/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/network/services/ppp/Makefile 
b/package/network/services/ppp/Makefile
index b43a40bdceec..9e42cb743745 100644
--- a/package/network/services/ppp/Makefile
+++ b/package/network/services/ppp/Makefile
@@ -24,6 +24,7 @@ PKG_VERSION:=$(PKG_RELEASE_VERSION)
 
 PKG_BUILD_DEPENDS:=libpcap
 
+PKG_ASLR_PIE_REGULAR:=1
 PKG_BUILD_PARALLEL:=1
 PKG_INSTALL:=1
 

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/2] busybox: enable truncate on bcm53xx target

2020-02-20 Thread Rafał Miłecki
From: Rafał Miłecki 

It's needed for optimized sysupgrade. On host machine this change
increased busybox size by 4096 B.

Signed-off-by: Rafał Miłecki 
---
 package/utils/busybox/Config-defaults.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/utils/busybox/Config-defaults.in 
b/package/utils/busybox/Config-defaults.in
index c715e4b993..36731f2b6e 100644
--- a/package/utils/busybox/Config-defaults.in
+++ b/package/utils/busybox/Config-defaults.in
@@ -843,6 +843,7 @@ config BUSYBOX_DEFAULT_TRUE
default y
 config BUSYBOX_DEFAULT_TRUNCATE
bool
+   default y if TARGET_bcm53xx
default n
 config BUSYBOX_DEFAULT_TTY
bool
-- 
2.25.0


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/2] bcm53xx: sysupgrade: optimize building UBI image

2020-02-20 Thread Rafał Miłecki
From: Rafał Miłecki 

Use "truncate" to adjust size of existing file instead of "dd" which
required creating a copy. This saves space on tmpfs. It may be as low
as 2.1 MiB when using OpenWrt default user space and way more (20+ MiB)
when flashing vendor firmware.

Signed-off-by: Rafał Miłecki 
---
 target/linux/bcm53xx/base-files/lib/upgrade/platform.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh 
b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
index 1686462cde..40b2ef67be 100644
--- a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
@@ -1,4 +1,4 @@
-RAMFS_COPY_BIN='osafeloader oseama otrx'
+RAMFS_COPY_BIN='osafeloader oseama otrx truncate'
 
 PART_NAME=firmware
 
@@ -281,7 +281,7 @@ platform_do_upgrade_nand_trx() {
while [ "$(dd if=$dir/root skip=$ubi_length bs=1 count=4 2>/dev/null)" 
= "UBI#" ]; do
ubi_length=$(($ubi_length + 131072))
done
-   dd if=$dir/root of=/tmp/root.ubi bs=131072 count=$((ubi_length / 
131072)) 2>/dev/null
+   truncate -s $ubi_length $dir/root
[ $? -ne 0 ] && {
echo "Failed to prepare new UBI image."
return
@@ -289,7 +289,7 @@ platform_do_upgrade_nand_trx() {
 
# Flash
mtd write /tmp/kernel.trx firmware || exit 1
-   nand_do_upgrade /tmp/root.ubi
+   nand_do_upgrade $dir/root
 }
 
 platform_do_upgrade_nand_seama() {
-- 
2.25.0


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/2] rssileds: add dependencies based on LDFLAGS

2020-02-20 Thread Adrian Schmutzler
This adds the direct dependencies introduced by TARGET_LDFLAGS
to the package's DEPENDS variable.

This was found by accidentally building rssileds on octeon, which
resulted in:

"Package rssileds is missing dependencies for the following libraries:
libnl-tiny.so"

Though the dependencies are provided when building for the
relevant targets ar71xx, ath79 and ramips, it seems more tidy to
specify them explicitly.

Signed-off-by: Adrian Schmutzler 
---
 package/network/utils/rssileds/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/utils/rssileds/Makefile 
b/package/network/utils/rssileds/Makefile
index 27cdb4c67c..7a59314693 100644
--- a/package/network/utils/rssileds/Makefile
+++ b/package/network/utils/rssileds/Makefile
@@ -18,7 +18,7 @@ define Package/rssileds
   SECTION:=net
   CATEGORY:=Network
   TITLE:=RSSI real-time LED indicator
-  DEPENDS:=+libiwinfo
+  DEPENDS:=+libiwinfo +libnl-tiny +libubox +libuci
   MAINTAINER:=Daniel Golle 
 endef
 
-- 
2.20.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/2] rssileds: restrict package to targets where it is used

2020-02-20 Thread Adrian Schmutzler
It does not seem very sensible to provide the rssileds package
on targets without corresponding LEDs, so restrict it to the
targets where it is used at the moment.

Signed-off-by: Adrian Schmutzler 
---
 package/network/utils/rssileds/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/utils/rssileds/Makefile 
b/package/network/utils/rssileds/Makefile
index 7a59314693..c8e8f39de9 100644
--- a/package/network/utils/rssileds/Makefile
+++ b/package/network/utils/rssileds/Makefile
@@ -18,7 +18,7 @@ define Package/rssileds
   SECTION:=net
   CATEGORY:=Network
   TITLE:=RSSI real-time LED indicator
-  DEPENDS:=+libiwinfo +libnl-tiny +libubox +libuci
+  DEPENDS:=@(TARGET_ar71xx||TARGET_ath79||TARGET_ramips) +libiwinfo 
+libnl-tiny +libubox +libuci
   MAINTAINER:=Daniel Golle 
 endef
 
-- 
2.20.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 2/2] rssileds: restrict package to targets where it is used

2020-02-20 Thread Piotr Dymacz

Hi Adrian,

On 20.02.2020 18:52, Adrian Schmutzler wrote:

It does not seem very sensible to provide the rssileds package
on targets without corresponding LEDs, so restrict it to the
targets where it is used at the moment.


This package isn't hardware related and shouldn't be limited to targets 
where only officially supported devices make use of it.


Thus, NAK from me for this one.

--
Cheers,
Piotr



Signed-off-by: Adrian Schmutzler 
---
  package/network/utils/rssileds/Makefile | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/utils/rssileds/Makefile 
b/package/network/utils/rssileds/Makefile
index 7a59314693..c8e8f39de9 100644
--- a/package/network/utils/rssileds/Makefile
+++ b/package/network/utils/rssileds/Makefile
@@ -18,7 +18,7 @@ define Package/rssileds
SECTION:=net
CATEGORY:=Network
TITLE:=RSSI real-time LED indicator
-  DEPENDS:=+libiwinfo +libnl-tiny +libubox +libuci
+  DEPENDS:=@(TARGET_ar71xx||TARGET_ath79||TARGET_ramips) +libiwinfo 
+libnl-tiny +libubox +libuci
MAINTAINER:=Daniel Golle 
  endef
  




___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 2/2] rssileds: restrict package to targets where it is used

2020-02-20 Thread Adrian Schmutzler
> -Original Message-
> From: Piotr Dymacz [mailto:pep...@gmail.com]
> Sent: Donnerstag, 20. Februar 2020 18:58
> To: Adrian Schmutzler ; openwrt-
> de...@lists.openwrt.org
> Subject: Re: [OpenWrt-Devel] [PATCH 2/2] rssileds: restrict package to targets
> where it is used
> 
> Hi Adrian,
> 
> On 20.02.2020 18:52, Adrian Schmutzler wrote:
> > It does not seem very sensible to provide the rssileds package
> > on targets without corresponding LEDs, so restrict it to the
> > targets where it is used at the moment.
> 
> This package isn't hardware related and shouldn't be limited to targets
> where only officially supported devices make use of it.
> 
> Thus, NAK from me for this one.

I assume that's only for 2/2?

> 
> --
> Cheers,
> Piotr
> 
> >
> > Signed-off-by: Adrian Schmutzler 
> > ---
> >   package/network/utils/rssileds/Makefile | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/package/network/utils/rssileds/Makefile
> b/package/network/utils/rssileds/Makefile
> > index 7a59314693..c8e8f39de9 100644
> > --- a/package/network/utils/rssileds/Makefile
> > +++ b/package/network/utils/rssileds/Makefile
> > @@ -18,7 +18,7 @@ define Package/rssileds
> > SECTION:=net
> > CATEGORY:=Network
> > TITLE:=RSSI real-time LED indicator
> > -  DEPENDS:=+libiwinfo +libnl-tiny +libubox +libuci
> > +  DEPENDS:=@(TARGET_ar71xx||TARGET_ath79||TARGET_ramips) +libiwinfo
> +libnl-tiny +libubox +libuci
> > MAINTAINER:=Daniel Golle 
> >   endef
> >
> >



___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 2/2] rssileds: restrict package to targets where it is used

2020-02-20 Thread Piotr Dymacz

Hi Adrian,

On 20.02.2020 19:00, Adrian Schmutzler wrote:

-Original Message-
From: Piotr Dymacz [mailto:pep...@gmail.com]
Sent: Donnerstag, 20. Februar 2020 18:58
To: Adrian Schmutzler ; openwrt-
de...@lists.openwrt.org
Subject: Re: [OpenWrt-Devel] [PATCH 2/2] rssileds: restrict package to targets
where it is used

Hi Adrian,

On 20.02.2020 18:52, Adrian Schmutzler wrote:
> It does not seem very sensible to provide the rssileds package
> on targets without corresponding LEDs, so restrict it to the
> targets where it is used at the moment.

This package isn't hardware related and shouldn't be limited to targets
where only officially supported devices make use of it.

Thus, NAK from me for this one.


I assume that's only for 2/2?


Yes, only this one (patch).

--
Cheers,
Piotr





--
Cheers,
Piotr

>
> Signed-off-by: Adrian Schmutzler 
> ---
>   package/network/utils/rssileds/Makefile | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/package/network/utils/rssileds/Makefile
b/package/network/utils/rssileds/Makefile
> index 7a59314693..c8e8f39de9 100644
> --- a/package/network/utils/rssileds/Makefile
> +++ b/package/network/utils/rssileds/Makefile
> @@ -18,7 +18,7 @@ define Package/rssileds
> SECTION:=net
> CATEGORY:=Network
> TITLE:=RSSI real-time LED indicator
> -  DEPENDS:=+libiwinfo +libnl-tiny +libubox +libuci
> +  DEPENDS:=@(TARGET_ar71xx||TARGET_ath79||TARGET_ramips) +libiwinfo
+libnl-tiny +libubox +libuci
> MAINTAINER:=Daniel Golle 
>   endef
>
>






___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] Mikrotik RB951Ui-2HnD: Wireless config missing on new hardware

2020-02-20 Thread Nishant Sharma
Hello,

[Unable to post on forum (error 502 bad gateway), hence posting here.]

It seems something has changed in the hardware. I have "Type: INTL"
devices here.

I have already tried the following firmwares:

1. custom compiled 19.07.0
2. openwrt 19.07.0
3. custom compiled 18.06.2
4. custom compiled 17.02.4

I have tried these firmware on multiple (5+) old and new devices.

On newer hardware, wifi config only touches the /etc/config/wireless and
there is no configuration inside.

Below is the output on older hardware with 17.02.4, which has wifi working:

```
root@HBCC2DE061D01A:~# iw dev wlan0 info
Interface wlan0
ifindex 6
wdev 0x1
addr cc:2d:e0:61:d0:25
type managed
wiphy 0
txpower 20.00 dBm

root@HBCC2DE061D01A:~# dmesg | grep ath
[   22.885162] ath: EEPROM regdomain: 0x0
[   22.885182] ath: EEPROM indicates default country code should be used
[   22.885191] ath: doing EEPROM country->regdmn map search
[   22.885212] ath: country maps to regdmn code: 0x3a
[   22.885224] ath: Country alpha2 being used: US
[   22.885233] ath: Regpair used: 0x3a

root@HBCC2DE061D01A:/sys/devices/platform# ls -1
ag71xx-mdio.1
ag71xx.0
ag71xx.1
alarmtimer
ar934x-nfc
ar934x_wmac
ath79-gpio
ath79-wdt
ehci-platform
leds-gpio
regulatory.0
serial8250
serial8250.0
uevent

```

And below is the output on new hardware with 17.02.4:

```
root@OpenWrt:~# iw dev wlan0 info
command failed: No such device (-19)

root@OpenWrt:~# dmesg | grep ath
root@OpenWrt:~#

root@OpenWrt:/sys/devices/platform# ls -1
ag71xx-mdio.1
ag71xx.0
ag71xx.1
alarmtimer
ar934x-nfc
ath79-gpio
ath79-wdt
ehci-platform
leds-gpio
regulatory.0
serial8250
serial8250.0
uevent

```

Unloading or loading ath9k module adds following line to dmesg:

```
root@OpenWrt:~# dmesg | grep ath
[ 1175.108742] ath9k: ath9k: Driver unloaded

```

The above behaviour is same with 19.07.0 on the new hardware.

I do not see ar934x_wmac in /sys/devices/platform on new hardware, but
it is present on older hardware.

Does anyone has a clue about what could be going on?

I have access to both the types of numerous devices, so I can provide
further debugging information as and when required.

Thanks in advance.

Regards,
Nishant

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2 1/3] build: package-ipkg: avoid calling wildcard twice

2020-02-20 Thread Eneas U de Queiroz
Instead of calling $(wildcard) to check if the removal list is empty,
then calling it again to actually remove the files, define a function so
that the arguments are expanded only once when it gets called.

Signed-off-by: Eneas U de Queiroz 

diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
index c4c8f4a36f..cd052698e2 100644
--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -18,6 +18,12 @@ IPKG_REMOVE:= \
 
 IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/opkg
 
+# 1: package name
+# 2: candidate ipk files
+define remove_ipkg_files
+  $(if $(strip $(2)),$(IPKG_REMOVE) $(1) $(2))
+endef
+
 # 1: package name
 # 2: variable name
 # 3: variable suffix
@@ -184,7 +190,7 @@ $(_endef)
 $$(IPKG_$(1)) : export DESCRIPTION=$$(Package/$(1)/description)
 $$(IPKG_$(1)) : export PATH=$$(TARGET_PATH_PKG)
 $(PKG_INFO_DIR)/$(1).provides $$(IPKG_$(1)): $(STAMP_BUILT) 
$(INCLUDE_DIR)/package-ipkg.mk
-   @rm -rf $$(IDIR_$(1)) $$(if $$(call opkg_package_files,$(1)*),; 
$$(IPKG_REMOVE) $(1) $$(call opkg_package_files,$(1)*))
+   @rm -rf $$(IDIR_$(1)); $$(call remove_ipkg_files,$(1),$$(call 
opkg_package_files,$(1)*))
mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/CONTROL $(PKG_INFO_DIR)
$(call Package/$(1)/install,$$(IDIR_$(1)))
$(if $(Package/$(1)/install-overlay),mkdir -p $(PACKAGE_DIR) 
$$(IDIR_$(1))/rootfs-overlay)
@@ -252,7 +258,7 @@ $(_endef)
@[ -f $$(IPKG_$(1)) ]
 
 $(1)-clean:
-   $$(if $$(call opkg_package_files,$(1)*),$$(IPKG_REMOVE) $(1) $$(call 
opkg_package_files,$(1)*))
+   $$(call remove_ipkg_files,$(1),$$(call opkg_package_files,$(1)*))
 
 clean: $(1)-clean
 

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2 0/3] build: Avoid 'Argument list too long' error

2020-02-20 Thread Eneas U de Queiroz
TLDR for those who have read v1:  I've come up with a good-enough, but
not perfect wildcard pattern, and added it in a separate commit.

After building all of the luci packages with all of the translations,
if I either run:
'make package/luci/clean' or 'make package/luci/compile', I get:
make[2]: execvp: /usr/bin/env: Argument list too long
make[2]: *** [../../luci.mk:285: luci-clean] Error 127

This is caused by the call to scripts/ipkg-remove with a list of over
2,300 packages matching a luci* wildcard:
$ ll bin/packages/arm_cortex-a9_vfpv3/luci/luci*.ipk | wc -l
2307

My first attempt to circumvent this was using xargs.  However, using
echo from the Makefile results in make calling the shell with the same
2,307 file names.  The solution is to have make write the list to a file
and then feed it to xargs.

To avoid creating a file every time, xargs is only used when the number
of files is >=512.

As an optimization, to avoid calling wildcard twice, I've defined a
RemoveOpkgPackageFiles function, and added the check for an empty list
there, so that the call to opkg_package_files would only be done when
the new function was called.

I've put them in separate commits to ease an eventual reversal or
rejection.

If we change the wildcard pattern that selects the files, we can
eliminate the problems with xargs, and avoid 4,612 runs of 'tar -Ozxf'
when making package/luci/compile.

There is a caveat; it will not remove the .ipk file if the version of
a package whose name ends in a digit (e.g. nghttp2) that was currently
built with an ABI_VERSION, but the version of the new build does not
have an ABI_VERSION.  Then, make package/nghttp2/clean will not remove
the old ipk file.

I consider this extremely minor.  Nonetheless, I will leave the
intermediate commit, since it works in 100% of the cases, making it
easier to revert this.  If I should rather squash them, let me know
which commits should be kept and I'll send a v3.

This was compile-tested for mvebu, and checked by adding $(info ...)
tracers to the new functions and to opkg_package_files in
include/feeds.mk.

To check how many ipk files each package was selecting with the new
wildcard, I've run the following script in a directory containing all
packages that I've build for mvebu:

#!/bin/bash
total=0
packages=0
for f in *.ipk; do
  PKG=$(tar -Ozxf "$f" ./control.tar.gz | tar -Ozxf - ./control \
| sed -ne '/^Package:/{s,.*: ,,; p}')
  SRC=$(tar -Ozxf "$f" ./control.tar.gz | tar -Ozxf - ./control \
| sed -ne '/^SourceName:/{s,.*: ,,; p}')
  if [ "${SRC}" = "${PKG}" ]; then
files="${PKG}[^a-z-]*_*.ipk"
  else
case "${SRC}" in
   *[0-9] )
  files="${SRC}*_*.ipk"
  ;;
   * )
  files="${SRC}[^a-z-]*_*.ipk"
esac
  fi
  n=$(echo ${files} | wc -w)
  if [ "$n" -ne 1 ]; then
echo pkg=${SRC} - n=${n}
ls -1 ${files}
  fi
  ((total = total + n))
  ((packages++))
done
echo Total Packages=${packages}. Total lookups=${total}

If you want to see the old wildcard, always use `files=${SRC}*_*.ipk`.

Before the change:
Total Packages=8213. Total lookups=16689
After:
Total Packages=8213. Total lookups=8838

ChangeLog:

v1->v2:
  * Renamed the new functions using lowercase and underscores
  * Used '< file' instead of 'cat file |' to pass the files to xargs
  * Added a commit changing the wildcard pattern, reverting the use of
xargs.

Eneas U de Queiroz (3):
  build: package-ipkg: avoid calling wildcard twice
  build: call ipkg-remove using xargs if #args>=512
  build: reduce number of files passed to ipk-remove

 include/package-ipkg.mk | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2 2/3] build: call ipkg-remove using xargs if #args>=512

2020-02-20 Thread Eneas U de Queiroz
The wildcard call to clean up luci package (luci*) can pick up over
2,300 files when the full tree is built. Running make package/luci/clean
or a second run of make package/luci/compile would fail with an
'Argument list too long' error.

To avoid that, a maybe_use_xargs function was created that runs the
command straight as usual if the number of arguments is < 512, or saves
the list in a temporary file and feeds it to xargs otherwise.

Signed-off-by: Eneas U de Queiroz 

diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
index cd052698e2..351cf25394 100644
--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -18,10 +18,20 @@ IPKG_REMOVE:= \
 
 IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/opkg
 
+# 1: command and initial arguments
+# 2: arguments list
+# 3: tmp filename
+define maybe_use_xargs
+  $(if $(word 512,$(2)), \
+$(file >$(3),$(2)) $(XARGS) $(1) < "$(3)"; rm "$(3)", \
+$(1) $(2))
+endef
+
 # 1: package name
 # 2: candidate ipk files
 define remove_ipkg_files
-  $(if $(strip $(2)),$(IPKG_REMOVE) $(1) $(2))
+  $(if $(strip $(2)), \
+$(call maybe_use_xargs,$(IPKG_REMOVE) $(1),$(2),$(TMP_DIR)/$(1).in))
 endef
 
 # 1: package name

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2 3/3] build: reduce number of files passed to ipk-remove

2020-02-20 Thread Eneas U de Queiroz
Instead of using xargs to pass a huge number of files to
script/ipkg-remove, which will usually pick only one, use a more
restrictive wildcard so that, currently, at the most 325 files are
examined, instead of up to over 2,300.  The 325-file package is python,
which is picking up python3* ipks.  It is about to be removed.
Runner-up is ddns-scripts with 7 files.

This makes a second run of make package/luci/compile go from
real 16.40s; user 17.42s; sys 2.73s
to
real 10.71s; user 9.51s; sys 1.27s

There is a caveat though: if one were to remove the ABI_VERSION of a
package that ends in a digit [0-9], then the old package ipk will not be
removed from the bin directory by make package/abc2/clean.

Signed-off-by: Eneas U de Queiroz 

diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
index 351cf25394..5b0143d56d 100644
--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -18,20 +18,16 @@ IPKG_REMOVE:= \
 
 IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/opkg
 
-# 1: command and initial arguments
-# 2: arguments list
-# 3: tmp filename
-define maybe_use_xargs
-  $(if $(word 512,$(2)), \
-$(file >$(3),$(2)) $(XARGS) $(1) < "$(3)"; rm "$(3)", \
-$(1) $(2))
+# Generates a make statement to return a wildcard for candidate ipkg files
+# 1: package name
+define gen_ipkg_wildcard
+  $(1)$$(if $$(filter -%,$$(ABIV_$(1))),,[^a-z-])*
 endef
 
 # 1: package name
 # 2: candidate ipk files
 define remove_ipkg_files
-  $(if $(strip $(2)), \
-$(call maybe_use_xargs,$(IPKG_REMOVE) $(1),$(2),$(TMP_DIR)/$(1).in))
+  $(if $(strip $(2)),$(IPKG_REMOVE) $(1) $(2))
 endef
 
 # 1: package name
@@ -200,7 +196,8 @@ $(_endef)
 $$(IPKG_$(1)) : export DESCRIPTION=$$(Package/$(1)/description)
 $$(IPKG_$(1)) : export PATH=$$(TARGET_PATH_PKG)
 $(PKG_INFO_DIR)/$(1).provides $$(IPKG_$(1)): $(STAMP_BUILT) 
$(INCLUDE_DIR)/package-ipkg.mk
-   @rm -rf $$(IDIR_$(1)); $$(call remove_ipkg_files,$(1),$$(call 
opkg_package_files,$(1)*))
+   @rm -rf $$(IDIR_$(1)); \
+   $$(call remove_ipkg_files,$(1),$$(call 
opkg_package_files,$(call gen_ipkg_wildcard,$(1
mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/CONTROL $(PKG_INFO_DIR)
$(call Package/$(1)/install,$$(IDIR_$(1)))
$(if $(Package/$(1)/install-overlay),mkdir -p $(PACKAGE_DIR) 
$$(IDIR_$(1))/rootfs-overlay)
@@ -268,7 +265,7 @@ $(_endef)
@[ -f $$(IPKG_$(1)) ]
 
 $(1)-clean:
-   $$(call remove_ipkg_files,$(1),$$(call opkg_package_files,$(1)*))
+   $$(call remove_ipkg_files,$(1),$$(call opkg_package_files,$(call 
gen_ipkg_wildcard,$(1
 
 clean: $(1)-clean
 

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel