diff options
author | Oliver Smith <osmith@sysmocom.de> | 2021-12-09 17:18:56 +0100 |
---|---|---|
committer | osmith <osmith@sysmocom.de> | 2021-12-13 11:56:21 +0000 |
commit | 0221a0b7f3ed77f2eb86042e84af246e216554e7 (patch) | |
tree | 58e7a9af70fbb2ec63ddb8108d88005694dc7781 | |
parent | 8a32ca538ab45baef4863755f2716cd480fa0b8c (diff) |
OSMO_RELEASE_REPOS: add simtrace2, osmo-remsim
Adjust to simtrace2's directory structure, which does not have a
configure.ac in the main directory like all other repositories. The main
directory has a regular Makefile without autotools, only the host dir
has a configure.ac file (and only in newer versions). Deal with this by
creating two tarballs, one with "git archive" for the whole directory,
and one for the host dir only with the usual "autoreconf -fi;
./configure; make dist-bzip2". The latter one has the files created by
autoreconf ("configure" script and others).
simtrace2
├── simtrace2-0.1.tar.bz2
├── simtrace2-0.2.tar.bz2
├── simtrace2-0.3.tar.bz2
├── simtrace2-0.4.tar.bz2
├── simtrace2-0.5.1.tar.bz2
├── simtrace2-0.5.tar.bz2
├── simtrace2-0.6.1.tar.bz2
├── simtrace2-0.6.tar.bz2
├── simtrace2-0.7.0.tar.bz2
├── simtrace2-0.7.1.tar.bz2
├── simtrace2-0.8.0.tar.bz2
├── simtrace2-0.8.1.tar.bz2
├── simtrace2-host-0.6.1.tar.bz2
├── simtrace2-host-0.6.tar.bz2
├── simtrace2-host-0.7.0.tar.bz2
├── simtrace2-host-0.7.1.tar.bz2
├── simtrace2-host-0.8.0.tar.bz2
└── simtrace2-host-0.8.1.tar.bz2
Closes: OS#5347
Change-Id: Ib52a23a2a7d6ea64bfa539b1d026f035fdb3af57
-rw-r--r-- | scripts/common.sh | 2 | ||||
-rwxr-xr-x | scripts/osmocom-release-tarballs.sh | 80 |
2 files changed, 74 insertions, 8 deletions
diff --git a/scripts/common.sh b/scripts/common.sh index 10fe7f3..8657fd8 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -29,6 +29,7 @@ OSMO_RELEASE_REPOS=" osmo-msc osmo-pcap osmo-pcu + osmo-remsim osmo-sgsn osmo-sip-connector osmo-smlc @@ -36,6 +37,7 @@ OSMO_RELEASE_REPOS=" osmo-trx osmo-uecups osmocom-bb + simtrace2 " OSMO_BRANCH_DOCKER_PLAYGROUND="${OSMO_BRANCH_DOCKER_PLAYGROUND:-master}" diff --git a/scripts/osmocom-release-tarballs.sh b/scripts/osmocom-release-tarballs.sh index 18ea1d7..8242a49 100755 --- a/scripts/osmocom-release-tarballs.sh +++ b/scripts/osmocom-release-tarballs.sh @@ -128,7 +128,7 @@ remove_temp_dir() { } # Clone an Osmocom repository to $TEMP/repos/$repo, clean it, checkout a tag. -# $1: Osmocom repository +# $1: Osmocom repository (may end in subdir, e.g. simtrace2/host) # $2: tag (optional, default: master) prepare_repo() { local repo="$1" @@ -144,13 +144,21 @@ prepare_repo() { git checkout -q "$tag" } + +# Get the desired tarball name, replace / with - in $1. +# $1: Osmocom repository (may end in subdir, e.g. simtrace2/host) +# $2: tag +tarball_name() { + echo "$(echo "$repo" | tr / -)-$tag.tar.bz2" +} + # Checkout a given tag and build a release tarball. -# $1: Osmocom repository +# $1: Osmocom repository (may end in subdir, e.g. simtrace2/host) # $2: tag create_tarball() { local repo="$1" local tag="$2" - local tarball="$repo-$tag.tar.bz2" + local tarball="$(tarball_name "$repo" "$tag")" # Be verbose during the tarball build and preparation. Everything else is not verbose, so we can generate an # easy to read overview of tarballs that are already built or are ignored. @@ -174,15 +182,72 @@ create_tarball() { fi } +# Create a release tarball with "git archive" for non-autotools projects. +# $1: Osmocom repository +# $2: tag +create_tarball_git() { + local repo="$1" + local tag="$2" + local tarball="$(tarball_name "$repo" "$tag")" + + set -x + + cd "$TEMP/repos/$repo" + git archive \ + -o "$tarball" \ + "$tag" + + set +x +} + # Move a generated release tarball to the output dir. +# $1: Osmocom repository (may end in subdir, e.g. simtrace2/host) +# $2: tag move_tarball() { local repo="$1" local tag="$2" - local tarball="$repo-$tag.tar.bz2" + local tarball="$(tarball_name "$repo" "$tag")" + local repo_dir="$(echo "$repo" | cut -d / -f 1)" cd "$TEMP/repos/$repo" - mkdir -p "$OUTPUT/$repo" - mv "$tarball" "$OUTPUT/$repo/$tarball" + mkdir -p "$OUTPUT/$repo_dir" + mv "$tarball" "$OUTPUT/$repo_dir/$tarball" +} + +# Check if a git tag has a specific file +# $1: Osmocom repository +# $2: tag +# $3: file +tag_has_file() { + local repo="$1" + local tag="$2" + local file="$3" + + git -C "$TEMP/repos/$repo" show "$tag:$file" >/dev/null 2>&1 +} + +# Create and move tarballs for Osmocom repositories. +# $1: Osmocom repository +# $2: tag +create_move_tarball() { + local repo="$1" + local tag="$2" + + case "$repo" in + simtrace2) + if tag_has_file "$repo" "$tag" host/configure.ac; then + create_tarball "$repo/host" "$tag" + move_tarball "$repo/host" "$tag" + fi + + create_tarball_git "$repo" "$tag" + move_tarball "$repo" "$tag" + ;; + *) + create_tarball "$repo" "$tag" + move_tarball "$repo" "$tag" + ;; + esac } remove_temp_dir @@ -211,8 +276,7 @@ for repo in $OSMO_RELEASE_REPOS; do fi echo " $tarball (creating)" - create_tarball "$repo" "$tag" - move_tarball "$repo" "$tag" + create_move_tarball "$repo" "$tag" done done |