You are not logged in.
Pages: 1
Topic closed
What I really want is a 'magic' command that would delete all the leftover files that were used to build a package, like developers usually do with the 'clean' target of Makefiles.
The most close to this I could found was the --clean option of makepkg, however it only seems to work if I use it before building a package. And, to be precise, what I am looking for is a way to do this after building a package.
1. Is there any way I could enforce the use of makepkg --clean without having to rebuild a package (with -f)?
2. Another alternative: is there any script or program out there that already resolved this issue? I have a strong belief that somebody already thought of this, it is not uncommon clean built files IMHO.
The practical scenario would be to do a
rm -rf src/ pkg/ <a downloaded tarball, zipfile or similar> <(occasionally) an aur tarball created with mkaurball>In other words, everything from a directory should be deleted, except the PKGBUILD and occasional .install and other auxiliary files.
In the case my question wasn't clear: any thoughts or recommendations or programs/scripts to clean a makepkg build?
Last edited by thiagowfx (2015-01-26 00:28:39)
Offline
Quick and dirty: Write a wrapper script for makepkg that deletes all files not in the source array of the PKGBUILD (and the created package of course) after the package build
Last edited by MK13 (2015-01-24 20:34:22)
Offline
You can remove the whole directory you've built it in, create a new one, cd there, move PKGBUILD etc.
makepkg uses a bunch of envars like SRCDEST - directory where the downloaded sources will be stored. Maybe this way you can move all the unneeded stuff to trash automatically.
Offline
I'm not really sure why you would want to delete the source files, but keep the PKGBUILD. If you want to rebuild, you'll need the sources anyways and if you want an update, then everything inclduing the PKGBUILD has to be replaced. So I'd suggest you use "makepkg -code" for your normal cleanup.
-code stands for "--clean --nobuild --nodeps --noextract". That will disable all makepkg steps and only perform the cleaning operation without anything else.
Edit: I'm considering writing a git-based PKGBUILD manager for my AUR packages that would provide similar functionality (git clean), but I am just too lazy.
Edit: To delete aurballs, use rm -rf *.src.tar.gz
Last edited by progandy (2015-01-24 21:37:32)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline
Thanks for the replies. This is the best I came up with:
makepkgclean () {
echo "--> Cleaning up makepkg files..."
makepkg -code
echo "--> Removing any AUR tarballs left out..."
find . -name '*.src.tar.gz' -exec rm {} \;
echo "--> Removing any created packages..."
find . -name '*.pkg.tar.xz' -exec rm {} \;
}Now, the only thing that is missing from this list are files downloaded from the source array. I can't simply delete all files from the source array; there could be local files in there. How could I delete only the files that are downloaded (e.g. by http, git, etc)?
---
karol, I was doing more or less what you said up to today. Sometimes I would manually delete the whole directory (just preserving the PKGBUILD, .install and local files from the source array), sometimes I would manually delete src/, pkg/, etc.
Anyway, my motivation / use case for this is as follows: I have a github repository with a bunch of PKGBUILDs I maintain (it is in my signature). My workflow is:
1. create a new PKGBUILD / update an existing one
2. makepkg -sif it and test manually if it works -- except in trivial changes
3. mkaurball it
4. burp it
5. update my git repository with those changes
--> 6. delete files that were created during the build process
The last step is the one I'm trying to optimize in this topic.
Offline
5. update my git repository with those changes
If you manage your source files in a git repository, you can remove all untracked files with a "git clean" command. I believe that should fit your needs. Maybe you need some paramaters, so tweak it during a few dry-runs (-n)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline
If you manage your source files in a git repository, you can remove all untracked files with a "git clean" command. I believe that should fit your needs. Maybe you need some paramaters, so tweak it during a few dry-runs (-n)
This is very nice indeed. For me,
git clean -n -x(and later on with -f) was a good run, because I already had some globs in my .gitignore to exclude files created with makepkg.
Well, I still want to improve the 'makepkgclean' function later on, but without deleting too much by guessing. But, for that, I would have to parse the source array and compare it with the files in the current directory, which I believe would be too much effort for such a simple task.
For now, I'm satisfied with its current version plus git clean. Marking the topic as solved, thanks.
Last edited by thiagowfx (2015-01-26 00:27:59)
Offline
rm -rf $(ls -a|grep -v PKGBUILD)Works for me. Too radical?
Offline
Offline
Pages: 1
Topic closed