Skip to content

Commit 02c06c6

Browse files
committed
sanitize branch name for filenames
1 parent 449f061 commit 02c06c6

File tree

6 files changed

+40
-9
lines changed

6 files changed

+40
-9
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,12 @@ TAG:=$(shell git --git-dir=$(SRC_PATH)/.git describe --tags --abbrev=0 --match "
2727
VERSION:=$(shell echo `git --git-dir=$(SRC_PATH)/.git describe --tags --long --match "v*" || echo "UNKNOWN"` | sed "s/^$(TAG)-//")
2828
BRANCH:=$(shell git --git-dir=$(SRC_PATH)/.git rev-parse --abbrev-ref HEAD 2> /dev/null || echo "UNKNOWN")
2929

30+
# strip illegal debian version string characters + illegal filename charachers
31+
DHBRANCH:=$(shell echo "$(BRANCH)" | sed 's/[^-+.0-9a-zA-Z~]/-/g' )
32+
3033
version:
3134
@if [ -d $(SRC_PATH)/".git" ]; then \
32-
echo "#define GPAC_GIT_REVISION \"$(VERSION)-$(BRANCH)\"" > $(GITREV_PATH).new; \
35+
echo "#define GPAC_GIT_REVISION \"$(VERSION)-$(DHBRANCH)\"" > $(GITREV_PATH).new; \
3336
if ! diff -q $(GITREV_PATH) $(GITREV_PATH).new >/dev/null ; then \
3437
mv $(GITREV_PATH).new $(GITREV_PATH); \
3538
fi; \
@@ -349,9 +352,6 @@ endif
349352

350353
ifeq ($(CONFIG_LINUX),yes)
351354

352-
# strip illegal debian version string characters
353-
DHBRANCH:=$(shell echo "$(BRANCH)" | sed 's/[^-+:.0-9a-zA-Z~]/-/g' )
354-
355355
deb:
356356
git checkout -- debian/changelog
357357
fakeroot debian/rules clean

build/xcode/generate_ios.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ version=`grep '#define GPAC_VERSION ' ../../include/gpac/version.h | cut -d '"'
77
TAG=$(git describe --tags --abbrev=0 --match "v*" 2> /dev/null)
88
REVISION=$(echo `git describe --tags --long --match "v*" 2> /dev/null || echo "UNKNOWN"` | sed "s/^$TAG-//")
99
BRANCH=$(git rev-parse --abbrev-ref HEAD 2> /dev/null || echo "UNKNOWN")
10-
rev="$REVISION-$BRANCH"
10+
11+
#sanitize branch name for filenames
12+
DHBRANCH=$(echo "$BRANCH" | sed 's/[^-+.0-9a-zA-Z~]/-/g' )
13+
14+
rev="$REVISION-$DHBRANCH"
1115
if [ "$rev" != "" ]
1216
then
1317
sed 's/<string>.*<\/string><!-- VERSION_REV_REPLACE -->/<string>'"$version"'<\/string>/' ../../applications/gpac/ios-Info.plist > ../../applications/gpac/ios-Info.plist.new

check_revision.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ if [ -d ".git" ]; then
77
TAG=$(git describe --tags --abbrev=0 --match "v*" 2>>gtmp)
88
VERSION=$(echo `git describe --tags --long --match "v*" 2>>gtmp || echo "UNKNOWN"` | sed "s/^$TAG-//")
99
BRANCH=$(git rev-parse --abbrev-ref HEAD 2>>gtmp || echo "UNKNOWN")
10-
revision="$VERSION-$BRANCH"
10+
11+
#sanitize branch name for filenames
12+
DHBRANCH=$(echo "$BRANCH" | sed 's/[^-+.0-9a-zA-Z~]/-/g' )
13+
14+
revision="$VERSION-$DHBRANCH"
1115

1216
rm gtmp
1317

generate_installer.bat

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ REM execute git and check if the result if found within revision.h
5252
for /f "delims=" %%a in ('git describe --tags --long --match "v*" ') do @set VERSION=%%a
5353
for /f "delims=" %%a in ('git describe --tags --abbrev^=0 --match "v*" ') do @set TAG=%%a-
5454
for /f "delims=" %%a in ('git rev-parse --abbrev-ref HEAD') do @set BRANCH=%%a
55+
56+
REM sanitize BRANCH for filename
57+
set "BRANCH=%BRANCH:/=-%"
58+
set "BRANCH=%BRANCH:"=-%"
59+
set "BRANCH=%BRANCH:<=-%"
60+
set "BRANCH=%BRANCH:>=-%"
61+
set "BRANCH=%BRANCH:|=-%"
62+
set "BRANCH=%BRANCH:@=-%"
63+
64+
5565
REM remove anotated tag from VERSION
5666
setlocal enabledelayedexpansion
5767
call set VERSION=%%VERSION:!TAG!=%%

mkdmg.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ cp $source_path/COPYING ./tmpdmg
4040
mkdir -p tmpdmg/GPAC.app/Contents/MacOS/modules
4141
mkdir -p tmpdmg/GPAC.app/Contents/MacOS/lib
4242

43-
cp bin/gcc/gm* tmpdmg/GPAC.app/Contents/MacOS/modules
44-
cp bin/gcc/gf_* tmpdmg/GPAC.app/Contents/MacOS/modules
43+
cp bin/gcc/gm* tmpdmg/GPAC.app/Contents/MacOS/modules || true
44+
cp bin/gcc/gf_* tmpdmg/GPAC.app/Contents/MacOS/modules || true
4545
cp bin/gcc/libgpac.dylib tmpdmg/GPAC.app/Contents/MacOS/lib
4646
if [ -f bin/gcc/libopenhevc.1.dylib ]; then
4747
cp bin/gcc/libopenhevc.1.dylib tmpdmg/GPAC.app/Contents/MacOS/lib
@@ -83,7 +83,11 @@ cd $source_path
8383
TAG=$(git describe --tags --abbrev=0 --match "v*" 2> /dev/null)
8484
REVISION=$(echo `git describe --tags --long --match "v*" 2> /dev/null || echo "UNKNOWN"` | sed "s/^$TAG-//")
8585
BRANCH=$(git rev-parse --abbrev-ref HEAD 2> /dev/null || echo "UNKNOWN")
86-
rev="$REVISION-$BRANCH"
86+
87+
#sanitize branch name for filenames
88+
DHBRANCH=$(echo "$BRANCH" | sed 's/[^-+.0-9a-zA-Z~]/-/g' )
89+
90+
rev="$REVISION-$DHBRANCH"
8791
cd $cur_dir
8892

8993
full_version=$version

version.bat

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ IF NOT EXIST .\.git\NUL GOTO not_git
77
for /f "delims=" %%a in ('git describe --tags --long --match "v*" ') do @set VERSION=%%a
88
for /f "delims=" %%a in ('git describe --tags --abbrev^=0 --match "v*" ') do @set TAG=%%a-
99
for /f "delims=" %%a in ('git rev-parse --abbrev-ref HEAD') do @set BRANCH=%%a
10+
11+
REM sanitize BRANCH for filename
12+
set "BRANCH=%BRANCH:/=-%"
13+
set "BRANCH=%BRANCH:"=-%"
14+
set "BRANCH=%BRANCH:<=-%"
15+
set "BRANCH=%BRANCH:>=-%"
16+
set "BRANCH=%BRANCH:|=-%"
17+
set "BRANCH=%BRANCH:@=-%"
18+
1019
REM remove anotated tag from VERSION
1120
setlocal enabledelayedexpansion
1221
call set VERSION=%%VERSION:!TAG!=%%

0 commit comments

Comments
 (0)