diff options
author | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2021-04-29 17:01:21 +0200 |
---|---|---|
committer | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2021-04-30 16:54:10 +0200 |
commit | b44c5be8e2b0b6eb57bb1a0d53aa469ea2f18eee (patch) | |
tree | b38b3c068fe632648276f9a3d64f0c44897889e6 | |
parent | 84ce0c64996e81a2e1dfc6c4d53de4ae05064a68 (diff) | |
download | vendor_replicant-release-scripts-b44c5be8e2b0b6eb57bb1a0d53aa469ea2f18eee.tar.gz vendor_replicant-release-scripts-b44c5be8e2b0b6eb57bb1a0d53aa469ea2f18eee.tar.bz2 vendor_replicant-release-scripts-b44c5be8e2b0b6eb57bb1a0d53aa469ea2f18eee.zip |
WIP script: TODO: move checkout_revision after fetchGNUtoo/make-source-tarball-manifest-todo
TODO: Use another approach instead (parse a manifest and use that
to checkoutout the source code)
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rwxr-xr-x | make_source_tarball.sh | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/make_source_tarball.sh b/make_source_tarball.sh index 3843eed..6958b01 100755 --- a/make_source_tarball.sh +++ b/make_source_tarball.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -x # # Copyright (C) 2021 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> # @@ -46,6 +47,32 @@ get_option() fi } +get_revision() +{ + repo="$1" + + shift 1 + + git -C "${repo}" --no-pager log --oneline --format='%H' $@ +} + +checkout_revision() +{ + repo="$1" + given_revision="$2" + + # TODO: handle multiple remotes + # Make sure to have the revision + git -C "${repo}" fetch $(git -C "${repo}" remote) "${given_revision}" + + current_revision="$(get_revision ${repo} HEAD -1)" + desired_revision="$(get_revision ${repo} ${given_revision})" + + if [ "${current_revision}" != "${desired_revision}" ] ; then + git -C "${repo}" checkout "${given_revision}" + fi +} + if [ $# -ne 2 -a $# -ne 4 -a $# -ne 6 ] ; then usage elif [ $# -eq 4 ] ; then @@ -77,6 +104,10 @@ if [ ! -d .repo ] ; then --depth=1 || rm -rf .repo/ fi +for repo in $(repo list | awk '{print $1}') ; do + checkout_revision "${repo}" "${tag}" +done + # We have an issue with all the Replicant releases before Replicant 6.0-0001: # All the manifests use git://, however over the time we moved several git # repositories and wrote some apache redirect rules to handle that. @@ -90,6 +121,8 @@ fi repo sync -j "${jobs}" + + # We want the exact same source code used to build the images, so we need to # remove all the modifications we did to enable fetching the source code if [ $(echo $major_version | sed 's/\..*//') -lt 6 ] ; then |