You are not logged in.

#1 2015-05-03 20:42:06

osendott
Member
Registered: 2015-05-03
Posts: 18

PKGBUILD Review

Would someone be so kind as to make sure my PKGBUILD is correct before I submit to the AUR?

# Maintainer: William Osendott <william.osendott@gmail.com>

_realname=Arch-Frost
pkgname=arch-frost-theme-git
pkgver="0.1.x"
pkgrel=1
pkgdesc='Arch-Frost GTK and Gnome-Shell theme'
arch=('any')
url='https://github.com/osendott/arch-frost'
license=('GPL3')
makedepends=('git')
provides=('arch-frost')
conflicts=('arch-frost')
source=('arch-frost::git+https://github.com/osendott/arch-frost.git')
md5sums=('SKIP')


package() {
  cd arch-frost
  install -dm 755 "${pkgdir}"/usr/share/themes/Arch-Frost
  rm -rf .git .gitignore arch-frost.tar.gz arch-frost-zip install.sh 
  cp -dr --no-preserve='ownership' * "${pkgdir}"/usr/share/themes/Arch-Frost
}

Last edited by osendott (2015-05-03 20:59:48)

Offline

#2 2015-05-03 20:47:08

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: PKGBUILD Review

Please use code tags when pasting to the boards: https://wiki.archlinux.org/index.php/Fo … s_and_code

For a normal PKGBUILD the pkgver should just be 0.1 (the pkgrel will be appended), however, for a -git PKGBUILD, you use a function like so:

pkgver() {
  cd "$srcdir/${_gitname}"
  git log -1 --format="%cd.g%h" --date=short | sed 's/-/./g'
}

and leave the value empty: makepkg will handle the rest.

Do you really need an `rm -rf` in there?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2015-05-03 20:58:33

osendott
Member
Registered: 2015-05-03
Posts: 18

Re: PKGBUILD Review

Apologies about the code tags. To be honest, I took the advice from the wiki and copied a PKGBUILD from another theme that had already been accepted to the AUR and edited that. I will remove the rm -rf and get rid of the files that do not need to be copied a better way. Is there anything else you can see?

Last edited by osendott (2015-05-03 21:03:50)

Offline

#4 2015-05-03 21:04:11

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,846
Website

Re: PKGBUILD Review

You never actually use the _realname variable, although there are a couple of instances where you could.

Other than that (and the things Jason mentioned), it looks good to me.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#5 2015-05-03 21:24:00

osendott
Member
Registered: 2015-05-03
Posts: 18

Re: PKGBUILD Review

it appears now that it's not pulling the sources in.

Offline

#6 2015-05-03 21:30:41

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,846
Website

Re: PKGBUILD Review

Try building in a clean srcdir. (makepkg -C)


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#7 2015-05-03 21:34:37

osendott
Member
Registered: 2015-05-03
Posts: 18

Re: PKGBUILD Review

yeah, that causes all kinds of problems lol I've got work to do apparently... you can't tell this is my first time can you?

Last edited by osendott (2015-05-03 21:35:24)

Offline

#8 2015-05-03 21:39:03

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,846
Website

Re: PKGBUILD Review

Don't worry, we were all newbies once. I'm glad you've asked for critique rather than just uploading something you weren't sure about. smile

Pleaes post the PKGBUILD as it is now. None of the changes mentioned should cause any problems.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#9 2015-05-03 21:54:11

osendott
Member
Registered: 2015-05-03
Posts: 18

Re: PKGBUILD Review

I'm so sorry, I'm an idiot, I had a couple simple typo's and apparently I have trouble remembering or even reading correct filenames of the files/folders I created lol anyway, below is my (hopefully) final version of my PKGBUILD. Also, it creates the archive like it should, and that archive contains the files/directory structure that looks correct, however I'm also left with an arch-frost folder in my working directory with other files/folders from my repo. Is this normal? I'm asking remedial questions I'm sure, but that's the only way I can learn, by doing and then learning from mistakes.

# Maintainer: William Osendott <william.osendott@gmail.com>

pkgname=arch-frost-theme-git
pkgver() {
  cd "$srcdir/${_gitname}"
  git log -1 --format="%cd.g%h" --date=short | sed 's/-/./g'
}
pkgrel=1
pkgdesc='Arch-Frost GTK and Gnome-Shell theme'
arch=('any')
url='https://github.com/osendott/arch-frost'
license=('GPL3')
makedepends=('git')
provides=('arch-frost')
conflicts=('arch-frost')
source=('arch-frost::git+https://github.com/osendott/arch-frost.git')
md5sums=('SKIP')


package() {
  cd arch-frost
  install -dm 755 "${pkgdir}"/usr/share/themes/Arch-Frost
  rm -R screens .git .gitignore arch-frost.tar.gz arch-frost.zip install.sh
  cp -dr --no-preserve='ownership' * "${pkgdir}"/usr/share/themes/Arch-Frost
}

Offline

#10 2015-05-03 22:13:56

osendott
Member
Registered: 2015-05-03
Posts: 18

Re: PKGBUILD Review

Ok I just tried it with # pacman -U <package-name> and everything worked fine (after I corrected the install directory) so I think I'm good.. one last question, I have a few txt files and a .png, how could I copy those to a separate directory?

Offline

#11 2015-05-03 22:27:17

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,846
Website

Re: PKGBUILD Review

This is a minor thing, but you should still have a pkgver variable, and it should have a value that the pkgver function has generated.

Move the pkgver function down to just above the package function (this isn't strictly necessary, but it's a widely adopted convention), recreate a blank pkgver variable below pkgname, and run makepkg once more.

You still have an rm command, which I don't think you should be doing. I recommend that you copy the specific folders that you need to install, rather than relying on wildcards.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#12 2015-05-03 22:31:36

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,544

Re: PKGBUILD Review

And please do not use that pkgver function. The date of the last commit is a horrible way to do versioning.

Everything you need to make a correct -git PKGBUILD is here: https://wiki.archlinux.org/index.php/VC … guidelines

Last edited by Scimmia (2015-05-03 22:32:19)

Offline

#13 2015-05-03 22:35:00

osendott
Member
Registered: 2015-05-03
Posts: 18

Re: PKGBUILD Review

guys, i'm sorry, but i'm very slowly getting lost here. this is my first time going through this, I'm going to try and prioritize your suggestions and try and work through them. I appreciate you guys trying to help me through this, just please remember, you're not talking to a veteran here (err well, I am a veteran, but it's of a war not PKGBUILDS lol)

I'm starting to think I should've picked a different PKGBUILD to use as a guide, but I looked at 3 different ones in the AUR, they all looked about the same.

Last edited by osendott (2015-05-03 22:35:11)

Offline

#14 2015-05-03 22:36:40

osendott
Member
Registered: 2015-05-03
Posts: 18

Re: PKGBUILD Review

I'm off for chow time, I'll work on this more later tonight. Thanks for all your help, I hope you guys are still around when I get back. This is why I love Arch, it forces you to learn new things and make sure you learn them 100% correctly, no short cuts (like not copying all files and then removing those you don't want lol )

Offline

#15 2015-05-03 22:52:11

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,544

Re: PKGBUILD Review

Don't get too bogged down. Your initial PKGBUILD, with the addition of a pkgver function, should work fine. The wiki page I linked to gives you details and examples of proper pkgver functions.

There are some other things that I think would really help, but many of them are at the repo level, not the PKGBUILD level.

Offline

#16 2015-05-04 02:53:40

osendott
Member
Registered: 2015-05-03
Posts: 18

Re: PKGBUILD Review

ok so now I'm working with this:

# Maintainer: William Osendott <william.osendott@gmail.com>

_pkgname=arch-frost
pkgname=${_pkgname}-theme-git
pkgver=73.a4e1b1b
pkgrel=1
pkgdesc='Arch-Frost GTK and Gnome-Shell theme'
arch=('any')
url='https://github.com/osendott/arch-frost'
license=('GPL3')
makedepends=('git')
provides=('arch-frost')
conflicts=('arch-frost')
source=('arch-frost::git+https://github.com/osendott/arch-frost.git')
md5sums=('SKIP')

pkgver() {
    cd ${srcdir}/${_pkgname}
    echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}
package() {
  cd arch-frost
  install -dm 755 "${pkgdir}"/usr/share/themes/Arch-Frost
  cp -dr --no-preserve='ownership' arch-frost arch-frost-light arch-frost-shell "${pkgdir}"/usr/share/themes/
  mkdir ~/Arch-Frost ~/Arch-Frost/Wallpapers ~/Arch-Frost/Documents
  cp -dr --no-preserve='ownership' wallpaper.png "${pkgdir}" ~/Arch-Frost/Wallpapers
  cp -dr --no-preserve='ownership' changelog credits README.md LICENSE "{$pkgdir}" ~/Arch-Frost/Documents
}

makepkg -c returns:

==> Making package: arch-frost 73.a4e1b1b-1 (Sun May  3 22:52:16 EDT 2015)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Cloning arch-frost git repo...
Cloning into bare repository '/home/willo/abs/arch-frost'...
remote: Counting objects: 847, done.
remote: Compressing objects: 100% (104/104), done.
remote: Total 847 (delta 37), reused 0 (delta 0), pack-reused 739
Receiving objects: 100% (847/847), 3.95 MiB | 2.99 MiB/s, done.
Resolving deltas: 100% (422/422), done.
Checking connectivity... done.
==> Validating source files with md5sums...
    arch-frost ... Skipped
==> Extracting sources...
  -> Creating working copy of arch-frost git repo...
Cloning into 'arch-frost'...
done.
==> Starting pkgver()...
==> Entering fakeroot environment...
==> Starting package()...
cp: cannot stat ‘{/home/willo/abs/pkg/arch-frost}’: No such file or directory
==> ERROR: A failure occurred in package().
    Aborting...

seems like I'm going backwards.. I look in all the directories, everything appears to be correctly copied/moved, at least on cursory inspection.

[edit]
looking at my package version, i'm going to guess that's not the correct way of versioning either.

Last edited by osendott (2015-05-04 02:54:56)

Offline

#17 2015-05-04 03:03:47

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,544

Re: PKGBUILD Review

Why are you using the -d switch with cp?

A PKGBUILD cannot touch your home dir.

Offline

#18 2015-05-04 03:22:53

osendott
Member
Registered: 2015-05-03
Posts: 18

Re: PKGBUILD Review

I have looked at several different PKGBUILD's in the AUR, they all have cp with the -d and -r switches. didn't make much sense to me either, but theirs seemed to work, so I figured why not. In fact, everything I've posted has came from from AUR, yet for some reason, fails to work when I plug my info in. I'm starting to think it's me.

Last edited by osendott (2015-05-04 03:23:31)

Offline

#19 2015-05-04 03:25:15

osendott
Member
Registered: 2015-05-03
Posts: 18

Re: PKGBUILD Review

of course, there's several with the rm -rf commands too lol so I guess that should've been my first clue..

Offline

#20 2015-05-04 03:32:51

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,544

Re: PKGBUILD Review

I think that would be my suggestion #1: stop taking random things from the AUR. Everything you need should be on the PKGBUILD and VCS PKGBUILD wiki pages. You're getting close.

Offline

#21 2015-05-04 04:06:13

osendott
Member
Registered: 2015-05-03
Posts: 18

Re: PKGBUILD Review

holy crap, I think I have finally managed to get it. only thing is, I'm not sure about the version number. (the one shown is after being updated by makepkg -s

# Maintainer: William Osendott <william.osendott@gmail.com>

_pkgname=arch-frost
pkgname=arch-frost-theme-git
pkgver=73.a4e1b1b
pkgrel=1
pkgdesc='Arch-Frost GTK and Gnome-Shell theme'
arch=('any')
url='https://github.com/osendott/arch-frost'
license=('GPL3')
makedepends=('git')
provides=('arch-frost')
conflicts=('arch-frost')
source=('arch-frost::git+https://github.com/osendott/arch-frost.git')
md5sums=('SKIP')


pkgver() {
    cd ${srcdir}/${_pkgname}
    echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}
package() {
  cd ${_pkgname}
  install -dm 755 "${pkgdir}"/usr/share/themes/Arch-Frost
  rm -R .git .gitignore arch-frost.tar.gz arch-frost.zip install.sh
  cp -r --no-preserve='ownership' arch-frost arch-frost-light arch-frost-shell "${pkgdir}"/usr/share/themes/Arch-Frost
  mkdir ~/Documents/Arch-Frost ~/Pictures/Arch-Frost-Wallpaper
  cp -r --no-preserve='ownership' README.md LICENSE credits changelog ~/Documents/Arch-Frost
  cp -r --no-preserve='ownership' wallpaper.png ~/Pictures/Arch-Frost-Wallpaper
}

Last edited by osendott (2015-05-04 04:08:46)

Offline

#22 2015-05-04 04:08:15

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,544

Re: PKGBUILD Review

No go. You missed the second part of post #17.

Why did you add the rm line? It doesn't seem to do anything useful.

Last edited by Scimmia (2015-05-04 04:08:43)

Offline

#23 2015-05-04 04:09:20

osendott
Member
Registered: 2015-05-03
Posts: 18

Re: PKGBUILD Review

oh crap i'm sorry i just forgot to remove it, yeah it's doing nothing

Offline

#24 2015-05-04 04:11:05

osendott
Member
Registered: 2015-05-03
Posts: 18

Re: PKGBUILD Review

yeah it's fixed on my end, and I also replaced the hard coded arch-frost with _pkgname, still no errors.

Offline

#25 2015-05-04 04:11:35

osendott
Member
Registered: 2015-05-03
Posts: 18

Re: PKGBUILD Review

# Maintainer: William Osendott <william.osendott@gmail.com>

_pkgname=arch-frost
pkgname=arch-frost-theme-git
pkgver=73.a4e1b1b
pkgrel=1
pkgdesc='Arch-Frost GTK and Gnome-Shell theme'
arch=('any')
url='https://github.com/osendott/arch-frost'
license=('GPL3')
makedepends=('git')
provides=('arch-frost')
conflicts=('arch-frost')
source=('arch-frost::git+https://github.com/osendott/arch-frost.git')
md5sums=('SKIP')


pkgver() {
    cd ${srcdir}/${_pkgname}
    echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}
package() {
  cd ${_pkgname}
  install -dm 755 "${pkgdir}"/usr/share/themes/Arch-Frost
  cp -r --no-preserve='ownership' arch-frost arch-frost-light arch-frost-shell "${pkgdir}"/usr/share/themes/Arch-Frost
  mkdir ~/Documents/Arch-Frost ~/Pictures/Arch-Frost-Wallpaper
  cp -r --no-preserve='ownership' README.md LICENSE credits changelog ~/Documents/Arch-Frost
  cp -r --no-preserve='ownership' wallpaper.png ~/Pictures/Arch-Frost-Wallpaper
}

Offline

Board footer

Powered by FluxBB