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

packaging dotfile



Hi!

It's me again, I just have finished trying this and trying that to extract
upstream versions from the upstream source to automagically upgrade in
debian/rules.
While I was doing so, I came across some pretty interesting things:
dotfile has got so many submodules that it doesn't seem good to have 20
lines of code for every module in the rule-file. As the extraction process
is the same for every module I wrote a shell script that might be supplied
with the modules name and then prints the 'correct' version number to
stdout. 
My first question is where is it legal to put that thing? is it ok when I
put it under debian/ ? I couldn't find that in the docu.
My second question is a bit more complex. I will have to explain how my
script works. It actually retrieves the upstream-version number and then
compares it with a built-in-cache. ( I thought I will need that cache,
cause how could the script know about debian-version ?) So when the
upstream-version (e.g. 0.02) and the upstream-version of the cache
(e.g. cachevalue 0.02-7) are the same (e.g. 0.02 = 0.02), then the
complete version is printed to stdout.
I hope that functionality is ok. 
My question now is when a new upstream version is introduced, the debian -
version must be reset to what value ? 0 or 1 ? I really don't know.
currently I am setting it to 1, but who knows if this is right?

Ps: I have attached the script for people who really wanna know what I am
talking about. (its about 1.3KB only)

kind regards,

Michael Moerz

#!/bin/bash
modulename=$1
subversion=$2
version=`cat Modules/english/${modulename}/version`

# cache fields ! do not edit as long as u don't know what you are doing
# per-module one line, starting with modulename then comes an equal and then
# the last used upstream-version a `-` and then the last debian version
bash=1.02-7
elm=1.0b1-9
fvwm1=1.3-6
fvwm2=1.1-4
ipfwadm=0.25b-4
procmail=1.3-2
rtin=0.02-8
tcsh=1.4-4
#canna=0.0.a2-1
# end of cache entries

# debug line
#echo "$modulename | $version | $subversion"

# fetch upstream version number, compare to built in cache, output computed
# version to stdout
awk -v base=${modulename} -v version=${version} -F = \
    ' $1 ~ "^" base { if ( $2 ~ "^" version "-" ) \
                        print $2;\
                      else \
                        print version "-1"  } ' debian/extract-version

# do the same as above, but with the built in cache
awk -v base=${modulename} -v version=${version} -F = \
    '{ if ( $1 ~ "^" base ) \
	 if ( $2 ~ "^" version "-" ) \
           print $1 "=" $2;\
         else \
           print $1 "=" version "-1"; \
       else \
         print $0 }' debian/extract-version > debian/extract-version.tmp

# first copy and then remove tmp to preserv file-permissions
cp debian/extract-version.tmp debian/extract-version
rm debian/extract-version.tmp


Reply to: