oshazard / apacman

ArchLinux User Repository (AUR) helper and pacman wrapper
https://aur.archlinux.org/packages/apacman/
GNU General Public License v3.0
70 stars 11 forks source link

AUR 4 #18

Closed helixarch closed 9 years ago

helixarch commented 9 years ago

It needs AUR 4 support

ghost commented 9 years ago

there's fledgling support- you can change the URL's used in /etc/apacman.conf

RPCURL="https://aur.archlinux.org/rpc.php?type" PKGURL="https://aur.archlinux.org"

These can be set to aur4. HOWEVER, the compatibility fails as the output differs slightly. e.g.: AUR3 (https://aur.archlinux.org/rpc.php?type=info&arg=dumpet):

{"version":1,"type":"info","resultcount":1,"results":{"ID":79002,"Name":"dumpet","PackageBaseID":79002,"PackageBase":"dumpet","Version":"2.1-2","CategoryID":16,"Description":"A tool for debugging El Torito boot images.","URL":"https:\/\/fedorahosted.org\/dumpet\/","NumVotes":1,"OutOfDate":0,"Maintainer":"sanerb","FirstSubmitted":1392392790,"LastModified":1392392994,"License":"GPL2","URLPath":"\/packages\/du\/dumpet\/dumpet.tar.gz"}}

AUR4 (https://aur.archlinux.org/rpc.php?type=info&arg=dumpet):

{"version":1,"type":"info","resultcount":1,"results":{"ID":184267,"Name":"dumpet","PackageBaseID":79002,"PackageBase":"dumpet","Version":"2.1-2","Description":"A tool for debugging El Torito boot images.","URL":"https:\/\/fedorahosted.org\/dumpet\/","NumVotes":1,"OutOfDate":0,"Maintainer":"sanerb","FirstSubmitted":1392392790,"LastModified":1433780379,"License":"GPL2","URLPath":"\/cgit\/aur.git\/snapshot\/dumpet.tar.gz","CategoryID":1,"Popularity":0}}

Here's what the diff looks like (piped through jshon):

6c6
<   "ID": 79002,
---
>   "ID": 184267,
11d10
<   "CategoryID": 16,
18c17
<   "LastModified": 1392392994,
---
>   "LastModified": 1433780379,
20c19,21
<   "URLPath": "\/packages\/du\/dumpet\/dumpet.tar.gz"
---
>   "URLPath": "\/cgit\/aur.git\/snapshot\/dumpet.tar.gz",
>   "CategoryID": 1,
>   "Popularity": 0

@oshazard what kind of changes need to be made to the parsing for this?

ghost commented 9 years ago

untested, but tada:

diff --git a/apacman b/apacman
index 703a1d7..73a3261 100755
--- a/apacman
+++ b/apacman
@@ -408,7 +408,7 @@ abslink() {
 pkginfo() {
   if ! [[ -f "$tmpdir/$1.PKGBUILD" ]]; then
     pkgpath=$(pkglink $1)
-    curl -Lfs "${pkgpath%/*}/PKGBUILD" > "$tmpdir/$1.PKGBUILD"
+    curl -Lfs "${pkgpath%/*/*}/plain/PKGBUILD?h=${1}" > "$tmpdir/$1.PKGBUILD"
     if [[ $2 ]]; then
       # rename for syntax highlighting
       cp "$tmpdir/$1.PKGBUILD" "$tmpdir/PKGBUILD"
diff --git a/apacman.conf b/apacman.conf
index 1f7f272..6d1e235 100644
--- a/apacman.conf
+++ b/apacman.conf
@@ -36,8 +36,8 @@
 #downdir="/var/cache/pacman/pkg"
 #savedir="/var/cache/apacman/pkg"
 #editor="nano -w"
-#RPCURL="https://aur.archlinux.org/rpc.php?type"
-#PKGURL="https://aur.archlinux.org"
+#RPCURL="https://aur4.archlinux.org/rpc.php?type"
+#PKGURL="https://aur4.archlinux.org"
 #ABSURL="rsync.archlinux.org"

 #

someone want to test those changes for me? tested, seems to do the trick.

EDIT: i am a gorram silly ninny. the issue i mention below? yeah. uh, i missed a slash in the PKGBUILD url. lolz. it's late.

@oshazard i'll create a PR for this.

oshazard commented 9 years ago

Thank you @bts368 . Merged. I have a couple more changes to make and still need to migrate my packages to AUR4

oshazard commented 9 years ago

Wrote this quickly to migrate packages, might be useful for someone else: https://gist.github.com/oshazard/370c7ed631af2181ee51

oshazard commented 9 years ago

ATTN: @helixarch @bts368