You are not logged in.

#1 2014-09-23 13:58:42

beta990
Member
Registered: 2011-07-10
Posts: 207

linux-media-git

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. smile

Last edited by beta990 (2014-09-23 14:06:33)

Offline

#2 2014-09-23 14:00:23

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

Re: linux-media-git

If you add the package name to the thread title and/or the thread, more people might be willing to have a look.

Offline

#3 2014-09-23 14:06:50

beta990
Member
Registered: 2011-07-10
Posts: 207

Re: linux-media-git

Awebb wrote:

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. smile

Last edited by beta990 (2014-09-23 14:07:05)

Offline

#4 2014-09-23 14:23:44

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: linux-media-git

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

#5 2014-09-23 14:46:16

beta990
Member
Registered: 2011-07-10
Posts: 207

Re: linux-media-git

Trilby wrote:

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

#6 2014-09-23 14:53:51

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

Re: linux-media-git

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.

Offline

#7 2014-09-23 14:57:16

beta990
Member
Registered: 2011-07-10
Posts: 207

Re: linux-media-git

I'm sorry guys. sad
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

#8 2014-09-23 14:59:37

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

Offline

#9 2014-09-23 15:15:32

beta990
Member
Registered: 2011-07-10
Posts: 207

Re: linux-media-git

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

#10 2014-09-23 15:21:30

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

Re: linux-media-git

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)

Offline

#11 2014-09-23 15:29:10

beta990
Member
Registered: 2011-07-10
Posts: 207

Re: linux-media-git

Scimmia wrote:

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. smile
Was indeed stupid to set build stuff in the package() function. tongue

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

#12 2014-09-23 15:40:23

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

Re: linux-media-git

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.

Offline

#13 2014-09-23 15:46:46

beta990
Member
Registered: 2011-07-10
Posts: 207

Re: linux-media-git

Scimmia wrote:

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. smile

Running now without --as-root, hope it works.
What about the .install file? Should I need to use that?

Offline

#14 2014-09-23 15:55:54

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

Re: linux-media-git

Yes, generally with a kernel module you'll need to use an install script to run depmod.

Offline

#15 2014-09-23 16:03:47

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: linux-media-git

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

#16 2014-09-23 16:26:00

beta990
Member
Registered: 2011-07-10
Posts: 207

Re: linux-media-git

Scimmia wrote:

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. smile
The build(_custom) script does it at the end, but I think it is needed to do this outside the script as well.

Trilby wrote:

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. smile
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. wink

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. tongue

Will keep you guys posted, and hope to make a change later tonight.

Last edited by beta990 (2014-09-23 16:27:13)

Offline

#17 2014-09-23 17:15:15

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: linux-media-git

beta990 wrote:

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

#18 2014-09-24 11:03:13

beta990
Member
Registered: 2011-07-10
Posts: 207

Re: linux-media-git

Scimmia wrote:

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!! big_smile

Could you check if my new version is OK to use, please? smile
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. smile

Offline

#19 2014-09-24 14:02:00

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: linux-media-git

Are you ignoring my post, or did you not understand it?

Offline

#20 2014-09-24 14:44:09

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

Re: linux-media-git

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.

Offline

#21 2014-09-24 15:11:07

beta990
Member
Registered: 2011-07-10
Posts: 207

Re: linux-media-git

tomk wrote:

Are you ignoring my post, or did you not understand it?

Both. tongue

I ignored your post, just because I didn't take a look at this yet. smile
But it looks very interesting thought.

Scimmia wrote:

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. smile

Offline

Board footer

Powered by FluxBB