#!/bin/bash # Package or update a new or existing crate. # # Usage: [REALVER=] ./release.sh [] # # Envvars: # See also ./vars.sh.frag for its envvars, which we pass through. # Run this before sourcing vars.sh.frag so the user reads it first exec_basename="$(basename "$0")" case "$exec_basename" in new-package.sh|package.sh) echo >&2 echo >&2 "WARNING! $exec_basename is deprecated. Please use update.sh instead." echo >&2 # Add 1 second sleep so users read the deprecation notice, # get annoyed by the wait and start using update.sh sleep 1 ;; esac . ./vars.sh.frag case "$(git rev-parse --abbrev-ref HEAD)" in pending-*) abort 1 "You are on a pending-release branch, $0 can only be run on another branch, like master";; esac timeout --foreground 15 git fetch origin --prune || abort 1 "Failed to fetch upstream to check pending branches, please check network" pending_branches=$(git branch --all --list "*pending-$PKGNAME") if [ -n "$pending_branches" ] then abort 1 "Please resolve these existing pending branches before updating this crate:$(printf "\n$pending_branches")" fi if [ -n "$VER" ]; then if [ ! -d "$PWD/src/$PKGBASE" ]; then abort 1 "Using crate $CRATE with version $VER but default-version is not packaged." \ "Package that first by running this script without the explicit version." fi fi if [ ! -d "$PKGDIR/debian" ]; then mkdir -p "$PKGDIR/debian" cat <<-eof > "$PKGCFG" overlay = "." uploaders = ["$DEBFULLNAME <$DEBEMAIL>"] eof fi if [ ! -f "$PKGDIR/debian/copyright" ]; then cat <<-eof > "$PKGDIR/debian/copyright" FIXME fill me in using ./copyright.debcargo.hint as a guide eof fi if [ -n "$VER" -a "$(sed -ne 's/^semver_suffix\s*=\s*//p' "$PKGCFG")" != "true" ]; then if grep -q semver_suffix "$PKGCFG"; then sed -i -e 's/^\(semver_suffix\s*=\s*\).*/\1true/' "$PKGCFG" else sed -i -e '1isemver_suffix = true' "$PKGCFG" fi fi if ! grep -q uploaders "$PKGCFG"; then # try to auto-fill in uploaders if debcargo.toml doesn't have it uploader="$(grep -E -A1 "[0-9][0-9]*( Debian)? Rust Maintainers" "$PKGDIR/debian/copyright" | tail -n1 | sed -re 's/^\s*[0-9]+\s*//g')" uploader="${uploader:-$DEBFULLNAME <$DEBEMAIL>}" sed -i -e 's/^\(overlay.*\)$/\1\nuploaders = ["'"$uploader"'"]/' "$PKGCFG" echo >&2 "$0: Auto-added $uploader to uploaders in debcargo.toml, based on d/copyright" if [ "$uploader" != "$DEBFULLNAME <$DEBEMAIL>" ]; then read >&2 -p "$0: You may also want to add yourself; ctrl-c if you want to do that, or press enter to continue... " x fi fi run_debcargo if ! git diff --quiet -- "$PKGDIR_REL"; then read -p "Update wrote some changes to $PKGDIR_REL, press enter to git diff..." x || true git diff -- "$PKGDIR_REL" echo >&2 "-- end of git diff --" fi cat >&2 <\`, where looks like 0.n or n - but you must have a good reason for this, which you should document in src/$PKGNAME-/debian/debcargo.toml. When satisfied with all of these outputs: - of debcargo after running ./update.sh - of lintian after running ./build.sh - of dev/list-rdeps.sh $CRATE then you can commit. For example: git commit -m "$CRATE: new upstream release" src/$PKGNAME/ and push all your changes. Then, ask a Debian Developer to run \`./release.sh $*\`. This finalises your changes in the changelog, and allows them to build and upload the package. If you're not a Debian Developer and are unable to upload, please don't run that script or else you will need to revert the changes that it makes to your git. Instead, add an empty RFS file inside the created debian directory. If there are other issues that need to be addressed such as missing dependencies, they can be addressed by adding a comment into the RFS file; see CONTRIBUTING.rst's "Ready for upload" section for more details. eof if [ -n "$VER" ]; then cat >&2 <