You are not logged in.

#1 2024-12-13 21:50:14

TZIKADA
Member
Registered: 2024-11-22
Posts: 18

Need some tips or help cleaning up packages [SOLVED]

I tend to install various packages but I noticed how some temporary files and the installations themselves are just all over the place and now I'm having a hard time deleting unnecessary files.

I use this code to install packages:

sudo pacman -S package

or

git clone URL
cd package
makepkg -isc

If possible, I'd like to move the packages from where they are currently to a single folder and delete the pkgbuilds (if necessary, I just don't understand what they are used for and they seem to take up space).

I'd also appreciate it if someone could explain what these commands do in detail. I've read the man page but I still failed to understand what exactly each of those lines does. For example, where are the installed packages stored and what is git?

Last edited by TZIKADA (2024-12-14 11:25:28)

Offline

#2 2024-12-14 00:17:02

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

Offline

#3 2024-12-14 08:19:48

TZIKADA
Member
Registered: 2024-11-22
Posts: 18

Re: Need some tips or help cleaning up packages [SOLVED]

I think I understand what my problem is. I didn't make a "builds" directory for AUR packages and I didn't mark some of the dependencies I installed manually as dependencies.

I tried using git clean -dfx and it gave me this:

[Dan@Potato ~]$ git clean -dfx
fatal: not a git repository (or any of the parent directories): .git

After reading these I don't think I have a problem with the installed packages, I can manually go over them and remove the unnecessary ones (unless there is a better solution).
But I still don't know how to remove the package builds from the "Home" directory.

Offline

#4 2024-12-14 08:28:46

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

Offline

#5 2024-12-14 08:56:49

TZIKADA
Member
Registered: 2024-11-22
Posts: 18

Re: Need some tips or help cleaning up packages [SOLVED]

A misunderstanding, I know how to use rm, but I don't know how to distinguish between files that I need and package builds. If there is no other way to do it other than manually I'll do it manually, but I'm asking in case there is an easier way to find which files should be removed. How do I know if a directory is a package build without looking up its name on google?

Offline

#6 2024-12-14 09:06:55

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

Re: Need some tips or help cleaning up packages [SOLVED]

How do I know if a directory is a package build without looking up its name on google?

Wtf are you talking about?
Packages are tarballs, they get extracted into the system when you install the packge. The package tarball, whether in the pacman cache  or some local build in your $HOME or wherever, becomes irrelevant, afterwards. You can do with it whatever you want - also delete it.

If you cloned an AUR repo into some local directory and have built and installed the package, you can delete the entire build tree along the package tarball afterwards.
Or you move the entire build directory into a different location. It really doesn't matter.
It might be reasonable to preserve the build directory for limited/faster rebuilds/updates later on, but that's really a personal estimation and super-specific to the AUR package and your intentions with it.

Please actually read the links I posted in #2

Offline

#7 2024-12-14 09:26:34

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: Need some tips or help cleaning up packages [SOLVED]

pacman manages packages on your system.
pacman -S deals with everything not locally installed AND from the official repositories. A package has been packaged by the maintainers for you to install. -Ss is "sync search".
pacman -Q means "query" and deals with locally installed packages. Anything you've installed with -S (from the repositories) and -U (from a locally available package file) can be inspected here. -R removes packages that are locally installed.

makepkg builds packages from definition files known as PKGBUILD (they build packages).
makepkg -s is short for --syncdeps and fetches dependencies found in the PKGBUILD
makepkg -i installs the package. You will get a pkg,tar.xz or pkg.tar.zstd or whatever the default in makepkg.conf is these days. If you don't add -i, you'll need to install the package with pacman -U.

The package file *.pkg.tar.zstd can be deleted afterwards, but you can keep it if you want to install it again. pacman actually keeps a cache of all files installed with -S in case you want to reinstall a package without downloading it again.

There also are lots of files and folders created when fetching the PKGBUILD and when using building the package with makepkg. You can delete those without interfering with your system, but reading the makepkg man page and looking at makepkg.conf is a good way to make sure you don't have to redownload everything on every update, especially if git is involved.

Read (again) the manpages of:
pacman
makepkg
PKGBUILD

EDIT: And read the fucking links seth posted. For real. Put down your thinking cap and calibrate your brain on input, read the two wiki links carefully and then reactivate the parts of your brain that think independently. I'm reminded of myself at the beginning of my journey when I read your replies. Read the damn thing once, then read it again and try to experiment with it.

Last edited by Awebb (2024-12-14 09:29:21)

Offline

#8 2024-12-14 11:20:10

TZIKADA
Member
Registered: 2024-11-22
Posts: 18

Re: Need some tips or help cleaning up packages [SOLVED]

Ok, I think my problems are solved. I used pacman -Qt and deleted every package from that list that I didn't need. I also removed every folder that contained a PKGBUILD file. Everything seems to be working.

P.S. I did read all the links you sent. By this point, I read each of them at least three times looking for various problems in other threads (4 times including today). I have a general problem with memorizing names so I might've confused you by calling a folder that contains a *.pkg.tar.zstd file "package build". But I did find a solution on the man page. Particularly, how to list packages that no other package depends on, and how to distinguish regular folders from folders that were created with git clone. I'll probably re-read the man page next time instead of relying on my memory. Thanks for the help.

Offline

#9 2024-12-14 14:04:46

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

Re: Need some tips or help cleaning up packages [SOLVED]

Ah, so you were only looking for strategies to decide what to "pacman -Rs" and this wa completely unrelated to build and package files.
Sorry, that wasn't really clear to me from your question.

Also check "pacman -Qm" for foreign packages (also such that might have been dropped out of the repo and provide dated software) and typically I just look across the list of packages to be updated and if something looks odd, check what that actually is and whether or why I need that.
You can also

LC_ALL=C pacman -Qi | awk '/^Name/ {name=$3} /^Installed Size/ {print $4 $5 " " name}' | sort -hr 

to get yourself a list of the packages sorted by installation size and whether there're some huge disk consumers amon them you might wanna get rid of.

Offline

Board footer

Powered by FluxBB