2
0
forked from Ivasoft/openwrt

scripts/package-metadata.pl: parse and validate field Require-User

The script will now detect uid/gid collision and can generate a table of
current allocation

    ./scripts/package-metadata.pl usergroup tmp/.packageinfo \
	| sort -k 1,1r -k 3,3n \
	| column -t

This should ensure that no collision will happen for each single build

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
This commit is contained in:
Yousong Zhou
2017-06-13 17:03:38 +08:00
parent f334a0cdb8
commit 80d9ec5d3d
2 changed files with 83 additions and 1 deletions

View File

@@ -632,6 +632,16 @@ sub gen_version_filtered_list() {
}
}
sub gen_usergroup_list() {
parse_package_metadata($ARGV[0]) or exit 1;
for my $name (keys %usernames) {
print "user $name $usernames{$name}{id} $usernames{$name}{makefile}\n";
}
for my $name (keys %groupnames) {
print "group $name $groupnames{$name}{id} $groupnames{$name}{makefile}\n";
}
}
sub parse_command() {
GetOptions("ignore=s", \@ignore);
my $cmd = shift @ARGV;
@@ -643,6 +653,7 @@ sub parse_command() {
/^subdirs$/ and return gen_package_subdirs();
/^license$/ and return gen_package_license(0);
/^licensefull$/ and return gen_package_license(1);
/^usergroup$/ and return gen_usergroup_list();
/^version_filter$/ and return gen_version_filtered_list();
}
die <<EOF
@@ -654,6 +665,7 @@ Available Commands:
$0 subdirs [file] Package subdir information in makefile format
$0 license [file] Package license information
$0 licensefull [file] Package license information (full list)
$0 usergroup [file] Package usergroup allocation list
$0 version_filter [patchver] [list...] Filter list of version tagged strings
Options: