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

Re: Bug#466550: Pristine source from upstream VCS repository

On Thu, Mar 12 2009, Russ Allbery wrote:

> Manoj Srivastava <srivasta@debian.org> writes:
>>  a) Run a upstream version check from cron, which mails me if there are
>>     new upstream versions of something I have.
>>  b) If there is a new upstream version, cd checked out dir
>>     1. No munging required: use uscan --rename --verbose to get the
>>        latest source.
>>     2. Munging needed. Run get-orig-source to get the latest upstream
>>        source via uscan; and munge it as needed to create the
>>        orig.tar.gz file
> Oh, okay, so your get-orig-source target would internally use uscan.  How
> do you tell from that what tarball it downloaded for an automated target?
> Would you parse the output of uscan somehow?

        OK. So here is a working setup:
--8<---------------cut here---------------start------------->8---
[master]__> uscan --verbose --rename --repack --force-download
-- Scanning for watchfiles in .
-- Found watchfile in ./debian
-- In debian/watch, processing watchfile line:
   opts=pasv,dversionmangle=s/\.ds//  http://www.fvwm.org/download/ ftp://ftp.fvwm.org/pub/fvwm/version-2/fvwm-([\d\.]*)\.tar\.gz debian debian/uscan-repack
-- Found the following matching hrefs:
Newest version on remote site is 2.5.27, local version is 2.5.27.ds
 (mangled local version number 2.5.27)
 => Package is up to date
Newest version on remote site is 2.5.27, local version is 2.5.27.ds
 (mangled local version number 2.5.27)
 => Forcing download as requested
-- Downloading updated package fvwm-2.5.27.tar.gz
-- Successfully downloaded updated package fvwm-2.5.27.tar.gz
    and renamed it as fvwm_2.5.27.orig.tar.gz
-- Executing user specified script
     debian/uscan-repack --upstream-version 2.5.27 fvwm-2.5.27.tar.gz
        Starting to get ../fvwm_2.5.27.orig.tar.gz 
        Munging ../fvwm_2.5.27.orig.tar.gz ==> ../fvwm_2.5.27.ds.orig.tar.gz
        ../fvwm_2.5.27.ds.orig.tar.gz created.
-- Scan finished
--8<---------------cut here---------------end--------------->8---

        The session above demonstrates uscan looking for, and
 downloading, the latest version of fvwm sources. If I had passed in a
 --download-version option, it would have looked for a specific version
 to get.

        The watch file is:
--8<---------------cut here---------------start------------->8---
opts=pasv,dversionmangle=s/\.ds//  http://www.fvwm.org/download/  \
    ftp://ftp.fvwm.org/pub/fvwm/version-2/fvwm-([\d\.]*)\.tar\.gz \
     debian debian/uscan-repack
--8<---------------cut here---------------end--------------->8---

        This specifies pasv, specifies the local version mangling (I
 append a .ds to the upstream version), and send in a user specified
 script for manging.

        The script used for mangling is appended below.

        Given that we already have a tool that can download upstream
 sources, with or without mangling, and can be used by facilities
 outside of the unpacked Debian source package to determine if there was
 new versions and to download unmangled versions, is there any need to
 retain the get-orig-source target at all? I mean, this seldom
 implemented target is duplicating an existing and widely used facility
 in Debian; and removing the target from the policy will advance the
 laudable goal of stripping the policy of cruft.

        Admittedly, we could standardize on the name uscan-repack or
 something for the user specified script to use to mangle the upstream
 sources if needed, and that will allow automata to know what files to
 extract from the .dsc (debian/watch and debian/uscan-repack [please
 suggest a better name]), I think that should be adequate for the use
 case at hand.



# 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 2 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
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

# This is heavily based on work done by Bernd Zeimetz, and has been
# extended slightly.

set -e

#command --upstream-version version filename
[ $# -eq 3 ] || exit 255

echo >&2 ''
echo >&2 "        Starting to get ${filename} "

# Unpack, and find the directory it unpacked into
tar xfz ${filename} 
dir=`tar tfz ${filename} | head -1 | sed 's,/.*,,g'`

# Package specific cleanups

echo >&2 "        Munging ${filename} ==> ${filename%%.orig.tar.gz}.ds.orig.tar.gz"
rm -rf ${DIRS_TO_REMOVE}

# Any additional cleanup goes in here
: echo ''

# rename, repack, cleanup
mv ${dir} ${dir}.ds.orig
tar cf - ${dir}.ds.orig | gzip -9 > ${filename%%.orig.tar.gz}.ds.orig.tar.gz
rm -rf ${dir}.ds.orig

echo >&2 "        ${filename%%.orig.tar.gz}.ds.orig.tar.gz created."

"It might help if we ran the MBA's out of Washington." Admiral Grace
Manoj Srivastava <srivasta@debian.org> <http://www.debian.org/~srivasta/>  
1024D/BF24424C print 4966 F272 D093 B493 410B  924B 21BA DABB BF24 424C

Reply to: