diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fda64869ccc0ff73e0b43761a88362caf7dd973b..eb65572e9b1d3882fc01b10f7d7fe44565bda8bc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,7 @@ variables: - GIT_VERSION: "2.36.2" + GIT_VERSION: "2.38.1" + PYTHON_VERSION: "3.10.8" DEFAULT_HELP_FORMAT: "man" stages: @@ -8,17 +9,24 @@ stages: - test - package +workflow: + rules: + - if: $CI_PIPELINE_SOURCE == "schedule" + - if: $CI_PIPELINE_SOURCE == "web" + - if: $CI_COMMIT_TAG + .build: stage: build script: - - yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker - - git clone https://github.com/git/git.git - - cd git - - git checkout v${GIT_VERSION} - - autoconf - - ./configure --prefix=${CI_PROJECT_DIR}/${NAME} - - make NO_INSTALL_HARDLINKS=YesPlease - - make NO_INSTALL_HARDLINKS=YesPlease install + - curl -s -L -o python.zip https://gitlab.synchrotron-soleil.fr/software-control-system/devtools/python3/-/jobs/artifacts/${PYTHON_VERSION}/download?job=${PLATFORM} && unzip -q python.zip + - rm python.zip + - export PATH=$(readlink -e .)/python-${PYTHON_VERSION}-${PLATFORM}/bin:${PATH} + - sudo python -m pip install --upgrade pip + - sudo python -m pip install --upgrade conan + - conan config init + - conan profile update settings.compiler.libcxx=libstdc++11 default + - conan create . git/${GIT_VERSION}@soleil/stable --build -c tools.system.package_manager:mode=install -c tools.system.package_manager:tool=yum -c tools.system.package_manager:sudo=True + - conan install git/${GIT_VERSION}@soleil/stable --install-folder ${CI_PROJECT_DIR}/${NAME} artifacts: name: ${NAME} paths: @@ -36,95 +44,54 @@ stages: - zip -r --symlinks ../${NAME}.zip * - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ../${NAME}.zip "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/git/${GIT_VERSION}/"' -linux-el6-x86_64: - extends: [".build"] - image: gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/dev-docker-tools/dev-el6-gcc44 - variables: - NAME: "git-${GIT_VERSION}-linux-el6-x86_64" - -test-el6-x86_64: - extends: [".test"] - image: gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/dev-docker-tools/dev-el6-gcc44 - variables: - NAME: "git-${GIT_VERSION}-linux-el6-x86_64" - needs: - - linux-el6-x86_64 - -package-el6-x86_64: - extends: [".package"] - image: gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/dev-docker-tools/dev-el6-gcc44 - variables: - NAME: "git-${GIT_VERSION}-linux-el6-x86_64" - needs: - - linux-el6-x86_64 - - test-el6-x86_64 - -linux-el6-i686: - extends: [".build"] - image: gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/dev-docker-tools/dev-el6-gcc44-x86 - variables: - NAME: "git-${GIT_VERSION}-linux-el6-i686" - -test-el6-i686: - extends: [".test"] - image: gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/dev-docker-tools/dev-el6-gcc44-x86 - variables: - NAME: "git-${GIT_VERSION}-linux-el6-i686" - needs: - - linux-el6-i686 - -package-el6-i686: - extends: [".package"] - image: gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/dev-docker-tools/dev-el6-gcc44-x86 - variables: - NAME: "git-${GIT_VERSION}-linux-el6-i686" - needs: - - linux-el6-i686 - - test-el6-i686 - -linux-el7-x86_64: +linux-x86_64: extends: [".build"] - image: gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/dev-docker-tools/dev-el7-gcc48 + image: gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/conan-docker-tools/conan-el6-gcc91 variables: - NAME: "git-${GIT_VERSION}-linux-el7-x86_64" + PLATFORM: linux-x86_64 + NAME: "git-${GIT_VERSION}-${PLATFORM}" -test-el7-x86_64: +test-x86_64: extends: [".test"] - image: gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/dev-docker-tools/dev-el7-gcc48 + image: gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/conan-docker-tools/conan-el6-gcc91 variables: - NAME: "git-${GIT_VERSION}-linux-el7-x86_64" + PLATFORM: linux-x86_64 + NAME: "git-${GIT_VERSION}-${PLATFORM}" needs: - - linux-el7-x86_64 + - linux-x86_64 -package-el7-x86_64: +package-x86_64: extends: [".package"] - image: gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/dev-docker-tools/dev-el6-gcc44-x86 + image: gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/conan-docker-tools/conan-el6-gcc91 variables: - NAME: "git-${GIT_VERSION}-linux-el7-x86_64" + PLATFORM: linux-x86_64 + NAME: "git-${GIT_VERSION}-${PLATFORM}" needs: - - linux-el7-x86_64 - - test-el7-x86_64 + - linux-x86_64 + - test-x86_64 -linux-el7-i686: +linux-i686: extends: [".build"] - image: gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/dev-docker-tools/dev-el7-gcc48-x86 + image: gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/conan-docker-tools/conan-el6-gcc91-x86 variables: - NAME: "git-${GIT_VERSION}-linux-el7-i686" - GIT_ROOT: "${CI_PROJECT_DIR}/${NAME}" + PLATFORM: linux-i686 + NAME: "git-${GIT_VERSION}-${PLATFORM}" -test-el7-i686: +test-i686: extends: [".test"] - image: gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/dev-docker-tools/dev-el7-gcc48-x86 + image: gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/conan-docker-tools/conan-el6-gcc91-x86 variables: - NAME: "git-${GIT_VERSION}-linux-el7-i686" + PLATFORM: linux-i686 + NAME: "git-${GIT_VERSION}-${PLATFORM}" needs: - - linux-el7-i686 + - linux-i686 -package-el7-i686: +package-i686: extends: [".package"] - image: gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/dev-docker-tools/dev-el7-gcc48-x86 + image: gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/conan-docker-tools/conan-el6-gcc91-x86 variables: - NAME: "git-${GIT_VERSION}-linux-el7-i686" + PLATFORM: linux-i686 + NAME: "git-${GIT_VERSION}-${PLATFORM}" needs: - - linux-el7-i686 - - test-el7-i686 + - linux-i686 + - test-i686 diff --git a/README.md b/README.md index 285c08191a00dd503c53b69eea18a36db1a11c18..56456293378ea46a3537fb5d5853cdcfae05e572 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,7 @@ # Git -Pipeline to build Git 2.36.2 for our legacy CentOS platform. +Pipeline to build Git 2.38.1 with conan on our legacy CentOS 6. -Allows to build Git for: -* CentOS 6.10 64 bits: [git-2.36.2-linux-el6-x86_64.zip](https://gitlab.synchrotron-soleil.fr/software-control-system/devtools/git/-/jobs/artifacts/main/download?job=linux-el6-x86_64) -* CentOS 6.10 32 bits: [git-2.36.2-linux-el6-i686.zip](https://gitlab.synchrotron-soleil.fr/software-control-system/devtools/git/-/jobs/artifacts/main/download?job=linux-el6-i686) -* CentOS 7.9 64 bits: [git-2.36.2-linux-el7-x86_64.zip](https://gitlab.synchrotron-soleil.fr/software-control-system/devtools/git/-/jobs/artifacts/main/download?job=linux-el7-x86_64) -* CentOS 7.9 32 bits: [git-2.36.2-linux-el7-i686.zip](https://gitlab.synchrotron-soleil.fr/software-control-system/devtools/git/-/jobs/artifacts/main/download?job=linux-el7-i686) - -Build on Docker image: -* gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/dev-docker-tools/dev-el6-gcc44 -* gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/dev-docker-tools/dev-el6-gcc44-x86 -* gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/dev-docker-tools/dev-el7-gcc48 -* gitlab-registry.synchrotron-soleil.fr/software-control-system/containers/dev-docker-tools/dev-el7-gcc48-x86 +Git 2.38.1 for: +* Linux 64 bits: [git-2.38.1-linux-x86_64.zip](https://gitlab.synchrotron-soleil.fr/software-control-system/devtools/git/-/jobs/artifacts/main/download?job=linux-x86_64) +* Linux 32 bits: [git-2.38.1-linux-i686.zip](https://gitlab.synchrotron-soleil.fr/software-control-system/devtools/git/-/jobs/artifacts/main/download?job=linux-i686) diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 0000000000000000000000000000000000000000..e466cf1f703c3d47b8da437265fe2ee808e442b4 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,74 @@ +from conan import ConanFile +from conan.tools.system import package_manager +from conan.errors import ConanInvalidConfiguration +from conans import AutoToolsBuildEnvironment, RunEnvironment, tools +import os + + +class GitConan(ConanFile): + name = "git" + version = "2.38.1" + + settings = "os", "compiler", "build_type", "arch" + + requires = \ + "libcurl/7.86.0", \ + "zlib/1.2.13" + + _autotools = None + + _autotools_args = [ + "NO_TCLTK=YesPlease", + "NO_INSTALL_HARDLINKS=YesPlease", + "RUNTIME_PREFIX=YesPlease", + "gitexecdir=libexec/git-core", + "template_dir=share/git-core/templates", + "sysconfdir=etc", + # "V=1" + ] + + def validate(self): + if self.settings.os not in ["Linux"]: + raise ConanInvalidConfiguration("This recipe supports only Linux") + + def source(self): + self.run( + "curl -s -L -O https://github.com/git/git/archive/refs/tags/v%s.tar.gz" % self.version) + self.run("tar -xzf v%s.tar.gz --strip 1" % self.version) + + def _build_configure(self): + if self._autotools: + return self._autotools + + self._autotools = AutoToolsBuildEnvironment(self) + + args = [ + "--enable-pthreads=-pthread", + "--with-tcltk=NO", + ] + + # Append run environment to autotools environment to have curl-config in path + env_build_vars = self._autotools.vars + run_environment = RunEnvironment(self) + env_build_vars = env_build_vars | run_environment.vars + + # Build configure + self.run("make configure") + + self._autotools.configure(args=args, vars=env_build_vars) + return self._autotools + + def build(self): + env_build = self._build_configure() + tools.replace_in_file("Makefile", "EXTLIBS += -lrt", "EXTLIBS += -lrt -ldl") + env_build.make(args=self._autotools_args) + + def package(self): + env_build = self._build_configure() + env_build.install(args=self._autotools_args) + + def package_info(self): + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) + + def deploy(self): + self.copy("*", symlinks=True)