You are not logged in.

#1 2021-02-21 22:36:06

Pyntux
Member
From: Serbia
Registered: 2008-12-21
Posts: 391

Can somebody please help me to make AUR package of my app? :)

I'm just asking for help. I tried but it didn't work.

I'm new to the python world and I don't know how to pack an AUR app. I would ask you to point me to what I should pay attention to, considering that I don't understand git the best also...

So, my app is here:

https://github.com/Pyntux/TimerDown

a small app, but it's mine smile


I do not speak English, but I understand...

Offline

#2 2021-02-21 23:35:54

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

Re: Can somebody please help me to make AUR package of my app? :)

What did you try that didn't work? This should be trivial, so you probably just missed something small.

Last edited by Scimmia (2021-02-21 23:36:08)

Online

#3 2021-02-22 10:09:22

Pyntux
Member
From: Serbia
Registered: 2008-12-21
Posts: 391

Re: Can somebody please help me to make AUR package of my app? :)

I tried to make PKGBUILd...

I do not know do I need to first package this following python instructions, then make PKGBUILD or just make PKGBUILD with git clone option? Can you point me to an example what to do?


I do not speak English, but I understand...

Offline

#4 2021-02-22 10:28:40

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
Website

Re: Can somebody please help me to make AUR package of my app? :)

Post your PKGBUILD.  You can browse existing python PKGBUILDs in the AUR or the official repos if you need more examples than /usr/share/pacman/PKGBUILD.proto

Last edited by graysky (2021-02-22 10:46:10)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#5 2021-02-22 13:38:23

metak
Member
Registered: 2009-09-27
Posts: 198

Re: Can somebody please help me to make AUR package of my app? :)

pkgname=timerdown-git
pkgver=r75.g11ba12c
pkgrel=1
pkgdesc="A simple python & pyQT5 app to turn off your PC in 'X' minutes"
url="https://github.com/Pyntux/TimerDown"
arch=('any')
license=('GPL3')
depends=('python-pyqt5')
makedepends=('git')
provides=("${pkgname%-*}")
conflicts=("${pkgname%-*}")
source=("${pkgname%-*}::git+${url}.git")
sha256sums=('SKIP')

pkgver() {
  cd "${pkgname%-*}"
  printf "r%s.g%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

package() {
  cd "${pkgname%-*}"
  install -d "$pkgdir"/usr/{bin,share/timerdown}
  cp -r {icons,TimerDown.py} "$pkgdir/usr/share/${pkgname%-*}"
  echo "#!/bin/sh
python /usr/share/timerdown/TimerDown.py" >> "$pkgdir/usr/bin/${pkgname%-*}"
  chmod +x "$pkgdir/usr/bin/${pkgname%-*}"
}

Offline

#6 2021-02-22 15:06:57

Pyntux
Member
From: Serbia
Registered: 2008-12-21
Posts: 391

Re: Can somebody please help me to make AUR package of my app? :)

@metak

Great! Thank you very much! big_smile

Can you explain me about pkgver a bit? Where to get that info?

Everything else is cristal clear, except runing app from terminal "timerdown", which call bash script, starts app but without icons from icons dir in /usr/share/timerdown...


OK, I could make resources file for that...

Last edited by Pyntux (2021-02-22 15:09:29)


I do not speak English, but I understand...

Offline

#7 2021-02-22 15:19:19

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,563

Re: Can somebody please help me to make AUR package of my app? :)

Can you explain me about pkgver a bit? Where to get that info?

https://wiki.archlinux.org/index.php/PKGBUILD

Offline

#8 2021-02-22 15:36:41

Pyntux
Member
From: Serbia
Registered: 2008-12-21
Posts: 391

Re: Can somebody please help me to make AUR package of my app? :)

OK, thanks


I do not speak English, but I understand...

Offline

#9 2021-02-22 15:39:53

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

Re: Can somebody please help me to make AUR package of my app? :)

Pyntux wrote:

starts app but without icons from icons dir in /usr/share/timerdown...

That's an error in your code, not in the packaging.  As written, your code assumes that the current working directory is next to the icon directory - that is a very bad assumption.  Use absolute paths (constructed from the appropriate python variable for getting resource directories).


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#10 2021-02-22 15:42:25

metak
Member
Registered: 2009-09-27
Posts: 198

Re: Can somebody please help me to make AUR package of my app? :)

@Pyntux

As others have linked the wiki links for creating pkgbuild files you should check them out, because it's all in there.
Regarding the script, it's to make it integrate better so it's easier to launch. Missing icons are because the you're supposed to be in the same directory when launching the app.?

  echo "#!/bin/sh
cd /usr/share/timerdown && python TimerDown.py" >> "$pkgdir/usr/bin/${pkgname%-*}"

Offline

#11 2021-02-22 15:55:03

Pyntux
Member
From: Serbia
Registered: 2008-12-21
Posts: 391

Re: Can somebody please help me to make AUR package of my app? :)

Yes, app is not made to launch that way, noob mistake, I am very, very new in programing.... I gonna change code...

With resource file everything works great... So... git push.... smile

##### EDIT:

I added timerdown.desktop, timerdown.ico for desktop file and resources file, and change code to use that resources file.... I will eventualy delete icons dir from git etc...

Here is PKGBUILD now:

 
pkgname=timerdown-git
pkgver=r82.gc2d001f
pkgrel=1
pkgdesc="A simple python & pyQT5 app to turn off your PC in 'X' minutes"
url="https://github.com/Pyntux/TimerDown"
arch=('any')
license=('GPL3')
depends=('python-pyqt5')
makedepends=('git')
provides=("${pkgname%-*}")
conflicts=("${pkgname%-*}")
source=("${pkgname%-*}::git+${url}.git")
sha256sums=('SKIP')

pkgver() {
  cd "${pkgname%-*}"
  printf "r%s.g%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

package() {
  cd "${pkgname%-*}"
  install -d "$pkgdir"/usr/{bin,share/timerdown,share/applications}
  cp -r {resources.py,timerdown.ico,TimerDown.py} "$pkgdir/usr/share/${pkgname%-*}"
  cp -r {TimerDown.desktop,} "$pkgdir/usr/share/applications/${pkgname%-*}.desktop"
  echo "#!/bin/sh
python /usr/share/timerdown/TimerDown.py" >> "$pkgdir/usr/bin/${pkgname%-*}"
  chmod +x "$pkgdir/usr/bin/${pkgname%-*}"
}

Last edited by Pyntux (2021-02-22 16:27:44)


I do not speak English, but I understand...

Offline

#12 2021-02-22 17:51:50

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,563

Re: Can somebody please help me to make AUR package of my app? :)

Congratulations! I ran makepkg and the package installed correctly. I would suggest simplifying your pkgver naming scheme that is easy to follow.
Some notes on the app:
You can't resize the window.
Default window too small (particularly on a 4K).
Would be nice to have an Enabled/Disabled button.

EDIT: And the reset button hangs.

Last edited by d_fajardo (2021-02-22 17:54:00)

Offline

#13 2021-02-22 19:00:21

Pyntux
Member
From: Serbia
Registered: 2008-12-21
Posts: 391

Re: Can somebody please help me to make AUR package of my app? :)

@d_fajardo

First, thank you!

The application code is very rough, there is room for repairs ...I will pay attention to all your suggestions and as much as my modest knowledge allows, I will fix what I can ...


https://aur.archlinux.org/packages/timerdown-git/

Last edited by Pyntux (2021-02-22 21:38:53)


I do not speak English, but I understand...

Offline

#14 2021-03-02 00:46:02

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Can somebody please help me to make AUR package of my app? :)

pyrcc is removed in Qt6, I would not depend on it. For python modules, importlib.resources is the preferred solution on the python level so there is not much use for RCC and the PyQt developer dropped support.

However, I'm rather curious why you don't install TimerDown.py to /usr/bin/ and have it look in hardcoded /usr/share/timerdown, or possibly use a Makefile that sets this up via make PREFIX=...

Failing that, you should still NOT use cd and check in the current directory... you should have TimerDown.py look for the icon files in

os.path.join(os.path.dirname(__file__), 'icons')

Last edited by eschwartz (2021-03-02 00:46:29)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#15 2021-03-02 21:32:36

Pyntux
Member
From: Serbia
Registered: 2008-12-21
Posts: 391

Re: Can somebody please help me to make AUR package of my app? :)

@eschwartz

I will setup script to look for icons in to / path or (and) look at "importlib.recources"... For everything else, my knowledge is small sad

I'm not a programmer, just a longtime Gnu/Linux user who has a desire to learn a little python.... My job is far from any use of a computer and it is a real miracle that I made this...

I appreciate that you drew my attention to the mistakes and gave me instructions, I will try to improve my knowledge, any help is welcome ....


os.path.join(os.path.dirname(__file__), 'icons')

I will try this...

Thank you!


Edit:

you were right about TimerDown.py in /usr/bin, that is way better.... Also i will change script to look for icons in /usr/share/timerdown/icons/, (without resources file) that can resolve some my problems... Like this:

pkgname=timerdown-git
pkgver=r8.g733d99e
pkgrel=1
pkgdesc="A simple python & pyQT5 app to turn off your PC in 'X' minutes"
url="https://github.com/Pyntux/TimerDown"
arch=('any')
license=('GPL3')
depends=('python-pyqt5')
makedepends=('git')
provides=("${pkgname%-*}")
conflicts=("${pkgname%-*}")
source=("${pkgname%-*}::git+${url}.git")
sha256sums=('SKIP')

pkgver() {
  cd "${pkgname%-*}"
  printf "r%s.g%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

package() {
  cd "${pkgname%-*}"
  install -d "$pkgdir"/usr/{bin,share/timerdown,share/applications}
  cp -r {icons,timerdown.ico} "$pkgdir/usr/share/${pkgname%-*}"
  cp -r {TimerDown.py,} "$pkgdir/usr/bin/${pkgname%-*}"
  cp -r {TimerDown.desktop,} "$pkgdir/usr/share/applications/${pkgname%-*}.desktop"
  chmod +x "$pkgdir/usr/bin/${pkgname%-*}"
} 

Last edited by Pyntux (2021-03-02 22:48:28)


I do not speak English, but I understand...

Offline

#16 2021-03-03 00:48:53

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Can somebody please help me to make AUR package of my app? :)

Nice!

You may also want to add a small Makefile, so it's clear to people how to use the software on any distro:

install:
	install -d '$(DESTDIR)'/usr/bin/
	install -m755 TimerDown.py '$(DESTDIR)'/usr/bin/timerdown
	install -d '$(DESTDIR)'/usr/share/timerdown/
	cp -r icons/ timerdown.ico '$(DESTDIR)'/usr/share/timerdown/
	install -d '$(DESTDIR)'/usr/share/applications/
	cp TimerDown.desktop '$(DESTDIR)'/usr/share/applications/timerdown.desktop

Then change the PKGBUILD to install like this:

package() {
    cd "${pkgname%-*}"
    make install DESTDIR="$pkgdir"
}

Last edited by eschwartz (2021-03-03 00:50:02)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#17 2021-03-03 05:59:36

Pyntux
Member
From: Serbia
Registered: 2008-12-21
Posts: 391

Re: Can somebody please help me to make AUR package of my app? :)

Great! smile

I really appreciate the help, thank you very much!!!

I will change today PKGBUILD for both packages in AUR after my daily job big_smile

Edit:

Summary:

I added "Makefile" to git repo based on your instructions... Now, PKGBUILD (for timerdown "no git version") looks like this:

# Maintainer: Pyntux <pyntux@gmail.com>

pkgname=timerdown
pkgver=0.2.1
pkgrel=1
pkgdesc="A simple python & pyQT5 app to turn off your Linux PC in "X" minutes or "X" hours, or at specified time."
url="https://github.com/Pyntux/TimerDown"
arch=('any')
license=('GPL3')
depends=('python-pyqt5')
makedepends=('git')
provides=("${pkgname%-*}")
conflicts=("${pkgname%-*}")
source=("$pkgname::git+$url.git#tag=v$pkgver")
sha256sums=('SKIP')


package() {
    cd "${pkgname%-*}"
    make install DESTDIR="$pkgdir"
}

Same is for git version + git version control code etc...

.... simple and clean... smile

Also, do I need to copy GPL3 licence somewhere or not? And, do I need to add something more to PKGBUILD? And, is there any way to get shorter pkgver number for git version?

Thank you!

Last edited by Pyntux (2021-03-03 09:45:47)


I do not speak English, but I understand...

Offline

Board footer

Powered by FluxBB