How to upload PKGBUILD to AUR

Hey,

like somebody may know, i try to figure out how to upload a PKGBUILD to AUR.

Now i have set up my VM where i can learn/test it how to do it.

I followed this Guide: https://wiki.archlinux.org/title/AUR_submission_guidelines

But it didnt seem to work.

I have done this:

I crated the config file under .ssh with the content:

Host aur.archlinux.org
IdentityFile ~/.ssh/aur
User aur

Than i created a SSH Key pair with

ssh-keygen -f ~/.ssh/aur

then i uploaded the content of aur.pub to my aur profile.

Than i have done this:

git clone ssh://aur@aur.archlinux.org/pkgbase.git

Than this:

git remote add label ssh://aur@aur.archlinux.org/pkgbase.git

And got this Error?:

[user@endeavourosvm ~]$ git remote add label ssh://aur@aur.archlinux.org/pkgbase.git
fatal: Kein Git-Repository (oder irgendein Elternverzeichnis bis zum Einhängepunkt /)
Stoppe bei Dateisystemgrenze (GIT_DISCOVERY_ACROSS_FILESYSTEM nicht gesetzt).
[user@endeavourosvm ~]$

And what i find interessting, i have following PKGBUILD in the pkgbase folder:

Maintainer Seva Alekseyev sevaa@yarxi.ru

Maintainer Stoyan Minaev stoyan.minaev@gmail.com

pkgbase=pkgbase
pkgname=yarxi
pkgver=1.10
pkgrel=1
pkgdesc=“Japanese-Russian kanji and word dictionary”
url=“http://www.susi.ru/yarxi/”
license=(‘custom’)
_source=(
“http://www.susi.ru/yarxi/yarxi_${pkgver}-${pkgrel}_amd64.deb”
“http://ftp.uk.debian.org/debian/pool/main/q/qt4-x11/libqtcore4_4.8.7+dfsg-11_amd64.deb”
“http://ftp.uk.debian.org/debian/pool/main/q/qt4-x11/libqtgui4_4.8.7+dfsg-11_amd64.deb”
“http://ftp.uk.debian.org/debian/pool/main/q/qt4-x11/libqt4-network_4.8.7+dfsg-11_amd64.deb”
)
arch=(‘x86_64’)
_md5sums=(
‘812d2265816ed781751c5c0eb6664d91’
‘b243ada8569b2b3d4586dc4178fd8d56’
‘797e351a57c9d56368f710e7cba40f21’
‘b3cff12767e21d3a76794046557d3df0’
)
depends=(
ttf-sazanami nas
)

prepare() {
cd $srcdir/
echo “Due to ‘makepkg’ and ‘PKGBUILD’ specs limitations I need to dowanload sources and validate them by myself”
for source_url in ${_source[@]}; do
source_filename=${source_url##/}
if [ ! -f “$source_filename” ]; then
echo “Downloading next source - $source_filename …”
curl -A DUMMY -O “$source_url”;
else
echo “Found already downloaded source - $source_filename”
fi
done
echo “And now we must validated dowanloaded sources …”
for (( i=0; i<${#_source[@]}; ++i )); do
source_url=${_source[i]}
source_filename=${source_url##
/}
source_expected_md5sum=${_md5sums[i]}
source_actual_md5sum=$(md5sum $source_filename | awk ‘{print $1}’)
if [ “$source_actual_md5sum” == “$source_expected_md5sum” ]; then
echo “Validated next source - $source_filename”
else
echo “Found corrupted source - $source_filename”; return 1
fi
done
}

build() {
cd $srcdir/
mkdir -p deb/{$pkgname,qt4core,qt4gui,qt4network}
bsdtar xf yarxi_${pkgver}-${pkgrel}_amd64.deb -C deb/$pkgname/
bsdtar xf libqtcore4_4.8.7+dfsg-11_amd64.deb -C deb/qt4core/
bsdtar xf libqtgui4_4.8.7+dfsg-11_amd64.deb -C deb/qt4gui/
bsdtar xf libqt4-network_4.8.7+dfsg-11_amd64.deb -C deb/qt4network/
for dir in deb/$pkgname deb/qt4core deb/qt4gui deb/qt4network; do
cd $dir; tar xf data.tar.*; cd $srcdir
done
}

package() {
cd $srcdir/
mkdir -p $pkgdir/usr/lib/
mkdir -p $pkgdir/usr/bin/
mkdir -p $pkgdir/usr/share/
mkdir -p $pkgdir/usr/share/applications/
mkdir -p $pkgdir/usr/share/doc/$pkgname/
mkdir -p $pkgdir/usr/share/icons/hicolor/{16x16/apps,32x32/apps,48x48/apps}/
mkdir -p $pkgdir/usr/share/pixmaps/
mkdir -p $pkgdir/usr/share/$pkgname/
install -m 0755 $srcdir/deb/$pkgname/usr/bin/$pkgname $pkgdir/usr/bin/$pkgname
install -m 0755 $srcdir/deb/qt4core/usr/lib/x86_64-linux-gnu/libQtCore.so.4.8.7 $pkgdir/usr/lib/libQtCore.so.4
install -m 0755 $srcdir/deb/qt4gui/usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.7 $pkgdir/usr/lib/libQtGui.so.4
install -m 0755 $srcdir/deb/qt4network/usr/lib/x86_64-linux-gnu/libQtNetwork.so.4.8.7 $pkgdir/usr/lib/libQtNetwork.so.4
install -m 0644 $srcdir/deb/$pkgname/usr/share/applications/seva-yarxi.desktop $pkgdir/usr/share/applications/
install -m 0644 $srcdir/deb/$pkgname/usr/share/doc/$pkgname/copyright $pkgdir/usr/share/doc/$pkgname/
for icons in 16x16 32x32 48x48; do
install -m 0644 $srcdir/deb/$pkgname/usr/share/icons/hicolor/$icons/apps/seva-yarxi.png $pkgdir/usr/share/icons/hicolor/$icons/apps/
done
install -m 0644 $srcdir/deb/$pkgname/usr/share/pixmaps/*.xpm $pkgdir/usr/share/pixmaps/
install -m 0644 $srcdir/deb/$pkgname/usr/share/$pkgname/yarxice.db $pkgdir/usr/share/$pkgname/
}

#vim: syntax=sh

For what? As example? Have i to delete this?

Anyway, replaced it with my PKGBUILD.

and tried:

git add PKGBUILD

But got same Error? like above.

So, i dont know what further todo and need help :grinning_face_with_smiling_eyes:

(and im still mad that i cant simply upload via browser!! :stuck_out_tongue_closed_eyes:)

You need to change the pkgbase to an actual name, or remove the line altogether.

Replace pkgbase with an actual name.

Before you do this, you need to cd inside the folder you just cloned. The folder name will be the same as the name you replaced pkgbase with in last command. Also, replace label with a name you’d like to put. Not necessary, but I prefer using origin.

Because you cloned pkgbuild for the package called pkgbase. You’re supposed to change the name. Also, I suppose the maintainer of the pkgbuild you cloned made the same mistake, and pushed their pkgbuild with a wrong name.


Listing the steps briefly:

Assuming your ssh key is set up all right.

Lets say the package it want to upload is named is geek-chat.

I do

git clone ssh://aur@aur.archlinux.org/geek-chat.git
cd geek-chat
git remote add origin ssh://aur@aur.archlinux.org/geek-chat.git
git fetch origin

Now copy your PKGBUILD into this folder. Then below commands

makepkg --printsrcinfo > .SRCINFO
git add PKGBUILD .SRCINFO
git commit -m "commit message"
git push

Replace commit message with an actual descriptive one line message.

I’m not sure if git push will work the first time you do it. You may need to do git push -u origin master.

1 Like

Thanks!

It seems i need anywhere to create a Account? Because:

[user@endeavourosvm ~]$ ls
pkgbase PKGBUILD
[user@endeavourosvm ~]$ rm -Rf pkgbase/
[user@endeavourosvm ~]$ git clone ssh://aur@aur.archlinux.org/borgrestore.git
Klone nach ‘borgrestore’…
warning: Sie scheinen ein leeres Repository geklont zu haben.
[user@endeavourosvm ~]$ ls
borgrestore PKGBUILD
[user@endeavourosvm ~]$ mv PKGBUILD borgrestore/
[user@endeavourosvm ~]$ ls
borgrestore
[user@endeavourosvm ~]$ cd borgrestore/
[user@endeavourosvm borgrestore]$ ls
PKGBUILD
[user@endeavourosvm borgrestore]$ git remote add origin ssh://aur@aur.archlinux.org/borgrestore.git
error: externes Repository origin existiert bereits.
[user@endeavourosvm borgrestore]$ git fetch origin
[user@endeavourosvm borgrestore]$ ls
PKGBUILD
[user@endeavourosvm borgrestore]$ makepkg --printsrcinfo > .SRCINFO
[user@endeavourosvm borgrestore]$ cat .SRCINFO
pkgbase = borgrestore
pkgdesc = Puts the system in exactly the same state as it is in a Borg snapshot.
pkgver = 0.1
pkgrel = 0.1
arch = any
depends = git
depends = borg
depends = python-llfuse
optdepends = vorta: a nice Borg GUI
source = git+https://github.com/solisinvictum/borgrestore.git
sha512sums = SKIP

pkgname = borgrestore
[user@endeavourosvm borgrestore]$ git add PKGBUILD .SRCINFO
[user@endeavourosvm borgrestore]$ git commit -m “upload borgrestore”
Identität des Autors unbekannt

*** Bitte geben Sie an, wer Sie sind.

FĂźhren Sie

git config --global user.email “you@example.com”
git config --global user.name “Your Name”

aus, um das als Ihre standardmäßige Identität zu setzen.
Lassen Sie die Option “–global” weg, um die Identität nur
fĂźr dieses Repository zu setzen.
fatal: Konnte die E-Mail-Adresse nicht automatisch erkennen (‘user@endeavourosvm.(none)’ erhalten)
[user@endeavourosvm borgrestore]$ git push
error: Src-Refspec refs/heads/master entspricht keiner Referenz.
error: Fehler beim Versenden einiger Referenzen nach ‘ssh://aur.archlinux.org/borgrestore.git’
[user@endeavourosvm borgrestore]$ git push -u origin master
error: Src-Refspec master entspricht keiner Referenz.
error: Fehler beim Versenden einiger Referenzen nach ‘ssh://aur.archlinux.org/borgrestore.git’
[user@endeavourosvm borgrestore]$

Edit:

ok found https://wiki.archlinux.org/title/Git#Configuration

But if i try that:

[user@endeavourosvm borgrestore]$ git config --global solisinvictum
error: Schlßssel enthält keine Sektion: solisinvictum
[user@endeavourosvm borgrestore]$

Looks like you haven’t set up git.

Run these

git config --global user.email “username@email.com”
git config --global user.name “Your Name”

Replace username@email.com and Your Name with actual email and names.

Do note, users will be able to see the email, so you may want to use an alternate email or a non existent email. That being said, I haven’t faced any spam.

Edit:

after this, run the commit command

1 Like

Also, if you’re not comfortable with git/pkgbuild, I could maintain the package on AUR for you?

lol. Thanks! I already asked here: Suggestion of Packages for the EndeavourOS Repo :grinning_face_with_smiling_eyes:

But sorry. Very nice of you. But now is too late. Now i want to learn it how to upload/manage it to AUR.

I now really good how to create/maintaine PKGBUILD self. Wich folders i dont allow to use, the regulations and so on. This not my first time.

Its only my first time to upload it via git. Years ago i could do it simply via browser.

Yeah there i was little faster as you :slight_smile:

Found the Wikientry about that. but it seems its still something wrong:

[user@endeavourosvm borgrestore]$ git config --global solisinvictum
error: Schlßssel enthält keine Sektion: solisinvictum
[user@endeavourosvm borgrestore]$

My Goal is to upload/maintain the Packages borgrestore, ds360 and wireguird.

Does not look like correct command.

See the commands here

This is same as the one given on link you posted earlier : https://wiki.archlinux.org/title/Git#Configuration

Ah, i thought i need to replace “user.name” with the actual username.

Nice:

https://aur.archlinux.org/packages/borgrestore/

It worked.

1 Like

Installed it :+1:

1 Like

Now i need to learn how to update it?

Or to do this, need i to do all steps again?

When updating, you edit Pkgbuild with new version name and any other command (if needed)

Then

makepkg --printsrcinfo > .SRCINFO
git add PKGBUILD .SRCINFO
git commit -m "commit message"
git push
1 Like

Ok. Understand.

And for a new pakage it would be like so:

git clone ssh://aur@aur.archlinux.org/NEW_PACKAGE.git
cd NEW_PACKAGE
git remote add origin ssh://aur@aur.archlinux.org/NEW_PACKAGE.git
git fetch origin

makepkg --printsrcinfo > .SRCINFO
git add PKGBUILD .SRCINFO
git commit -m “commit message”
git push

Yes. :+1:

Nice. Thanks a lot for your help and clearification how to do it.

Pushed a new update to borgrestore because of https://github.com/solisinvictum/borgrestore/commit/89a0b621e6fc702f5c0f32cb3c06dd7577a19c4b

and it worked :slight_smile:

Now i know how to do it. Thanks!

1 Like

Hey sorry for jumping in. I just wanted to know because I’m also trying to learn AUR upload.

The only things that one needs to have configured are an SSH key on his/her AUR/Arch account and to have a similar git repo set at AUR just like we do for GitLab or GitHub. Clone a repo from AUR copy files from my repo to the AUR repo folder thenPKGBUILD with a .SRCINFOand then push the content of the current AUR repo folder to the AUR repo.

Am I correct?

Didn’t understand this part :thinking:

When you clone a package link that does not exist, you get an empty repo. And when you make the first commit to it and push, the package automatically gets associated with your account.

Yes. Just make sure the link you clone doesn’t already exist.

1 Like

Yes.

Liked described here. @flyingcakes did a good job to explain it to me.

I was referring to this command.
git clone ssh://aur@aur.archlinux.org/NEW_PACKAGE.git

Because we do the same when we’re cloning from a GitLab or Hub repo. But I don’t see a way to create a repo beforehand like in GitLab or Hub.

Just running git clone with the ssh://aur@aur.archlinux.org initiate the local repo then push would initiate remote repo at AUR and create it. Is that what happens?

AUR automatically creates a repo (aka package page) when you push at a link that doesn’t yet exist.

Thank you,

This is what I was confused about because GitLab or Hub kind of need to have the repo ready when pushing from local to remote (correct me if I’m worng).

1 Like