[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

script to get "-v${version} -sa" arguments



-v needs a specific version you've to find out, and -sa presence depends on
whether that orig tarball is already in bpo, which is a PITA if you have to
check manually.

I use this script for my backports, just thought someone else might find it
useful.  Some example:

$ dpkg-buildpackage -rfakeroot `~/hacking/backports/get_previous_version` -j2
Args added for gnash: "-v0.8.2-1".  Press enter to continue.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
#!/bin/bash -e
#
# Copyright (C) 2008  Robert Millan
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.


package=`dpkg-parsechangelog | sed -ne s/^Source:\ //p`
dist=etch
dist_num=40

if [ "${package}" == "" ] ; then
  echo "Could not identify package" >&2
  exit 1
fi

get_version_in ()
{
  wget -q $1/main/source/Sources.bz2 -O - | bunzip2 -c \
  | dchroot -q -d -c sid -- grep-dctrl -PX ${package} | sed -ne s/^Version:\ //p
}

version_in_bpo=`get_version_in http://backports.org/debian/dists/${dist}-backports`
stripped_version_in_bpo=`echo ${version_in_bpo} | sed -e "s/~bpo${dist_num}+[0-9]\+$//g"`

if [ "${version_in_bpo}" == "" ] ; then
  version_in_stable=`get_version_in http://ftp.nl.debian.org/debian/dists/${dist}`
  if [ "${version_in_stable}" == "" ] ; then
    # never been in stable
    version_in_stable=0
  fi
  args="-v${version_in_stable} -sa"
else
  args="-v${stripped_version_in_bpo}"
fi

echo "Args added for ${package}: \"${args}\".  Press enter to continue." >&2
read

echo "${args}"

Reply to: