Debian Codegraph @

script/update-version

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`. -e
2
3 rfc822_datestampscip-shell shell shell-project 0.0.0 rfc822_datestamp(). () {
4 # All the other changelog entries use this exact timestamp, so let's do so as
5 # well. Use -0000 to indicate that our timestamp is in UTC, even though we
6 # ourselves may not be.
7 LC_ALL=C datescip-shell system . . date. +'%a, %d %b %Y 14:29:00 -0000'
8 }
9
10 user_idscip-shell shell shell-project 0.0.0 user_id(). () {
11 gitscip-shell system . . git. var GIT_COMMITTER_IDENT | sedscip-shell system . . sed. -e 's/^\(.*<[^>]*>\).*$/\1/'
12 }
13
14 update_goscip-shell shell shell-project 0.0.0 update_go(). () {
15 local version="$1"
16
17 sedscip-shell system . . sed. -i -e "s/\(Version = \)\"[0-9.]*\"/\\1\"$version\"/" config/version.go
18 }
19
20 update_debianscip-shell shell shell-project 0.0.0 update_debian(). () {
21 local version="$1"
22
23 # Return if already updated.
24 ! grepscip-shell system . . grep. -qs -F "git-lfs ($version)" debian/changelog || return
25
26 local tmpdir=$(mktempscip-shell system . . mktemp. -d)
27 local tmpfile="$tmpdir/changelog"
28
29 printfscip-shell system . . printf. 'git-lfs (%s) stable; urgency=low
30
31 * New upstream version
32
33 -- %s %s\n\n' "$version" "$(user_idscip-shell shell shell-project 0.0.0 user_id().)" "$(rfc822_datestampscip-shell shell shell-project 0.0.0 rfc822_datestamp().)" >"$tmpfile"
34
35 catscip-shell system . . cat. debian/changelog >>"$tmpfile"
36 mvscip-shell system . . mv. "$tmpfile" debian/changelog
37 }
38
39 update_rpmscip-shell shell shell-project 0.0.0 update_rpm(). () {
40 local version="$1"
41
42 ruby -pi -e "\$_.gsub!(/^(Version:\\s+)[0-9.]+$/, '\\1$version')" \
43 rpm/SPECS/git-lfs.spec
44 }
45
46 update_versioninfoscip-shell shell shell-project 0.0.0 update_versioninfo(). () {
47 local version="$1"
48
49 ruby -pi -e "ver = '$version'; pieces = ver.split('.')" \
50 -e '$_.gsub!(/("Major": )\d+/, %Q(\\1#{pieces[0]}))' \
51 -e '$_.gsub!(/("Minor": )\d+/, %Q(\\1#{pieces[1]}))' \
52 -e '$_.gsub!(/("Patch": )\d+/, %Q(\\1#{pieces[2]}))' \
53 -e '$_.gsub!(/("ProductVersion": )"[\d.]+"/, %Q(\\1"#{ver}"))' \
54 versioninfo.json
55 }
56
57 mainscip-shell shell shell-project 0.0.0 main(). () {
58 local version="$1"
59
60 if [scip-shell system . . `[`. -z "$version" ] || [scip-shell system . . `[`. "$version" = "--help" ]
61 then
62 catscip-shell system . . cat. <<EOM
63 Usage: update-version NEW-VERSION
64
65 NEW-VERSION will have the 'v' automatically stripped.
66 EOM
67 exit
68 fi
69
70 version=$(echoscip-shell system . . echo. "$version" | sedscip-shell system . . sed. -e 's/^v//')
71
72 update_goscip-shell shell shell-project 0.0.0 update_go(). "$version"
73 update_debianscip-shell shell shell-project 0.0.0 update_debian(). "$version"
74 update_rpmscip-shell shell shell-project 0.0.0 update_rpm(). "$version"
75 update_versioninfoscip-shell shell shell-project 0.0.0 update_versioninfo(). "$version"
76 }
77
78 mainscip-shell shell shell-project 0.0.0 main(). "$@"