Skip to content

Commit 8519fd3

Browse files
committed
Rename the apk packages to the canon name when creating the repository
The obs worker just uses name.apk when providing the packages. This does not work for Apk repositories, as the file name is not part of the repository metadata.
1 parent 32b50b5 commit 8519fd3

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Build/Apk.pm

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,4 +819,19 @@ sub verscmp {
819819
}
820820
}
821821

822+
sub canonname {
823+
my ($handle) = @_;
824+
my $qq;
825+
if (is_apkv3($handle)) {
826+
require Build::Apkv3 unless defined &Build::Apkv3::querypkginfo;
827+
$qq = Build::Apkv3::querypkginfo($handle);
828+
} else {
829+
$qq = queryvars($handle);
830+
}
831+
die("bad apk package\n") unless $qq && defined($qq->{'pkgname'}) && defined($qq->{'pkgver'});
832+
my $cn = "$qq->{'pkgname'}-$qq->{'pkgver'}.apk";
833+
die("bad apk package\n") if $cn =~ /^\./ || $cn =~ /\// || $cn =~ /--/;
834+
return $cn;
835+
}
836+
822837
1;

build-recipe-docker

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,8 @@ recipe_build_docker() {
186186
test -n "$apk_arch" || cleanup_and_exit 1 "could not determine apk arch"
187187
mkdir -p "$BUILD_ROOT/$TOPDIR/SOURCES/repos/$apk_arch"
188188
find "$BUILD_ROOT/$TOPDIR/SOURCES/repos" -name \*.apk -print | while read apk ; do
189-
ln -f $apk "$BUILD_ROOT/$TOPDIR/SOURCES/repos/$apk_arch"
189+
apk_cn=$(perl -I$BUILD_DIR -MBuild::Apk -e 'print Build::Apk::canonname($ARGV[0])' $apk)
190+
test -n "$apk_cn" && ln -f $apk "$BUILD_ROOT/$TOPDIR/SOURCES/repos/$apk_arch/$apk_cn"
190191
done
191192
chroot $BUILD_ROOT bash -c "cd $TOPDIR/SOURCES/repos/$apk_arch && apk index --allow-untrusted --rewrite-arch $apk_arch *.apk" > "$BUILD_ROOT/$TOPDIR/SOURCES/repos/$apk_arch/APKINDEX.tar.gz"
192193
fi

0 commit comments

Comments
 (0)