Project

General

Profile

Actions

Task #104994

open

Set proper branch alias for supported release branches (incl. ELTS)

Added by Rafael Kähm 2 months ago. Updated 2 months ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
Category:
composer
Target version:
Start date:
2024-09-16
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.1
Tags:
Complexity:
no-brainer
Sprint Focus:

Description

TYPO3s release branches do not have proper extra.branch-alias settings.

This leads to errors by requiring local TYPO3 mono-repo in own composer project.

All sysext/*/composer.json files must get proper aliases, to be compatible with setup like described in "Steps to reproduce".

Steps to reproduce:

Clone the TYPO3 mono-repo into TYPO3-Core_Monorepo 12.4 branch into TYPO3-Core_Monorepo directory.

git clone -b 12.4 https://github.com/TYPO3/typo3.git TYPO3_Core_Monorepo

Copy following to root composer.json

{
  "type": "project",
  "repositories": {
    "local-typo3-monorepo": {
      "type": "path",
      "url": "TYPO3-Core_Monorepo/typo3/sysext/*",
      "options": {
        "reference": "none",
        "versions": {
          "typo3/cms-adminpanel": "dev-12.4",
          "typo3/cms-backend": "dev-12.4",
          "typo3/cms-belog": "dev-12.4",
          "typo3/cms-beuser": "dev-12.4",
          "typo3/cms-core": "dev-12.4",
          "typo3/cms-dashboard": "dev-12.4",
          "typo3/cms-extbase": "dev-12.4",
          "typo3/cms-extensionmanager": "dev-12.4",
          "typo3/cms-felogin": "dev-12.4",
          "typo3/cms-filelist": "dev-12.4",
          "typo3/cms-filemetadata": "dev-12.4",
          "typo3/cms-fluid": "dev-12.4",
          "typo3/cms-fluid_styled_content": "dev-12.4",
          "typo3/cms-form": "dev-12.4",
          "typo3/cms-frontend": "dev-12.4",
          "typo3/cms-impexp": "dev-12.4",
          "typo3/cms-indexed_search": "dev-12.4",
          "typo3/cms-info": "dev-12.4",
          "typo3/cms-install": "dev-12.4",
          "typo3/cms-linkvalidator": "dev-12.4",
          "typo3/cms-lowlevel": "dev-12.4",
          "typo3/cms-opendocs": "dev-12.4",
          "typo3/cms-reactions": "dev-12.4",
          "typo3/cms-recycler": "dev-12.4",
          "typo3/cms-redirects": "dev-12.4",
          "typo3/cms-reports": "dev-12.4",
          "typo3/cms-rte_ckeditor": "dev-12.4",
          "typo3/cms-scheduler": "dev-12.4",
          "typo3/cms-seo": "dev-12.4",
          "typo3/cms-setup": "dev-12.4",
          "typo3/cms-styleguide": "dev-12.4",
          "typo3/cms-sys_note": "dev-12.4",
          "typo3/cms-tstemplate": "dev-12.4",
          "typo3/cms-viewpage": "dev-12.4",
          "typo3/cms-webhooks": "dev-12.4",
          "typo3/cms-workspaces": "dev-12.4" 
        }
      }
    }
  },
  "config": {
    "allow-plugins": true,
    "platform": {
      "php": "8.1" 
    },
    "sort-packages": true,
    "preferred-install": {
      "typo3/cms-core": "source",
      "*": "dist" 
    }
  },
  "require": {
    "typo3/cms-about": "12.4.x-dev",
    "typo3/cms-adminpanel": "12.4.x-dev",
    "typo3/cms-backend": "12.4.x-dev",
    "typo3/cms-belog": "12.4.x-dev",
    "typo3/cms-beuser": "12.4.x-dev",
    "typo3/cms-core": "12.4.x-dev",
    "typo3/cms-extbase": "12.4.x-dev",
    "typo3/cms-extensionmanager": "12.4.x-dev",
    "typo3/cms-felogin": "12.4.x-dev",
    "typo3/cms-filelist": "12.4.x-dev",
    "typo3/cms-filemetadata": "12.4.x-dev",
    "typo3/cms-fluid": "12.4.x-dev",
    "typo3/cms-fluid-styled-content": "12.4.x-dev",
    "typo3/cms-form": "12.4.x-dev",
    "typo3/cms-frontend": "12.4.x-dev",
    "typo3/cms-impexp": "12.4.x-dev",
    "typo3/cms-info": "12.4.x-dev",
    "typo3/cms-install": "12.4.x-dev",
    "typo3/cms-lowlevel": "12.4.x-dev",
    "typo3/cms-recordlist": "12.4.x-dev",
    "typo3/cms-redirects": "12.4.x-dev",
    "typo3/cms-reports": "12.4.x-dev",
    "typo3/cms-rte-ckeditor": "12.4.x-dev",
    "typo3/cms-scheduler": "12.4.x-dev",
    "typo3/cms-seo": "12.4.x-dev",
    "typo3/cms-setup": "12.4.x-dev",
    "typo3/cms-sys-note": "12.4.x-dev",
    "typo3/cms-t3editor": "12.4.x-dev",
    "typo3/cms-tstemplate": "12.4.x-dev",
    "typo3/cms-viewpage": "12.4.x-dev" 
  },
}

Try to install that project with composer

composer install

You will get ~40 Errors about version mismatch.

Problem 1
    - Root composer.json requires typo3/cms-about 12.4.x-dev (exact version match), found typo3/cms-about[dev-main, v8.7.7, ..., 8.7.x-dev, v9.0.0, ..., 9.5.x-dev, v10.0.0, ..., 10.4.x-dev] but it does not match the constraint.
  Problem 2
    - Root composer.json requires typo3/cms-adminpanel 12.4.x-dev (exact version match), it is satisfiable by typo3/cms-adminpanel[12.4.x-dev] from composer repo (https://repo.packagist.org) but typo3/cms-adminpanel[dev-12.4] from path repo (TYPO3-Core_Monorepo/typo3/sysext/*) has higher repository priority. The packages from the higher priority repository do not match your constraint and are therefore not installable. That repository is canonical so the lower priority repo's packages are not installable. See https://getcomposer.org/repoprio for details and assistance.
  Problem 3
    - Root composer.json requires typo3/cms-backend 12.4.x-dev (exact version match), it is satisfiable by typo3/cms-backend[12.4.x-dev] from composer repo (https://repo.packagist.org) but typo3/cms-backend[dev-12.4] from path repo (TYPO3-Core_Monorepo/typo3/sysext/*) has higher repository priority. The packages from the higher priority repository do not match your constraint and are therefore not installable. That repository is canonical so the lower priority repo's packages are not installable. See https://getcomposer.org/repoprio for details and assistance.
  Problem 4
    - Root composer.json requires typo3/cms-belog 12.4.x-dev (exact version match), it is satisfiable by typo3/cms-belog[12.4.x-dev] from composer repo (https://repo.packagist.org) but typo3/cms-belog[dev-12.4] from path repo (TYPO3-Core_Monorepo/typo3/sysext/*) has higher repository priority. The packages from the higher priority repository do not match your constraint and are therefore not installable. That repository is canonical so the lower priority repo's packages are not installable. See https://getcomposer.org/repoprio for details and assistance.
  Problem 5
    - Root composer.json requires typo3/cms-beuser 12.4.x-dev (exact version match), it is satisfiable by typo3/cms-beuser[12.4.x-dev] from composer repo (https://repo.packagist.org) but typo3/cms-beuser[dev-12.4] from path repo (TYPO3-Core_Monorepo/typo3/sysext/*) has higher repository priority. The packages from the higher priority repository do not match your constraint and are therefore not installable. That repository is canonical so the lower priority repo's packages are not installable. See https://getcomposer.org/repoprio for details and assistance.
  Problem 6
    - Root composer.json requires typo3/cms-core 12.4.x-dev (exact version match), it is satisfiable by typo3/cms-core[12.4.x-dev] from composer repo (https://repo.packagist.org) but typo3/cms-core[dev-12.4] from path repo (TYPO3-Core_Monorepo/typo3/sysext/*) has higher repository priority. The packages from the higher priority repository do not match your constraint and are therefore not installable. That repository is canonical so the lower priority repo's packages are not installable. See https://getcomposer.org/repoprio for details and assistance.
  Problem 7
    - Root composer.json requires typo3/cms-extbase 12.4.x-dev (exact version match), it is satisfiable by typo3/cms-extbase[12.4.x-dev] from composer repo (https://repo.packagist.org) but typo3/cms-extbase[dev-12.4] from path repo (TYPO3-Core_Monorepo/typo3/sysext/*) has higher repository priority. The packages from the higher priority repository do not match your constraint and are therefore not installable. That repository is canonical so the lower priority repo's packages are not installable. See https://getcomposer.org/repoprio for details and assistance.
  Problem 8
    - Root composer.json requires typo3/cms-extensionmanager 12.4.x-dev (exact version match), it is satisfiable by typo3/cms-extensionmanager[12.4.x-dev] from composer repo (https://repo.packagist.org) but typo3/cms-extensionmanager[dev-12.4] from path repo (TYPO3-Core_Monorepo/typo3/sysext/*) has higher repository priority. The packages from the higher priority repository do not match your constraint and are therefore not installable. That repository is canonical so the lower priority repo's packages are not installable. See https://getcomposer.org/repoprio for details and assistance.
  Problem 9
    - Root composer.json requires typo3/cms-felogin 12.4.x-dev (exact version match), it is satisfiable by typo3/cms-felogin[12.4.x-dev] from composer repo (https://repo.packagist.org) but typo3/cms-felogin[dev-12.4] from path repo (TYPO3-Core_Monorepo/typo3/sysext/*) has higher repository priority. The packages from the higher priority repository do not match your constraint and are therefore not installable. That repository is canonical so the lower priority repo's packages are not installable. See https://getcomposer.org/repoprio for details and assistance.

etc. etc. .........

Patch for 12.4 branch:

Just find and replace "dev-main": "12.4.x-dev" by "dev-12.4": "12.4.x-dev"


Purpose/Background

I want to make a TYPO3 core patches, but test them within EXT:solr setup before pushing.


Files

104994.for.12.4-branch.patch (21.6 KB) 104994.for.12.4-branch.patch Rafael Kähm, 2024-09-16 19:45

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Task #91470: Remove branch-alias from TYPO3 v10.4 branchRejected2020-05-25

Actions
Actions #2

Updated by Rafael Kähm 2 months ago

  • Description updated (diff)
Actions #3

Updated by Rafael Kähm 2 months ago

  • Description updated (diff)
Actions #4

Updated by Rafael Kähm 2 months ago

  • Related to Task #91470: Remove branch-alias from TYPO3 v10.4 branch added
Actions #5

Updated by Stefan Bürk 2 months ago

  • Status changed from New to Needs Feedback
  • Assignee set to Stefan Bürk

Maybe would be nice, however that is not required.

You have two issues in the composer.json you posted:

  • wrong version constraint for the monorepo repository packages
  • not using the correct require version constraint
  "repositories": {
    "local-typo3-monorepo": {
      "type": "path",
      "url": "TYPO3-Core_Monorepo/typo3/sysext/*",
      "options": {
        "reference": "none",
        "versions": {
          "typo3/cms-adminpanel": "dev-12.4",     <-- these versions are wrong
          "typo3/cms-backend": "dev-12.4",
          "typo3/cms-belog": "dev-12.4",
          "typo3/cms-beuser": "dev-12.4",
          "typo3/cms-core": "dev-12.4",
          "typo3/cms-dashboard": "dev-12.4",
          "typo3/cms-extbase": "dev-12.4",
          "typo3/cms-extensionmanager": "dev-12.4",
          "typo3/cms-felogin": "dev-12.4",
          "typo3/cms-filelist": "dev-12.4",
          "typo3/cms-filemetadata": "dev-12.4",
          "typo3/cms-fluid": "dev-12.4",
          "typo3/cms-fluid_styled_content": "dev-12.4",
          "typo3/cms-form": "dev-12.4",
          "typo3/cms-frontend": "dev-12.4",
          "typo3/cms-impexp": "dev-12.4",
          "typo3/cms-indexed_search": "dev-12.4",
          "typo3/cms-info": "dev-12.4",
          "typo3/cms-install": "dev-12.4",
          "typo3/cms-linkvalidator": "dev-12.4",
          "typo3/cms-lowlevel": "dev-12.4",
          "typo3/cms-opendocs": "dev-12.4",
          "typo3/cms-reactions": "dev-12.4",
          "typo3/cms-recycler": "dev-12.4",
          "typo3/cms-redirects": "dev-12.4",
          "typo3/cms-reports": "dev-12.4",
          "typo3/cms-rte_ckeditor": "dev-12.4",
          "typo3/cms-scheduler": "dev-12.4",
          "typo3/cms-seo": "dev-12.4",
          "typo3/cms-setup": "dev-12.4",
          "typo3/cms-styleguide": "dev-12.4",
          "typo3/cms-sys_note": "dev-12.4",
          "typo3/cms-tstemplate": "dev-12.4",
          "typo3/cms-viewpage": "dev-12.4",
          "typo3/cms-webhooks": "dev-12.4",
          "typo3/cms-workspaces": "dev-12.4" 
        }
      }

and for the requires of core packages the @dev should be used:

"typo3/cms-backend": "@dev",

TYPO3 provides a "template" which is also used in composer based acceptance tests - and also
some contributors using it in that very same folder or outside. Even the TDK thing which provides
a generic composer based setup for monorepo work works without needing the change for the branch-aliases.

See https://github.com/TYPO3/typo3/blob/12.4/Build/composer/composer.dist.json

I just did a check based on that template from the 12.4 monorepo branch with only adjusting
the repository path and adding styleguide and typo3-console as require to it to demonstrate
that other extension packages are installable. I combined that with the ddev setup explained
in the typo3 core contribution guide with adding the branch checkout for 12.4 to it because
the guide is written for the main branch. This also includes the admin user creation with the
example user from the quickstart guide (you can adjust that)

Additionally, I added writing a config/system/additional.php with the correct trustedHostPattern
required for ddev which ddev does not correctly write in this case.

Here a one-command chain which does the whole step:

  • create a folder and change into it
  • checkout the monorepo into a subfolder typo3-core/
  • change to branch 12.4
  • copy the monorepo composer.json.dist as root composer.json and adjust the monorepo repository patch
  • create some required folders to be there
  • create a ddec configuration suitable for TYPO3 monorepo using apache2
  • start ddev
  • install monorepo composer packages in that folder (not required directly, only for core work)
  • install composer packages for the copied and adjusted root composer json using ddev
  • require typo3/cms-styleguide in suitable version and typo3-console the same using ddev
  • using the TYPO3 setup command to install the setup, db configuration and admin user ...
  • ensure database tables are up2date
  • create style guide page tree for TCA and FRONTEND
  • restart the ddev instance so ddev can detect the installation as TYPO3 composer mode and writes config/system/additional.php correctly
  • launch the just install system showing the backend login form (which you can login using the example user or adjusted credential in the command
cd $HOME \
    && rm -rf $HOME/work/core-v12-monorepo-composer-test \
    && mkdir -p $HOME/work/core-v12-monorepo-composer-test \
    && cd $HOME/work/core-v12-monorepo-composer-test \
    && git clone https://github.com/TYPO3/typo3.git typo3-core \
    && cd typo3-core \
    && git checkout 12.4 \
    && cd $HOME/work/core-v12-monorepo-composer-test \
    && sed 's/..\/..\/typo3\/sysext/typo3-core\/typo3\/sysext/' \
       typo3-core/Build/composer/composer.dist.json > ./composer.json \
    && mkdir ./public ./packages \
    && ddev config \
         --project-name 't3c-main' \
         --project-type 'typo3' \
         --docroot 'public/' \
         --database 'mariadb:10.11' \
         --php-version '8.1' \
         --composer-version 'stable' \
         --nodejs-version '22' \
         \
         --project-tld 'ddev.site' \
         --router-http-port '80' \
         --router-https-port '443' \
         --webserver-type 'apache-fpm' \
         --additional-hostnames 't3c-dev,t3c-prod' \
         \
         --timezone 'Europe/Berlin' \
         --web-environment='TYPO3_CONTEXT=Development' \
         --webimage-extra-packages='build-essential' \
    && ddev start \
    && ./typo3-core/Build/Scripts/runTests.sh -s composerInstall \
    && ddev composer install \
    && ddev composer require \
         typo3/cms-styleguide:^12.0.5 \
         helhum/typo3-console:^8.1.1 \
    && ddev typo3 setup \
        --driver=mysqli \
        --host=db \
        --port=3306 \
        --dbname=db \
        --username=db \
        --password=db \
        --admin-username=john-doe \
        --admin-user-password='John-Doe-1701D.' \
        --admin-email="john.doe@example.com" \
        --project-name='TYPO3 Contribution' \
        --no-interaction \
        --server-type=apache \
        --force \
    && ddev typo3 extension:setup \
    && ddev typo3 styleguide:generate --create -- tca \
    && ddev typo3 styleguide:generate --create -- frontend \
    && ddev restart \
    && ddev launch typo3

I hope these information and run gives you some help at hand to realize the required setup.

Actions #6

Updated by Rafael Kähm 2 months ago

Thanks for the reply @Stefan Bürk.
There are other ways to get it working as well, nonetheless this is a fully valid variant within Composer/Packagist if branch-alias section is set properly.

"typo3/cms-adminpanel": "dev-12.4", <-- these versions are wrong

It is valid for Packagist and Composer constraint for requiring specific branch, which can be used for repositories.*.options.versions as well and which helps resolving the available versions of packages.
See example with proper branch-aliases:

curl https://packagist.org/packages/apache-solr-for-typo3/solr.json -sSf | jq --raw-output '.package.versions | keys' | grep dev-

It lists all branches, not only the main branch:

For EXT:solr

  ...
  "dev-release-10.0.x",
  "dev-release-11.0.x",
  "dev-release-11.1.x",
  "dev-release-11.2.x",
  "dev-release-11.5.x",
  "dev-release-11.6.x",
  "dev-release-12.0.x",
  "dev-release-3.1.x",
  "dev-release-4.0.x",
  "dev-release-5.0.x",
  "dev-release-5.1.x",
  "dev-release-6.0.x",
  "dev-release-6.1.x",
  "dev-release-6.5.x",
  "dev-release-7.0.x",
  "dev-release-7.5.x",
  "dev-release-8.0.x",
  "dev-release-8.1.x",
  "dev-release-9.0.x",
  ...

For TYPO3:

curl https://packagist.org/packages/typo3/cms-core.json -sSf | jq --raw-output '.package.versions | keys' | grep dev-

"dev-main",

You can currently omit the repositories.*.options.versions in the root composer.json and require typo3/core-* Packages by
  • @dev (not safe enough, because wrong TYPO3 mono-repo branch could be used accidentally with succeeded installation...)
    or by
  • 12.4.x-dev (not safe enough currently, because the Release commits like https://github.com/TYPO3/typo3/commit/6d1d7bbd54994ffc699e2970ee402b28d2073487 could be pulled, so the setup is not installable)
    By the way, this can be solved by replacing in every composer.json(in fixture extensions as well) the "12.4.*@dev" with "self.version" and not changing it on release commits.

Is there some reason to avoid proper Composer settings?

With proper settings(branch alias + "self.version"), you do not want to change the versions in all composer.json files and can use it in any branch and any state.

Actions

Also available in: Atom PDF