[SOLVED][Arch] - Help with PKGBUILD - realtimeconfigquickscan-git

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

Post Reply
CrocoDuck
Established Member
Posts: 1133
Joined: Sat May 05, 2012 6:12 pm
Been thanked: 17 times

[SOLVED][Arch] - Help with PKGBUILD - realtimeconfigquickscan-git

Post by CrocoDuck »

Hi there, this topic is related to The Audio Configuration Checklist. I am trying to bring realtimeconfigquickscan-git back to the AUR. These are my references. I have got a working PKGBUILD:

Code: Select all

# Maintainer: CrocoDuck <crocoduck.oducks@gmail.com>
# Contributor: Giancarlo Bianchi <giancarlobianchi76@gmail.com>

pkgname=realtimeconfigquickscan-git
pkgver=c362fbb
pkgrel=1
pkgdesc="Linux configuration checker for systems to be used for real-time audio"
arch=('any')
url="https://github.com/raboof/realtimeconfigquickscan"
license=('GPL')
depends=('perl-tk')
makedepends=('git')
provides=("${pkgname}")
conflicts=("${pkgname}" "realtimeconfigquickscan" "realtimeconfigquickscan-hg")
source=("${pkgname}::git://github.com/raboof/realtimeconfigquickscan")
md5sums=('SKIP')

package() {

  # Install Script Files:
  install -dm 0755 "$pkgname"/ "$pkgdir"/usr/share/"$pkgname"
	cp -a $pkgname/. "$pkgdir"/usr/share/"$pkgname"
  
  # Generate and install systemwise script launching scripts:
  install -dm 0755 "$pkgdir"/usr/bin/
  
    # Console Script:
cat << EOF > "$pkgdir"/usr/bin/realTimeConfigQuickScan
#!/bin/bash
set -e
cd /usr/share/$pkgname
exec perl ./realTimeConfigQuickScan.pl
EOF
chmod 755 "$pkgdir/usr/bin/realTimeConfigQuickScan"

  # GUI script:
cat << EOF > "$pkgdir"/usr/bin/QuickScan
#!/bin/bash
set -e
cd /usr/share/$pkgname
exec perl ./QuickScan.pl
EOF
chmod 755 "$pkgdir/usr/bin/QuickScan"
  
}
However, namcap is issuing some warnings:

Code: Select all

realtimeconfigquickscan-git W: Referenced library 'bash' is an uninstalled dependency
realtimeconfigquickscan-git W: Referenced library 'perl' is an uninstalled dependency
realtimeconfigquickscan-git W: Referenced library 'sh' is an uninstalled dependency
realtimeconfigquickscan-git W: Potential non-FHS info page (usr/share/realtimeconfigquickscan-git/.git/info/exclude) found.
realtimeconfigquickscan-git W: File (.BUILDINFO) exists in a non-standard directory.
realtimeconfigquickscan-git W: Directory (usr/share/realtimeconfigquickscan-git/.git/branches) is empty
realtimeconfigquickscan-git W: Directory (usr/share/realtimeconfigquickscan-git/.git/refs/tags) is empty
realtimeconfigquickscan-git W: Directory (usr/share/realtimeconfigquickscan-git/.git/objects/info) is empty
realtimeconfigquickscan-git W: Dependency included and not needed ('perl-tk')
They kinda look weird. Like, I know that perl-tk is needed since the GUI just doesn't work otherwise. Also, bash, is a dependency in stuff into base-devel, so I guess I should not include it, while perl is a dependency of perl-tk. And what with .BUILDINFO? For the rest, I guess empty directories should not be a problem...
Last edited by CrocoDuck on Wed Mar 02, 2016 11:09 pm, edited 1 time in total.
Joermungand
Established Member
Posts: 276
Joined: Wed Oct 24, 2012 5:19 pm

Re: [Arch] - Help with PKGBUILD - realtimeconfigquickscan-git

Post by Joermungand »

Well, here are a few comments:
  • the $pkgname variable should not be employed in order to refer to the application name, either in the provides/conflicts arrays or in the package function (after all, it is the application that should be visible after installation, not the package); I usually employ ${pkgname%-*} for that (which removes the ‘-git’ suffix);
  • install is not exactly used the way it should be; it’s supposed to copy things, not create them. So you should install files individually (a for loop is probably useful here), using the -D option to create necessary path nodes;
  • when you install the entire "$pkgname" directory, you also install the hidden ‘.git’ subdirectory;
  • as far as the files in the /usr/bin directory are concerned, it would perhaps be wiser (and easier to follow) to just create the two files yourself, include them in the ‘source’ and md5sums arrays, then just install them inn the package function; you’ll have to add them to git when you commit your files before pushing to AUR4;
  • warnings about bash, perl, sh, as well as .BUILDINFO are nothing to worry about; same for ‘perl-tk’;
Please let me know if all this makes sense to you.

Edit: Not all files in the src directory should be installed in /usr/share/${pkgname%-*}. COPYING and README are better suited in /usr/share/doc/${pkgname%-*}.
CrocoDuck
Established Member
Posts: 1133
Joined: Sat May 05, 2012 6:12 pm
Been thanked: 17 times

Re: [Arch] - Help with PKGBUILD - realtimeconfigquickscan-git

Post by CrocoDuck »

Thanks Joermungand, really appreciated. I have just a question:
Joermungand wrote:
  • install is not exactly used the way it should be; it’s supposed to copy things, not create them. So you should install files individually (a for loop is probably useful here), using the -D option to create necessary path nodes;
  • when you install the entire "$pkgname" directory, you also install the hidden ‘.git’ subdirectory;
In AUR3 it looked like this:

Code: Select all

package() {
  cd "$srcdir/$_gitname-build"

  install -dm 0755 "$pkgdir/usr/share/$_pkgname"
  install -dm 0755 "$pkgdir/usr/bin/"

  # Data files
  for i in *; do
    install -m 0644 "$i" "$pkgdir/usr/share/$_pkgname/$i"
  done
  }
I guess this is the sort of thing you have in mind? By doing this I am supposed to copy all the script files and discard the hidden .git directories, that should not be copied. Is that correct?
Joermungand
Established Member
Posts: 276
Joined: Wed Oct 24, 2012 5:19 pm

Re: [Arch] - Help with PKGBUILD - realtimeconfigquickscan-git

Post by Joermungand »

Yeah, something like that. You will need two different loops, with * replaced by *.pm and *.pl respectively. Then COPY and README should be installed into the corresponding /usr/share/doc directory.
Then, if you write the executable files yourself, the "$pkgdir/usr/bin/" line is redundant, as install used with the -D option witll autmatically create all necessary directories. Also, I doubt the files in "/usr/share/$pkgname" (or whatever it’s called) should have different attributes as compared to their parent directory (644 vs. 755 – the 0 padding is unnecessary). Normally, you get warning/error messages when you try to install files the permissions of which differ from their parent directory, which is only sane. So, in that case, the first install line in the old PKGBUILD is redundant, too.
CrocoDuck
Established Member
Posts: 1133
Joined: Sat May 05, 2012 6:12 pm
Been thanked: 17 times

Re: [Arch] - Help with PKGBUILD - realtimeconfigquickscan-git

Post by CrocoDuck »

Hi there! I got an update:

Code: Select all

# Maintainer: CrocoDuck <crocoduck.oducks@gmail.com>
# Contributor: Giancarlo Bianchi <giancarlobianchi76@gmail.com>

pkgname=realtimeconfigquickscan-git
pkgver=c362fbb
pkgrel=1
pkgdesc="Linux configuration checker for systems to be used for real-time audio"
arch=('any')
url="https://github.com/raboof/realtimeconfigquickscan"
license=('GPL')
depends=('perl-tk')
makedepends=('git')
provides=('realtimeconfigquickscan')
conflicts=('realtimeconfigquickscan' 'realtimeconfigquickscan-hg')
source=("${pkgname%-*}"::"git://github.com/raboof/realtimeconfigquickscan"
        'realTimeConfigQuickScan'
        'QuickScan')
md5sums=('SKIP' '45847f5cbc4880b6e724fa4fafbdc3c7' '8e3ff9238a56c66fb2f50f4f36259a95')

package() {

  cd ${pkgname%-*}
  # Install Script Files:
  # *.pm files
  for i in *.pm; do
    install -Dm 755 "$i" "$pkgdir/usr/share/${pkgname%-*}/$i"
  done  
  # *.pl files
  for i in *.pl; do
    install -Dm 755 "$i" "$pkgdir/usr/share/${pkgname%-*}/$i"
  done
  
  # Install doc files:
  install -D COPYING  "$pkgdir/usr/share/doc/${pkgname%-*}/COPYING"
  install -D README.md  "$pkgdir/usr/share/doc/${pkgname%-*}/README.md"
  
  # Install Executable scripts:
  cd "$srcdir"
  install -Dm 755 realTimeConfigQuickScan "$pkgdir/usr/bin/realTimeConfigQuickScan"
  install -Dm 755 QuickScan "$pkgdir/usr/bin/QuickScan"

}
With the two "executables":

QuickScan:

Code: Select all

#!/bin/bash

set -e
cd /usr/share/realtimeconfigquickscan
exec perl ./QuickScan.pl
realTimeConfigQuickScan:

Code: Select all

#!/bin/bash

set -e
cd /usr/share/realtimeconfigquickscan
exec perl ./realTimeConfigQuickScan.pl
I think it should be almost OK. I was looking at one of your PKGBUILDs Joermungand and I have a question. I see that you didn't use ${pkgname%-*} in the provides and conflicts arrays. Do you have a particular reason for doing that?

Also, I am maintaining pianoteq stuff (here one of the PKGBUILDs). The Arch wiki recommends to use the -bin suffix. I guess it would be better to do with that -bin the same thing I did with -git here...
User avatar
thetotalchaos
Established Member
Posts: 212
Joined: Mon Sep 29, 2014 8:29 pm
Has thanked: 55 times
Been thanked: 9 times
Contact:

Re: [Arch] - Help with PKGBUILD - realtimeconfigquickscan-git

Post by thetotalchaos »

Meanwhile you can get it from here
https://www.parabola.nu/packages/pcr/an ... kscan-git/

The only dependency i am aware of is perl-tk
You can listen to my music at: https://totalchaos-music.bandcamp.com/

Take a journey to wonderland with The Butterfly Effect 2016
https://totalchaos-music.bandcamp.com/a ... fly-effect
Joermungand
Established Member
Posts: 276
Joined: Wed Oct 24, 2012 5:19 pm

Re: [Arch] - Help with PKGBUILD - realtimeconfigquickscan-git

Post by Joermungand »

CrocoDuck wrote:I think it should be almost OK. I was looking at one of your PKGBUILDs Joermungand and I have a question. I see that you didn't use ${pkgname%-*} in the provides and conflicts arrays. Do you have a particular reason for doing that?
Nah, no particular reason, guess I was just in a hurry to get the actual packing done.
CrocoDuck wrote:Also, I am maintaining pianoteq stuff (here one of the PKGBUILDs). The Arch wiki recommends to use the -bin suffix. I guess it would be better to do with that -bin the same thing I did with -git here...
Yes, the ‘-bin’ suffix is recommended for packages installing binaries directly instead of building them from source – although you will find plenty of PKGBUILDS on AUR that do not follow this convention (one of mine included :wink: – I’ll request a merge on that, anyway, so it’s as good as gone). It should be removed from app-specific variables, as well. By the way, I can see ‘realtimeconfigquickscan-hg’ in your conflicts array, it should follow the same pattern. Packages provide the application named under the ‘provides’ variable, so ‘realtimeconfigquickscan’ is enough. I haven’t seen any package named ‘realtimeconfigquickscan-hg’ on AUR (maybe in AUR3?), so whoever wants to maintain that will have to worry about the ‘conflicts’ when it comes to it.

Other than that, it looks fine to me (which does not necessarily mean it’s compliant). Thanks for contributing!
CrocoDuck
Established Member
Posts: 1133
Joined: Sat May 05, 2012 6:12 pm
Been thanked: 17 times

Re: [Arch] - Help with PKGBUILD - realtimeconfigquickscan-git

Post by CrocoDuck »

thetotalchaos wrote:Meanwhile you can get it from here
https://www.parabola.nu/packages/pcr/an ... kscan-git/

The only dependency i am aware of is perl-tk
Thanks. That PKGBUILD is very similar to the AUR3 ones. QuickScan is now back in the AUR and I have used what I have learn to improve my other PKGBUILDs as well.

Thank you so much!
Post Reply