You are not logged in.

#1 2025-11-22 15:03:35

cafe
Member
From: Brasil
Registered: 2014-03-20
Posts: 162

Refering to a file in Downloads folder in a PKGBUILD

Imagine you need to install a proprietary software that you need to login to get the executable. The file goes to you Downloads folder. To avoid the (small) hassle of moving the file to your PKGBUILD location, how can I simply define a source file that is in the user's Download folder?

The closest I've got was

source=(file://$HOME/Downloads/$installer)

but that doesn't work because the variables in the path get replaced such as:

source=(file:///home/<myUsername>/Downloads/<theActualFile>)

How to make the <userName> part generic?

Offline

#2 2025-11-22 15:17:36

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,538

Re: Refering to a file in Downloads folder in a PKGBUILD

My download folder is /tmp and the browser also asks me where to store stuff - don't blindly assume things about 3rd systems.

That being said:

the path get replaced such as

Where when and how?
The PKGBUILD will be interpreted on the building system, ie. on *your* system $HOME gets expanded to /home/cafe and on my system to /home/seth - what should be what you want, no?

Offline

#3 2025-11-24 14:56:22

cafe
Member
From: Brasil
Registered: 2014-03-20
Posts: 162

Re: Refering to a file in Downloads folder in a PKGBUILD

Thanks seth

Digging a little deeper, I found out that the variable replacement happens when generating the .SRCINFO file.

makepkg --printsrcinfo > .SRCINFO

So I manually edited the file to remove the user refererence. Now it is working as intended.

Package is: https://aur.archlinux.org/packages/dsim (you can compare the first submission with the last one)

Thanks for the help.

Offline

#4 2025-11-24 15:00:09

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,351

Re: Refering to a file in Downloads folder in a PKGBUILD

You're thanking him while ignoring the main point of his post? DO NOT DO WHAT YOU'RE DOING. Assuming people download to $HOME/Downloads is just insane.

Offline

#5 2025-11-24 20:24:21

Muflone
Package Maintainer (PM)
From: Italy
Registered: 2013-10-08
Posts: 140
Website

Re: Refering to a file in Downloads folder in a PKGBUILD

Just to confirm, there's no $HOME/Downloads in my system

Offline

#6 2025-11-24 20:32:01

loqs
Member
Registered: 2014-03-06
Posts: 18,725

Re: Refering to a file in Downloads folder in a PKGBUILD

The basis for the use of `$HOME/Downloads` is that the user is incapable of moving a file into the same directory as the PKGBUILD if a different download location was used?

Offline

#7 2025-11-24 20:42:46

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,538

Re: Refering to a file in Downloads folder in a PKGBUILD

To avoid the (small) hassle of moving the file to your PKGBUILD location

s/incapable/too lazy/

Offline

#8 2025-11-25 06:31:14

system72
Member
Registered: 2025-11-22
Posts: 347
Website

Re: Refering to a file in Downloads folder in a PKGBUILD

i use ~/downloads because its more sane

KWOB.png

Last edited by system72 (2025-11-25 06:31:55)

Offline

#9 2025-11-30 12:04:32

cafe
Member
From: Brasil
Registered: 2014-03-20
Posts: 162

Re: Refering to a file in Downloads folder in a PKGBUILD

I remember the time when arch wiki was a place were people would help each other. It's a shame we've lost that spirit.

I did not like been called insane when I was just trying to help others creating a package that would simplify other's people life.

Assuming that people use a standard XDG dirs location is perfectly fine.

I thanked seth because he did helped me think a little deeper about this _simple_ problem. The others were just toxic.

Offline

#10 2025-11-30 12:43:29

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,538

Re: Refering to a file in Downloads folder in a PKGBUILD

I would not consider pointing out one's default download location to be "toxic", if if so - I started that.

Also *you* have not been called insane by anyone, but relying on the premise of a standard absolute download location. It is in the sense that it is not a sane premise as people have at least anecdotally rejected it.

The chosen pattern here is completely uncommon and therefore unexpectable and would in doubt force users to create a hard coded path predetermined by you.

If you really think locating the sources next to the pkgbuild is too much effort, you could remove it from the array and find it in the filesystem in a custom prepare or build function - I personally would not necessarily consider that a sane approach either (for its ridiculous inefficiency)


The overall suggestion in this thread, however toxic, remains to require the sources in a relative path to not force specific environments on your users.

Offline

#11 2025-11-30 21:18:33

loqs
Member
Registered: 2014-03-06
Posts: 18,725

Re: Refering to a file in Downloads folder in a PKGBUILD

There are two paths that are defined to be available in a PKGBUILD $srcdir and $pkgdir.  Where $srcdir,  $pkgdir and $HOME resolve to is undefined.  As such paths are undefined they should not be relied upon. You are also imposing another requirement on the build environment used by not quoting $srcdir and $pkgdir meaning those paths can not contain spaces. Pointing out these issues is not intended to be toxic or targeted at you in particular.

Last edited by loqs (2025-11-30 22:02:46)

Offline

Board footer

Powered by FluxBB