help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rolling back only a single package


From: Tonton
Subject: Re: rolling back only a single package
Date: Mon, 31 Dec 2018 16:17:26 +0100

On Sun, 30 Dec 2018 19:57:06 -0300
<address@hidden> wrote:

> Tonton <address@hidden> writes:
> 
> Yes, but I check the blog suggested by Björn:
> 
> https://www.gnu.org/software/guix/blog/2018/multi-dimensional-transactions-and-rollbacks-oh-my/
>

Cool, I hadn't seen this post before. So yes, that sounds like a good way
forward. :)
 
> >
> > As a quick fix for xmobar I see it was updated to 0.28 in commit
> > ccd4fd3f2a614996bff5436cc22e4715a7eb1f31 and only two lines were
> > changed.  
> 
> I'm begging to think that it' a problem with GHC version. After all it
> doesn't make sense to have a segfault in haskell code. Besides, I read a
> comment on a readme in the github repo that points in that direction.
> 
> So even if a get this pkg definition to work, maybe xmobar will keep
> segfaulting now and then.
> 

Oh, yes. If the problem lies in the GHC version this package definition won't
solve it.

> > would create a file ~/my-guix-pakcages/my-xmobar.scm and put the
> > following in it:
> >
> > -------------------------------------------------------------------------------------------------
> > (define-module (my-xmobar) ;; The name "my-xmobar" have to be 
> >                                            ;; the same as the filename
> >   #:use-module (guix packages)
> >   #:use-module (guix download)
> >   #:use-module (gnu packages)
> >   #:use-module (gnu packages wm))
> >
> > (define-public my-xmobar
> >   (package
> >     (inherit xmobar)
> >     (name "xmobar")
> >     (version "0.27")
> >     (source (origin
> >              (method url-fetch)
> >                (uri (string-append "mirror://hackage/package/xmobar/"
> >                                    name "-" version ".tar.gz"))
> >               (sha256
> >                (base32
> >                 "0agx490q6sbmv3vfq33ys8dsrgwizj3bmha4i1pkxz5wp5q8cx3l"))))))
> > -------------------------------------------------------------------------------------------------
> >
> > Then add the file to your shells $GUIX_PACKAGE_PATH like 
> > 'export GUIX_PACKAGE_PATH=~/my-guix-pakcages/:$GUIX_PACKAGE_PATH'
> > in your .profile or similar. Open a new shell and run:
> > guix package -i address@hidden
> >
> > Hope that helps. :)
> >  
> 
> It does! It's a good way to getting my hands dirty and learn.
> 
> So, this it's a little long, sorry...
> 
> Where do you get that commit hash?
> 

The commit hash earlier (ccd4fd3f2a614996bff5436cc22e4715a7eb1f31) is from
the guix repository at https://git.savannah.gnu.org/cgit/guix.git/

The hash in the package definition is from guix hash. I get it by running:

$ guix download 
https://hackage.haskell.org/package/xmobar-0.27/xmobar-0.27.tar.gz
Starting download of /tmp/guix-file.hS67K3
From https://hackage.haskell.org/package/xmobar-0.27/xmobar-0.27.tar.gz...
[...]
/gnu/store/l9bz25g4li7g3snasm35cc2c6qf3qmn7-xmobar-0.27.tar.gz
0agx490q6sbmv3vfq33ys8dsrgwizj3bmha4i1pkxz5wp5q8cx3l

$ guix hash /gnu/store/l9bz25g4li7g3snasm35cc2c6qf3qmn7-xmobar-0.27.tar.gz
0agx490q6sbmv3vfq33ys8dsrgwizj3bmha4i1pkxz5wp5q8cx3l

You might notice that the hash guix download yields is the same as guix
hash. I've been recommended running guix hash separately as a best
practice, I don't remember the specifics and it costs me nothing. :)

> Here is what I did to get the hash and see the differences.
> 
> -------------------------------------------------------------------------------------------------
> git clone https://github.com/jaor/xmobar
> 
> cd xmobar
> 
> $git rev-list -n1 0.28
> 661f1a529f0e8416560d0f5f121bce15a1cfc329
> 
> $git rev-list -n1 0.26
> f897fbe3645d5af96197ee6b9c2dc547f5c036cf
> 
> $git diff 11fa52601bc486b110252b7c6aa22bae2bafbd86
> 661f1a529f0e8416560d0f5f121bce15a1cfc329
> -------------------------------------------------------------------------------------------------
> 
> to know the sha265:
> 
> -------------------------------------------------------------------------------------------------
> $wget http://hackage.haskell.org/package/xmobar-0.26/xmobar-0.26.tar.gz
> $sha256 xmobar-0.26.tar.gz
> -------------------------------------------------------------------------------------------------
> 
See above, but here I think it's a better idea to use guix download and
guix hash. Also because guix download will get the tarball and put it in
your store, so you won't have to download it again while testing builds.

> Then I follow your advice and create a package. 
> 
> -------------------------------------------------------------------------------------------------
> (define-module (xmobar-0.26)
>   #:use-module (guix packages)
>   #:use-module (guix download)
>   #:use-module (gnu packages)
>   #:use-module (gnu packages wm))
> 
> (define-public xmobar-0.26
>   (package
>    (inherit xmobar)
>    (name "xmobar")
>    (version "0.27")
>    (source (origin
>             (method url-fetch)
>             (uri (string-append "mirror://hackage/package/xmobar/"
>                                 name "-" version ".tar.gz"))
>             (sha256
>             
> "ff7dd9af151e0336d35fa4741a76fe8a95762649c11877442449b321f106e4a5")))))
> -------------------------------------------------------------------------------------------------
>
> 
> Note that I didn't use (base32 "sha256-in-base32")
> 
> but I try with:
> 
> -------------------------------------------------------------------------------------------------
> $sha256 xmobar-0.26.tar.gz | base32
> -------------------------------------------------------------------------------------------------
> 
> and then using (base32 ...) and get the same error:
> 
> $guix package -i xmobar-0.26
> guix package: warning: failed to load '(xmobar-0.26)':
> no code for module (xmobar-0.26)
> guix package: error: xmobar-0.26: unknown package
> 
> (after set up the GUIX_PACKAGE_PATH, obviusly)
> 
> or even:
> 
> $guix package -i address@hidden
> guix package: warning: failed to load '(xmobar-0.26)':
> no code for module (xmobar-0.26)
> guix package: error: xmobar: package not found for version 0.2¬
> 
> 
> mmm, what's wrong? maybe some dependency change? Or did I put the wrong
> sha256? The url it's fine, Why it can't found it?
> 

Awesome, great work :)

I'd double check GUIX_PACKAGE_PATH and that the filename is
xmobar-0.26.scm and it exists in GUIX_PACKAGE_PATH.
$ echo $GUIX_PACKAGE_PATH
$ find $(echo "$GUIX_PACKAGE_PATH" | sed 's/:/ /g') -name xmobar-0.26.scm

Then xmobar-0.26 is the variable name for your package definition used for 
guile hacking. While
address@hidden is sort of the package name used for tools like guix package and 
guix build.

Another great tool when writing package definitions is guix lint.

> 
> This way to do it it's good to learn how to extend packages and maybe
> beggining packagings other things. But with the problem at hand
> shouldn't we use the package definition that guix has and is know to work?
> 
> Anyway for that I'll check the Björn answer. This one has it's own merits
> XD.
> 

Look forward to seeing how you end up solving this. :)

Tonton




reply via email to

[Prev in Thread] Current Thread [Next in Thread]