diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2015-04-08 14:30:12 +0300 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-04-08 14:30:20 +0300 |
commit | a5fe5ac9c916f0954456904ce6943b42a38dd756 (patch) | |
tree | c7e1306216ceca1e9ba3af3acdaa7a9991480ada | |
parent | add9056c370442beae9213e5e5a85859f745ee90 (diff) |
make-index.pl: force C locale and use sort explicitely
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
-rwxr-xr-x | shared/make-index.pl | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/shared/make-index.pl b/shared/make-index.pl index a72b4d7..54d3299 100755 --- a/shared/make-index.pl +++ b/shared/make-index.pl @@ -2,11 +2,13 @@ use strict; use warnings; +use POSIX; my $dir = $ARGV[0]; die "Usage: $0 <package directory>\n" unless -d $dir; +setlocale(LC_ALL, "C"); sub pkg_metadata { @@ -64,13 +66,21 @@ sub pkg_metadata return $meta; } + +my @packages; + if (opendir D, $dir) { while (defined(my $e = readdir D)) { next unless -f "$dir/$e" && $e =~ m{\.ipk$}; - print pkg_metadata("$dir/$e"); + push @packages, $e; } closedir D; } + +foreach my $package (sort @packages) +{ + print pkg_metadata("$dir/$package"); +} |