You are not logged in.
Pages: 1
Hi all,
I hope you can help, making my PKGBUILD a bit better:
https://raw.githubusercontent.com/beta9 … t/PKGBUILD
I'm a bit confused, because of the following line: make -C ../ install
The modules get installed, but how does it work? Are they copied to a fakeroot first?
Or do I need to run the makepkg -sci --asroot?
Thanks and hope I report this in the correct section. ![]()
Last edited by beta990 (2014-09-23 14:06:33)
Offline
If you add the package name to the thread title and/or the thread, more people might be willing to have a look.
Offline
If you add the package name to the thread title and/or the thread, more people might be willing to have a look.
Done!
Thanks. ![]()
Last edited by beta990 (2014-09-23 14:07:05)
Offline
I'm not sure where to start with this one - so many things are very wrong in that PKGBUILD.
The first I noticed, but not nearly the most important is that you are doing all the preparing and building in the package function. You should do these instead in prepare and build functions. Then your build function is cloning a git repo - this is the old way to retrieve git sources - makepkg will handle this now, just put the git url into sources.
But even this manual git pull is very confusing, and this is where the really bad issues start. There is no actual git url. Instead you cd into a directory which already must have a full git repo and you are just updating it. Where does this initial git repo come from? Perhaps the same place as all the other source: it seems *everything* is included in the aur tarball. I'm not sure this could even be uploaded to the AUR, but if it makes it, it will be removed very quickly.
EDIT: ok one of those was due to me misreading the build function. But the rest still applies.
Last edited by Trilby (2014-09-23 14:25:35)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I'm not sure where to start with this one - so many things are very wrong in that PKGBUILD.
The first I noticed, but not nearly the most important is that you are doing all the preparing and building in the package function. You should do these instead in prepare and build functions. Then your build function is cloning a git repo - this is the old way to retrieve git sources - makepkg will handle this now, just put the git url into sources.
But even this manual git pull is very confusing, and this is where the really bad issues start. There is no actual git url. Instead you cd into a directory which already must have a full git repo and you are just updating it. Where does this initial git repo come from?Perhaps the same place as all the other source: it seems *everything* is included in the aur tarball. I'm not sure this could even be uploaded to the AUR, but if it makes it, it will be removed very quickly.EDIT: ok one of those was due to me misreading the build function. But the rest still applies.
Yeah, there are a lot of stupid things. That's why I wanted to post it here first, before posting it to AUR (even if, because it's rather a custom PKG).
This is how it should work (see: http://www.linuxtv.org/wiki/index.php/H … e_Drivers):
1. Get build script (see _git..)
2. clone the media_tree (./build_devel --main-git)
3. apply patches to modules/files
4. build (make -C ../v4l)
5. install (make -C ../ install)
6. clean (for file in `find /lib/modules -name "*.ko"`;..)
I'm a first starter and looked at some other PKG's from AUR. I'd also looked at the Wiki('s), but maybe I need more time reading this..
Offline
Wow. Just...wow.
beta990, stop and do some reading about PKGBUILDs. What you have posted is one of the worst I've seen. From the manual clone, to using cp -R on a file, to editing the filesystem directly, to not even touching $pkgdir. I'm with Trilby, I don't even know where to start.
Online
I'm sorry guys. ![]()
I was a bit desperate to get everything to work, so I just created this quickly without looking for the correct instructions.
What do you mean with the manual clone? I need to clone this otherwise I'm not getting the full source?
Offline
Online
Is it better now?
I looked up the Wiki, but do I need to use prepare, etc.?
In the examples I only see build and package.
Last edited by beta990 (2014-09-23 15:15:50)
Offline
Getting better.
The prepare function is where you make changes to the sources (patches, sed, etc). See https://wiki.archlinux.org/index.php/Cr … _Functions
You still have build_devel, what is this? And you're still manipulating files in the host filesystem. Don't do that, everything should be put into $pkgdir.
Last edited by Scimmia (2014-09-23 15:23:54)
Online
Getting better.
The prepare function is where you make changes to the sources (patches, sed, etc). See https://wiki.archlinux.org/index.php/Cr … _Functions
You still have build_devel, what is this? And you're still manipulating files in the host filesystem. Don't do that, everything should be put into $pkgdir.
Thanks. ![]()
Was indeed stupid to set build stuff in the package() function. ![]()
The build_custom (renamed it), is a copy of the build script from the original source: http://git.linuxtv.org/cgit.cgi/media_b … tree/build
But I did make some changes, like switching the branch, etc.
Maybe a sed instead would make it a bit better.
The problem is that the files on the host need to be moved/changed, otherwise conflicts are happening.
I think you mean this line:
for file in `find /lib/modules -name "*.ko"`; do if [[ ..
Hmm, should it be done separate from the package install?
Offline
How about this; if you have to use --as-root, you're doing things very, very wrong. Run makepkg as a normal user and see what fails. The --as-root option is even going to be removed in pacman 4.2.
Online
How about this; if you have to use --as-root, you're doing things very, very wrong. Run makepkg as a normal user and see what fails. The --as-root option is even going to be removed in pacman 4.2.
Thanks. ![]()
Running now without --as-root, hope it works.
What about the .install file? Should I need to use that?
Offline
Yes, generally with a kernel module you'll need to use an install script to run depmod.
Online
I only have a moment to check in - but I just wanted to drop the note that this looks hundreds of times better. I'm glad Scimmia could walk you through much of this - and also glad you are so responsive to our critical feedback. There are some steps left, but it is well on it's way. Perhaps the next big step is to move all those patches out of the aur tarball. Strictly speaking, the AUR guidelines do allow patches to be uploaded with the PKGBUILD, but there is a fine line: when the package basically is the patches, and there are so many, it is best to host those elsewhere and let makepkg grab them like other sources. This should be quite easy as you already have them on github.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Yes, generally with a kernel module you'll need to use an install script to run depmod.
Ok, I will take a look and see how it works. ![]()
The build(_custom) script does it at the end, but I think it is needed to do this outside the script as well.
I only have a moment to check in - but I just wanted to drop the note that this looks hundreds of times better. I'm glad Scimmia could walk you through much of this - and also glad you are so responsive to our critical feedback. There are some steps left, but it is well on it's way. Perhaps the next big step is to move all those patches out of the aur tarball. Strictly speaking, the AUR guidelines do allow patches to be uploaded with the PKGBUILD, but there is a fine line: when the package basically is the patches, and there are so many, it is best to host those elsewhere and let makepkg grab them like other sources. This should be quite easy as you already have them on github.
Hi Trilby,
Thanks for the feedback! Yeah, I just want to learn and how to do things better. ![]()
Good feedback helps me a lot, thanks to Scimmia (and others) that point me to the right direction.
It's my first 'real' PKG, so I'm glad to get some help. Since this isn't that great (yet), I didn't want to upload it on AUR, without a check first. ![]()
About the package itself; the amount of patches should be lower within a few weeks. Some of them aren't merged yet/tested, and most of them are just patches that I want to test out myself. They would not make part of the AUR-package. The patches are available somewhere else, but I uploaded them to my github, just for testing/editing. Still need to read how to get remote patches, but I think they should also be in the source line. ![]()
Will keep you guys posted, and hope to make a change later tonight.
Last edited by beta990 (2014-09-23 16:27:13)
Offline
The problem is that the files on the host need to be moved/changed, otherwise conflicts are happening.
Incorrect - see depmod.d(5) and /usr/lib/depmod.d/search.conf for details.
Offline
How about this; if you have to use --as-root, you're doing things very, very wrong. Run makepkg as a normal user and see what fails. The --as-root option is even going to be removed in pacman 4.2.
It worked!! ![]()
Could you check if my new version is OK to use, please? ![]()
https://github.com/beta992/ArchLinux/tr … -media-git
I have also added .install script that runs depmod -a at the end of the install. Since it installs to the current kernel installed, I don't think it is necessary to add the Linux-kernel version to it.
I got one final question thought: on some packages I would like chown/chmod a dir and/or file. What is the best way to set this? Should it be in the PKGBUILD or should it not be set at all?
The reason why I asked is because on some packages I add an user, but the permissions need to be set.
Thanks for all the help so far. ![]()
Offline
Are you ignoring my post, or did you not understand it?
Offline
You're definitely getting there. Beyond what tomk said:
1. You need a pkgver function.
2. Looking at what the build script does, I would just get rid of it and either add the entries to the source array or do things manually.
3. Patches in a prepare function. If you use the source array to get the tree instead of the script, this should work.
4. Quoting. Some of your paths that include $srcdir are unquoted.
5. Kind of nit-picky, but your use of braces for variables is inconsistent. Either use them or don't, your choice, but be consistent about it.
Online
Are you ignoring my post, or did you not understand it?
Both. ![]()
I ignored your post, just because I didn't take a look at this yet. ![]()
But it looks very interesting thought.
You're definitely getting there. Beyond what tomk said:
1. You need a pkgver function.
2. Looking at what the build script does, I would just get rid of it and either add the entries to the source array or do things manually.
3. Patches in a prepare function. If you use the source array to get the tree instead of the script, this should work.
4. Quoting. Some of your paths that include $srcdir are unquoted.
5. Kind of nit-picky, but your use of braces for variables is inconsistent. Either use them or don't, your choice, but be consistent about it.
1. Yeah, can this also be later set? Two git sources are cloned, and the second one needs to be in pkgver
2. Will take a look, at the moment this is the easy way, since a script already exist. ;p
3/4/5. Thanks, will take a look at it. ![]()
Offline
Pages: 1