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

Re: net-retriever: handy debug hack to pull in development udeb's at runtime



Ian Campbell <ijc@hellion.org.uk> writes:

> Package: net-retriever
> Version: 1.37
> Severity: wishlist
> Tags: patch
>
> On Wed, 2014-01-22 at 22:23 +0100, Cyril Brulebois wrote:
>> Ian Campbell <ijc@hellion.org.uk> (2014-01-22):
>> > I finally got fed up of rebuilding the initrd to include new versions of
>> > udebs I was hacking on, so I bodged up something in net-retriever to
>> > allow me to just throw udebs into a reprepro archive on a local web dir
>> > and have them be used.
>> > 
>> > So now I just need to build the initrd once with this included and I can
>> > preseed a location to get devel udebs from. It fits in quite nicely with
>> > apt-setup/local0 for debs to install on the target system.
>> > 
>> > Patch is below. I've also thrown it onto gitorious at:
>> > https://gitorious.org/ijc-debian/net-retriever/commit/34e4eb1e972dfbcec757b815f81b7d42447dfad7
>> > 
>> > This is by no means a proper thing and apart from being a massive hack
>> > it has no support for checking the gpg sigs, release files etc. 
>> > 
>> > But here it is in case it is useful to someone...
>> 
>> ACK on principle, that avoids having to resort to disabling GPG checks
>> in this component and {hacking,cracking} an archive by replacing bits
>> with tweaked packages, or having to build custom debian-archive-keyring
>> deb/udeb. (Tried both, and neither is nice.)
>> 
>> Can't really look at the implementation right now though, sorry about
>> that.
>
> No problem, I was mostly just putting it out there in case anyone else
> wanted it. It sounds like you think it might be something which could
> plausibly be added to the proper package?
>
>> Might be nice to file a bug against net-retriever to track it?
>
> Good idea, doing so now (Bcc to submit@) leaving quotes in place and
> attaching the patch for the BTS.

In addition it would be nice to have this on a branch in the official
Alioth repository. 

Gaudenz

>
> Thanks,
>
> Ian
> From 34e4eb1e972dfbcec757b815f81b7d42447dfad7 Mon Sep 17 00:00:00 2001
> From: Ian Campbell <ijc@hellion.org.uk>
> Date: Sun, 19 Jan 2014 13:19:21 +0000
> Subject: [PATCH] Development udeb retrieval support.
>
> Use via preseeding:
>     d-i retriever/devel-udeb/url string http://www-int./~ijc/debian/devel-udeb
> or on the command line:
>     retriever/devel-udeb/url=http://www-int./~ijc/debian/devel-udeb
> ---
>  debian/changelog               |    6 ++++++
>  debian/net-retriever.templates |    7 +++++++
>  net-retriever                  |   37 ++++++++++++++++++++++++++++++++++++-
>  3 files changed, 49 insertions(+), 1 deletion(-)
>
> diff --git a/debian/changelog b/debian/changelog
> index e74d768..6681e99 100644
> --- a/debian/changelog
> +++ b/debian/changelog
> @@ -1,3 +1,9 @@
> +net-retriever (1.38+ijc1) UNRELEASED; urgency=low
> +
> +  * Add hack to allow preseeding a URL to retrieve development udebs from.
> +
> + -- Ian Campbell <ijc@hellion.org.uk>  Sun, 05 Jan 2014 12:43:24 +0000
> +
>  net-retriever (1.37) unstable; urgency=low
>  
>    [ Updated translations ]
> diff --git a/debian/net-retriever.templates b/debian/net-retriever.templates
> index d3da8a9..8b33adf 100644
> --- a/debian/net-retriever.templates
> +++ b/debian/net-retriever.templates
> @@ -11,3 +11,10 @@ _Description: Downloading a file failed:
>   problem with your network, or with the mirror. You can choose to retry
>   the download, select a different mirror, or cancel and choose another
>   installation method.
> +
> +Template: retriever/devel-udeb/url
> +Type:string
> +_Description: Additional udeb mirror for development
> + FOR DEVELOPMENT USE ONLY
> + .
> + No authentication of the mirror is performed. Use at your own risk.
> diff --git a/net-retriever b/net-retriever
> index 347fefc..4c2ac8f 100755
> --- a/net-retriever
> +++ b/net-retriever
> @@ -16,6 +16,8 @@ db_get mirror/$protocol/hostname
>  hostname="$RET"
>  db_get mirror/$protocol/directory
>  directory="$RET"
> +db_get retriever/devel-udeb/url
> +dev_url="$RET"
>  
>  keyring=/usr/share/keyrings/archive.gpg
>  
> @@ -23,6 +25,15 @@ fetch() {
>  	fetch-url -c "${protocol}://${hostname}${directory}/$1" "$2"
>  }
>  
> +dev_fetch() {
> +	if [ -z "$dev_url" ]; then
> +		error "dev_fetch with no retriever/devel-udeb/url active -- something untoward is going on"
> +	fi
> +
> +	p=${1#@@devel@@}
> +	fetch-url -c "${dev_url}/$p" "$2"
> +}
> +
>  checkmatch() {
>  	release="$1"
>  	packages="$2"
> @@ -63,7 +74,17 @@ shift
>  
>  case "$cmd" in
>      retrieve)
> -	fetch "$@"
> +	case $1 in
> +	    @@devel@@*)
> +		log "devel: $@"
> +		dev_fetch "$@"
> +		;;
> +	    *)
> +		log "regular: $@"
> +		fetch "$@"
> +		;;
> +	esac
> +
>  	exit $?
>  	;;
>  
> @@ -127,6 +148,20 @@ case "$cmd" in
>  			elif [ "$ext" = .gz ]; then
>  				zcat "$Packages" >> "$1"
>  			fi
> +			if [ -n "$dev_url" ]; then
> +				DevelPackages="/tmp/net-retriever-$$-Devel-Packages"
> +				log "Checking $dev_url for DevelPackages"
> +				if dev_fetch "dists/$codename/$pkgfile" "$DevelPackages" ; then
> +					log "Got devel Packages from dists/$codename/$pkgfile"
> +					if [ "$ext" = '' ]; then
> +						cat "$DevelPackages" | sed -e 's/^Filename: /&@@devel@@/g' >> "$1"
> +					elif [ "$ext" = .gz ]; then
> +						zcat "$DevelPackages" | sed -e 's/^Filename: /&@@devel@@/g' >> "$1"
> +					fi
> +				else
> +					log "No devel Packages from dists/$codename/$pkgfile"
> +				fi
> +			fi
>  			ret=0
>  			break
>  		done
> -- 
> 1.7.10.4
>

-- 
Ever tried. Ever failed. No matter.
Try again. Fail again. Fail better.
~ Samuel Beckett ~


Reply to: