Помогите с зависимостями / Help with dependencies

Привет всем :enos:! Недавно я кое-как добавил свое приложение в AUR. И не смог разобраться какие зависимости ему нужны, вместо этого я использовал команду ldd klauspro прошелся по пакетам библиотек и добавил их в зависимости. Правильно ли я сделал?

Если что ссылка на пакет (там же исходный код):
https://aur.archlinux.org/packages/klaus-bin

А при сборке я следовал следующим инструкциям:

makepkg -si
tar -czvf klaus-bin.tar.gz PKGBUILD .SRCINFO
makepkg --printsrcinfo > .SRCINFO
git add PKGBUILD .SRCINFO
git commit -m "Initial commit"
git remote add aurbin ssh://aur@aur.archlinux.org/klaus-bin.git
git push aurbin master

Я мало что понимаю в AUR, помогите разобраться пожалуйста :enos: :enos: :enos:.

Hello everyone: enos:! I recently somehow added my app to the AUR. And I couldn’t figure out what dependencies it needed, instead I used the ldd klauspro command, went through the library packages and added them to the dependencies. Did I do it right?

If anything, link to the package (same source code):
https://aur.archlinux.org/packages/klaus-bin

And when building, I followed the following instructions:
makepkg -si
tar -czvf klaus-bin.tar.gz PKGBUILD .SRCINFO
makepkg --printsrcinfo > .SRCINFO
git add PKGBUILD .SRCINFO
git commit -m “Initial commit”
git remote add aurbin ssh://aur@aur.archlinux.org/klaus-bin.git
git push aurbin master

I don’t understand much about AUR, please help me figure it out :enos: :enos: :enos:.

# Maintainer: Dmali <dmali@vk.com>

pkgname=klaus-bin
pkgver=1.0
_releasedate=2023-05-18
pkgrel=1
pkgdesc="Best Arch Manager"
arch=('x86_64')
url="https://github.com/dmaliog/kLausqt/"
license=('GPL 2.0')
groups=()
depends=('qt5-webengine' 'qt5-base' 'qt5-declarative' 'qt5-multimedia' 'qt5-webchannel'
         'qt5-location' 'libglvnd' 'gcc-libs' 'glibc' 'icu' 'nss' 'nspr' 'zlib' 'libevent'
         'libjpeg-turbo' 'opus' 'ffmpeg' 'libvpx' 'libx11' 'libxcomposite' 'libxdamage'
         'libxext' 'libxfixes' 'libxrender' 'libxrandr' 'libxtst' 'glib2' 'libpng' 'libwebp'
         'freetype2' 'expat' 'fontconfig' 'harfbuzz' 're2' 'libxcb' 'libxkbcommon'
         'dbus' 'pciutils' 'alsa-lib' 'snappy' 'libxml2' 'libxslt' 'minizip' 'lcms2' 'libpulse'
         'md4c' 'krb5' 'openssl' 'systemd-libs' 'double-conversion' 'pcre2' 'zstd' 'xz'
         'dav1d' 'librsvg' 'cairo' 'aom' 'gsm' 'libjxl' 'lame' 'openjpeg2' 'rav1e' 'speex'
         'svt-av1' 'libtheora' 'libvorbis' 'x264' 'x265' 'xvidcore' 'libva' 'libmfx' 'bzip2'
         'libmodplug' 'libopenmpt' 'libbluray' 'gmp' 'gnutls' 'srt' 'libssh' 'libvdpau' 'libdrm'
         'intel-oneapi-compiler-shared-runtime' 'util-linux-libs' 'libffi' 'brotli' 'graphite'
         'libxau' 'libxdmcp' 'libpulse' 'e2fsprogs' 'keyutils' 'libcap' 'libgcrypt' 'lz4' 'libsoxr'
         'gdk-pixbuf2' 'pango' 'pixman' 'highway' 'libogg' 'mpg123' 'libp11-kit' 'libidn2'
         'libunistring' 'libtasn1' 'nettle' 'intel-oneapi-compiler-shared-runtime-libs'
         'libsndfile' 'libasyncns' 'libgpg-error' 'gcc-libs' 'libtiff' 'fribidi' 'libthai' 'flac'
         'libdatrie')

source=(
	"${pkgname}-${pkgver}.zip::${url}/releases/download/${pkgver}/klaus-${pkgver}-${_releasedate}-linux64.zip"
)

sha256sums=(
	'SKIP'
)

package() {
    mkdir -p ${pkgdir}/usr/bin/
    mkdir -p ${pkgdir}/usr/share/icons/hicolor/128x128/apps/

    install -Dm755 ./klaus/klauspro ${pkgdir}/usr/bin/klauspro

	install -Dt ${pkgdir}/usr/share/applications/ -m644 ./klaus/klaus.desktop
	install -Dt ${pkgdir}/usr/share/icons/hicolor/128x128/apps/ -m644 ./klaus/klaus.png
}

I didn’t read the source of your application in detail but it looks like a pretty straightforward Qt application.

It is exceptionally unlikely that you need all those dependencies. Your application itself probably only needs a couple of Qt dependencies.

On the other hand, you also need to add dependencies for the programs you use in your scripts. i.e. zenity and yay for example.

Also, a PKGBUILD for a binary should 100% have a checksum. You can easily populate that by running updpkgsums in the directory with your PKGBUILD.

1 Like

Можете помочь его составить? Насчет сумм я добавлю + yay и zenity. А что касаемо зависимостей, как понять какие нужны?

Can you help me compile it? As for the amounts, I’ll add + yay and zenity. And as for dependencies, how do I figure out which ones are needed?

QT += core gui widgets network webenginewidgets multimedia это то от чего зависит мое приложение? ’

QT += core gui widgets network webenginewidgets multimedia is this what my app depends on?

qt5-base,qt5-multimedia,qt5-network, qt5-webengine,qt5-widgets,qt5-xmlpatterns,yay, zenity,notify-send,konsole?

That seems more reasonable. You should probably have neofetch has an optdepend.

A few things I noticed in a brief look:

  • Do you really want to depend on konsole? It is pretty easy to support a list of common terminals. konsole has a massive amount of dependencies if you aren’t using plasma.
  • The wayland.sh script modifies grub configs and runs grub-mkconfig without checking to see if grub is in use. If this is for Arch, many Arch users use bootloaders other than grub.
  • Your main program loads translations but you didn’t make any of your string literals translatable.

qt5-base,qt5-multimedia,qt5-network, qt5-webengine,qt5-widgets,qt5-xmlpatterns,yay, zenity,notify-send,konsole, grub, neofetch

Хорошо, как думаете этот список подойдет чтобы ничего не сломалось у других пользователей?

Well, do you think this list is suitable so that nothing breaks for other users?

Насчет консоли, я только учусь и это моя первая программа. Я планирую сделать перевод на все языки и если будет возможно использовать встроенный терминал.

As for the console, I’m just learning and this is my first program. I plan to make a translation in all languages and if possible use the built-in terminal.

Temporarily remove the dependency on konsole and test the application in an environment without any Qt libraries installed like mate or a plain WM and see if it runs and functions properly.

The reason to temporarily drop konsole is it will also bring in tons of Qt and k* packages.

The issue I was pointing out is that your application strings aren’t translatable. You need to wrap string literals in tr() in most cases to make them translatable. For example:

ui->label1->setText("Добавить пакет в AUR");

should be:

ui->label1->setText(tr("Добавить пакет в AUR"));

Once you do that, anyone can make a translation for your application and submit it to you.

One more piece of advice I would share is that 6 months from now you will have no idea what label1 or action_18 are which will make your code hard to maintain. Instead, use meaningful names for those elements.

Спасибо за ценные советы, и спасибо за помощь. Я очень рад, что есть такие люди как вы, которые помогают начинающим пользователям, таким как я разобраться в некоторых непонятных моментах. В итоге получается примерно так?

Thank you for your valuable advice, and thank you for your help. I am very glad that there are people like you who help novice users like me to understand some of the incomprehensible points. The result is something like this?

# Maintainer: Dmali <dmali@vk.com>

pkgname=klaus-bin
pkgver=1.1
_releasedate=2023-05-19
pkgrel=1
pkgdesc="Arch manager that allows you to download, install, delete packages (including PKGBUILD changes) and display ratings and other things. Add/use automatic scripts to automate repeated actions. Add kernel modules and boot time to GRUB. View system logs. Enable auto-update of the system, delete orphans, and the package cache (with its configuration). There are recommended applications that allow you to install useful applications without problems."
arch=('x86_64')
url="https://github.com/dmaliog/kLausqt/"
license=('GPL 2.0')
groups=()
depends=('qt5-base' 'qt5-multimedia' 'qt5-network' 'qt5-webengine' 'qt5-widgets' 'qt5-xmlpatterns' 'yay' 'zenity' 'notify-send' 'konsole' 'neofetch')

source=(
	"${pkgname}-${pkgver}.zip::${url}/releases/download/${pkgver}/klaus-${pkgver}-${_releasedate}-linux64.zip"
)

sha256sums=(
	'd2369f869e0b2799ead447fd642bb42386d5452b09f6db1f04b91c3601ced040'
)

package() {
    mkdir -p ${pkgdir}/usr/bin/
    mkdir -p ${pkgdir}/usr/share/icons/hicolor/128x128/apps/

    install -Dm755 ./klaus/klauspro ${pkgdir}/usr/bin/klauspro

	install -Dt ${pkgdir}/usr/share/applications/ -m644 ./klaus/klaus.desktop
	install -Dt ${pkgdir}/usr/share/icons/hicolor/128x128/apps/ -m644 ./klaus/klaus.png
}

Не подскажите мне, глупому человеку, как теперь обновить PKGBUILD на сайте?
Также как я сделал это ранее?

Can you tell me, a stupid person, how to update PKGBUILD on the site now?
Just like I did earlier?

git add PKGBUILD .SRCINFO
git commit -m “Initial commit”
git remote add aurbin ssh://aur@aur.archlinux.org/klaus-bin.git
git push aurbin master
1 Like

На что посоветуете заменить konsole? Вы могли заметить у меня прописаны некоторые флаги которые помогают взаимодействовать с konsole…

What do you recommend replacing konsole with? You may have noticed that I have some flags registered that help me interact with konsole…

If you still have the exiting directory you can simply.

makepkg --printsrcinfo > .SRCINFO
git commit PKGBUILD .SRCINFO -m "Update to version 1.1"
git push

Похоже я что-то напутал…

Looks like I messed up something…: :grinning:

Missing dependencies:
→ qt5-network
→ qt5-widgets
→ notify-send

One option would be to have a list of acceptable options instead of relying on a single terminal.

For example, you could create a list like this:

struct Terminal {
    QString binary;
    QString args;
};

const QVector<Terminal> m_terminalList = {
    {"/usr/bin/konsole", "-e"},
    {"/usr/bin/gnome-terminal", "--"},
    {"/usr/bin/xfce4-terminal", "-x"},
    {"/usr/bin/lxterminal", "-e"},
    {"/usr/bin/xterm", "-e"},
    {"/usr/bin/alacritty", "-e"}
};

Then find an appropriate terminal like this:

Terminal getTerminal()
{
    // Iterate over the list until we find an installed terminal
    for (const Terminal &terminal : m_terminalList) {
        if (QFile::exists(terminal.binary)) {
            return terminal;
        }
    }

    // Return a default constructed Terminal if one if not found
    return Terminal();
}

In your application I would then create a function called something like runInTerminal(QStringList) and wrap everything you need in that so in your program you can call runInTerminal() and have it just work even if you decide to change the implementation later.

This is part of libnotify

I would try it without these and see if it works. Just make sure you are testing in a non-Qt environment.

Хорошо, спасибо сейчас попробую добавить возможность перевода, и попробую установить в другой среде, в виртуальной машине.

Okay, thanks now I’ll try adding the translation option, and I’ll try installing it in a different environment, in a virtual machine.

1 Like
remote: error: The following error occurred when parsing commit
remote: error: :
remote: error: pkgdesc field too long: Arch manager that allows you to download, install, delete packages (including PKGBUILD changes) and display ratings and other things. Add/use automatic scripts to automate repeated actions. Add kernel modules and boot time to GRUB. View system logs. Enable auto-update of the system, delete orphans, and the package cache (with its configuration). There are recommended applications that allow you to install useful applications without problems.
remote: error: hook declined to update refs/heads/master
To ssh://aur.archlinux.org/klaus-bin.git
 ! [remote rejected] master -> master (hook declined)
error: не удалось отправить некоторые ссылки в «ssh://aur.archlinux.org/klaus-bin.git»

Я понял что название слишком длинное но как теперь удалить файл и добавить по новой?

I realized that the name is too long, but now how do I delete the file and add a new one?

Я использовал

git remote add aur2 ssh://aur@aur.archlinux.org/klaus-bin.git  

makepkg --printsrcinfo > .SRCINFO
git commit PKGBUILD .SRCINFO -m "Update to version 1.1"
git push
git push aur2 master

and as I understand it, I created a lot of git remote add aur2, aurbin and so on how to remove them

Edit the file and then follow the same steps again. Change the commit description after the -m to whatever you want. Something like “Update description in PKGBUILD”

The fact is that I have already updated the file

# Maintainer: Dmali <dmali@vk.com>

pkgname=klaus-bin
pkgver=1.1
_releasedate=2023-05-19
pkgrel=1
pkgdesc="Arch manager that allows you to download, install, delete packages..."
arch=('x86_64')
url="https://github.com/dmaliog/kLausqt/"
license=('GPL 2.0')
groups=()
depends=('qt5-base' 'qt5-multimedia' 'qt5-webengine' 'qt5-xmlpatterns' 'yay' 'zenity' 'libnotify' 'konsole' 'neofetch')

source=(
	"${pkgname}-${pkgver}.zip::${url}/releases/download/${pkgver}/klaus-${pkgver}-${_releasedate}-linux64.zip"
)

sha256sums=(
	'd146f688d97e05021a8a98bd2cba763dc88bc2aa54d9f7f6ee445f210e14e09c'
)

package() {
    mkdir -p ${pkgdir}/usr/bin/
    mkdir -p ${pkgdir}/usr/share/icons/hicolor/128x128/apps/

    install -Dm755 ./klaus/klauspro ${pkgdir}/usr/bin/klauspro

	install -Dt ${pkgdir}/usr/share/applications/ -m644 ./klaus/klaus.desktop
	install -Dt ${pkgdir}/usr/share/icons/hicolor/128x128/apps/ -m644 ./klaus/klaus.png
}

only in the local folder

I tried it in mate, everything works fine, only I had to edit the missing CSS a little