[buildd-tools-devel] Bug#693928: sbuild: Please support building without providing a version number
Johannes Schauer
josch at debian.org
Tue Jan 26 07:50:11 UTC 2016
Control: tag -1 + pending
Hi,
On Wed, 21 Nov 2012 20:56:50 +0000 Roger Leigh <rleigh at debian.org> wrote:
> Mainly just notes so I don't forget:
>
> Currently, sbuild uses a package_version syntax to specify the package and
> version to use when downloading the source package. It would be useful in
> many cases to be able to just specify the package name only, and obtain the
> latest version in the specified distribution.
so today I realized how often I used the following pattern:
$ apt-get source --download-only foo
$ sbuild foo*.dsc
so I sat down and looked at how to implement this feature.
> Currently, Sbuild::Build copes with no version being provided. It's just a
> matter of disabling the "invalid source" check. But fetch_source_files
> currently has some requirements for knowing the version up-front, and will
> require some refactoring (or an alternative block for versionless source
> downloading) to handle this. It will also need some logic adding to find the
> correct .dsc after the download is done; since we download into a temporary
> directory, only one ${package}*.dsc should match that glob; also need to
> check how multiple source versions are handled.
>
> Not quite as simple as I initially thought, but it's pretty much contained
> within fetch_source_files. So long as we reset $dsc and 'DSC File', that
> should be sufficient.
Turned out to be even harder than you initially thought because the version is
also required for log filtering (PKGBUILDDIR and BUILDDIR), for all kinds of
log status printing, for external command percentage escapes %d and %p, for
opening the build log at package_ver.build, making the build log symlink and
some more status printing...
Though I think I managed to implement it now. It is now in the sbuild git. Here
the commit message for details of how it was done:
Allow to build by only passing source package name without version (closes: #693928)
The packagename_version format was a handy way to fulfill the assumption
sbuild makes that the source package version is available right from the
start. Sbuild then uses the version for things like log filtering,
status output, external command percentage escapes or the build log file
name.
This patch makes it optional that the version is known from the start.
In case it is not known it will:
- not print version information in the build log
- not let external command percentage escapes be defined
- use only the package name for the build log filename
- set up log filtering much later when the version is definitely known
To not break existing setups, all the old behavior is kept if the
version is known from the start. To distinguish the version being known
from not being known, the user-supplied argument is checked for the
presence of an underscore. If an underscore exists, then either a dsc is
passed or the pkgname_version format was used and in both cases, the old
behavior can be executed. If no underscore can be found, then it is a
bare package name and the different behavior explained above will kick
in.
The man page has been adapted to document the new behavior.
While I was at it, I also rewrote the code downloading the source
package:
- The old code triggered an "apt-get update" if the source package
could not be found. This is not necessary because the source package
is fetched after the chroot is updated. Furthermore it allows to
"apt-get update" to be run without eventual failures be caught by the
respective external command hooks. Lastly, this would ignore the
--no-apt-update command line option.
- "apt-cache showsrc" was run without --only-source
- The "apt-cache showsrc" output was parsed using Perl regexes.
Dpkg::Index is used now.
- The Files field is now parsed using Dpkg::Checksums instead of using
perl regexes.
- the @fetched array was only filled but never used by anybody
Thanks!
cheers, josch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: signature
URL: <http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20160126/737686b8/attachment.sig>
More information about the Buildd-tools-devel
mailing list