Commit graph

82 commits

Author SHA1 Message Date
472bba6fbb pgit.sh: Make PGIT_SH_PROJECTS work on all commands

PGIT_SH_PROJECTS currently only sets the projects to operate on for the get command. Extend this to all commands. And replace the environment variable by a command-line option, likely after this script has been ported to Python.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-21 15:53:27 +01:00
ea968b521b pgit.sh: Log complete refspec in get

Change the project header logged during the get command to include the complete refspec.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-21 15:53:27 +01:00
f86634a1d1 pgit.sh: Rename command "clone" to "get"

"clone" in the Git sense means to copy a remote project over from scratch. pgit.sh clone has come from that, but has since evolved into something different, a mixture of clone, pull and fetch, so find a different name. "get" seems generic enough and doesn't clash with a Git meaning. Adapt variable names accordingly across the project.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-21 15:53:25 +01:00
82b41ffce2 pgit.sh: Beautify variable names some more

Continue to name variables in pgit.sh somewhat more consistently, notably turn somevar into some_var. Plus some additional cleanup. Still not a beauty.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-21 14:10:34 +01:00
b9e1f91ff6 pgit.sh: Don't show fat header for one project

The fat marker with counter (# ==== [1/1] Fetching ...) is distracting if shown for only one project, so only show a regular marker without counter.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-21 12:13:11 +01:00
93b2a2f222 pgit.sh: Support refspec keyword current-branch

If "current-branch" is specified within --refspec, either as from-ref or as to-ref, expand that to the branch the working directory has currently checked out.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-21 04:14:59 +01:00
f38abb9057 pgit.sh clone: Merge code path "from-user == login"

The cases from-user == login and from-user != login have different code paths and can be streamlined somewhat, so do that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-19 19:37:17 +01:00
cb3ccaa338 pgit.sh: Auto-detect current project in toplevel dir

This commit allows pgit.sh to target not only multiple projects below a projects-directory, but also one single project. If invoked from the toplevel directory of a project, it uses that as the only project it should deal with. This is meant to facilitate running the same VCS abstraction logic for one project as for many projects. The project or projects to deal with should probably be specified on the command line, but changing the auto-detection mechanism buys us what we want for now with low hassle.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-18 01:20:25 +01:00
f28ee62209 pgit.sh: Make some (!) variable names less messy

Some variable names are too short for global scope ($p, $pdir, $pdirs), among others. For those mentioned: Make them longer and more descriptive.

Also add a variable project_name, which denotes what a project is in a remote repository, and which is currently but not necessarily always the same as the project directory.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-18 01:20:25 +01:00
1e9ab195a6 pgit.sh: Pass --autostash to rebase

Calling make git-pull-xxx from a projects directory stops iterating projects if one has a dirty workspace. Calling --autostash fixes that.

With this in place, a failed rebase leaves the local changes behind stashed. So, after manually fixing the rebase, the stash needs to be manually reapplied. The commands that led up to the failure are logged right before, so I have hope that this is learnable, and not too much of a footgun.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-10 09:55:59 +01:00
4431993665 pgit.sh pull: Rebase target branch before merge

Before merging the remote branch, do a rebase. This may fail and prompt conflict resolution, but that seems the canonical outcome for the common use case "interactive make git pull-xxx" with master out-of-sync.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-01-31 11:13:41 +01:00
132dce8b3f jw-projects.py: Rename it to jw-pkg.py

jw-projects.py is now a multi-call executable, with "projects" being just one of its subcommands. Rename it to jw-pkg.py to reflect that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-01-28 15:24:16 +01:00
0b83c863a2 jw.build.cmds: Move build.cmds -> cmds.projects

Reorganize the Python module structure. Placing the command classes under jw.cmds.projects instead of jw.build.cmds will allow to add a nested command structure, with the current commands, being mostly related to building software, found below a "projects" toplevel command.

Other conceivable commands could be "package" for packaging, or "distro" for commands wrapping the distribution's package manager.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-01-26 17:58:23 +01:00
93052882de pgit.sh clone: Fetch submodule tags only from origin

To avoid network errors while fetching tags, run

git submodule foreach --recursive 'git fetch --tags -f origin

i.e. only fetch tags from origin, which by convention points to git.janware.com.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-01-06 19:11:01 +01:00
3af712705d pgit.sh: Run git fetch --tags on submodules

On pull / clone operations, run

git submodule foreach --recursive 'git fetch --tags'

Notably the Bootstrap package needs the tags to check out different Bootstrap versions.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-12-23 14:06:41 +00:00
016c1f4220 pgit.sh: Don't fetch with target refspec

"git fetch $remote $fromref:$toref" fails if the $fromref is behind $toref.

Unrolling the syntax into "git fetch" followed by "git merge --ff-only $remote/$fromref $toref" is accepted, though, and saves some otherwise necessary case distinction code around it.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-29 15:35:39 +01:00
9217d38964 Everywhere: Rename package "jw-build" to "jw-pkg"

jw-build doesn't stop at building software, packaging it afterwards is also a core feature, so this commit gives the package a better name.

The commit replaces strings s/jw-build/jw-pkg/ in text files and file names. Fallout to the functionality is fixed, variable names are left as they are, though. To be adjusted by later commits.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-28 13:35:56 +01:00
e31e50036d pgit.sh: push doesn't understand --login

--login is not understood by pgit.sh push. Solve that by allowing all commands a --login option. This addresses our use case, but isn't ideal of course. Will be finally fixed by moving pgit.sh's functionality into Python code.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-26 20:55:35 +01:00
0d95ccc5a0 pgit.sh: clone --login configures broken remote

pgit.sh clone --login <username> fails to insert said username into a remotes url while adding it: Of ssh://<username>@git.janware.com/srv/git, only ssh://@git.janware.com/srv/git makes it into the config. Fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-26 20:00:51 +01:00
f9f0041790 pgit.sh: Support --login

In the move away from environment variables, replace JANWARE_USER support in pgit.sh by the --login option.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-24 10:35:07 +01:00
d047ad650c pgit.sh: Support --refspec

In the attempt to move away from communicating options via environment variables from one part of jw-build software to another, replace PGIT_CLONE_FROM_USER with the clearer --refspec option. Which is also more versatile.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-24 10:04:47 +01:00
9283479489 make, scripts: Don't unconditionally clone with proactiveAuth=basic

Don't unconditionally add proactiveAuth=basic to Git's config during clone, but only if cloning happens after authentication.

This saves unauthenticated users funny password prompts. On the other hand, this makes a server setting persistent which could be changed on the server.

URL =~ /api/ (or so) => 401, followed by Basic Auth URL !=~ /api/ (or so) => Redirect or free access, depending on resource

Currently all resources, including API, are accessible by either basic auth or a Cookie, but basic auth needs to be present in the first request, which throws off some clients (notably Git without proactiveAuth=basic).

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-20 17:32:04 +01:00
c37f2aaca3 pgit.sh: Deprecate CentOS 7

CentOS 7's Git doesn\'t understand -C, consider that obsolete and don't cd into a directory any longer.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-20 16:15:26 +01:00
e46ab382e9 pgit.sh: Set http.proactiveAuth=basic

For git clone, use and persist the http.proactiveAuth=basic config option, because it's needed for janware.com servers.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-20 15:07:17 +01:00
b7833c928a pgit.sh fix: --create-remote-user-repos parsed incorrectly

--create-remote-user-repos is not recognized because of is not recognized because of a typo, fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-18 21:12:54 +01:00
dc5515df09 pgit.sh clone: Use jw-projects.py instead of git-srv-admin.sh

Replace git-srv-admin.sh list-personal-projects by the more universal "jw-projects.py list-repos" for enumerating repo names. This is a step towards supporting Git servers other than janware.com.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-18 15:40:27 +01:00
1b21e33ded pgit.sh: Support --remote-base

pgit.sh has ssh://$login@git.janware.com/srv/git/$fromuser/proj/$reponame hard-coded as the remote Git URLs of every cloned project.

This commit adds support for the global option --remote-base. Passing it changes the URL to <remote-base>/$fromuser/$reponame..

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-18 15:25:46 +01:00
aed14fd480 pgit.sh clone: Support --create-remote-user-repos

Add support for --create-user-repos to pgit.sh. It controls whether or not personal remote repositories on janware.com are created when cloning from another user.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-18 15:37:03 +01:00
b82d4249f9 pgit.sh: Remove CVS support

Don't identify projects directory by a the presence of a correct CVS subdirectory any longer.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-17 11:30:59 +01:00
5b758023ac pgit.sh: Re-add scripts/pgit.sh

pgit.sh is not indispensable for building a projects directory, but it is necessary for some convenience targets in projects-dir.mk.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-14 15:38:54 +01:00
bc883deed4 Everywhere: Remove everything non-essential for "make clean all"

This commit removes everything not strictly necessary for running "make clean all" inside jw-build.

packaging jw-devtest. This cuts the repo down from 24077 to 4725 lines of code.

The idea is to

1) Further remove bloat from the remaining bits

2) Re-add what's necessary to build and package other essential repos.

The decision should be based on whether or not jw-build can also be useful in a non-janware context.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-14 15:02:56 +01:00
5e9168480a project-dirs.mk / pgit.sh: Add support for offlining projects

This adds support for the variable OFFLINE_PROJECTS in projects-dir.mk and the PGIT_IGNORE environment variable. Both go hand in hand and do what their names insinuate. OFFLINE_PROJECTS is initialized from EXCLUDE_FROM_BUILD, which in turn is initialized from exclude.txt and friends.

Signed-off-by: Jan Lindemann <jan@janware.com>
2020-05-10 08:07:22 +00:00
17244e9a3f pgit.sh: Add support for target refspec to PGIT_CLONE_FROM_USER

PGIT_CLONE_CLONE_FROM_USER now supports optional suffixes of the form [:src-ref[:dst-ref]]. If present, src-ref specifies the remote branch pgit.sh tries to fetch, and dst-ref the local branch it tries to fetch into. src-ref defaults to "master" (as it was before) and dst-ref to nothing, i.e. no head-update of any local branch.

Signed-off-by: Jan Lindemann <jan@janware.com>
2020-02-24 14:35:26 +00:00
e3469d0ac0 pgit.sh: Rename clone remote user-xxx to jw-xxx

This looks more understandable for non-janware user cases

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-10-11 15:28:05 +00:00
db6bdc454e scm.sh + pgit.sh: Add on-demand to recurse-submodules

git pull, push, fetch use --recurse-submodules, which is non-optional for push. Added --recurse-submodules=on-demand to all for consistency.

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-10-09 15:16:25 +00:00
098653aed2 pgit.sh: Add --recurse-submodules to all git fetch, pull and push
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-02-07 11:04:45 +00:00
559198f765 pgit.sh: Run update-descriptions after push during clone
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-01-04 18:06:00 +00:00
00a52c9039 pgit.sh: Don't pull fetchuser into current master, only fetch
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-01-03 12:10:00 +00:00
ce5111e7eb pgit.sh: Fix detection of pending commits

git diff exit status just catches file changes, not not file additions, removals or renames.

Signed-off-by: Jan Lindemann <jan@janware.com>
2018-12-16 11:12:22 +00:00
be98a4049c pgit.sh: Don't uncoditionally set -e

Base that on whether or not PGIT_KEEP_GOING is defined

Signed-off-by: Jan Lindemann <jan@janware.com>
2018-12-12 16:53:27 +00:00
adb18caa13 make, scripts: git submodule update --init --recursive

Consistently run git submodule update with --init --recursive.

Signed-off-by: Jan Lindemann <jan@janware.com>
2018-11-18 18:31:30 +00:00
fb7df55e6f pgit.sh: Add iteration counter to logging
Signed-off-by: Jan Lindemann <jan@janware.com>
2018-10-23 11:45:10 +00:00
20f675c280 make, scripts: Fix CentOS 7 build
Signed-off-by: Jan Lindemann <jan@janware.com>
2018-10-13 10:46:02 +00:00
fce5e7b8c1 pgit.sh: Reduce verbosity
Signed-off-by: Jan Lindemann <jan@janware.com>
2018-03-06 14:45:45 +00:00
8e879fb51a pgit.sh commit: Add support for --cvs
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-10-06 14:15:54 +00:00
b3f12a6c35 pgit.sh: Add support for defining pdir and pdirs in the environment
TODO: These variables seem a bit short for the environment
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-06-17 09:16:44 +00:00
763d18f350 pgit.sh: Make commit check if there's a diff before running commit
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-06-12 09:11:28 +00:00
cf4308e2c5 pgit.sh: Add support for environment variable PGIT_KEEP_GOING

Sadly, a commit returns 1 if there's nothing to commit, which makes pgit.sh error out of the project loop, which is run with set -e. This option disables -e.

OTOH, pgit.sh commit could check for a diff and only run git commit if there is a diff.

Signed-off-by: Jan Lindemann <jan@janware.com>
2017-06-12 08:59:08 +00:00
e1200746e3 pgit.sh: Use plain directory path for diff prefix

The diff source and destination in diff used to be a/path/to/file.txt and b/path/to/file.txt which differed from cvs diff -u. Changed that, now make diff in the toplevel directory creates usable patches for all sources.

Signed-off-by: Jan Lindemann <jan@janware.com>
2017-06-01 08:41:00 +00:00
bab0c1f69f pgit.sh: Some experiments to output formatting
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-04-28 11:37:15 +00:00