Re: git: "overlay" of own remote-branch on official freebsd-ports repo

2021-10-13 Thread FreeBSD User
On Tue, 12 Oct 2021 10:01:00 -0600
Warner Losh  wrote:

> On Tue, Oct 12, 2021 at 9:32 AM FreeBSD User  wrote:
> 
> > I do not know whether I'm right in this list, but since the subject is
> > mutual so common
> > in development and GIT, I have the strong feeling I'm right here.
> >
> > Im quite new to git, so apologizes for any inconvenience reading my
> > question.
> >
> > Using poudriere on 14-CURRENT to create a selection of packages also
> > includes updating
> > the ports tree on a regular basis. I maintain some "special" ports not
> > official part of
> > the FreeBSD ports tree and some other ports are part of those I'm supposed
> > to maintain. I
> > keep personally track of the changes in a git repo of my own.
> >
> > Now I'd like to "overlay" the official portas repo by that of mine to
> > include changes.
> > With SVN, there was no problem to have local changes not overwritten by
> > regular updates
> > of the ports tree as long as the specific port in question wasn't updated
> > by the official
> > site. In git, this behaviour seems to have changed, any changes I made so
> > far are gone
> > after poudriere is adviced to update the tree.
> >
> > I'd like to ask how FreeBSD developers and maintainers do the trick. If
> > there is an
> > official cookbook fpr maintainers (I haven't found it yet ...), please be
> > so kind and
> > refer to it. Any advice is welcome.
> >  
> 
> tl;dr: branches are cheap and well supported in git. You just make a branch
> for your
> local changes, and update that however you see fit.
> 
> For ports I have like that, I've just created a branch in git. I rebase the
> branch forward
> each time I update. For me, though, the branch is mostly uncommitted in
> upstream
> changes that may not be ready for some reason... There's two ways to do
> this.
> You can just merge, which is OK if you aren't upstreaming the changes, or
> you can
> rebase if the changes or a subset of the changes likely will end up in
> FreeBSD.
> 
> Others might recommend stash, but I find it too unwieldy for more than a
> couple
> of things.
> 
> So the workflow would be:
> 
> git clone -o freebsd  freebsd-ports
> cd freebsd-ports
> git checkout -b hartmann-specials
> 
> 
> Now, you can use poudriere-ports with the -B hartmann-specials and your
> local repo as the source of truth.
> 
> to update
> 
> cd freebsd-ports
> git checkout main
> git pull --rebase  # or --ff-only, I use
> --rebase because I push and it's habit
> git rebase -i main hartmann-specials
> 
> Note: if you need to have multiple trees with this branch you are modifying,
> then a git pull --rebase will let you cope with the forced-pushes this
> method
> would require. You can also do it with git merge on hartmann-specials if you
> don't need to keep the changes separate or you have a lot of downstreams
> that would get cranky, which doesn't sound like the case here.
> 
> Warner

As I wrote, I'm quite new to git and always surprised. Thanks for the help and
the neat tip. I'll try.

Kind regards and thanks,

Oliver



Re: git: "overlay" of own remote-branch on official freebsd-ports repo

2021-10-13 Thread FreeBSD User
On Tue, 12 Oct 2021 18:01:56 +
Brooks Davis  wrote:

> On Tue, Oct 12, 2021 at 05:31:48PM +0200, FreeBSD User wrote:
> > I'd like to ask how FreeBSD developers and maintainers do the trick. If
> > there is an official cookbook fpr maintainers (I haven't found it yet ...),
> > please be so kind and refer to it. Any advice is welcome.  
> 
> If you only want to add extra ports, I'd recommend maintaining a
> separate repo for use with the ports collection's under-documented
> overlay feature.  This avoids the need to rebase or merge your trees.
> 
> You create the overlay in poudriere with something like:
> 
> poudriere ports -c -p cheri-ports-overlay -U
> https://github.com/CTSRD-CHERI/cheri-ports-overlay.git -m git -B main
> 
> You then use it by adding -O cheri-ports-overlay to your other poudriere
> commands like poudriere bulk.
> 
> Note that you may need to install poudriere-devel or install it by hand
> to get this feature.
> 
> -- Brooks

Hello,

that sounds very good and usefull.

Thank you very much

Kind regards,

Oliver



Re: git: "overlay" of own remote-branch on official freebsd-ports repo

2021-10-12 Thread Brooks Davis
On Tue, Oct 12, 2021 at 05:31:48PM +0200, FreeBSD User wrote:
> I'd like to ask how FreeBSD developers and maintainers do the trick. If there 
> is an
> official cookbook fpr maintainers (I haven't found it yet ...), please be so 
> kind and
> refer to it. Any advice is welcome.

If you only want to add extra ports, I'd recommend maintaining a
separate repo for use with the ports collection's under-documented
overlay feature.  This avoids the need to rebase or merge your trees.

You create the overlay in poudriere with something like:

poudriere ports -c -p cheri-ports-overlay -U 
https://github.com/CTSRD-CHERI/cheri-ports-overlay.git -m git -B main

You then use it by adding -O cheri-ports-overlay to your other poudriere
commands like poudriere bulk.

Note that you may need to install poudriere-devel or install it by hand
to get this feature.

-- Brooks


signature.asc
Description: PGP signature


Re: git: "overlay" of own remote-branch on official freebsd-ports repo

2021-10-12 Thread Felix Palmen
* Warner Losh  [20211012 10:01]:
> tl;dr: branches are cheap and well supported in git. You just make a branch
> for your
> local changes, and update that however you see fit.
> 
> For ports I have like that, I've just created a branch in git. I rebase the
> branch forward
> each time I update.

+1, I do basically the same. I'd say having a local branch in your local
repo is one ot the killer features of git over svn.

I just do a few details slightly different, maybe it helps as one
possible example. I only fetch 'main' from the official repo and rebase
my 'local' branch onto that. During the rebase, it's easy to solve any
conflicts with changes in 'main'. You still keep a list of your local
commits, well organized.

I recently decided to also publish my local branch. So now I just have
two remotes on my local ports repo, the official FreeBSD repo and
another one on github, looking like this:

  # git remote -v
  origin  https://github.com/Zirias/zfbsd-ports.git (fetch)
  origin  https://github.com/Zirias/zfbsd-ports.git (push)
  upstreamhttps://git.freebsd.org/ports.git (fetch)
  upstreamhttps://git.freebsd.org/ports.git (push)

With that and remote branch tracking set up correctly, I just need these
commands (I have them in a script) to update from the official repo,
rebase and force push to my github repo:

  git checkout local
  git fetch upstream main:main && git rebase main
  git push -f --all

BTW, git leaves working copy changes alone if possible, so maybe it's
poudriere's way of using git that erases them – just use git directly
instead of poudriere. And then, I always hated having random local
changes not organized in any way, this quickly grows into a maintenance
nightmare, so I'm very thankful I can now easily use git branches
instead.

-- 
 Dipl.-Inform. Felix Palmen ,.//..
 {web}  http://palmen-it.de  {jabber} [see email]   ,//palmen-it.de
 {pgp public key} http://palmen-it.de/pub.txt   //   """
 {pgp fingerprint} A891 3D55 5F2E 3A74 3965 B997 3EF2 8B0A BC02 DA2A


signature.asc
Description: PGP signature


Re: git: "overlay" of own remote-branch on official freebsd-ports repo

2021-10-12 Thread Warner Losh
On Tue, Oct 12, 2021 at 9:32 AM FreeBSD User  wrote:

> I do not know whether I'm right in this list, but since the subject is
> mutual so common
> in development and GIT, I have the strong feeling I'm right here.
>
> Im quite new to git, so apologizes for any inconvenience reading my
> question.
>
> Using poudriere on 14-CURRENT to create a selection of packages also
> includes updating
> the ports tree on a regular basis. I maintain some "special" ports not
> official part of
> the FreeBSD ports tree and some other ports are part of those I'm supposed
> to maintain. I
> keep personally track of the changes in a git repo of my own.
>
> Now I'd like to "overlay" the official portas repo by that of mine to
> include changes.
> With SVN, there was no problem to have local changes not overwritten by
> regular updates
> of the ports tree as long as the specific port in question wasn't updated
> by the official
> site. In git, this behaviour seems to have changed, any changes I made so
> far are gone
> after poudriere is adviced to update the tree.
>
> I'd like to ask how FreeBSD developers and maintainers do the trick. If
> there is an
> official cookbook fpr maintainers (I haven't found it yet ...), please be
> so kind and
> refer to it. Any advice is welcome.
>

tl;dr: branches are cheap and well supported in git. You just make a branch
for your
local changes, and update that however you see fit.

For ports I have like that, I've just created a branch in git. I rebase the
branch forward
each time I update. For me, though, the branch is mostly uncommitted in
upstream
changes that may not be ready for some reason... There's two ways to do
this.
You can just merge, which is OK if you aren't upstreaming the changes, or
you can
rebase if the changes or a subset of the changes likely will end up in
FreeBSD.

Others might recommend stash, but I find it too unwieldy for more than a
couple
of things.

So the workflow would be:

git clone -o freebsd  freebsd-ports
cd freebsd-ports
git checkout -b hartmann-specials


Now, you can use poudriere-ports with the -B hartmann-specials and your
local repo as the source of truth.

to update

cd freebsd-ports
git checkout main
git pull --rebase  # or --ff-only, I use
--rebase because I push and it's habit
git rebase -i main hartmann-specials

Note: if you need to have multiple trees with this branch you are modifying,
then a git pull --rebase will let you cope with the forced-pushes this
method
would require. You can also do it with git merge on hartmann-specials if you
don't need to keep the changes separate or you have a lot of downstreams
that would get cranky, which doesn't sound like the case here.

Warner


git: "overlay" of own remote-branch on official freebsd-ports repo

2021-10-12 Thread FreeBSD User
I do not know whether I'm right in this list, but since the subject is mutual 
so common
in development and GIT, I have the strong feeling I'm right here.

Im quite new to git, so apologizes for any inconvenience reading my question.

Using poudriere on 14-CURRENT to create a selection of packages also includes 
updating
the ports tree on a regular basis. I maintain some "special" ports not official 
part of
the FreeBSD ports tree and some other ports are part of those I'm supposed to 
maintain. I
keep personally track of the changes in a git repo of my own.

Now I'd like to "overlay" the official portas repo by that of mine to include 
changes.
With SVN, there was no problem to have local changes not overwritten by regular 
updates
of the ports tree as long as the specific port in question wasn't updated by 
the official
site. In git, this behaviour seems to have changed, any changes I made so far 
are gone
after poudriere is adviced to update the tree.

I'd like to ask how FreeBSD developers and maintainers do the trick. If there 
is an
official cookbook fpr maintainers (I haven't found it yet ...), please be so 
kind and
refer to it. Any advice is welcome.

Kind regards and thanks in advance,

O. Hartmann