Package: devscripts
Version: 2.10.59
Severity: normal

The file debian/repack.sh has been attached for testing.

PROBLEM

 $ licensecheck debian/repack.sh
 debian/repack.sh: UNKNOWN

 $ head -18 debian/repack.sh | nl -ba
     1  #!/bin/sh
     2  #   Copyright
     3  #
     4  #       Copyright (C) 2008-2009 Jari Aalto <[email protected]>
     5  #
     6  #   License
     7  #
     8  #       This program is free software; you can redistribute it and or
     9  #       modify it under the terms of the GNU General Public License as
    10  #       published by the Free Software Foundation; either version 2 of
    11  #       the License, or (at your option) any later version.
    12  #
    13  #       This program is distributed in the hope that it will be useful, 
but
    14  #       WITHOUT ANY WARRANTY; without even the implied warranty of
    15  #       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    16  #       General Public License for more details at
    17  #       <http://www.gnu.org/copyleft/gpl.html>.
    18

-- Package-specific info:

--- /etc/devscripts.conf ---

--- ~/.devscripts ---
DEBUILD_DPKG_BUILDPACKAGE_OPTS="-i.pc -iconfig.status -ibackup.bzr -i.git -uc 
-us"
DEBUILD_PRESERVE_ENVVARS="DH_ALWAYS_EXCLUDE,PATH,CC,CXX"
DEBUILD_LINTIAN=yes
DEBUILD_PRESERVE_ENV=yes
DGET_VERIFY=no

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.30-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages devscripts depends on:
ii  dpkg-dev                      1.15.5.3   Debian package development tools
ii  libc6                         2.10.2-2   GNU C Library: Shared libraries
ii  perl                          5.10.1-8   Larry Wall's Practical Extraction 

Versions of packages devscripts recommends:
ii  at                 3.1.11-1              Delayed job execution and batch pr
ii  bsd-mailx [mailx]  8.1.2-0.20090911cvs-2 simple mail user agent
ii  bzr                2.0.2-1               easy to use distributed version co
ii  curl               7.19.7-1              Get a file from an HTTP, HTTPS or 
ii  cvs                1:1.12.13-12          Concurrent Versions System
ii  dctrl-tools        2.13.1                Command-line tools to process Debi
ii  debian-keyring [de 2009.11.04            GnuPG (and obsolete PGP) keys of D
ii  dillo [www-browser 2.0-1                 Small and fast web browser
ii  dput               0.9.5.1               Debian package upload tool
ii  elinks [www-browse 0.12~pre5-1           advanced text-mode WWW browser
ii  epiphany-gecko [ww 2.26.3-2              Intuitive GNOME web browser - Geck
ii  equivs             2.0.7-0.1             Circumvent Debian package dependen
ii  fakeroot           1.14.4-1              Gives a fake root environment
ii  git-core           1:1.6.5-1             fast, scalable, distributed revisi
ii  gnupg              1.4.10-2              GNU privacy guard - a free PGP rep
ii  iceweasel [www-bro 3.0.14-1              lightweight web browser based on M
ii  konqueror [www-bro 4:4.3.1-1             KDE 4's advanced file manager, web
ii  libauthen-sasl-per 2.13-1                Authen::SASL - SASL Authentication
ii  libcrypt-ssleay-pe 0.57-2                Support for https protocol in LWP
ii  libparse-debcontro 2.005-2               Easy OO parsing of Debian control-
ii  libsoap-lite-perl  0.710.10-1            Perl implementation of a SOAP clie
ii  libterm-size-perl  0.2-4+b1              Perl extension for retrieving term
ii  libtimedate-perl   1.1900-1              Time and date functions for Perl
ii  liburi-perl        1.37+dfsg-1           Manipulates and accesses URI strin
ii  libwww-perl        5.833-1               Perl HTTP/WWW client/server librar
ii  libyaml-syck-perl  1.07-1                fast, lightweight YAML loader and 
ii  links [www-browser 2.2-1+b1              Web browser running in text mode
ii  lintian            2.2.18                Debian package checker
ii  lsb-release        3.2-23                Linux Standard Base version report
ii  lynx-cur [www-brow 2.8.8dev.1-1          Text-mode WWW Browser with NLS sup
ii  lzma               4.43-14               Compression method of 7z format in
ii  mailx              1:20081101-2          Transitional package for mailx ren
ii  man-db             2.5.6-4               on-line manual pager
ii  mercurial          1.4-1                 scalable distributed version contr
ii  midori [www-browse 0.1.8-1               fast, lightweight graphical web br
ii  openssh-client [ss 1:5.1p1-8             secure shell client, an rlogin/rsh
ii  opera [www-browser 10.10.4742.gcc4.qt3   The Opera Web Browser
ii  patch              2.5.9-5               Apply a diff file to an original
ii  patchutils         0.3.1-2               Utilities to work with patches
ii  sensible-utils     0.0.1                 Utilities for sensible alternative
ii  strace             4.5.19-1              A system call tracer
ii  subversion         1.6.3dfsg-1           Advanced version control system
ii  unzip              6.0-1                 De-archiver for .zip files
ii  w3m [www-browser]  0.5.2-2.1             WWW browsable pager with excellent
ii  wdiff              0.5-19                Compares two files word by word
ii  wget               1.12-1.1              retrieves files from the web
ii  xemacs21-mule [www 21.4.22-2             highly customizable text editor --

Versions of packages devscripts suggests:
ii  build-essential               11.4       Informational list of build-essent
pn  cvs-buildpackage              <none>     (no description available)
ii  devscripts-el                 31.2-1     Emacs wrappers for the commands in
pn  gnuplot                       <none>     (no description available)
ii  libfile-desktopentry-perl     0.04-2     Perl module to handle freedesktop 
ii  libnet-smtp-ssl-perl          1.01-2     SSL support for Net::SMTP
ii  mutt                          1.5.20-4   text-based mailreader supporting M
ii  svn-buildpackage              0.6.29     helper programs to maintain Debian
ii  w3m                           0.5.2-2.1  WWW browsable pager with excellent

-- no debconf information
#!/bin/sh
#   Copyright
#
#       Copyright (C) 2008-2009 Jari Aalto <[email protected]>
#
#   License
#
#       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
#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#       General Public License for more details at
#       <http://www.gnu.org/copyleft/gpl.html>.

set -e
set -u

Help ()
{
    echo "
SYNOPSIS
  repack.sh --upstream-source <ver> <downloaded file> [package]

DESCRIPTION
    Repackage upstream source. The command line arguments are due
    to uscan(1) order. The PACKAGE argument is optional.

EXAMPLES
    Repack foo-1.1.tar.gz as bar-1.10.tar.gz

        repack.sh 1.10 foo-1.1.tar.gz bar

AUTHOR
    Jari Aalto <[email protected]>. Licenced under GPL v2 or,
    at your option, any later version.
"
    exit 0
}

Run ()
{
    ${test+echo} "$@"
}

Warn ()
{
    echo "$*" >&2
}

Die ()
{
    Warn "$*"
    exit 1
}

AtExit ()
{
    if [ "$DIR" ]; then
	[ -d "$DIR" ] && Run rm -rf "$DIR"
    fi
}

DebianVersion ()
{
    # YYYYMMDD => YYYY.MMDD
    echo $1 | sed 's/\(....\)\(..\)\(..\)/\1.\2\3/'
}

DebianTar ()
{
    local ver=$1
    local dver=$2
    local file=$3
    local pkg=$4

    # If version is same, use original file

    if [ "$ver" = "$dver" ]; then
	if [ "$pkg" ]; then
	    echo $file | sed "s,.*$ver,$pkg-$ver,"
	else
            echo $file
	fi
	return 0
    fi

    if [ "$pkg" ]; then
	echo $file | sed -e "s,.*$ver,$pkg-$dver,"
    else
        # replace with new version
	echo $file | sed -e "s,$ver,$dver,"
    fi
}

Pkg ()
{
    local file=$1

    if [ -f debian/changelog ]; then
	dpkg-parsechangelog | awk '/^Source:/ {print $2}'
    else

	# package-1.1.tar.gz => package
	echo $file | sed "s,-[0-9].*,,"
    fi
}

Version ()
{
    local file=$1
    local pkg=$(Pkg $file)

    if [ ! "$pkg" ]; then
	Die "[ERROR] Internal error. 'pkg' variable not set. Run with debug (-x)"
    fi

    echo $file |
    sed -e "s,\.tar.*,," \
        -e "s,$pkg[-_],,"
}

Main ()
{
    DIR=

    #  Ignore uscan(1) argument --upstream-version in $1

    case "$1" in
	--help|-h)
		Help
		;;
	--*)	shift
		;;
    esac

    VER="$1"
    FILE="$2"

    if [ ! -f "$FILE" ]; then
	Die "[ERROR] Arg 2. File does not exist: $FILE"
    fi


    PKG=${3:-$(Pkg $FILE)}

    if [ ! "$PKG" ]; then
	Die "[ERROR] Internal error. PKG not set. Run with debug (-x)"
    fi


    CURVER=$(Version $FILE)

    if [ ! "$CURVER" ]; then
	Die "[ERROR] Internal error. CURVER not set. Run with debug (-x)"
    fi

    DVER=$(DebianVersion "$VER")
    DFILE=$(DebianTar "$CURVER" "$DVER" "$FILE" $PKG)

    #  Debian Developer's Reference 6.7.8.2 Repackaged upstream source

    REPACK_DIR="$PKG-$DVER.orig"

    DIR=$(Run mktemp -d ./tmp.repack.XXXXXX)

    echo "Repacking $FILE as $PKG-$DVER"

    #	Create an extra directory to cope with tarballs that
    #	do not have root/ directory

    UP_BASE="$DIR/unpack"
    Run mkdir "$UP_BASE"

    Run tar -C "$UP_BASE" -xf "$FILE"

    if [ $(ls -1 "$UP_BASE" | wc -l) -eq 1 ]; then
	# Tarball does contain a root directory
	UP_BASE="$UP_BASE/$(ls -1 "$UP_BASE")"
    fi

    #	Remove files if needed

    #	Repack

    Run mv "$UP_BASE" "$DIR/$REPACK_DIR"

    #	Don't use pipes. Errors are not handled correctly if pipes aree used.

    Run tar -C "$DIR" -cf "$DIR/repacked.tar" "$REPACK_DIR"
    Run gzip --best "$DIR/repacked.tar"
    Run mv "$DIR/repacked.tar.gz" "$DFILE"

    echo "Done $DFILE"
}

trap AtExit QUIT INT EXIT
Main "$@"

# End of file

Reply via email to