After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 731051 - deploy: Remove legacy "current" symbolic links
deploy: Remove legacy "current" symbolic links
Status: RESOLVED FIXED
Product: ostree
Classification: Infrastructure
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: OSTree maintainer(s)
OSTree maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-05-31 17:53 UTC by Colin Walters
Modified: 2014-09-26 17:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
deploy: Remove legacy "current" symbolic links (3.27 KB, patch)
2014-05-31 17:53 UTC, Colin Walters
committed Details | Review
ostree admin instutil set-kargs: make more flexible (8.37 KB, patch)
2014-09-25 21:30 UTC, Owen Taylor
committed Details | Review
ostree admin: Add a --print-current-dir option (4.35 KB, patch)
2014-09-25 21:30 UTC, Owen Taylor
committed Details | Review
Add test case for 'admin instutil set-kargs' (4.36 KB, patch)
2014-09-26 15:55 UTC, Owen Taylor
committed Details | Review
Test 'ostree admin --print-current-dir' (1.16 KB, patch)
2014-09-26 15:55 UTC, Owen Taylor
committed Details | Review

Description Colin Walters 2014-05-31 17:53:55 UTC
Per comment, this was a temporary non-atomic hack, and it's time to
remove it.
Comment 1 Colin Walters 2014-05-31 17:53:56 UTC
Created attachment 277626 [details] [review]
deploy: Remove legacy "current" symbolic links
Comment 2 Colin Walters 2014-09-13 14:45:35 UTC
Might break some people's scripts, but they shouldn't be relying on this anyways.
Comment 3 Colin Walters 2014-09-13 14:45:50 UTC
Attachment 277626 [details] pushed as dfeb27e - deploy: Remove legacy "current" symbolic links
Comment 4 Owen Taylor 2014-09-15 15:10:02 UTC
This looks like it will break the gnome-hwtest install script (not immediately, since the image isn't rebuilt unless manually retagged, and anyways this is just the script to install a new image.)

It's used to find out the current revision of a sysroot:

    ref=`readlink /ostree/deploy/gnome-continuous/current | sed 's@deploy/\([0-9a-f]*\).*@\1@'`

And to refer to the /etc currently deployed in a sysroot:

    fstab=/tmp/installroot/ostree/deploy/gnome-continuous/current/etc/fstab

What are the approved replacements?
Comment 5 Colin Walters 2014-09-15 16:19:39 UTC
(In reply to comment #4)

> What are the approved replacements?

The most powerful solution is to use libostree, e.g.:

    let sysroot = OSTree.Sysroot.new(mntdir);
    sysroot.load(null);
    let deployments = sysroot.get_deployments();
    let current = deployments[0];
    let deployDir = sysroot.get_deployment_directory(current);

However, we could add something to be convenient for shell scripts...

# ostree admin --sysroot=/path/to/sysroot status --print-current-dir

?
Comment 6 Owen Taylor 2014-09-16 18:04:56 UTC
Leaving aside writing my particular scripts to JS (not inclined at the moment), I think being sysadmin scripting friendly is definitely a good thing.

--print-current-dir as a global option, or have a subcommand?

What about finding the current version, either of:

 csum=`ostree admin --print-current-dir| sed 's@deploy/\([0-9a-f]*\).*@\1@'`

 csum=`ostree admin status | while read current osname csum  ; do [ "$current" = '*' ] && echo $csum ; done`

seem clunky.
Comment 7 Colin Walters 2014-09-16 18:45:57 UTC
What did you want?  The tree revision (checksum)?  The deployment root?  (Note the latter may not be $checksum.0)
Comment 8 Owen Taylor 2014-09-16 19:06:47 UTC
I separately have need for the deployment root and the current tree revision. 

Admittedly, the need for the current tree revision is a bit obscure - what I'm doing is doing a filesystem-level mirror of an already installed tree to a new partition, then rerunning 'ostree admin deploy' to change the bootloader config to have different --karg=root=LABEL=<blah>.

Since ostree admin deploy needs a ref, I need to figure out what the ref is - it may be fine to do one of the above hacks in this specialized case. Or maybe 'ostree admin deploy' needs a --refresh option that redeploys with the same tree revision.
Comment 9 Colin Walters 2014-09-20 18:19:20 UTC
Note for changing the kernel arguments, there is "ostree admin instutil set-kargs", which is almost what you want.  Would just need --karg-extend --karg-replace=, like deploy has.
Comment 10 Owen Taylor 2014-09-25 21:30:47 UTC
Created attachment 287114 [details] [review]
ostree admin instutil set-kargs: make more flexible

Add command line arguments:
 --import-proc-cmdline: import values from /proc/cmdline
 --merge: import current values
 --replace=ARG=VALUE: replace value
 --append=ARG=VALUE: append a new argument

Extra command line arguments are treated like --append=, which
gives backwards compatibility.
Comment 11 Owen Taylor 2014-09-25 21:30:53 UTC
Created attachment 287115 [details] [review]
ostree admin: Add a --print-current-dir option

Add an option --print-current-dir that prints the current deployment
directory to stdout and exits.
Comment 12 Colin Walters 2014-09-26 12:00:37 UTC
Review of attachment 287115 [details] [review]:

A little awkward that this is special cased instead of being another builtin.  OTOH, I know adding builtins is a lot of boilerplate.

And there is precedent in e.g. "git rev-parse --show-toplevel".  (What does telling me the the git topdir have to do with parsing revs??)

So...marking ACN.  But maybe we can think about some better way to handle frequently used vs infrequently used tools.  That's kind
of what I was going for with "instutil", but this isn't related to installing.
Comment 13 Colin Walters 2014-09-26 12:13:18 UTC
Review of attachment 287114 [details] [review]:

Looks good!  Would like some tests though.
Comment 14 Owen Taylor 2014-09-26 15:55:15 UTC
Created attachment 287187 [details] [review]
Add test case for 'admin instutil set-kargs'

Test out the newly added options to 'instutil set-kargs' along with
the existing functionality.
Comment 15 Owen Taylor 2014-09-26 15:55:18 UTC
Created attachment 287188 [details] [review]
Test 'ostree admin --print-current-dir'

Add a test for the --print-current-dir option
Comment 16 Owen Taylor 2014-09-26 16:00:16 UTC
(In reply to comment #12)
> Review of attachment 287115 [details] [review]:
> 
> A little awkward that this is special cased instead of being another builtin. 
> OTOH, I know adding builtins is a lot of boilerplate.
> 
> And there is precedent in e.g. "git rev-parse --show-toplevel".  (What does
> telling me the the git topdir have to do with parsing revs??)
> 
> So...marking ACN.  But maybe we can think about some better way to handle
> frequently used vs infrequently used tools.  That's kind
> of what I was going for with "instutil", but this isn't related to installing.

I just literally followed what you suggested in comment #5 without thinking about it too much. I was also reminded of the git rev-parse option; at least we're putting this on 'ostree admin' not on a random subcommand, so there might be some chance of it being found...
Comment 17 Colin Walters 2014-09-26 17:20:18 UTC
Review of attachment 287187 [details] [review]:

LGTM
Comment 18 Colin Walters 2014-09-26 17:20:46 UTC
Review of attachment 287188 [details] [review]:

Yep.
Comment 19 Colin Walters 2014-09-26 17:21:35 UTC
(In reply to comment #16)

> 
> I just literally followed what you suggested in comment #5 without thinking
> about it too much. 

Right, forgot I said that =)

> I was also reminded of the git rev-parse option; at least
> we're putting this on 'ostree admin' not on a random subcommand, so there might
> be some chance of it being found...

Yep, I think it's fine.  Let's go with it.
Comment 20 Owen Taylor 2014-09-26 17:32:50 UTC
Attachment 287114 [details] pushed as 262cba0 - ostree admin instutil set-kargs: make more flexible
Attachment 287115 [details] pushed as d64d003 - ostree admin: Add a --print-current-dir option
Attachment 287187 [details] pushed as c3f8019 - Add test case for 'admin instutil set-kargs'
Attachment 287188 [details] pushed as cc180f5 - Test 'ostree admin --print-current-dir'