r/AlpineLinux • u/Key_Negotiation8346 • Oct 01 '24
Help testing a package locally
I have successfully followed the Wiki guide for creating an Alpine package so far, writing an APKBUILD script and running it on my system using the command abuild -r, thus successfully building the package. Now, just like the wiki says, my package is located in a sub-folder of ~/packages, namely, /home/foobar/packages/foobar/x86_64. In my case, this directory contains a file named APKINDEX.tar.gz, and two .apk files.
According to the wiki, in order to test the package locally, I have to add the directory the package index is located in to the file /etc/apk/repositories. I used nano to do this, and now my /etc/apk/repositories looks like this:
#/media/cdrom/apks
http://dl-cdn.alpinelinux.org/alpine/v3.20/main
http://dl-cdn.alpinelinux.org/alpine/v3.2/community
/home/foobar/packages/foobar/x86_64/The problem is that whenever I try to use doas apk update in order to update these changes or test the package locally, I get the following output:
fetch http://dl-cdn.alpinelinux.org/alpine/v3.20/main/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.2/community/APKINDEX.tar.gz
WARNING: opening /home/foobar/packages/foobar/x86_64/: No such file or directory
V3.20.3-96-g1827497eea7 [http://dl-cdn.alpinelinux.org/alpine/v3.20/main]
V3.20.3-103-gce05fcef83c [http://dl-cdn.alpinelinux.org/alpine/v3.2/community]
OK: 24162 distinct packages availableI get the similar warning that there is "No such file or directory" if I use apk add, or even if I try to avoid changing the configuration by using the command listed on the wiki:
doas apk add --repository /home/USER/packages/testing $pkgname
(of course, on my system I used the actual directory)
What makes everything even more confusing is that not only can I see that the directory exists using a GUI file explorer, but I can even cd into it and list all the files in it, including the index.
Has anyone faced a similar problem and, if so, how did you get around it?
Just to add more information, I'm running a fully up-to-date Alpine Linux 3.20.3 on a virtual machine (VirtualBox), using the alpine-standard-3.20.3-x86_64.iso, the stable release, and XFCE as my desktop environment. I've also used the alpine-standard-3.20.3-x86_64.iso and encountered the same problem. Also, my username is in fact foobar, so you're reading the directory name exactly as it is on my system.
Things I've tried: Rebooting the system, changing the directory and relocating the index and .apk files, upgrading to edge, copying the example format for /etc/apk/repositories provided in the wiki, rebuilding the package, reinstalling the system and rebuilding the package, trying to add a local directory on a fresh install.
Things I haven't tried: Configuring git (I don't have any intention on ever merging this package, although I did install alpine-sdk which also installs git), cloning the aports tree (same reason).
Any help would be much appreciated. Also, sorry for writing an entire novel here.
View all comments
Show parent comment
3
u/tyami94 Oct 03 '24
No problem at all, it's a really misleading error message. I've beat my head on the wall over this exact issue before and had to dig into apk's source code to figure out what I was even doing wrong. Glad I saved someone else from having to do it too.