Package: dput
Version: 0.9.6.3
Severity: wishlist
Tags: upstream

Dear Maintainer,
while trying to dput to an ubuntu PPA, the upload failed with the following
message:

   Rejected:
   Source/binary (i.e. mixed) uploads are not allowed.

I thought it would be useful if there was a script/program that could convert a
mixed .changes file into a source-only .changes file.
I'm calling it dput-c2sc but if you can think of a better name then please go
ahead and change it!
If there's a better way to do this then please let me know.
I spotted the TODO file:
5. Restrict upload types (source, binary etc.) in config

I don't think this is exactly what I'm proposing, maybe it could be a dput
option - I don't know enough about how .changes files are handled to be sure.



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

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

Versions of packages dput depends on:
ii  gnupg   1.4.12-4+b1
ii  python  2.7.3-1

dput recommends no packages.

Versions of packages dput suggests:
ii  lintian         2.5.10
pn  mini-dinstall   <none>
ii  openssh-client  1:6.0p1-2
ii  rsync           3.0.9-3

-- no debconf information
#!/bin/sh
set -e

eecho()
{
	echo "$1" 1>&2
}
Usage()
{
	eecho "Usage: dput-c2sc <some-package.changes> > <some-package-source-only.changes>"
	exit 1
}
# Verify it's a real .changes file.
if test "$1" = "" || test ! -f $1; then
	eecho "Error: \"$1\" : file not found."
	Usage
fi
package="$(cat "$1" | grep '^Source: ' | sed -e 's| |\n|g' | tail -n 1)"
if test "$package" = ""; then
	eecho "Error: package name not found in .changes file."
	eecho "\tIs is really a changes file?"
	Usage
fi
if test "" = "$(echo "$1" | grep "^$package")"; then
	eecho "Error: .changes file name doesn't start with package name."
	Usage
fi

if test "" != "$(cat "$1" | head -n 1 | grep "^-----BEGIN")"; then
	# Strip the signature from top and bottom.
	res="$(cat "$1" | grep -v '.deb$' | grep -v '^Binary:' | grep -v "^ $package-" | sed -re 's|^Architecture: .+$|Architecture: source|g' | head -n -8)"
	lc="$(echo "$res" | wc -l - | sed -e 's| |\n|g' | head -n 1)"
	lc="$(($lc - 3))"
	echo "$res" | tail -n $lc
else
	cat "$1" | grep -v '.deb$' | grep -v '^Binary:' | grep -v "^ $package-" | sed -re 's|^Architecture: .+$|Architecture: source|g'
fi

Reply via email to