You are not logged in.

#1 2012-01-28 18:41:05

alexpbrown
Member
Registered: 2012-01-28
Posts: 10

pkgcl - get changelogs for packages

So I was kind of bummed that Arch didn't really have nice changelogs like I remember from Ubuntu. It never occurred to me that someone was doing those manually for each package update, which is obviously not realistic for a project like Arch. But after some searching, I found out that most of the devs write decently verbose commit messages. And since all that clicking is way too much work for every package, I made a little ruby program to get "changelogs" from commit messages.

AUR
Github

Here's the help output:

Usage: pkgcl [options] <packages>

    -c, --commits=NUM                Show NUM commit messages
        --show-git-svn-id            Show git-svn-id messages
    -h, --help                       Show this message

It takes STDIN too! For all packages that need updating:

pacman -Qqu | pkgcl

Screenshot:
zUBlQ.png

Writing this doubled as a ruby learning experience for me, so I'm sure this could be better/faster. Let me know what you think!

Last edited by alexpbrown (2012-01-28 19:01:21)

Offline

#2 2012-01-29 06:52:10

tomd123
Developer
Registered: 2008-08-12
Posts: 565

Re: pkgcl - get changelogs for packages

I really like this idea and it worked for me.

A suggestion, you could create a gemspec file and upload pkgcl to rubygems smile

Offline

#3 2012-02-01 21:38:24

alexpbrown
Member
Registered: 2012-01-28
Posts: 10

Re: pkgcl - get changelogs for packages

Thanks!

I always thought rubygems were for libraries for some reason, but I just looked at the docs and it says "applications or libraries". So I guess that means I'm looking into it!

Offline

#4 2012-02-01 23:04:42

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: pkgcl - get changelogs for packages

@alexpbrown,

Thanks for the pkgcl - two days ago I have started a thread about your - as I know now - package: https://bbs.archlinux.org/viewtopic.php?id=134732 smile


"I exist" is the best myth I know..

Offline

#5 2012-02-01 23:56:41

alexpbrown
Member
Registered: 2012-01-28
Posts: 10

Re: pkgcl - get changelogs for packages

Woah, I had no idea! I had seen some talk on the forums about wanting something like this, but I must have missed this thread. Thanks for checking out my script big_smile

Offline

#6 2012-02-10 18:21:47

FernandoBasso
Member
From: Brazil
Registered: 2010-10-27
Posts: 90
Website

Re: pkgcl - get changelogs for packages

Voted on AUR. Keep the work. Very useful.


There is a difference between knowing the path and walking the path.

Offline

#7 2012-02-10 18:59:23

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: pkgcl - get changelogs for packages

Bug

pkgcl foo
[foo]
Not Found

[foo]
/usr/lib/ruby/1.9.1/open-uri.rb:35:in `initialize': No such file or directory - &showmsg=1 (Errno::ENOENT)
        from /usr/lib/ruby/1.9.1/open-uri.rb:35:in `open'
        from /usr/lib/ruby/1.9.1/open-uri.rb:35:in `open'
        from /usr/bin/pkgcl:132:in `block in <main>'
        from /usr/bin/pkgcl:127:in `each'
        from /usr/bin/pkgcl:127:in `<main>'

aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#8 2012-02-10 20:31:56

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: pkgcl - get changelogs for packages

Packages in [testing] will never be found unless they're brand new. Diff belows fixes that, as well as the explosion when open() fails (by avoiding it). That said, you should probably do a proper begin/rescue for that call since its dependent on the network and could fail for a menagerie of reasons, even if get_pkg() suceeds.

diff --git a/pkgcl b/pkgcl
index b32e2b9..e226a27 100755
--- a/pkgcl
+++ b/pkgcl
@@ -63,6 +63,8 @@ def get_pkg(pkg)
         repo = $2
       when /^Architecture(\s?)*: (.+)$/
         arch = $2
+      when /^$/
+        break
       end
     end
   end
@@ -125,7 +127,7 @@ def show_commit(n)
 end
 
 packages.each do |p|
-  git_link = get_pkg(p)
+  git_link = get_pkg(p) or next
   puts "["+colorize(p, 31)+"]"
 
   # get the page with the messages expanded

Last edited by falconindy (2012-02-10 21:24:16)

Offline

#9 2012-02-11 00:32:12

alexpbrown
Member
Registered: 2012-01-28
Posts: 10

Re: pkgcl - get changelogs for packages

fsckd wrote:

Bug

pkgcl foo
[foo]
Not Found

[foo]
/usr/lib/ruby/1.9.1/open-uri.rb:35:in `initialize': No such file or directory - &showmsg=1 (Errno::ENOENT)
        from /usr/lib/ruby/1.9.1/open-uri.rb:35:in `open'
        from /usr/lib/ruby/1.9.1/open-uri.rb:35:in `open'
        from /usr/bin/pkgcl:132:in `block in <main>'
        from /usr/bin/pkgcl:127:in `each'
        from /usr/bin/pkgcl:127:in `<main>'

I just pushed a version to AUR that should fix this. Let me know!

Offline

#10 2012-02-11 00:38:41

alexpbrown
Member
Registered: 2012-01-28
Posts: 10

Re: pkgcl - get changelogs for packages

falconindy wrote:

Packages in [testing] will never be found unless they're brand new. Diff belows fixes that, as well as the explosion when open() fails (by avoiding it). That said, you should probably do a proper begin/rescue for that call since its dependent on the network and could fail for a menagerie of reasons, even if get_pkg() suceeds.

*awesome patch snipped*

Thanks for the patch! I don't have [testing] enabled so I'm not sure I know what you're referring to, but I'll turn it on and see what's up.

Good call on the "begin/rescue" too. Might take a bit since this is a ruby learning experience for me, bear with me!

Offline

#11 2012-02-11 00:41:58

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: pkgcl - get changelogs for packages

alexpbrown wrote:
fsckd wrote:

Bug

I just pushed a version to AUR that should fix this. Let me know!

Yes it does. smile


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#12 2012-02-11 00:42:23

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: pkgcl - get changelogs for packages

alexpbrown wrote:

Thanks for the patch! I don't have [testing] enabled so I'm not sure I know what you're referring to

The problem is that calling 'pacman -Si <pkg>' will return multiple instances of the package when it exists in multiple repos, for example:

$ pacman -Si kmod
Repository     : testing
Name           : kmod
Version        : 5-2
URL            : http://git.profusion.mobi/cgit.cgi/kmod.git
Licenses       : GPL2
Groups         : None
Provides       : module-init-tools=3.16
Depends On     : glibc  zlib
Optional Deps  : None
Conflicts With : module-init-tools
Replaces       : module-init-tools
Download Size  :  69.71 KiB
Installed Size : 312.00 KiB
Packager       : Dave Reisner <dreisner@archlinux.org>
Architecture   : x86_64
Build Date     : Fri 10 Feb 2012 02:08:36 PM EST
MD5 Sum        : 0df4e6b14d272712bd3f08cfd1dc1f80
SHA256 Sum     : 3fa39adc75c460c924c92c8e727a656767da027ac92a58bc3fa12e7ffa201321
Signatures     : Yes
Description    : Linux kernel module handling

Repository     : core
Name           : kmod
Version        : 4-2
URL            : http://git.profusion.mobi/cgit.cgi/kmod.git
Licenses       : GPL2
Groups         : None
Provides       : module-init-tools=3.16
Depends On     : glibc  zlib
Optional Deps  : None
Conflicts With : module-init-tools
Replaces       : module-init-tools
Download Size  :  75.64 KiB
Installed Size : 292.00 KiB
Packager       : Dave Reisner <dreisner@archlinux.org>
Architecture   : x86_64
Build Date     : Tue 31 Jan 2012 12:16:01 AM EST
MD5 Sum        : f9b608f832ffdc3cf4b550e8d71e3494
SHA256 Sum     : d71dc1cd3340ec8cf25c3efbbf02d412019e05fa025ff2230948f7567ffec04f
Signatures     : Yes
Description    : Linux kernel module handling

Your while loop will read the entirety of the output, leaving repo/arch set according to the last occurrences of those keys. I'd say 99% of the time, you want info about the package that pacman is going to favor, e.g. the first result, so simply quit parsing after the end of the first result.

I don't really know ruby either, but it's readable enough that it's easy to hack on for simple bug fixes like this.

Last edited by falconindy (2012-02-11 00:43:37)

Offline

#13 2012-02-11 02:47:28

alexpbrown
Member
Registered: 2012-01-28
Posts: 10

Re: pkgcl - get changelogs for packages

fsckd wrote:

Yes it does. smile

/dance

falconindy wrote:

Your while loop will read the entirety of the output, leaving repo/arch set according to the last occurrences of those keys. I'd say 99% of the time, you want info about the package that pacman is going to favor, e.g. the first result, so simply quit parsing after the end of the first result.

Ah, that makes sense. I updated it with your patch. This ends up working pretty much exactly like calling `pkgcl --enable-testing`

falconindy wrote:

I don't really know ruby either, but it's readable enough that it's easy to hack on for simple bug fixes like this.

smile This is one of the things I'm really liking about ruby so far.

Offline

#14 2012-11-05 09:58:46

FernandoBasso
Member
From: Brazil
Registered: 2010-10-27
Posts: 90
Website

Re: pkgcl - get changelogs for packages

Voted on AUR. I hope to see it in the official repositories soon.

Last edited by FernandoBasso (2012-11-05 09:59:55)


There is a difference between knowing the path and walking the path.

Offline

#15 2012-11-07 11:52:31

megadriver
Member
From: Spain
Registered: 2010-02-03
Posts: 58
Website

Re: pkgcl - get changelogs for packages

When trying to use this, I got the following error:

/usr/lib/ruby/1.9.1/open-uri.rb:216:in `open_loop': redirection forbidden: http://www.archlinux.org -> https://www.archlinux.org/ (RuntimeError)
        from /usr/lib/ruby/1.9.1/open-uri.rb:146:in `open_uri'
        from /usr/lib/ruby/1.9.1/open-uri.rb:677:in `open'
        from /usr/lib/ruby/1.9.1/open-uri.rb:33:in `open'
        from ./test.rb:6:in `<main>'

So I replaced the "http" in line 83 with "https", and now it works as expected.

Anyway, very cool stuff! I was looking for something like this for a long time!

Offline

Board footer

Powered by FluxBB