Re: what's the Correct git update method keeping local changes

From: Tomoaki AOKI <junchoon_at_dec.sakura.ne.jp>
Date: Tue, 28 Mar 2023 10:27:54 UTC
On Tue, 28 Mar 2023 09:59:45 +0200
Matthias Andree <mandree@FreeBSD.org> wrote:

> Am 28.03.23 um 05:19 schrieb void:
> > Hello hackers@
> > 
> > I looked in the porters and developers handbooks and couldn't find 
> > reference
> > to a Correct method of working with git, poudriere, the ports tree and
> > local changes for a use case like mine.
> > 
> > Right now my workflow looks like this:
> > 
> > 1. apply patch either with patch -p0 < patchfile or git apply from the 
> >     top of the ports tree
> > 2. git stash
> > 3. poudriere ports -u -q
> > 4. git stash pop
> > 5. run the poudriere build
> > 
> > then, subsequent poudriere builds need steps 2-5 repeated.
> > 
> > I'm wary of git merge/apply because i'm not a dev and so don't want to push
> > changes. but I want to update the ports tree for poudriere with local 
> > changes
> > keeping them local.
> > 
> > What's the best way?
> 
> So - there's some discrepancy in your tools there, you are using git to 
> keep local patches, and poudriere to update.  This seems odd.  Is 
> poudriere using git to update your ports tree? Portsnap?  Something 
> else? We don't know.
> 
> I personally do not use poudriere ports -u, in fact I am maintaining my 
> /usr/ports in Git (but then I occasionally push from my tree into 
> FreeBSD's), and poudriere knows the ports tree with a "null" method, and 
> then 2...4 become a simple "git pull --rebase --autostash".
> 
> > $ poudriere ports -l
> > PORTSTREE METHOD TIMESTAMP           PATH
> > default   null   2023-03-27 05:59:35 /usr/ports
> 
> -- 
> Matthias Andree
> FreeBSD ports committer

I myself use git to update ports tree and never use `poudriere port -u`.
Basically every step is done on /usr/ports.

1. Apply patches I want to try.
2. `git stash`
3. `git pull --ff-only`
4. `portsdb -Uu`
5. `git stash apply`

Step 4 is for portupgrade (still use it if tooooooo many update is
proposed by `poudriere bulk` but need some ports updated right away
(basically small security updates), and pkg_replace doesn't work as
intended.
This step updates INDEX locally and update portupgrade database.
If INDEX is somehow broken, do `portsdb-Fu` before step 5 to fetch
last sane (but old) INDEX.

Note that I've configured poudriere ports tree as below to
use /usr/ports.

`poudriere ports -c -f none -M /usr/ports -m null`

This is because, I cannot recall which actually was, some ports
hesitates to build unless ports tree is /usr/ports and I only use
poudriere on bare metal environment. No builds for other archs nor
branches.

-- 
Tomoaki AOKI    <junchoon@dec.sakura.ne.jp>