]> git.proxmox.com Git - rustc.git/commitdiff
Fix update-version script and make it smarter
authorXimin Luo <infinity0@debian.org>
Tue, 30 May 2017 23:53:14 +0000 (01:53 +0200)
committerXimin Luo <infinity0@debian.org>
Tue, 30 May 2017 23:53:14 +0000 (01:53 +0200)
debian/README.source
debian/rules
debian/update-version.sh [changed mode: 0644->0755]

index 3f1252d8a5cb196f0b1f5e57f621ef2dfdd9c55f..9b2d2c777068208ff805ee227bf0d1af4080309e 100644 (file)
@@ -13,6 +13,8 @@ Import of a new upstream version
 
 $ uscan
 $ gbp import-orig --upstream-branch=upstream/experimental --debian-branch=debian/experimental ../rustc_X.YY.0+dfsg1.orig.tar.xz
+$ dch -v X.YY.0+dfsg1-1
+$ debian/rules update-version
 
 
 Embedded libraries
index 492c2b67e45f8b332bc87a71461e4bf8e8eaad2b..00ef169fe0b2ff8d30b35777e854a3bccffd935c 100755 (executable)
@@ -28,9 +28,12 @@ RELEASE_CHANNEL := stable
 
 DEB_DESTDIR := $(CURDIR)/debian/tmp
 
-RUST_VERSION := $(shell echo '$(DEB_VERSION_UPSTREAM)' | sed -re 's/([^.]+)\.([^.]+)\..*/\1.\2/')
+SED_VERSION_SHORT := sed -re 's/([^.]+)\.([^.]+)\..*/\1.\2/'
+RUST_VERSION := $(shell echo '$(DEB_VERSION_UPSTREAM)' | $(SED_VERSION_SHORT))
 RUST_LONG_VERSION := $(shell echo '$(DEB_VERSION_UPSTREAM)' | sed -re 's/([^+]+).*/\1/')
 LIBSTD_PKG := libstd-rust-$(RUST_VERSION)
+# Sed expression that matches the "rustc" we have in our Build-Depends field
+SED_RUSTC_BUILDDEP := sed -ne "/^Build-Depends:/,/^[^[:space:]\#]/{/^ *rustc .*,/p}" debian/control
 
 # These are the normal build flags. Upstream is moving to debian/config.toml
 # but at the current version not all of these flags are available in that file.
@@ -42,11 +45,14 @@ DEB_CONFIGURE_FLAGS += --llvm-root=/usr/lib/llvm-3.9
 RUSTBUILD = ./x.py
 RUSTBUILD_FLAGS = --config debian/config.toml -v
 
+update-version:
+       oldver=$(shell $(SED_RUSTC_BUILDDEP) | sed -ne 's/.*(<= \(.*\)).*/\1/gp' | $(SED_VERSION_SHORT)); \
+       newver=$(RUST_VERSION); \
+       if [ $$oldver != $$newver ]; then debian/update-version.sh $$oldver $$newver; fi
+
 # Below we detect how we're supposed to bootstrap the stage0 compiler. See
 # README.Debian for more details of the cases described below.
 #
-# Sed expression that matches the "rustc" we have in our Build-Depends field
-SED_RUSTC_BUILDDEP := /^Build-Depends:/,/^[^[:space:]\#]/{/\s*rustc.*,/$$action}
 PRECONFIGURE_CHECK = :
 HAVE_BINARY_TARBALL := $(shell ls -1 dl/*$(DEB_HOST_RUST_TYPE)* 2>/dev/null | wc -l)
 # allow not using the binary tarball although it exists
@@ -76,8 +82,8 @@ else
     # In this case, we'll bootstrap from the stage0 given in that tarball.
     # To ensure the uploader of the .dsc didn't make a mistake, we first check
     # that rustc isn't a Build-Depends for the current architecture.
-    ifneq (,$(shell action=p; sed -ne "$(SED_RUSTC_BUILDDEP)" debian/control))
-    ifeq (,$(shell action=p; sed -ne "$(SED_RUSTC_BUILDDEP)" debian/control | grep '!$(DEB_HOST_ARCH)'))
+    ifneq (,$(shell $(SED_RUSTC_BUILDDEP)))
+    ifeq (,$(shell $(SED_RUSTC_BUILDDEP) | grep '!$(DEB_HOST_ARCH)'))
         PRECONFIGURE_CHECK = $(error found matches for dl/*$(DEB_HOST_RUST_TYPE)*, \
           but rustc might be a Build-Depends for $(DEB_HOST_ARCH))
     endif
old mode 100644 (file)
new mode 100755 (executable)
index 79820f9..74bafec
@@ -1,4 +1,6 @@
 #!/bin/bash
+# Don't run this directly, use "debian/rules update-version" instead
+
 prev_stable() {
 local V=$1
 python -c 'import sys; k=map(int,sys.argv[1].split(".")); k[1]-=1; print ".".join(map(str,k))' "$V"
@@ -12,11 +14,12 @@ NEW_M1=$(prev_stable $NEW)
 ORIG_R="${ORIG/./\\.}" # match a literal dot, otherwise this might sometimes match e.g. debhelper (>= 9.20141010)
 
 sed -i -e "s|libstd-rust-${ORIG_R}|libstd-rust-$NEW|g" \
-       -e "s|rustc (<= ${ORIG_R}|rustc (<= $NEW|g" \
-       -e "s|rustc (>= ${ORIG_M1/./\\.}|rustc (>= ${NEW_M1}|g" control
+       -e "s|rustc\( *\)(<= ${ORIG_R}|rustc\1(<= $NEW|g" \
+       -e "s|rustc\( *\)(>= ${ORIG_M1/./\\.}|rustc\1(>= ${NEW_M1}|g" control
 
 git mv libstd-rust-$ORIG.lintian-overrides libstd-rust-$NEW.lintian-overrides
 sed -i -e "s|libstd-rust-${ORIG_R}|libstd-rust-$NEW|g" libstd-rust-$NEW.lintian-overrides
 }
 
-update 1.16 1.17
+cd $(dirname "$0")
+update "$1" "$2"