On 05/21/2015 05:23 PM, Ondřej Čertík wrote:
> On Thu, May 21, 2015 at 12:42 AM, Dag Sverre Seljebotn
> <
d.s.se...@astro.uio.no> wrote:
>> Ondrej started a discussion at
https://github.com/hashdist/hashdist/pull/337
>> which I'd like to open up on the mailing list. Brief summary:
>>
>> Ondrej's working on adding synonyms for profiles, so that you can do `hit
>> activate myprofile` (or whatever) and we have a global alias from myprofile
>> to the built profile.
>
> It's `hit load myprofile`.
>
>>
>> Then the question is: Do we also add a history mechanism; `hit rollback`,
>> etc?
>
> For sure ---- it's already there, the old profiles stay, as hashes. We
> just need to provide nice tools for the user to use them.
> One of them is to print old hashes that were once called "myprofile",
> so that you can revert to it.
>
>> To me it feels a bit like duplicating git, and that all the features of git
>> (branching, etc. etc.) would be beneficial for managing stacks as well.
>
> The git analogy is not perfect ---- the similarity is that the
> myprofile is like a branch, and a profile hash is like a commit. But
> the difference is that git commits depend on each other, in
> succession, while profile hashes are completely independent. You can
The hashes are independent, but the changes you do to profiles typically
build on one another, and don't underestimate the power of the metadata
(integrity hash, timestamp, author, log message), even if that is stuff
we could duplicate too...
If we get "hit install numpy", then "hit install scipy", I would really
like that to
a) be implemented as successive changes to a profile YAML file
b) each command I run should be a seperate commit (being a machine-based
change it needs to be well tracked, easily revertable etc.)
I guess that could also be satisfied by using git in a very restricted
mode (like, only one branch), instead. But I am rather convinced that
using git in one way or another should play a part, life is too short to
make our own history tracking system, and we don't have to use or
support all of git's features.
> order them by the time they were created, but that's not how git works
> --- you can create the last commit first, and first commit last, and
> rebase on top. The time of commits will show this, i.e. that the
> commits are not ordered by time (necessarily). So in our case, the
> profile history is really just a set of hashes, with no intrinsic
> ordering/dependencies.
The editing history of your profile YAML files *is* ordered in times and
git commits will typically match that. Fancy rebasing is not something
that happens by default. If you do, you of course can't complain
afterwards that "hit rollback" reset the last commit even if didn't have
newest timestamp; that is what you expect...
If you do "hit install numpy; hit uninstall numpy; hit install numpy",
there are 3 commits even if you end up with the original profile hash.
> I am not sure I follow. Essentially you are saying to put the
> Hashstack repository inside ~/.hashdist, and let it be managed by
> `hit`? And the profile yaml, let's say the default.yaml, will also be
> managed by git, inside ~/.hashdist, and `hit` will provide some nice
> tools on top?
By default, I would put a small repo that links to hashstack, like this one:
https://github.com/hashdist/profile-template
> So if I have 10 different profiles, those will be in 10 different
> branches? A typical thing that I do is that I update one package, and
> then rebuild all profiles. So I would need to rebase the 10 profile
> branches first on top of the latest Hashstack to rebuild?
Yes, it doesn't quite work, does it? I'm brainstorming :)
So what about (typically) having a single branch, and each profile is a
YAML file? So if I do
hit load prof1
hit install numpy # commit (1) changes prof1.yaml
hit load prof2
hit install pandas # commit (2) changes prof2.yaml
then there are 2 commits to the repo, one that changes prof1.yaml and
one that changes prof2.yaml.
"hit rollback" needs some thought here though. For the commits above it
could use "git log prof1.yaml" and do a "git revert", but it's not clear
what it should do, or whether it should raise an error, in your case
where you change package definition and wants to rebuild all the profiles.
I think for typical non-power-user cases, "prof1.yaml" contains the sha1
of a specific Hashstack commit. And if you want new package definitions,
that could be done with
hit load prof1
hit fetch-package-definitions # commit (3) changes prof1.yaml
which again lends itself nicely to a rollback git commit.
Anyway, I'm not sure just how important the rollback command is. The
important thing is there's an easy to understand history system that
tracks everything in a nice way.
So, how do you feel about one repo with one YAML file per "globally
available" profile? Files like "debian.yaml" should either be in other
repos included via a git hash, or in the same repo in a sub-directory
(so "debian.yaml" would be a profile named "debian", but just move it to
"support/debian.yaml" and it doesn't show up in the profile list).
Dag Sverre