184 Commits

Author SHA1 Message Date
Luca Di Sera
6b424efcf1 Do not assume FHS in init-repository and configure
On systems that do not follow the Filesystem Hierarchy Standard, such as
guix, the hardcoded `/bin/pwd` will fail to be found so that the script
will fail.

Use `pwd`, instead, so that the command can be found through the normal
path search mechanism.

Change-Id: I519d535bcaf53119c8800cc5545da9a0e48e677a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-06-28 17:41:38 +02:00
Fabian Kosmale
61dc233044 init-repository: Check for cmake
And bail out with proper warning if cmake is missing

Change-Id: I39a9e340f873f8de05264d57b2a80fb754b30fbe
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-03-26 23:07:40 +01:00
Alexandru Croitor
29019c9cae CMake: Rewrite init-repository using CMake and .sh / .bat scripts
init-repository is now implemented using CMake + .sh / .bat scripts.

The intent behind the change is not to require Perl to checkout and
build Qt, because it can be troublesome to acquire on Windows and it
can also lead to issues during builds due to CMake picking up a Perl
distribution-shipped compiler.

All previous options were ported over like
- module-subset
- alternates
- etc.

A few new options were added:
- --resolve-deps / --no-resolve-deps
- --optional-deps / --no-optional-deps
- --verbose
and some other internal ones for testing reasons.

The new script does automatic resolving of dependencies
based on the depends / recommends keys in .gitmodules unless
--no-resolve-deps is passed.
So if you configure with --module-subset=qtsvg, the script will also
initialize qtbase.
If --no-optional-deps is passed, only required dependencies ('depends'
ky) will be included and optional dependencies ('recommends' key) will
be excluded.

The new script now has a new default behavior when calling
init-repository a second time with --force, without specifying a
--module-subset option. Instead of initializing all submodules, it
will just update the existing / previously initialized submodules.

It also understands a new module-subset keyword "existing", which
expands to the previously initialized submodules, so someone can
initialize an additional submodule by calling
 init-repository -f --module-subset=existing,qtsvg

Implementation notes:

The overall code flow is init-repository -> cmake/QtIRScript.cmake
-> qt_ir_run_main_script -> qt_ir_run_after_args_parsed ->
qt_ir_handle_init_submodules (recursive) -> qt_ir_clone_one_submodule
with some bells and whistles on the side.

The command line parsing is an adapted copy of the functions
in qtbase/cmake/QtProcessConfigureArgs.cmake. We can't use those exact
functions because qtbase is not available when init-repository is
initially called, and force cloning qtbase was deemed undesirable.

We also have a new mechanism to detect whether init-repository was
previously called. The perl script used the existence of the qtbase
submodule as the check. In the cmake script, we instead set a custom
marker into the local repo config file.

Otherwise the code logic should be a faithful reimplementation of
init-repository.pl aside from some small things like logging and
progress reporting.

The pre-existing git cloning logic in QtTopLevelHelpers was not used
because it would not be compatible with the alternates option and I
didn't want to accidentally break the pre-existing code. Plus
init-repository is a bit opinionated about how it clones and checks
out repos.
The dependency collection and sorting logic uses the pre-existing code
though.

See follow up commit about implicitly calling init-repository when
qt5/configure is called and the repo was not initialized before.

[ChangeLog][General] init-repository was rewritten using CMake. Perl
is no longer required to initialize the qt5.git super repo.

Task-number: QTBUG-120030
Task-number: QTBUG-122622
Change-Id: Ibc38ab79d3fdedd62111ebbec496eabd64c20d2b
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-02-28 06:23:36 +01:00
Alexandru Croitor
1971e8075d CMake: Rename init-repository script to make space for cmake script
Task-number: QTBUG-120030
Change-Id: Iae2f3e25814321729c213503db2ac8a3a39cf2d9
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-02-28 06:23:32 +01:00
Lucie Gérard
a09d8e0ae6 Update license header to SPDX format
Pick-to: 6.5 6.6 6.7
Task-number: QTBUG-67283
Change-Id: Id3679318557c7611b040b155fe1c815e1093d8f9
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-12-12 06:17:14 +00:00
Joerg Bornemann
6c40b6160e init-repository: Fix wrong remote URLs in cloned submodules
The cloned submodules had a wrong origin remote URL if the origin remote
of the local qt5.git repository had a trailing slash.

Fix this by stripping the trailing slash when stripping the trailing
".git" from qt5.git's remote.

Pick-to: 6.5 6.6
Fixes: QTBUG-113793
Change-Id: I199b6e1915f67558ecfe69f7300d0f9ef0d4b232
Reviewed-by: Alexandru Croitor (OOO) <alexandru.croitor@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-06-12 12:10:34 +00:00
Audun Sutterud
499f6e2fe5 Warn on absent qtrepotools
When qtrepotools is absent from --module-subset, Git hooks cannot be
installed. Emit a warning in this case.

Change-Id: I7c53b8c2817f72dbdc2b813dd18c8f63061a00c8
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
2023-01-26 13:26:02 +01:00
Kai Köhne
becb423e80 Replace LGPL2.1 only header with LGPL3 one
This is in line with e.g. qtbase. Also remove outdated/unreferenced
license files.

Pick-to: 6.3
Change-Id: I5d3370ab453610f9c8165ff9e57db7ad4a785370
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2021-12-19 19:47:15 +00:00
Li Xinwei
4450693ac0 Fix --mirror option for init-repository
If submodule url is absolute, don't use mirror, don't set
remote.gerrit.url and remote.gerrit.fetch.

To avoid error when passing "--mirror git://github.com/qt/":
fatal: remote error: qt/https://code.qt.io/playground/qlitehtml
is not a valid repository name
Visit https://support.github.com/ for help

amends 7374ef8e38b6b47589ff4f2977f102fc63ab3d72

Change-Id: Ifb4e1c8de57c7729f2965c16388f1acd763a150f
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-05-31 10:58:48 +00:00
Kai Köhne
7374ef8e38 Support absolute submodule urls
This is needed for qttools.

Fixes: QTBUG-93850
Change-Id: I59a7f8a56d8d7143521b67d0c385150e62338209
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-05-27 06:32:24 +00:00
Paul Wicking
ed139ea47e Update documentation for init-repository
There's no mention of additionalLibrary status.

Pick-to: 6.1 6.0
Change-Id: I3ebf8fdc6dcfc01392b1ab5a42734cef81d6fc61
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-03-25 15:39:05 +01:00
Topi Reinio
8ebf0095c3 init-repository: Fix incorrect use of 'or' operator
This fixes the warning 'Useless use of a constant ("qt5") in void
context at ./init-repository line 649.'

Pick-to: 6.1 6.0 5.15
Change-Id: I12133b30b504e536eaf68e4260df5aed28543eb6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-02-25 15:14:58 +01:00
Topi Reinio
6f7f1cd550 init-repository: Allow 'tqtc-' prefix for qt5 repository
Pick-to: 6.1 6.0 5.15
Change-Id: Ic4b14e4e6efd43e54a241000e090981ce8b6c651
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-02-11 09:35:59 +01:00
Paul Wicking
414165e366 Fix init-repository
Introducing additionalLibrary to .gitmodules
broke init-repository. Add the new state also
here.

Task-number: QTBUG-90669
Pick-to: 6.1
Change-Id: I3ac9960427ef2fd8fe39b508b69459f4fcf81ca7
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
2021-02-09 06:43:18 +01:00
Frederik Gladhorn
accc0af6e4 Add clang-format-pre-commit hook
Change-Id: I762b85b96f7ab87e6c11426607165d4f1b8dbae5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-10-02 23:32:53 +02:00
Kai Koehne
6dfe5c31f2 init-repo: Resolve alternate url for git sub-submodules
Do set correct --alternates argument for sub-submodules like
qtwebengine/src/3rdparty. So far these repositories were always
fully cloned from remote (or the mirror).

Fixes: QTBUG-61901
Change-Id: I19f5930a03ab9050b6e62ac5a5c78780d0544e03
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-09-13 08:53:29 +00:00
Andy Shaw
c1fcf7c1ad init-repo: Allow sub-module checkout path to differ from config name
Change-Id: I622a8ed5daee59a96f4c6c28cc8c5e4d20b88f58
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-07-10 15:23:41 +00:00
Oswald Buddenhagen
c64b2415d3 init-repo: complain about non-option arguments
otherwise abuse may go unnoticed (at this stage ...).

Change-Id: Ic8c2a843a941cdeb2d69542830eccf7fadcf252d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-02-20 11:20:20 +00:00
Oswald Buddenhagen
3ea073ada1 ignore submodules in dirtiness check
changed submodule sha1s should not prevent updating.

Change-Id: Ibd4480bed91de2a04719c32c95a4c603eda4c44b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-04-23 11:19:48 +00:00
Oswald Buddenhagen
315b76dc9b fix url normalization
after 8c0390143, we cannot rely on the denormalized segment starting
with a slash any more.

Task-number: QTBUG-59753
Change-Id: Ia3a3c005d1f41320747a60efc48a180caa88206b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Valentin Fokin <fokinv@inf.u-szeged.hu>
2017-04-06 09:20:33 +00:00
Jason Erb
084d79e8b4 Reflect current URL in example comment
Change-Id: I51091c69d2698ba23207a95d17f4748c22cd7cb7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-03-16 12:01:37 +00:00
Jason Erb
8c0390143b Remove init-repository assumption of repo url “…/qt/<repo>”
Task-number: QTBUG-59355
Change-Id: I7bc2c94f13c6cf43bd9d4472f18b3b769e75954b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-03-13 15:18:47 +00:00
Oswald Buddenhagen
150071b395 don't fail to check out some modules in pinned mode
when used without the --branch option, we clone with --no-checkout, to
avoid unnecessarily checking out files twice when the recorded sha1
doesn't happen to be the tip of the default branch. however, that would
leave the index in a dirty state which would make the subsequent
submodule update abort at some point, silently.

to deal with the problem, we ignore this type of index dirtyness and use
submodule update with --force.

Task-number: QTBUG-57289
Change-Id: I6fc9693b0eaadfb04d2d80f9c8f1f2e11be47ae9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-11-30 15:12:13 +00:00
Oswald Buddenhagen
977f0841e4 refuse to operate with dirty submodules
the operation would later error out anyway, after spending a lot of time
fetching the remotes, and leaving a partially updated state behind.

Change-Id: Ib2a688e446a9bd4ba3b15fc73082224433c18388
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-11-30 15:12:07 +00:00
Oswald Buddenhagen
6773d4ef94 produce less ugly paths to the commit template in submodules
Change-Id: I7ebf3c46088e193c8f4605532c1f4a1b6d62d230
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-11-14 12:17:36 +00:00
Oswald Buddenhagen
357d29a002 add --no-fetch option
there is no point in re-fetching all repositories just because an update
failed due to local modifications.

Change-Id: Ie9883586d77f3310058353844f0bbcfb0b775ebb
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-11-14 12:17:33 +00:00
Oswald Buddenhagen
71ed40b0ac fix cloning of tagged versions
the .gitmodules of tagged commits typically refers to a release branch
which was deleted shortly after the release. consequently, git clone
--branch is bound to fail.

of course, cloning a fixed sha1/tag requires no branch in the first
place, so revert back to using git clone --no-checkout in that case.

amends ac6168c0c.

Task-number: QTBUG-49133
Change-Id: Ica032f1d07a70ad89f16b23bdf5cdab785612fdc
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-11-04 12:42:26 +00:00
Ilia Kirianovskii
9443890d60 Fix git_install_hooks for relative gitdir
Previously we expected gitdir to be always absolute. This patch fixes
git_install_hooks in case of relative gitdir.

Change-Id: Ia0883af18229703aaa22c62fd2181ed56d9f2fce
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-05-24 04:39:24 +00:00
Oswald Buddenhagen
a1ec8795c6 make it actually possible to specify 'ignore' as a class
another thing the doc claims to be possible - also quite reasonably.

Change-Id: I2220245b10f02a778345b6549e345b2486630ffd
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-05-05 20:02:39 +00:00
Oswald Buddenhagen
c41d854254 make it actually possible to exclude classes
the doc - quite reasonably - claims that it is possible.

Change-Id: I4668b3feafe721f1db4deb65848206d8197962c8
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-05-05 20:02:38 +00:00
Liang Qi
c80e96bb09 Merge remote-tracking branch 'origin/5.6.0' into 5.6
Conflicts:
	.gitmodules

Change-Id: Ic9c8564006c2722f925700f09ff42da3e912f580
2016-03-31 09:53:10 +02:00
Iikka Eklund
84a1676ed6 Update .gitmodules for automated release src package creation
Introduce new "deprecated" value for status attribute.

We have two flavors of big source packages we need to produce:

qt-everywhere-* which needs to include:

 - essential
 - addon
 - preview
 - deprecated (e.g. qtscript and qtenginio for Qt5.6 release)

Installer only specific source package:

 - essential
 - addon

 The rest (deprecated, preview, ...) need to be shown as split src
 packages in the installer.

The above leads to the following changes:

qtscript: addon -> deprecated

 Needs to be part of big src packages but excluded from installer
 specific big source package.

qtenginio: obsolete -> deprecated

 We can't exclude this module from qt-everywhere src packages.

qtwayland: preview -> addon

 Needs to be part of installer specific big src package and the
 module status is not preview anymore.

Change-Id: I52e10629bf81860f56ebc4ce9d395e0ca54c4264
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-03-08 17:54:29 +00:00
Oswald Buddenhagen
fdf1b3cc8d rework hook installation
the primary purpose of this change is making it work with new-style
submodules (1.7+) and git-worktree (2.5+). this means resolving '.git'
and 'commondir' files.

we avoid calling git commands, because a) it's slow on windows, b) some
of them are unavailable in older git versions and it's tedious to deal
with that and c) their output is not necessarily optimal (not always
absolute paths).

we also don't use relative paths for the hook locations any more, as
that's too tedious to deal with.

Change-Id: Ie341e748e56d6bef40856e4a49ac368850028d83
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-02-17 20:18:48 +00:00
Oswald Buddenhagen
d1d52b5c1e properly complain about invalid entries in --module-subset
Change-Id: I13ec7a6acdc8a47efea14bfabf0413d8a3570870
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-02-07 09:09:30 +00:00
Oswald Buddenhagen
3de19487d9 replace 'initrepo' with more fine-grained 'status'
instead of a simple bool, we now have five states: preview, active,
addon, obsolete, and ignore (the default). the default includes the
first three.

the CI system is expected to use --module-subset=all,-ignore to include
everything that is expected to build (in some configurations).

Change-Id: Ifb43412054a8e42db0425f24f8e53acfce363caa
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-02-07 09:09:27 +00:00
Oswald Buddenhagen
2e134da46c don't use POD, to restore msysgit perl compatibility
Change-Id: I360a6d5246e33dcf3f72bc83f2790905af8c1463
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-12-25 08:07:16 +00:00
Oswald Buddenhagen
c3e404fffd don't use GetOptionsFromArray, to restore msysgit perl compatibility
Change-Id: Ic02a5d8b5a8a813a23bed1c0b45bcb8ee47e3edb
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-12-25 08:07:10 +00:00
Edward Welbourne
383b2585e3 Explain what the canonical URLs are.
This caught me out the first time I tried to use init-repository.
Documentation should work for noobs.

Change-Id: Ia6c9ce395ace034128bfe80f2c31be7f9cd4cf35
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-10-12 05:24:50 +00:00
Jani Heikkinen
4116ec2474 Removed QtWebkit and QtWebkit-Examples from qt5.git
QtWebkit (and QtWebkit-Examples) were deprecated in Qt 5.5 and will now
be removed from qt5.git in Qt5.6 release

Change-Id: I86e1072141956136fa5e4220cdcdf812492453b3
Reviewed-by: Tuukka Turunen <tuukka.turunen@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-09-03 17:40:10 +00:00
Simon Hausmann
b34e3669ff Prospective fix for unnecessary submodule cloning
When cloning qtdeclarative, we end up also cloning qtdeclarative-testsuites,
which is not intentional for users of Qt (and init-repository). The init-repository
script checks for the submodule "repo".update key and skips the sub module if the value
is "ignore". However according to the documentation no checkout is to be done if the value
is "none", which is also what qtdeclarative's .gitmodules specifies for the ecmascript
test suite.

Change-Id: Ieb37607ae4ea7c32d6af886d3e2533fb9dea1f13
Reviewed-by: Jani Heikkinen <jani.heikkinen@theqtcompany.com>
2015-03-27 10:04:11 +00:00
Oswald Buddenhagen
a5edc40176 Merge remote-tracking branch 'origin/5.4' into 5.5 2015-03-09 12:28:37 +01:00
Oswald Buddenhagen
ac6168c0cb use git clone --branch instead of --no-checkout
git submodule update does not cause an actual checkout if HEAD matches
the recorded submodule sha1 even if it was not actually checked out.

it would be possible to work around this by calling git checkout HEAD in
each submodule if no files are checked out, but that seems hacky.

instead, just make the module cloning already check out the desired
branch. this produces checkouts that are within a few commits of the
final sha1, so isn't too bad.

Change-Id: I435c1a2e24f39fd8c0d65f0d90df0216715668b7
2015-03-04 12:23:13 +01:00
Jani Heikkinen
c2d151522b Update copyright headers
Qt copyrights are now in The Qt Company, so we could update the source
code headers accordingly. In the same go we should also fix the links to
point to qt.io.

Change-Id: Ieb3be34b0d4061fb8dc886991528951f59dbd67e
Reviewed-by: Tuukka Turunen <tuukka.turunen@digia.com>
Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
2015-02-25 03:23:07 +00:00
Oswald Buddenhagen
34c7caab3f don't fetch again when updating submodules
we already did it a moment ago.

this should affect only the --remote case, but there is no harm in
always specifying it.

Change-Id: I3ef0854c790726772fb63ab7829b59ef85ac4f18
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-02-06 06:24:10 +00:00
Oswald Buddenhagen
9ebad7830d don't checkout when cloning
we will subsequently do a submodule update with a possibly different
sha1 anyway.

Change-Id: I4950f3727e4263a73c32eff8460962d5796bc5f3
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-02-06 06:24:06 +00:00
Oswald Buddenhagen
1ad0a17fa0 make manual fetching sane
it is in no way said that the remote's HEAD will contain the commit to
be checked out - in fact, it's pretty much guaranteed that it won't for
anything but the default branch. fetching the whole remote avoids
additional roundtrips and makes the --branch feature actually work
reasonably.

Change-Id: I20de2da848b12aea8c5b2784307fe9860252009b
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-02-06 06:24:03 +00:00
Oswald Buddenhagen
d553fc4fa9 always check out the target branch when using --branch
a submodule update with --remote will use the tip of the remote's
branch, but it won't actually switch to the branch if HEAD doesn't point
to it yet.

Change-Id: If13e31da2646683dfb9e832eaab929190acb0167
Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
2015-02-06 06:23:59 +00:00
Oswald Buddenhagen
b236ef6aef fix --branch without --no-update
clearly, i botched the syntax, but i can't even tell how. that's perl.
the new version is more readable anyway.

Change-Id: Ic3e93c2cf30ee92f368808070899af4b9f7809a3
Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
2015-02-06 06:23:54 +00:00
Oswald Buddenhagen
38cfc8ec95 don't fetch unless we are updating
it's just wasting time.

Change-Id: I541cc535c5c95b0140cfa14d7cb042dbe029525e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
2014-11-12 10:49:16 +01:00
Kai Koehne
402bf7aec2 Fix cloning with mirrors
Commit 486f5f37761 broke the cloning with one of the mirror options:

git ls-remote git://mirror/qt/qtactiveqt.git.git test/if/mirror/exists
fatal: The remote end hung up unexpectedly

Change-Id: Ia154ee34dd10e35b24676777d8dde98ef0790ee1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2014-11-12 10:49:07 +01:00