You are not logged in.

#1 2013-06-10 13:08:44

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

[solved] Why does 'pacscripts' sometimes take so long?

$ pacscripts -h
This program prints out the {pre,post}_{install,remove,upgrade} scripts
of a given package.
Usage: pacscripts pkgname|pkgfile

 OPTIONS:
  -h, --help                 Print this help message
  -v, --version              Print program name and version

Example: pacscripts gconf-editor
Example: pacscripts gconf-editor-2.24.1-1-x86_64.pkg.tar.gz
$ time pacscripts chromium
post_install() {
    xdg-icon-resource forceupdate --theme hicolor &>/dev/null
    update-desktop-database -q
}

post_upgrade() {
    post_install
}

post_remove() {
    post_install
}


real    0m16.453s
user    0m12.982s
sys 0m0.174s

16 seconds. It prints the scripts very quickly and hangs for several seconds.
Compare it with:

$ time pacscripts firefox
post_install() {
  update-desktop-database -q
  gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
}

post_upgrade() {
  post_install
}

post_remove() {
  post_install
}



real    0m0.247s
user    0m0.052s
sys 0m0.026s
$ time pacscripts yudit
==> ERROR: Package yudit does not include any .INSTALL script

real    0m0.272s
user    0m0.059s
sys 0m0.017s
$ time pacscripts gconf-editor
pkgname=gconf-editor

post_install() {
  usr/sbin/gconfpkg --install ${pkgname}
  gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
}

pre_upgrade() {
  pre_remove $1
}

post_upgrade() {
  post_install $1
}

pre_remove() {
  usr/sbin/gconfpkg --uninstall ${pkgname}
}

post_remove() {
  gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
}


real    0m2.182s
user    0m1.440s
sys 0m0.096s

What does the execution speed depend on? Does it matter if I have the package installed or not? Does size of the package matter?

Last edited by karol (2013-06-19 18:27:34)

Offline

#2 2013-06-10 13:56:22

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: [solved] Why does 'pacscripts' sometimes take so long?

Mine seems to go fast all the time... it was a bit slower when I tried gconf-editor, but that is beacuse I neither had it installed nor in my cache.  But still that was only 0.57s...


Edit: I did not know about pacscripts though... its neat.  I wish I had known about this before gummiboot overwrote the 0000 spot of my firmware's boot manager (it is typically reserved for the "Setup" which is what gets you into the bios).  Fortunately, my computer was "smart" enough to write itself a new one at 0011, but I am unsure if this is now even permanent...

Last edited by WonderWoofy (2013-06-10 13:58:30)

Offline

#3 2013-06-10 14:07:01

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

Re: [solved] Why does 'pacscripts' sometimes take so long?

All packages I posted are in the cache, some of them are also installed.

The sloooow one is not a huge deal, I'm just a curious little kitty and I would like to know.

Offline

#4 2013-06-10 14:43:47

aesiris
Member
Registered: 2012-02-25
Posts: 94

Re: [solved] Why does 'pacscripts' sometimes take so long?

Have you already tried defragmentating the pacman db with pacman-optimize?

Offline

#5 2013-06-10 15:00:42

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

Re: [solved] Why does 'pacscripts' sometimes take so long?

aesiris wrote:

Have you already tried defragmentating the pacman db with pacman-optimize?

Yup, many times. I haven't noticed any change.

Offline

#6 2013-06-10 15:19:08

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

Re: [solved] Why does 'pacscripts' sometimes take so long?

Changing

bsdtar -xOf /var/cache/pacman/pkg/chromium-27.0.1453.110-1-i686.pkg.tar.xz .INSTALL

to

bsdtar -xqOf /var/cache/pacman/pkg/chromium-27.0.1453.110-1-i686.pkg.tar.xz .INSTALL

(added '-q' switch) makes it better :-)

$ time bsdtar -xqOf /var/cache/pacman/pkg/chromium-27.0.1453.110-1-i686.pkg.tar.xz .INSTALL
post_install() {
    xdg-icon-resource forceupdate --theme hicolor &>/dev/null
    update-desktop-database -q
}

post_upgrade() {
    post_install
}

post_remove() {
    post_install
}

real	0m0.036s
user	0m0.023s
sys	0m0.004s

but I have no idea if it breaks anything.

man bsdtar wrote:

     -q, --fast-read
             (x and t mode only) Extract or list only the first archive entry that matches each pattern or filename oper‐
             and.  Exit as soon as each specified pattern or filename has been matched.  By default, the archive is always
             read to the very end, since there can be multiple entries with the same name and, by convention, later entries
             overwrite earlier entries.  This option is provided as a performance optimization.

Offline

#7 2013-06-10 20:27:46

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 5,661

Re: [solved] Why does 'pacscripts' sometimes take so long?

Do you not get asked for a password? I got asked for one twice so gconf-editor took 25 secs but most of that was me typing...


How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | grub2 | systemd | LVM2 on LUKS
Lenovo x121e | Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz GenuineIntel | Intel Centrino Wireless-N 1000 | US keyboard with Euro | 320G 7200 RPM Seagate HDD

Offline

#8 2013-06-11 07:56:58

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

Re: [solved] Why does 'pacscripts' sometimes take so long?

cfr wrote:

Do you not get asked for a password? I got asked for one twice so gconf-editor took 25 secs but most of that was me typing...

Maybe because you didn't have gconf-editor in your cache and it had to be downloaded first.
No password prompts but

$ pacscripts gconf-editor
/usr/bin/sudo
resolving dependencies...

Packages (10):

...

Offline

#9 2013-06-11 18:36:26

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 5,661

Re: [solved] Why does 'pacscripts' sometimes take so long?

No I get asked for a password even if I immediately repeat the command when it must already be in the cache.


How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | grub2 | systemd | LVM2 on LUKS
Lenovo x121e | Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz GenuineIntel | Intel Centrino Wireless-N 1000 | US keyboard with Euro | 320G 7200 RPM Seagate HDD

Offline

#10 2013-06-11 21:01:32

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

Re: [solved] Why does 'pacscripts' sometimes take so long?

Maybe it's because

spacman() {
        if [ $EUID -eq 0 ]; then
                pacman "$@"
        else
                if ! type -p sudo; then
                        error "Cannot find the sudo binary! Is sudo installed?"
                        error "Otherwise try to run the program as root"
                        exit 1
                else
                        sudo pacman "$@"
                fi
        fi
}

and then

        url=$(spacman -Sdp $1 | tail -n1)
        filename=$(basename $url)
        if [ ! -f "$pac_cache/$filename" ]; then
                if ! spacman -Sdw --noconfirm $1 >&2; then
                        error "Failed to download $1"
                        return 1
                fi
                echo >&2
        fi

I don't see the reason to run 'sudo pacman -Sdp $1 | tail -n1', just 'pacman' should be enough.
I'll ask on the ML.

Offline

#11 2013-06-11 22:05:34

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 5,661

Re: [solved] Why does 'pacscripts' sometimes take so long?

I was curious why I was getting asked to authenticate when others apparently are not. I did see that in the script but then why doesn't it apply to everyone? It looks like it uses sudo to assign url regardless of the status of the cache etc.

I'm tempted to feel it should not really download to pacman's cache anyway but use a temporary directory just because it is supposed to be providing information and it seems a bit odd to download to pacman's "real" cache for that if the package isn't installed an may never be installed on the system. But I guess there are advantages to its being as it is.


How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | grub2 | systemd | LVM2 on LUKS
Lenovo x121e | Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz GenuineIntel | Intel Centrino Wireless-N 1000 | US keyboard with Euro | 320G 7200 RPM Seagate HDD

Offline

#12 2013-06-11 22:29:52

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

Re: [solved] Why does 'pacscripts' sometimes take so long?

I was thinking about fetching the info from git e.g. https://projects.archlinux.org/svntogit … s/chromium

This script is pretty old and if I'm reading it right, it hasn't been touched since creation https://projects.archlinux.org/pacman.g … pacscripts

Offline

#13 2013-06-12 08:19:34

skanky
Member
From: WAIS
Registered: 2009-10-23
Posts: 1,838

Re: [solved] Why does 'pacscripts' sometimes take so long?

cfr wrote:

No I get asked for a password even if I immediately repeat the command when it must already be in the cache.

Is that down to your sudo setting? I get asked first time, but subsequent times I don't as sudo has not yet timed out.
That may be why others aren't getting it - also if they've added pacman to the list of commands that don't require a password.


"...one cannot be angry when one looks at a penguin."  - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Online

#14 2013-06-12 19:12:26

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 5,661

Re: [solved] Why does 'pacscripts' sometimes take so long?

Sorry, yes. The fact that I get asked again immediately and that I get asked twice in the first place is down to my sudo configuration on this machine. I should have explained that. What I meant, however, was that I got asked for a password even if the package was already in pacman's cache i.e. even if pacman doesn't need to download anything to a protected directory. Others' reports suggested to me that they did not get asked for a password at all provided the package was already cached.


How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | grub2 | systemd | LVM2 on LUKS
Lenovo x121e | Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz GenuineIntel | Intel Centrino Wireless-N 1000 | US keyboard with Euro | 320G 7200 RPM Seagate HDD

Offline

#15 2013-06-12 19:15:07

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

Re: [solved] Why does 'pacscripts' sometimes take so long?

It still runs 'sudo pacman' to get the basename / url - I don't see why it should and I submitted a patch to the ML.
If on your setup running 'sudo foo' means you're asked for password - you get asked for the password even if no package gets downloaded, because it already sits in your cache.

Offline

#16 2013-06-19 18:27:15

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

Re: [solved] Why does 'pacscripts' sometimes take so long?

Offline

#17 2013-06-19 21:46:55

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 5,661

Re: [solved] Why does 'pacscripts' sometimes take so long?

Thanks, Karol. That's good to know.


How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | grub2 | systemd | LVM2 on LUKS
Lenovo x121e | Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz GenuineIntel | Intel Centrino Wireless-N 1000 | US keyboard with Euro | 320G 7200 RPM Seagate HDD

Offline

Board footer

Powered by FluxBB