From: Paul Spooren Date: Tue, 19 Apr 2022 18:02:59 +0000 (+0200) Subject: build: use numeric-owner in ipkg-build X-Git-Tag: v23.05.0-rc1~3568 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=7a732213322d9aa6d8743beffb185ca6f53a5bea;p=openwrt%2Fopenwrt.git build: use numeric-owner in ipkg-build To create packages the `ipkg-build` script is used which double packs `control.tar.gz` and `data.tar.gz` to a single package. By default it's using a verbose username instead of a numeric value for files. Official OpenWrt images (artifacts) are created within docker containers which do not seem to contain those verbose usernames and instead defaults to numeric values. This becomes a problem when rebuilding public artifacts because other build environments may offer verbose usernames and there the created packages is different from the official ones. With this commit `ipkg-build` always uses numeric values for user/group and thereby making it easier to reproduce official artifacts. Signed-off-by: Paul Spooren --- diff --git a/scripts/ipkg-build b/scripts/ipkg-build index 19df621048..122cca2cb4 100755 --- a/scripts/ipkg-build +++ b/scripts/ipkg-build @@ -179,20 +179,20 @@ for file_mode in $file_modes; do chown "$uid:$gid" "$pkg_dir/$path" chmod "$mode" "$pkg_dir/$path" done -$TAR -X "$tmp_dir"/tarX --format=gnu --sort=name -cpf - --mtime="$TIMESTAMP" . | gzip -n - > "$tmp_dir"/data.tar.gz +$TAR -X "$tmp_dir"/tarX --format=gnu --numeric-owner --sort=name -cpf - --mtime="$TIMESTAMP" . | gzip -n - > "$tmp_dir"/data.tar.gz installed_size=$(stat -c "%s" "$tmp_dir"/data.tar.gz) sed -i -e "s/^Installed-Size: .*/Installed-Size: $installed_size/" \ "$pkg_dir"/$CONTROL/control -( cd "$pkg_dir"/$CONTROL && $TAR --format=gnu --sort=name -cf - --mtime="$TIMESTAMP" . | gzip -n - > "$tmp_dir"/control.tar.gz ) +( cd "$pkg_dir"/$CONTROL && $TAR --format=gnu --numeric-owner --sort=name -cf - --mtime="$TIMESTAMP" . | gzip -n - > "$tmp_dir"/control.tar.gz ) rm "$tmp_dir"/tarX echo "2.0" > "$tmp_dir"/debian-binary pkg_file=$dest_dir/${pkg}_${version}_${arch}.ipk rm -f "$pkg_file" -( cd "$tmp_dir" && $TAR --format=gnu --sort=name -cf - --mtime="$TIMESTAMP" ./debian-binary ./data.tar.gz ./control.tar.gz | gzip -n - > "$pkg_file" ) +( cd "$tmp_dir" && $TAR --format=gnu --numeric-owner --sort=name -cf - --mtime="$TIMESTAMP" ./debian-binary ./data.tar.gz ./control.tar.gz | gzip -n - > "$pkg_file" ) rm "$tmp_dir"/debian-binary "$tmp_dir"/data.tar.gz "$tmp_dir"/control.tar.gz rmdir "$tmp_dir"