You are not logged in.

#601 2012-01-18 23:49:10

keenerd
Trusted User (TU)
Registered: 2007-02-22
Posts: 647
Website

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

Sorry, I was being an idiot.  Your bug is legit.  Here is the simplest patch for it:

line 252:
${EDITOR:-vi} "$2"
should be replaced with
eval ${EDITOR:-vi} "$2"

Offline

#602 2012-01-18 23:58:02

emphire
Member
From: Canada
Registered: 2007-03-21
Posts: 173

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

Thanks for the quick response. That does the trick for me.

Offline

#603 2012-01-20 09:50:56

deadshox
Member
From: Berlin, Germany
Registered: 2009-08-25
Posts: 31

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

Thanks for 'packer', it is the perfect alternative to yaourt.

It looks wonderfull and is fast. Perfect. smile

Offline

#604 2012-01-22 08:47:00

keenerd
Trusted User (TU)
Registered: 2007-02-22
Posts: 647
Website

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

My "fix" for Emphire's problem seemed to make absolutely no sense, so I asked Falconindy to look at it.  He said it was because of IFS trickery and forwarded me a patch.  I've been testing it for the past three days and it seems to work well.  In hindsight, IFS abuse might have been the trickiest most convoluted section of code.  Bruenig, please apply patch :-)

diff --git a/packer b/packer
index e35f87b..64d782e 100644
--- a/packer
+++ b/packer
@@ -78,9 +78,7 @@ sourcemakepkgconf() {
 
 # Parse IgnorePkg and --ignore, put in globally accessible ignoredpackages array
 getignoredpackages() {
-  IFS=','
-  ignoredpackages=($ignorearg)
-  IFS=$'\n'" "
+  IFS=',' read -ra ignoredpackages <<< "$ignorearg"
   ignoredpackages+=( $(grep '^ *IgnorePkg' "$pacmanconf" | cut -d '=' -f 2-) )
 }
 
@@ -102,8 +100,7 @@ existsinpacman() {
 
 # Tests whether $1 is provided in pacman, sets globally accessibly providepkg var
 providedinpacman() {
-  IFS=$'\n'
-  providepkg=( $(pacman -Ssq -- "^$1$") )
+  IFS=$'\n' read -rd '' -a providepkg < <(pacman -Ssq -- "^$1$")
 }
 
 # Tests whether $1 exists in a pacman group
@@ -122,6 +119,7 @@ scrapeaurdeps() {
   . "$tmpdir/$1.PKGBUILD"
   IFS=$'\n'
   dependencies=( $(echo -e "${depends[*]}\n${makedepends[*]}" | sed -e 's/=.*//' -e 's/>.*//' -e 's/<.*//'| sort -u) )
+  unset IFS
 }
 
 # Finds dependencies of package $1
@@ -372,5 +370,5 @@ installhandling() {
   if [[ $pacmandepends ]]; then
-    IFS=$'\n'
-    pacmandepends=( $(printf "%s\n" "${pacmandepends[@]}" | sort -u) )
+    IFS=$'\n' read -rd '' -a pacmandepends < \
+      <(printf "%s\n" "${pacmandepends[@]}" | sort -u)
     echo -e "${COLOR6}Pacman Targets (${#pacmandepends[@]}):${ENDCOLOR} ${pacmandepends[@]}"
   fi
@@ -482,7 +480,6 @@ if [[ $option = update ]]; then
   # Aur update
   echo -e "${COLOR5}:: ${COLOR1}Synchronizing aur database...${ENDCOLOR}"
-  IFS=$'\n'
-  packages=( $(pacman -Qm) )
+  IFS=$'\n' read -rd '' -a packages < <(pacman -Qm)
   newpackages=()
   checkignores=()
   total="${#packages[@]}"
   grep -q '^ *ILoveCandy' "$pacmanconf" && bartype='candy' || bartype='normal'
@@ -608,8 +605,7 @@ if [[ $option = search || $option = searchinstall ]]; then
   sed -i '/^$/d' "$tmpdir/search.results"
 
   # Prepare tmp file and arrays
-  IFS=$'\n'
-  aurname=( $(cut -f 1 "$tmpdir/search.results") )
+  IFS=$'\n' read -rd '' -a aurname < <(cut -f 1 "$tmpdir/search.results")
   aurtotal="${#aurname[@]}"
   alltotal="$(($pactotal+$aurtotal))"
   # Echo out the -Ss formatted package information
@@ -629,6 +625,7 @@ if [[ $option = search || $option = searchinstall ]]; then
       printf "%d ${COLOR3}aur/${COLOR1}%s ${COLOR2}%s${ENDCOLOR} (%s)\n    %s\n" $(nl -v ${pactotal:-0} -w 1 < "$tmpdir/search.results")
     fi
   fi | fmt -"$_WIDTH" -s
+  unset IFS
 
   # Prompt and install selected numbers
   if [[ $option = searchinstall ]]; then
@@ -643,6 +640,5 @@ if [[ $option = search || $option = searchinstall ]]; then
     # Parse answer
     if [[ $REPLY ]]; then
-      IFS=' '
       for num in $REPLY; do
         if [[ $num -lt $alltotal ]]; then
           pkglist+=("${allpackages[$num]}")

Offline

#605 2012-02-04 06:39:52

YAOMTC
Member
Registered: 2010-02-23
Posts: 166

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

chneukirchen wrote:

When I run pacman 4.0.1 with signatures turned on, pacman called by packer fails to retrieve the key if I run packer as a user:

  % packer -S lftp
  error: lftp: key "94657AB20F2A092B" is unknown
  :: Import PGP key 0F2A092B, "Andreas Radke <andyrtr@archlinux.org>", created 2011-05-14? [Y/n] y
  error: key "Andreas Radke <andyrtr@archlinux.org>" could not be imported
  error: failed to commit transaction (invalid or corrupted package (PGP signature))
  Errors occurred, no packages were upgraded.

With sudo packer it works:

  % packer -S lftp
  error: lftp: key "94657AB20F2A092B" is unknown
  :: Import PGP key 0F2A092B, "Andreas Radke <andyrtr@archlinux.org>", created 2011-05-14? [Y/n] y
  (1/1) checking package integrity                   [######################] 100%

I've actually had this problem, and I always run with sudo...

Offline

#606 2012-02-04 12:39:41

keenerd
Trusted User (TU)
Registered: 2007-02-22
Posts: 647
Website

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

Not really a Packer problem.  Take care of pacman and import your keys.  The Arch News has the information you need.

You really should not be launching Packer with root or sudo privileges.

Offline

#607 2012-02-04 15:21:49

YAOMTC
Member
Registered: 2010-02-23
Posts: 166

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

keenerd wrote:

Not really a Packer problem.  Take care of pacman and import your keys.  The Arch News has the information you need.

I had already imported the master keys, and I ran pacman-key --refresh-keys before trying to update. But it still said there was an unknown key (Stéphane Gaudreault) and packer was unable to import it, while pacman could. Does this mean I should stick to using pacman for the core/extra/community updates, and only use packer for AUR stuff?

keenerd wrote:

You really should not be launching Packer with root or sudo privileges.

I used to use clyde, and read that I shouldn't use it as root, but sudo was fine. What's different about packer that I shouldn't launch with sudo?

Last edited by YAOMTC (2012-02-04 15:23:48)

Offline

#608 2012-02-04 16:32:47

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 664

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

YAOMTC wrote:

Does this mean I should stick to using pacman for the core/extra/community updates, and only use packer for AUR stuff?

Packer wraps pacman, meaning you're using the same pacman in both cases... In my experience, when I had signature-checking enabled, then it was a hit'n mis with the sigs, i.e. upon first run it would fail import keys sometimes and then on second or third run it would. Eventually I got fed up with it and disabled sig-checks completelly, as I really don't care about it anyways...

Last edited by mhertz (2012-02-04 16:38:03)

Offline

#609 2012-02-15 13:49:16

skull-y
Member
From: Germany/Saxony-Anhalt /Halle
Registered: 2009-01-25
Posts: 29

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

I installed it and it runs perfect and very fast.

Offline

#610 2012-02-17 12:32:26

jceasless
Member
Registered: 2009-04-20
Posts: 73

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

For some reason my packer can't see the AUR. I've noticed it when searching for things (-Ss), but this seems to really confirm it:

% packer -S packer
Package `packer' does not exist.

Offline

#611 2012-02-17 16:07:29

DarkSniper
Member
Registered: 2011-04-05
Posts: 74

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

Just wondering, are there any plans to implement ABS support into packer? While packer is vastly superior to yaourt, its lack of ABS support will make things slightly more tedious when it comes time to update the repo packages that I've customized.


Failure is not an option... It comes bundled with Windows.

Offline

#612 2012-02-17 16:52:49

karol
Archivist
Registered: 2009-05-06
Posts: 25,433

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

jceasless wrote:

For some reason my packer can't see the AUR. I've noticed it when searching for things (-Ss), but this seems to really confirm it:

% packer -S packer
Package `packer' does not exist.

https://bbs.archlinux.org/viewtopic.php?pid=1056892 links to https://bbs.archlinux.org/viewtopic.php?pid=1054323 -> https://bugs.archlinux.org/task/28259

Offline

#613 2012-02-19 06:27:46

steve_v
Member
Registered: 2006-02-11
Posts: 79

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

Offline

#614 2012-02-19 09:00:25

SKeaLoT
Member
Registered: 2009-10-02
Posts: 14

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

Been using packer for a while, but today I noticed I can't install AUR packages.
Not sure if the problem is my computer (I haven't updated in a while), AUR, or packer.
Anyway here's the output I get for packer -S packer:

Aur Targets (1): packer

Proceed with installation? [Y/n] 

tar: This does not look like a tar archive

gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
/home/felipe/bin//packer: line 283: cd: packer: No such file or directory
No PKGBUILD found in directory.

- You crashed my helicopter!
- Verily!

Offline

#615 2012-02-19 09:10:32

karol
Archivist
Registered: 2009-05-06
Posts: 25,433

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

SKeaLoT, read the post above yours.

Offline

#616 2012-02-19 15:24:15

jceasless
Member
Registered: 2009-04-20
Posts: 73

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

karol wrote:
jceasless wrote:

For some reason my packer can't see the AUR. I've noticed it when searching for things (-Ss), but this seems to really confirm it:

% packer -S packer
Package `packer' does not exist.

https://bbs.archlinux.org/viewtopic.php?pid=1056892 links to https://bbs.archlinux.org/viewtopic.php?pid=1054323 -> https://bugs.archlinux.org/task/28259

Interesting.. I remember not being able to access the AUR last weekend (around when I first installed packer, coincidentally). I don't think bug #28259 relates to my situation, however, because I can access the website again and download PKGBUILDs with wget.

Which means it might be related to https://bugs.archlinux.org/task/28515, steve_v mentions. This bug is supposedly fixed as of this morning, but I'm still seeing the same behavior.

There is also a patch mentioned on that last bug, but it is for yaourt and it isn't immediately obvious to me how to port that to packer.

Last edited by jceasless (2012-02-19 15:26:19)

Offline

#617 2012-02-19 16:56:24

keenerd
Trusted User (TU)
Registered: 2007-02-22
Posts: 647
Website

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

Offline

#618 2012-02-20 00:11:22

tarakbumba
Member
From: Turkiye
Registered: 2008-07-17
Posts: 72

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

Hi. I' m thinking about if packer can pass makepkg options to makepkg when building packages. Currently we can not use makepkg options those we want makepkg to use. Also i'd like to see if packer can remove installed dependencies when building packages; like "makepkg -r" i have looked into code and tried to modified it to match my needs. (but it requires a configuration file for packer...) So here is a patch that extends packer features:
extend_packer_features.patch

# This patch gives packer to use user defined makepkg options, removing installed dependencies and use packer builtin options automatically
# to achieve those, this patch brings a new config file fo packer.

--- packer.orig	2012-02-19 21:49:39.086210504 +0200
+++ packer	2012-02-20 01:54:30.840168841 +0200
@@ -23,6 +23,12 @@
 makepkgconf='/etc/makepkg.conf'
 usermakepkgconf="$HOME/.makepkg.conf"
 pacmanconf='/etc/pacman.conf'
+packerconf='/etc/packer.conf'
+userpackerconf="$HOME/.config/packer/packer.conf"
+
+# Source packer.conf
+  . "$packerconf"
+  [[ -r "$userpackerconf" ]] && . "$userpackerconf"
 
 RPCURL="https://aur.archlinux.org/rpc.php?type"
 PKGURL="https://aur.archlinux.org/packages"
@@ -67,6 +73,7 @@
   echo '    --auronly   - only do actions for aur'
   echo '    --devel     - update devel packages during -Su'
   echo '    --skipinteg - when using makepkg, do not check md5s'
+  echo '   --cleandeps| -c   - cleans installed dependencies'
   echo '    -h          - outputs this message'
   exit
 }
@@ -137,6 +144,7 @@
   dependencies=( $(echo -e "${depends[*]}\n${makedepends[*]}" | sed -e 's/=.*//' -e 's/>.*//' -e 's/<.*//'| sort -u) )
 }
 
+
 # Finds dependencies of package $1
 # Sets pacmandeps and aurdeps array, which can be accessed globally after function runs
 finddeps() {
@@ -179,6 +187,21 @@
   return 0
 }
 
+remove_deps() {
+		# exit cleanly on failure to remove deps as package has been built successfully
+        installed_deps="${aurdeps[@]} ${pacmandeps[@]}"
+
+        if [[ $installed_deps < 1 ]]; then
+                return 0
+        else
+	  echo "Removing installed dependencies..."
+	  if ! runasroot pacman -Rn ${aurdeps[@]} ${pacmandeps[@]}; then
+		  echo "Failed to remove installed dependencies."
+		  return 0
+	  fi
+	fi
+}
+
 # Displays a progress bar ($1 is numerator, $2 is denominator, $3 is candy/normal)
 aurbar() {
   # Delete line
@@ -313,6 +336,10 @@
   elif [[ $2 = explicit ]]; then
     runasroot $PACMAN ${PACOPTS[@]} -U $pkgname-*$PKGEXT
   fi
+
+  if [[ $cleandeps -eq 1 ]]; then
+    remove_deps
+  fi
 }
 
 # Goes through all of the install tests and execution ($@ is packages to be installed)
@@ -466,7 +493,8 @@
     '--noedit') noedit='1' ;;
     '--auronly') auronly='1' ;;
     '--devel') devel='1' ;;
-    '--skipinteg') MAKEPKGOPTS="--skipinteg" ;;
+    '--cleandeps'| '-c') cleandeps='1' ;;
+    '--skipinteg') "$MAKEPKGOPTS --skipinteg" ;;
     '--') shift ; packageargs+=("$@") ; break ;;
     -*) echo "packer: Option \`$1' is not valid." ; exit 5 ;;
     *) packageargs+=("$1") ;;

packer.conf

# Options to use with packer

# MAKEPKG OPTIONS
#################
# User defined makepkg options.
# To see what options available use "makepkg --help" command.
# Assign options to MAKEPKGOPTS variable.
#
#########################################################################################################################################
### WARNING: Do not use "-f", "-s", "-r", "--skipinteg" and "--asroot" options here; because those are packer builtin options.        ###
#########################################################################################################################################

MAKEPKGOPTS=""


# PACKER OPTIONS
################
# User defined packer options which will directly passed on packer.
# Define which options to be passed to packer one by one
# Use, option='1' form. Do not include options those you want to manually pass to packer.
# To see what options are available use "packer --help" command
# i.e.:  
# cleandeps='1'

Say what you mean, mean what you say

Offline

#619 2012-02-20 09:57:04

NoobCp
Member
From: IRC @-offtopic
Registered: 2010-09-28
Posts: 14
Website

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

To start off here's a few feature requests:

  1. It would be nice for there to be a convenient way to point packer to use pacmatic instead of pacman, would be a good way to remember to use packer more often;

  2. Colors readable on a white BG (bright yellow question prompts...);

  3. Compiler and possibly other intensive sub-processes (optionally?) launched with increased NICE value.


EDIT: something I posted before realising it must be a PKGBUILD error and not a packer bug now with less excess paste:

==> Starting build()...
cp: cannot open `config.template' for reading: Permission denied
==> ERROR: A failure occurred in build().
    Aborting...
The build failed.

EDIT2: since the above edit removed info relevant to the reply after this:

$ pacmatic -Q packer
packer 20120220-1

Last edited by NoobCp (2012-02-20 10:10:14)

Offline

#620 2012-02-20 10:02:24

karol
Archivist
Registered: 2009-05-06
Posts: 25,433

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

1. Update / rebuild packer. Ooooops, I see you're using an up to date version.
It's already possible https://aur.archlinux.org/packages.php? … mments=all

Comment by: bruenig on Wed, 08 Feb 2012 02:00:58 +0000
@rlipman

Some kind soul wrote a patch that allows you to set the client you want to use instead of pacman.

Just do: export PACMAN_CLIENT='pacmatic'

Then you should be set (it reads that environment variable)


Edit: I don't see this change documented in the man page though.

Last edited by karol (2012-02-20 10:09:32)

Offline

#621 2012-02-20 14:24:57

keenerd
Trusted User (TU)
Registered: 2007-02-22
Posts: 647
Website

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

It is PACMAN, not PACMAN-CLIENT.

Changing the colors is "simple but not easy".  Edit /usr/bin/packer and change the color escapes on line 30.  You may want to save you changes as a patch for when you next update Packer.

To nice the resource intensive bits, add nice to both instances of "makepkg $MAKEPKGOPTS" on line 309 and 311.  Or just alias packer to "nice packer".

Anyway, two of your three requests can be done just with

alias packer="PACMAN=pacmatic nice packer"

Offline

#622 2012-02-20 20:38:49

karol
Archivist
Registered: 2009-05-06
Posts: 25,433

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

Offline

#623 2012-02-20 21:05:02

doug piston
Member
From: Seattle
Registered: 2011-09-11
Posts: 387
Website

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

YAOMTC wrote:
keenerd wrote:

You really should not be launching Packer with root or sudo privileges.

I used to use clyde, and read that I shouldn't use it as root, but sudo was fine. What's different about packer that I shouldn't launch with sudo?


I would like to understand this better as well. TMK(I have not tried in awhile) running packer without sudo would always error and inform me to use sudo. If this is incorrect I would like to stop the error in my ways.

Offline

#624 2012-02-20 21:55:46

DarkSniper
Member
Registered: 2011-04-05
Posts: 74

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

doug piston wrote:
YAOMTC wrote:
keenerd wrote:

You really should not be launching Packer with root or sudo privileges.

I used to use clyde, and read that I shouldn't use it as root, but sudo was fine. What's different about packer that I shouldn't launch with sudo?


I would like to understand this better as well. TMK(I have not tried in awhile) running packer without sudo would always error and inform me to use sudo. If this is incorrect I would like to stop the error in my ways.

If I remember correctly, it's dangerous to build packages as root (makepkg complains about this and requires the --asroot flag if you want to do so anyway). Packer (and many other pacman wrappers) call sudo when they need it so there's really no need to use sudo/root on them (redundant and dangerous). I'm able to call packer as a regular user, and if I'm trying to do something that requires root (like -Syu) I'm prompted for my password by sudo, never once has it complained that I was not running as root.

Last edited by DarkSniper (2012-02-20 22:21:53)


Failure is not an option... It comes bundled with Windows.

Offline

#625 2012-02-20 22:18:12

doug piston
Member
From: Seattle
Registered: 2011-09-11
Posts: 387
Website

Re: packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

DarkSniper wrote:
doug piston wrote:
YAOMTC wrote:

I used to use clyde, and read that I shouldn't use it as root, but sudo was fine. What's different about packer that I shouldn't launch with sudo?


I would like to understand this better as well. TMK(I have not tried in awhile) running packer without sudo would always error and inform me to use sudo. If this is incorrect I would like to stop the error in my ways.

If I remember correctly, it's dangerous to build packages as root (makepkg complains about this and requires the --asroot flag if you want to do so anyway). Packer (and many other pacman wrappers) call sudo when they need it so there's really no need to use sudo/root on it (redundant and dangerous). I'm able to call packer as a regular user, and if I'm trying to do something that requires root (like -Syu) I'm prompted for my password by sudo, never once has it complained that I was not running as root.


Dangerous? Well that makes me less then happy in my pants. Thank you for the explanation and I will discontinue using sudo.

Last edited by doug piston (2012-02-20 22:18:52)

Offline

Board footer

Powered by FluxBB