brunelli / aurupbot

A script to automatically maintain your VCS-based AUR packages for you.
GNU General Public License v2.0
7 stars 1 forks source link

pkgbase not handled correctly #8

Closed stefanhusmann closed 9 years ago

stefanhusmann commented 9 years ago

If run onto a split package, aurupbot tries to download all the packages in the pkgname array, which is wrong and leaves stray and ampty git repos. If there is a pkgbase variable set, there is one git repo in AUR with that name. If pkgbase is not set, the first value name in the pkgname-array is taken as pkgbase.

brunelli commented 9 years ago

Could you provide an example?

stefanhusmann commented 9 years ago

"aurupbot handbrake-svn" creates three git repos, two empty ones and one working one. "aurupbot lrexlib" creates 5 empty repos.

brunelli commented 9 years ago

Oh, now I understand what you're talking about...

But I'm not sure yet about the implementation. For example:

The handbrake-svn is not listed in AUR, but its "children" (handbrake-cli-svn and handbrake-gtk-svn) are listed. So, what should I do when getting a list of user packages? Should I update the two packages? Should I update only handbrake-svn? Should I update everything?

If I update only handbrake-svn, will the two be updated too?

stefanhusmann commented 9 years ago

The handbrake-svn is not listed in AUR, but its "children" (handbrake-cli-svn and handbrake-gtk-svn) are listed. So, what should I do when getting a list of user packages?

handbrake-svn is not listed in the aurweb search list, but if you click on one of the packages you will see that there is a "Package base" shown on the AUR page.

Should I update only handbrake-svn? Yes, the other ones will be updated automagically.

I think the following function needs to be changed.

get_user_packages() {
  echo "==> Getting packages maintained by $1"

  USER_PKGS=$( curl -s "https://aur.archlinux.org/rpc.php?type=msearch&arg=$1" |
               grep -Po '"Name":.*?[^\\],' |
               cut -f 4 -d \" )

  [ "$USER_PKGS" ] &&
  echo $( wc -w <<< "$USER_PKGS" ) "package(s) found:" $USER_PKGS ||
      echo "No package found." 2>&2
  for iter in $USER_PKGS
  do
      PKGBASE=$( grep -m 1 -e "^[[:space:]]*pkgbase" PKGBUILD |
               cut -f 1 -d "=" --complement | tr -d \'\"\(\) ) # this was stolen from your code of the PKGNAME variable
      if [ $PKGBASE != "" ]; then
      # add $PKGBASE to a new array, say NEW_USER_PKGS
      else
      # add the element itself to the new array
      fi
}

That would work if there is a pkgbase defined in the PKGBUILD. I currently have not idea if this is not the case but the PKGBUILD has more than one pkgname.

brunelli commented 9 years ago

handbrake-svn is not listed in the aurweb search list, but if you click on one of the packages you will see that there is a "Package base" shown on the AUR page.

Yeap, that was exactly what I meant.

Yes, the other ones will be updated automagically.

Okay, that's very good.

I think the following function needs to be changed.

Nope, it will require more complex changes...

What should happen if you run, let's say, aurupbot handbrake-gtk-svn? Should I update only handbrake-gtk-svn? Should I update the pkgbase?

Also, aurupbot handbrake-svn functioned flawlessly here. It built the two packages and committed the changes. Couldn't test with lrexlib though. Could you provide the logs?

I'll take a look at this sunday night or monday morning. Right now I'm busy with other things, sorry...

stefanhusmann commented 9 years ago

What should happen if you run, let's say, aurupbot handbrake-gtk-svn? Should I update only handbrake-gtk-svn?

Yes, it is the same PKGBUILD.

Also, aurupbot handbrake-svn functioned flawlessly here.

Indeed. Maybe the stray-repo-issue will only happen when the -u option is involved? I will check that.

Couldn't test with lrexlib though. Could you provide the logs?

There are no logs. The PKGBUILD has no pkgver function, so aurupbot does nothing more than checking them out.

I'll take a look at this sunday night or monday morning. Right now I'm busy with other things, sorry...

No need to apologize, we all have a personal life. Thank you for your help

stefanhusmann commented 9 years ago

Indeed the stray repos only come up in conjunction with the -u option.

brunelli commented 9 years ago

@stefanhusmann Please test and post in here if something else needs to be added.

stefanhusmann commented 9 years ago

Thanks, works fine.