apt-src-0.25.1/0000755000000000000000000000000012225606413010037 5ustar apt-src-0.25.1/TODO0000644000000000000000000000327207743127733010547 0ustar Somehow reconcile with other similer tools: - apt-build - apt-src (the apt patch) Does not handle source dependencies yet. Build-deps notes: - a package like poldhu needs to build after both the kernel and pcmcia-source. pcmcia-source in turn needs to build after the kernel.. - if the kernel is rebuilt, the things that build-dep on it should be rebuilt after it I could use two fields for this: Source-Depends: kernel-source Build-After: kernel-source, pcmcia-cs So it ensures that kernel-source is installed, and builds poldhu only after both have built. This would call for some way of knowing that the sources were built though. Hm. There is a problem with the kernel-source package really being kernel-source-. Perhaps apt-src needs to be changed so you can refer to a source package in terms of all the binary packages that that source package builds, but also all the packages said binary package provides. Hmm, the real trick is where to get that info. Getting it from the apt binary cache would be hard, and also misleading, because something might not be available in binary form yet. It should really parse the debian control file of installed source packages to get this. Should offer a way to build packages with some environment variables set the same each time. DEB_BUILD_OPTS and so on. Per-package.. I may want other per-package configurable stuff, like whether to install debs, whether to build on upgrade, and what debs to install if multiple build (a-la pine). One idea is to put that in a file in the source tree. Another is to put it in the status file. Hmm. Make /usr/src be the default location for root, but not for non-root users? apt-src-0.25.1/AptSrc.pm0000644000000000000000000004211510053652552011576 0ustar #!/usr/bin/perl package AptSrc; use warnings; use strict; use Cwd q{realpath}; use AptPkg::Config q{$_config}; use AptPkg::System q{$_system}; use AptPkg::Version; use AptPkg::Source; use AptPkg::Cache; use Fcntl qw(:DEFAULT :flock); use Carp; # AptPkg init blah. $_config->init; $_config->{quiet} = 2; $_system = $_config->system; our $vs = $_system->versioning; our $aptsrc = AptPkg::Source->new; our $aptcache = AptPkg::Cache->new; # Holds installed sources; read from the status file. our %sources; # Directory limit. our $loclimit; # Whether the status file is opened readonly, or for writing too. our $writestatus; # Filehandle locking status file. my $statuslock; # Holds error unwind subs. our @unwind; # Pass an AptPkg::Config in, and it will be used to configure this module. sub config { my $class=shift; $_config=shift; } # Save the status file at program end, if it was opened for writing. sub END { AptSrc->writestatus() if $writestatus; } sub statusdir { my $class=shift; return "$ENV{HOME}/.apt-src/"; } sub statusfile { my $class=shift; return $class->statusdir()."/status"; } # If writestatus is set to true, it will lock the status file for writing. sub readstatus { my $class=shift; $writestatus=shift; my $fn=$class->statusfile(); if (! -e $fn) { # Set up an empty file, and lock that. if ($writestatus) { $class->writestatus; } else { return; } } open($statuslock, $fn) || $class->error("read $fn: $!"); if ($writestatus) { if (! flock($statuslock, LOCK_EX | LOCK_NB)) { $writestatus=0; # don't zero file! $class->error("$fn is locked by another process"); } } { local $/="\n\n"; while (<$statuslock>) { my %rec; foreach my $line (split /\n/, $_) { my ($key, $value) = split /:\s*/, $line, 2; $rec{lc($key)}=$value; } my $item=$class->new(%rec); # Make sure that the item still exists, and check # for a locally changed version. if (! -d $item->location) { delete $sources{$item->location}; } elsif (open(APTSRC_CHANGELOG, $item->location."/debian/changelog")) { my $line=; close APTSRC_CHANGELOG; if ($line =~ /^([^\s]+)\s+\(([^)]+)\)/) { my $source=$1; my $version=$2; $item->source($source); $item->version($version); } else { $item->warning("cannot parse ".$item->location."/debian/changelog"); } } else { $item->warning("cannot read ".$item->location."/debian/changelog"); } } } close $statuslock unless $writestatus; } sub writestatus { my $class=shift; my $fn=$class->statusfile(); if (! $writestatus) { $class->error("writestatus called with read-only status file"); } if (! -e AptSrc->statusdir) { mkdir AptSrc->statusdir || AptSrc->error("Unable to create status directory: $!"); } open(my $status, ">$fn.new") || $class->error("write $fn.new: $!"); foreach my $k (keys %sources) { my $item=$sources{$k}; next if $item->{status} eq 'removed'; foreach my $key (sort keys %$item) { print $status ucfirst($key).": ".$item->{$key}."\n"; } print $status "\n"; } close $status; rename("$fn.new", $fn) || $class->error("rename $fn.new to $fn failed: $!"); } # Pass a directory, and any packages in that directory will be acted on, but # no others. Without parameters, returns the current loclimit. sub loclimit { my $class=shift; if (@_) { return $loclimit=realpath(shift); } else { return $loclimit; } } # Returns true if the item patches the location limit, or there is no # limit. sub meets_loclimit { my $this=shift; return 1 if ! $loclimit || $loclimit eq $this->basedir || $loclimit eq $this->location; return 0; } # May be passed a hash of the item's contents. sub new { my $proto = shift; my %fields=@_; my $class = ref($proto) || $proto; my $this=bless ({%fields}, $class); if (exists $this->{location}) { $sources{$this->{location}}=$this; } else { $this->updatelocation; } return $this; } # Returns the set of all installed sources. sub installed { my $class=shift; my $this=shift; return grep { $_->status eq "installed" && $_->meets_loclimit } values %sources; } # Returns the set of all unpacked but not yet fully installed sources. sub unpacked { my $class=shift; my $this=shift; return grep { $_->status eq "unpacked" && $_->meets_loclimit } values %sources; } # Returns all sources that match the passed name or names. The names can # include regexps, as well. sub match { my $class=shift; # Build up a regexp that will match the requested names. my $regexp=join("|", map { my $source = ($class->findsource($_))[1]; $source=$_ unless defined $source; $source; } @_); return grep { $_->{source} =~ m/^($regexp)$/ && $_->meets_loclimit } values %sources; } # Returns all known sources (that match the loclimit). sub all { return grep { $_->meets_loclimit } values %sources; } # Finds a source package matching the input, and returns the version number # and source package name. The input can be the name of a binary or source # package, and can have =version prepended to specify a specific version, # or /release prepended to specify a specific release. sub findsource { my $class=shift; my $spec=shift; my $reqversion; my $reqrelease; if ($spec =~ /(.*)=(.*)/) { $reqversion=$2; $spec=$1; } elsif ($spec =~ /(.*)\/(.*)/) { $reqrelease=$2; $spec=$1; } # Look up source packages matching the given binary or source # package name. my @matches=$aptsrc->find($spec); # Now, filter the matches down to match any version or release # requirements. if (defined $reqversion) { @matches = grep { $_->{Version} eq $reqversion } @matches; } if (defined $reqrelease) { # Sources doesn't have release info, so to get it look at # the release info of one if the binary packages produced # by the source. my @newmatches; SOURCE: foreach my $source (@matches) { my @binaries=@{$source->{Binaries}}; next unless @binaries; my $binname=$binaries[0]; my $binpkg=$aptcache->get($binname); next unless ref $binpkg; my @vers = grep { $_->{VerStr} eq $source->{Version} } @{$binpkg->{VersionList}}; next unless @vers == 1; foreach my $verfile (@{$vers[0]->{FileList}}) { my $archive=$verfile->{File}->{Archive}; if (defined $archive && $archive eq $reqrelease) { push @newmatches, $source; next SOURCE; } } } @matches=@newmatches; } # Finally, take the most recent version of the remaining matches. my ($source, $version); foreach my $match (@matches) { if (! defined $version || $vs->compare($match->{Version}, $version) > 0) { $source=$match->{Package}; $version=$match->{Version}; } } return ($version, $source); } # Install a source, or upgrade an installed source. # Returns the source or sources that were installed or upgraded. sub install { my $class=shift; my $source=shift; my $dir=shift || "."; my $ignoreloclimit=shift; if (! $writestatus) { $class->error("install called with read-only status file"); } my $version; ($version, $source)=$class->findsource($source); if (! defined $version) { $class->error("No such source"); } my $cwd=realpath($dir); my @alreadyinstalled=grep { $_->source eq $source && ($_->basedir eq $cwd || $_->location eq $cwd) } $class->installed(); if (@alreadyinstalled) { my @ret; foreach my $pkg (@alreadyinstalled) { my $newpkg = $pkg->upgrade; if (! $newpkg) { $class->warning($pkg->source." in ".$pkg->location." is already the latest version"); } else { push @ret, $newpkg; } } return @ret; } my $item=$class->new( status => 'removed', basedir => $cwd, source => $source, version => $version, sourcepkgversion => $version, ); # Go to the loclimit directory, to install a package there. if (defined $loclimit && ! $ignoreloclimit) { chdir($loclimit) || $class->error("Cannot chdir to $loclimit"); } else { chdir($dir) || $class->error("Cannot chdir to $dir"); } # source=version used to get exactly the version the user asked # for. if ($class->do(qw{apt-get source}, "$source=$version") != 0) { $class->error("Failed to download $source"); } if (! -d $item->location) { $class->error("Did not unpack to ".$item->location); } if ($_config->get_bool("APT::Src::BuildDeps", 1) && $class->do("dpkg-checkbuilddeps", $item->location."/debian/control") != 0) { # Build deps are not satisfied, so launch # apt. This is done in two steps because # for non-root we have to use su. if ($class->do_root(qw{apt-get -y build-dep}, $source) != 0) { $item->status('unpacked'); $class->error("Unable to satisfy build dependencies for $source"); } } $item->status("installed"); return $item; } # Upgrade an item. Returns the item that was upgraded, or nothing if no # upgrade. sub upgrade { my $this=shift; if (! $writestatus) { $this->error("upgrade called with read-only status file"); } my ($version, $source)=$this->findsource($this->source); if (! defined $version || $vs->compare($version, $this->version) != 1) { # Nothing to upgrade. return; } return unless $this->meets_loclimit; $this->info("Upgrading ".$this->location." .."); # To upgrade a source, the current tree is renamed prefixed with # "local-", the old source package is re-extracted, and a diff is taken # between the pristine source and the possibly modified local- # source. Then the new source is installed, and the patch is applied to # it, and the local- tree removed. If the old source package is not # avilable or the patch fails to apply, these are warnings, not # errors. my $oldloc=$this->location; my $oldsrc=$this->source; my $oldupstream=$this->upstreamversion; my $olddsc=$this->source."_".$this->sourcepkgversion.".dsc"; $this->source("local-".$this->source); $this->updatelocation; rename($oldloc, $this->location) || $this->error("failed renaming $oldloc"); # Set up error unwind to rename it back. push @unwind, sub { rename($this->location, $oldloc) || $this->error("failed renaming ".$this->location); $this->source($oldsrc); $this->updatelocation; }; my $diff; if ($_config->get_bool('APT::Src::Patch', 1)) { $this->clean; if (-e $this->basedir."/".$olddsc) { chdir($this->basedir) || $this->error("chdir ".$this->basedir.": $!"); if ($this->do("dpkg-source", "-x", $olddsc) != 0) { $this->warning("Unable to extract old source package; cannot generate diff"); } else { $diff=$this->basedir."/".$this->source."_".$this->version.".tmpdiff"; my $ret = $this->do("diff --new-file -ur ". $oldsrc."-".$oldupstream." ". $this->source."-".$this->upstreamversion. " > $diff"); if ($ret >> 8 == 2) { $this->warning("Trouble generating diff"); unlink($diff); $diff=undef; } } $this->do("rm","-rf",$oldloc); } else { $this->warning("Old source package dsc $olddsc is gone; cannot generate diff"); } } my $newthis=$this->install($source, $this->basedir, 1); $this->remove(1); pop @unwind; # no need to unwind now $this=$newthis; if (defined $diff) { chdir($this->location) || $this->error("chdir ".$this->location.": $!"); if ($this->do("patch -p1 < $diff") != 0) { $this->warning("Patch did not cleanly apply. Leaving it in $diff"); } else { unlink($diff); } } $this->info("Successfully upgraded ".$this->location); return $this; } # Remove a source. sub remove { my $this=shift; my $force=shift; if (! $writestatus) { $this->error("remove called with read-only status file"); } return unless $force || $this->meets_loclimit; if ($this->status =~ /^(installed|unpacked)$/) { if (!$_config->get_bool('APT::Src::NoDeleteSource')) { $this->info("Removing ".$this->source." from ".$this->location." .."); my @files=$this->basedir."/".$this->source."_".$this->version.".dsc"; if ($this->upstreamversion eq $this->version) { # native package push @files, $this->basedir."/".$this->source."_".$this->version.".tar.gz"; } else { # non-native push @files, $this->basedir."/".$this->source."_".$this->upstreamversion.".orig.tar.gz"; push @files, $this->basedir."/".$this->source."_".$this->version.".diff.gz"; } foreach my $file (@files) { if (-e $file && ! unlink $file) { $this->error("Unable to remove $file"); } } if ($this->do("rm", "-rf", $this->location) != 0) { $this->error("Unable to remove ".$this->location); } } } $this->status("removed"); return $this; } # Clean a source tree. sub clean { my $this=shift; return unless $this->meets_loclimit; $this->info("Cleaning in ".$this->location." .."); chdir $this->location || $this->error("Unable to chdir to ".$this->location); my @command = qw{debian/rules clean}; if ($> != 0) { unshift @command, "fakeroot"; } if ($this->do(@command) != 0) { $this->error("Cleaning failed"); } return $this; } # Build a source tree. sub build { my $this=shift; return unless $this->meets_loclimit; # Let the package know it's being built by apt-src. $ENV{APT_SRC_BUILD}=1; $this->info("Building in ".$this->location." .."); chdir $this->location || $this->error("Unable to chdir to ".$this->location); my @command; if (! $_config->exists('APT::Src::BuildCommand')) { @command = qw{dpkg-buildpackage -b -us -uc}; if ($> != 0) { push @command, "-rfakeroot"; } } else { @command=split(/\s+/, $_config->get('APT::Src::BuildCommand')); if ($> != 0) { push @command, "-rfakeroot"; } } if ($this->do(@command) != 0) { $this->error("Building failed"); } $this->info("Successfully built in ".$this->location); return $this; } # Installs all the packages generated by building a source tree. sub installdebs { my $this=shift; return unless $this->meets_loclimit; # Find and parse .changes file to figure out what debs were # generated and should be installed. my $changes=$this->basedir."/".$this->source."_".$this->version."_". $_config->get("APT::Architecture").".changes"; if (! -e $changes) { $this->error("Cannot find changes file $changes"); } open (my $c, $changes) || $this->error("Cannot read changes file $changes: $!"); while (<$c>) { last if /^Files:/; } my (@debs, @files); push @files, $changes; while (<$c>) { chomp; last if ! /^ /; if (/^ [0-9a-zA-Z]+ \d+ [^ ]+ [^ ]+ (.*)/) { my $file=$1; push @files, $this->basedir."/".$file; push @debs, $this->basedir."/".$file if $file=~/\.deb$/; } } close $c; if (! @debs) { $this->warning("No debs were generated, or error parsing changes file"); } else { $this->info("Installing debs built from ".$this->location." .."); my @command = ("dpkg", "-i", @debs); if ($this->do_root(@command) != 0) { $this->error("Error installing @debs"); } if (@files && ! $_config->get_bool('APT::Src::KeepBuilt')) { unlink(@files) || $this->warning("Failed to remove some of the built files (@files)");} $this->info("Successfully installed debs."); } } # Given a directory, tries to find a debian/changelog and parse a version # out of the first line of it; returns the version or undef. sub guessversion { my $class=shift; my $dir=shift; open(my $changelog, "$dir/debian/changelog") || return; my $line=<$changelog>; close $changelog; if ($line =~ /^[^\s]+\s+\(([^\)]+)\)\s+/) { return $1 } return; } # Returns three or less letters to indicate the status. sub shortstatus { my $this=shift; my ($letter) = $this->status =~ m/(.)/; return $letter; } # Helper method to set location from three other fields. Adds the item to # the %sources hash. sub updatelocation { my $this=shift; delete $sources{$this->{location}} if defined $this->{location}; $this->{location} = $this->{basedir}."/". $this->{source}."-". $this->upstreamversion; $sources{$this->{location}}=$this; } # Returns upstream version. sub upstreamversion { my $this=shift; return $vs->upstream($this->{version}); } # Error reporting & etc. sub error { my $class=shift; print STDERR "E: ".shift()."\n"; # Error unwind. foreach (reverse @unwind) { $_->(); } exit(1); } sub warning { my $class=shift; print STDERR "W: ".shift()."\n"; } sub info { my $class=shift; print "I: ".shift()."\n"; } # Runs a shell command, gaining root if necessary. sub do_root { my $class=shift; if ($> != 0) { my @command=qw(sudo); if ($_config->exists('APT::Src::RootCommand')) { @command=split(/\s+/, $_config->get('APT::Src::RootCommand')); } unshift @_, @command; } $class->do(@_); } # Runs a shell command, only displaying its output in verbose mode or if it # fails. Returns like system does. sub do { my $class=shift; if ($_config->get_bool('APT::Src::Trace')) { $class->info("running: @_"); } unless ($_config->get_bool('APT::Src::Quiet')) { return system @_; } my $pid=open(my $fh, "-|"); if ($pid) { # Parent, my @output=<$fh>; close $fh; if ($? != 0) { print STDERR @output; } return $?; } else { # Child. open(STDERR, ">&STDOUT"); close(STDOUT); exec(@_); } } # Field accesses. sub AUTOLOAD { my $this=shift; (my $field = our $AUTOLOAD) =~ s/.*://; if (@_) { $this->{$field}=shift; } return $this->{$field}; } 1 apt-src-0.25.1/debian/0000755000000000000000000000000012225606413011261 5ustar apt-src-0.25.1/debian/compat0000644000000000000000000000000207743127730012470 0ustar 4 apt-src-0.25.1/debian/copyright0000644000000000000000000000047507743127732013235 0ustar apt-src was written by Joey Hess . Copyright 2002 Joey Hess This is free software; see the GNU General Public Licence version 2 or later for copying conditions. There is NO warranty. On Debian systems, the complete text of the GPL is in the file /usr/share/common-licenses/GPL apt-src-0.25.1/debian/control0000644000000000000000000000154110070065724012665 0ustar Source: apt-src Section: admin Priority: optional Build-Depends: debhelper (>= 4), dpkg-dev (>= 1.9.0) Maintainer: Laszlo Boszormenyi (GCS) Standards-Version: 3.6.1.0 Package: apt-src Architecture: all Section: admin Depends: libapt-pkg-perl (>= 0.1.6), dpkg-dev, apt, ${misc:Depends}, ${perl:Depends} Recommends: sudo, fakeroot, build-essential Description: manage Debian source packages apt-src is a command line interface for downloading, installing, upgrading, and tracking Debian source packages. It makes source package management feel a lot like using apt to manage binary packages, and is being used as a testbed to work on adding source dependencies to Debian. . It can be run as a normal user, or as root. If you want a convenient way to track updates to packages while preserving your local modifications, this is a way to do that. apt-src-0.25.1/debian/rules0000755000000000000000000000135112225603110012330 0ustar #!/usr/bin/make -f build: build-stamp build-stamp: dh_testdir perl Makefile.PL INSTALLDIRS=vendor $(MAKE) pod2man man/apt-src.es.pod > man/apt-src.es.1 pod2man man/apt-src.fr.pod > man/apt-src.fr.1 touch build-stamp clean: dh_testdir dh_testroot rm -f build-stamp perl Makefile.PL -$(MAKE) realclean dh_clean man/apt-src.es.1 man/apt-src.fr.1 binary-arch: build binary-indep: build dh_testdir dh_testroot dh_clean -k $(MAKE) install DESTDIR=debian/apt-src dh_installdocs TODO dh_installexamples config dh_installman man/*.1 dh_installchangelogs dh_compress dh_fixperms dh_perl dh_installdeb dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary apt-src-0.25.1/debian/changelog0000644000000000000000000002211212225606407013134 0ustar apt-src (0.25.1-0.2) unstable; urgency=low * Non-maintainer upload. * Fix POD files to be compatible with perl 5.18. Closes: #723955. * debian/rules: - Use $(DESTDIR) instead of PREFIX MakeMaker hack. -- Bill Allombert Thu, 10 Oct 2013 21:40:30 +0200 apt-src (0.25.1-0.1) unstable; urgency=low * NMU * Include French generated manpage from #280078 * Spanish manpage translation update (Closes: #257728) -- Thomas Huriaux Sat, 27 Jan 2007 10:56:52 +0100 apt-src (0.25.1) unstable; urgency=low * Bugfix release: - Install latest version of package sources (thanks to Eric Wong , closes: #183223). - Add -rfakeroot to APT::Src::BuildCommand for non root users (thanks to Michael Banck , closes: #232657). - Add configuration item APT::Src::NoDeleteSource for not removing source files with source package (thanks to David B Harris , closes: #186171). * New maintainer (closes: #240396). -- Laszlo Boszormenyi (GCS) Sat, 22 May 2004 13:12:36 +0000 apt-src (0.25) unstable; urgency=low * Orphaned. -- Joey Hess Fri, 26 Mar 2004 21:34:47 -0500 apt-src (0.24) unstable; urgency=low * Move from build-depends-indep to build-depends, to meet current policy. -- Joey Hess Wed, 3 Sep 2003 12:15:41 -0400 apt-src (0.23) unstable; urgency=low * Added Spanish translation of man page. Closes: #206199 -- Joey Hess Thu, 21 Aug 2003 13:46:06 -0400 apt-src (0.22) unstable; urgency=low * Fix a stupid logic error that zeroed status files if flcoking them for write failed. Doh! Closes: #201590 -- Joey Hess Wed, 23 Jul 2003 20:25:49 -0400 apt-src (0.21) unstable; urgency=low * When looking at binary packages to find a source package tied to a given release, only consider binary packages with the same version as the source package. Closes: #169858 * Corrected version comparison. * Thanks to Andrew Pimlott for the analysis and patch. -- Joey Hess Mon, 3 Feb 2003 13:54:30 -0500 apt-src (0.20) unstable; urgency=low * Corrected man page, su -c can be used. * Added APT::Src::BuildDeps. * Deal with upgrading sources that are in the "unpacked" state. -- Joey Hess Fri, 6 Dec 2002 23:15:59 -0500 apt-src (0.19) unstable; urgency=low * Fix import/inject confusion. Closes: #158591 -- Joey Hess Sat, 31 Aug 2002 18:08:37 -0400 apt-src (0.18) unstable; urgency=low * Removed the kernel-specific changelog parsing hack, since I don't think it was really useful. * Fixed regexp based listing. * Shut up apt progress info that goes to stdout and messed up version, location, and name commands. -- Joey Hess Mon, 26 Aug 2002 12:25:35 -0400 apt-src (0.17) unstable; urgency=low * Truncate overlong fields in apt-src list. * Allow use of binary package names anywhere a package name can be specified, not only at install time. Closes: #157106 -- Joey Hess Sun, 18 Aug 2002 19:04:45 -0400 apt-src (0.16) unstable; urgency=low * Support --apend-to-version built kernel trees. -- Joey Hess Sun, 18 Aug 2002 13:55:32 -0400 apt-src (0.15) unstable; urgency=low * Can now use AptPkg::Source to properly get source version numbers. Thanks, bod. * With that, I can emulate apt's package=version notation to allow downloads of sources of specific versions. I can also emulate package/release, but only for binary package names. This is not yet complete; since on upgrade it will always bring you up to unstable -- there is no pinning and no holding of sources available yet. Closes: #154720 * Uploaded to the perl staging area since it needs a new version of libapt-pkg-perl. -- Joey Hess Tue, 6 Aug 2002 01:32:14 -0400 apt-src (0.14) unstable; urgency=low * Fixed parsing of apt-cache showsrc output in some circumstances. Closes: #155145 -- Joey Hess Sun, 4 Aug 2002 18:25:07 -0400 apt-src (0.13) unstable; urgency=low * Capitalize Debian. Closes: #154755 -- Joey Hess Sat, 3 Aug 2002 15:11:01 -0400 apt-src (0.12) unstable; urgency=low * Added an example config file with all the options in it. -- Joey Hess Mon, 29 Jul 2002 14:04:11 -0400 apt-src (0.11) unstable; urgency=low * Added a special debian kernel source hack. A debian kernel source package, used by make-kpkg will have a debian/changelog like so: kernel-source-2.4.18 (dragon.5) unstable; urgency=low If such a debian/changelog is found, pull the version number from the package name plus the bit in parens, and separate with a + sign, yielding 2.4.18+dragon.5 in this example. I hope this takes care of flavours and APPEND_TO_VERSION stuff for kernel modules packages using apt-src. -- Joey Hess Mon, 29 Jul 2002 13:22:58 -0400 apt-src (0.10) unstable; urgency=low * Gain root before running update. * Typo fixes, Closes: #154642 * Don't croak if the first apt-src command run is a read-only one. Closes: #154643 -- Joey Hess Sun, 28 Jul 2002 19:59:59 -0400 apt-src (0.9) unstable; urgency=low * Fixed 'apt-src install ' to work again, and make it work in either the basedir or the location of the source. * Do patching when upgrading with 'apt-src install ' too. * Keep track of the last installed version of a source, and use that when patching, no matter what the changelog claims the version is. This allows modification of a tree, changelog incrementing, and then upgrading with the patch brought forward. * Fixed forward patch generation and application to really work. * Added more status messages. * Fixed apt-src upgrade --build. -- Joey Hess Sun, 28 Jul 2002 16:50:14 -0400 apt-src (0.8) unstable; urgency=low * Fixed error on first run when ~/.apt-src did not exist. * Added a configurable APT::Src::RootCommand; default to sudo. * Use RootCommand when satisfying build deps. * Pass -y to apt-get build-dep. * Default it to verbose mode; for quiet mode use -q. * Added -t/--trace switch. * Fixed chdir problems. * Fixed upgrades, and made upgrading much more robust on unexpected failures. * Always scan debian/changelog and parse out version, instead of storing a fixed version. * Notice when a source tree goes away and forget about it. -- Joey Hess Sun, 28 Jul 2002 00:53:20 -0400 apt-src (0.7) unstable; urgency=low * Fixed stupid typo. -- Joey Hess Fri, 26 Jul 2002 02:27:42 -0400 apt-src (0.6) unstable; urgency=low * This is the first release into debian proper. -- Joey Hess Thu, 25 Jul 2002 00:59:48 -0400 apt-src (0.5) unstable; urgency=low * The import command will try to guess at the version based on debian/changelog, if no version is specified. * Centralized errors and warnings, and made them display identical to apt's errors and warnings. Not that I like that display much, but.. * Remove debs and changes after -i. Added a --keep-built option (and a config file option) to disable this. * Tight command argument count checking; lookup table dispatch. * Added a name command, which can look up a source name. This may seem useless, but apt-src name 'kernel-source.*' is potentially handy. * Lock status file when performing an operation that changes status; don't write it out after operations that cannot change status. * Make apt-src build error if the requested source package is not installed. * Added -v flag for verbose mode; made non-verbose by default. * Added a INT signal handler. * Fixed changes parsing. * Do real version comparison on upgrade. * Fixed upgrade cwd glitch. -- Joey Hess Thu, 20 Jun 2002 04:15:51 -0400 apt-src (0.4) unstable; urgency=low * Added import command, to allow use of existing source trees without necessarily downloading of, oh, the kernel-source source package. * Fixed nasty upgrade behavior if there is no known upstream source for a package. * Update status file atomically. No locking yet though; TODO'd. -- Joey Hess Wed, 19 Jun 2002 21:51:04 -0400 apt-src (0.3) unstable; urgency=low * Added version command. * Set APT_SRC_BUILD when building a package. Packages may conditionalize on this to know when apt-src is building them, and query it for info. * Allow commands to use regexps as part of package names. This allows for stuff like: apt-src version 'kernel-source.*' -- Joey Hess Wed, 19 Jun 2002 20:08:32 -0400 apt-src (0.2) unstable; urgency=low * Make changes file parser support non-free stuff. * Fixes for non-local deb installation. -- Joey Hess Tue, 18 Jun 2002 22:49:46 -0400 apt-src (0.1) unstable; urgency=low * First release. -- Joey Hess Tue, 18 Jun 2002 20:59:20 -0400 apt-src-0.25.1/man/0000755000000000000000000000000012225606413010612 5ustar apt-src-0.25.1/man/apt-src.es.pod0000644000000000000000000002410012225601322013264 0ustar # (c) 2003 Software in the Public Interest # Esta traducción ha sido realizada por Rubén Porras Campo # Está basada en la página de manual original: # versión 1.3 del CVS de # /cvs/debian-doc/manpages/english/apt-src/apt-src.1.pod =encoding ISO8859-1 =head1 NOMBRE apt-src - gestiona árboles de paquetes fuentes de Debian =head1 SINOPSIS B [S>] S> B [S>] S> paq1 [paq2 ...] B S> paq =head1 DESCRIPCIÓN apt-src es una interfaz de línea de órdenes para descargar, instalar, actualizar, y seguir los paquetes fuentes de Debian. Puede ejecutarse como usuario normal o como superusuario. A diferencia de los paquetes binarios, los paquetes fuentes no se instalan en un lugar canónico. En lugar de esto, se "instalan" desempaquetando el árbol de las fuentes en un directorio, el cual puede estar donde desee. Un paquete fuente puede instalarse varias veces en diferentes lugares. Este programa gestiona los paquetes fuentes instalados de este modo, y proporciona facilidades de búsqueda para encontrar donde fue instalado un determinado paquete. A menos que se proporcione la opción -h o --help se debe de proporcionar una de los siguientes órdenes. =over 4 =item update Actualiza la lista de paquetes disponibles. Idéntico que apt-get update, debe ejecutarse como superusuario en su configuración predeterminada. =item install Instala los paquetes fuentes nombrados en el directorio actual. Si un paquete ya está instalado en el directorio actual, intentará actualizarlo. Esta orden aceptará el nombre de paquetes binarios o paquetes fuentes. Igual que con apt-get install, puede usar como prefijo del nombre =versión o /distribución para especificar la versión que quiere instalar o de que distribución desea obtenerla. Se asegurará de que las dependencias de construcción del paquete se satisfacen. Si se proporciona la opción --location, el paquete fuente se instalará o actualizará en el lugar indicado en vez de en el directorio actual. Si se proporciona la opción --build, se compilará cada paquete instalado o actualizado. =item upgrade Actualiza todos los paquetes fuentes instalados, o, si se proporcionan las opciones --location o --here, sólo se actualizarán los paquetes fuentes del directorio especificado. Si se proporciona la opción --patch (por omisión), apt-src intentará generar un parche que contenga todos los cambios locales hechos al paquete fuente, y los aplicará al árbol actualizado. Esto permite que los cambios locales se preserven a través de las actualizaciones de los paquetes, pero es posible que no siempre funcione, en estos casos deberá combinar los cambios usted mismo. Si se proporciona la opción --build, se compilará cada paquete instalado o actualizado. =item remove Elimina los paquetes fuentes nombrados. Se pueden usar las opciones --location y --here para eliminar sólo los paquetes de un directorio determinado. =item build Construye las fuentes especificadas. Si el paquete fuente no está instalado, se instalará primero. =item clean Limpia el árbol de los paquetes fuentes listados. Se pueden usar las opciones --location y --here para limpiar sólo los paquetes de un determinado directorio. =item import Use esta opción para hacerle saber a apt-src acerca de un paquete fuente ya desempaquetado. Después del nombre bajo el que será importado debe especificar la localización del árbol con las fuentes (con --location), y puede especificar la versión (con --version). No espere que la orden build funcione en estas fuentes, a menos que tengan un directorio debian/. =item list Sin ningún otro parámetro, listará todos los paquetes fuentes instalados, su estado, y el directorio donde fueron instalados. Si se proporciona el nombre de un paquete, mostrará sólo los ejemplares instalados de ese paquete fuente. Si se usan las opciones --location o --here, limitarán la lista de paquetes a los instalados en el directorio especificado. =item location Sólo acepta un parámetro, el nombre del paquete fuente. Si el paquete está instalado, devolverá el directorio raíz del árbol de las fuentes del paquete. Esta orden puede usarse cuando necesite incluir ficheros de otro paquete fuente, o algo por el estilo. Por ejemplo: -I`apt-src location paquete` =item version Sólo acepta un parámetro, el nombre del paquete fuente. Si el paquete está instalado devuelve la versión del paquete. =item name Sólo acepta un parámetro, el nombre del paquete fuente (puede especificarse con expresiones regulares). Devuelve el nombre del paquete fuente que concuerde con el nombre, si es que hay alguno. =back =head1 OPCIONES Todas las opciones de la línea de órdenes pueden incluirse en el fichero de configuración. Las descripciones indican la opción que es necesario emplear. Para opciones booleanas puede modificar el comportamiento usando algo como -f-,--no-f, -f=no o alguna que otra variante. =over 4 =item B<-h>, B<--help> Muestra este texto de ayuda. =item B<-b>, B<--build>, B<--compile> Construye los paquetes fuentes después de instalarlos o actualizarlos. Opción de configuración: APT::Src::Compile. =item B<-i>, B<--installdebs> Instala los paquetes después de construirlos. Implica --build. Opción de configuración: APT::Src::InstallDebs Note que si un paquete fuente genera varios binarios, todos se instalarán. =item B<-p>, B<--patch> Trata de parchear los cambios locales en el nuevo árbol después de actualizar. Habilitado por omisión, use --no-p para deshabilitarlo. Opción de configuración: APT::Src::Patch. =item B<-l>, B<--location> Especifica un directorio, sólo opera en paquetes en ese directorio. Opción de configuración: APT::Src::Location. =item B<-c>, B<--cwd>, B<--here> Sólo operan sobre paquetes en el directorio actual. Opción de configuración: APT::Src::Here. =item B<--upstream-version> Sólo tiene utilidad con la orden version, hace que omita la versión de Debian de la salida de la versión del paquete. =item B<-k>, B<--keep-built> No borra los .debs y otros ficheros contruídos después de instalarlos con la opción --installdebs. Opción de configuración: APT::Src::KeepBuilt =item B<-n>, B<--no-delete-source> No borra los ficheros fuentes cuando se elimine el paquete fuente. Opción de configuración: APT::Src:NoDeleteSource =item B<--version> Especifica una versión del árbol de las fuentes. Se usa junto con la orden import. =item B<-q>, B<--quiet> Dirije todo salida de la orden a /dev/null a menos que la orden no se ejecute como era de esperar. Opción de configuración: APT::Src::Quiet =item B<-t>, B<--trace> Muestra todas las órdenes que ejecuta. Opción de configuración: APT::Src::Trace =back Además de las opciones anteriores, algunas opciones de configuración menos usadas sólo pueden especificarse en los ficheros de configuración, /etc/apt/apt.conf y ~/.apt-src/config. Éstas son: =over 4 =item APT::Src::BuildCommand La orden a usar para construir el árbol. Se ejecuta en el árbol a construir, por omisión es "dpkg-buildpackage -b -us -uc", con "-rfakeroot" añadido para los usuarios distintos del superusuario. =item APT::Src::RootCommand La orden a usar si un usuario necesita convertirse en superusuario. Se usa, por ejemplo, para satisfacer dependencias de construcción. "sudo" es una buena elección, es el comportamiento predeterminado. Si quiere usar "su", necesitará establecerlo a "su -c". =item APT::Src::BuildDeps Controla si apt-src se asegura de que las dependencias de construcción de un paquete se satisfacen al instalar o actualizar el paquete. Por omisión está habilitado, si lo deshabilita, es posible que los paquetes no se puedan construir debido a la falta de las dependencias de contrucción. =back =head1 NOTA SOBRE LOS NOMBRES Puede usar el nombre del paquete binario o del paquete fuente cuando desee instalar un nuevo paquete fuente. El resto del tiempo, cuando los paquetes ya estén instalados, tiene que usar el nombre del paquete fuente (es posible que esto cambie en un futuro). Sin embargo, puede usar expresiones regulares como parte de los nombres. =head1 ENTORNO Este programa establece APT_SRC_BUILD cuando contruye un paquete. =head1 EJEMPLOS Para instalar las fuentes de pine en /usr/src, construirlo, e instalar los debs resultantes: apt-src install --location=/usr/src -i pine Para seguir los cambios del paquete fuente pine, e instalar los debs cuando halla una nueva versión disponible: apt-src install -i pine Para instalar una copia local del paquete tal, al que va a aplicar un parche local: apt-src install tal cd tal-version patch <~/mi-parche-para-tal apt-src build --installdebs tal Para actualizar su copia local de tal, manteniendo su parche, constuirlo, e instalar los nuevos debs: apt-src install -i tal Para importar el árbol de fuentes en /usr/src/linux, que puede haber sido desempaquetado de un tar de ftp.kernel.org (o desde el paquete kernel-source) en apt-src, de forma que éste pase a saber de su existencia: apt-src import kernel --location=/usr/src/linux --version=2.4.18 En un debian/rules de un paquete de módulos del núcleo que necesite saber si está siendo construido por apt-src, y si es así establecer las variables KVERS, KSRC. y KDREV que normalmente establece make-kpkg: ifdef APT_SRC_BUILD KDREV=$(shell apt-src version kernel\(-source.\*\)\?) KSRC=$(shell apt-src location kernel\(-source.\*\)\?) KVERS=$(shell apt-src name kernel\(-source.\*\)\? | sed s/kernel-source-//) endif =head1 FICHEROS =over 4 =item /etc/apt/sources.list Contiene los lugares de dónde descarga los paquetes. =item ~/.apt-src/status El fichero de estado de apt-src, contiene los paquetes instalados. =item /etc/apt/apt.conf Fichero de configuración global de apt-src (y apt). =item ~/.apt-src/config Fichero de configuración de apt-src para cada usuario. =back =head1 VÉASE ADEMÁS L, L, L =head1 AUTOR Copyright 2002 Joey Hess Esto es software libre; lea la Licencia Pública General de GNU versión 2 o posterior para las condiciones de copia. NO hay ninguna garantía. =head1 TRADUCTOR Traducción de Rubén Porras Campo apt-src-0.25.1/man/apt-src.fr.pod0000644000000000000000000002732112225601445013302 0ustar ***************************************************** * GENERATED FILE, DO NOT EDIT * * THIS IS NO SOURCE FILE, BUT RESULT OF COMPILATION * ***************************************************** This file was generated by po4a(7). Do not store it (in cvs, for example), but store the po file used as source file by po4a-translate. In fact, consider this as a binary, and the po file as a regular .c file: If the po get lost, keeping this translation up-to-date will be harder. =encoding ISO8859-1 =head1 NOM apt-src - Gère les arborescences des paquets source debian. =head1 SYNOPSIS B [S>] S> B [S>] S> paquet1 [paquet2 ...] B S> paquet =head1 DESCRIPTION apt-src est une interface en ligne de commande pour le téléchargement, l'installation, la mise à niveau et le suivi des paquets source debian. Ce programme peut être exécuté aussi bien par un utilisateur normal que par le superutilisateur (root). À la différence des paquets binaires, les paquets source ne sont pas installés dans un emplacement standard (canonique). En effet, ils sont S<« installés »> en dépaquetant leur arborescence source dans le répertoire désiré. Un paquet source peut être installé plusieurs fois, à des emplacements différents. Ce programme gère les paquets source installés selon ce principe et fournit des outils de recherche pour vous aider à trouver où un paquet source est installé. Une des commandes ci-dessous doit être indiquée, sauf lors de l'utilisation des options -h ou -help. =over 4 =item update Met à jour les listes des paquets disponibles. Rigoureusement identique à S<« apt-get update »>. Ne peut être exécutée, dans la configuration par défaut, que par le superutilisateur. =item install Installe, dans le répertoire courant, le ou les paquets source indiqués. Si le paquet est déjà installé dans le répertoire courant, une mise à niveau est tentée. Cette commande accepte aussi bien les noms de paquets binaires que ceux des paquets source. Comme avec S<« apt-get install »>, vous pouvez préfixer le nom avec =version ou /distribution (release) pour spécifier la version du paquet ou la distribution choisie. Cette commande s'assurera que les dépendances du paquet source sont satisfaites. Avec l'option --location, le paquet source sera installé ou mis à niveau à l'emplacement indiqué au lieu du répertoire courant. Avec l'option --build tous les paquets nouvellement installés ou mis à jour seront compilés. =item upgrade Met à jour tous les paquets source installés, sauf avec les options --location ou --here (ici), où seuls les paquets source situés dans le répertoire indiqué seront mis à jour. Avec l'option --patch (valeur par défaut), apt-src tentera de fabriquer une rustine (patch) contenant tous les changements locaux apportés au paquet source puis appliquera cette rustine à l'arborescence après sa mise à jour. Ceci permet à vos changements locaux d'être préservés lors d'une mise à niveau du paquet. Il peut arriver que cette méthode ne fonctionne pas, vous devrez alors fusionner vos propres modifications à la main. Avec l'option --build tous les paquets nouvellement installés ou mis à jour seront compilés. =item remove Supprime le ou les paquets source spécifiés. Les options --location ou --here (ici) peuvent être employées pour limiter la suppression des paquets au répertoire indiqué. =item build Construit la ou les sources spécifiées. Si la source n'est pas encore installée, elle le sera préalablement. =item clean Nettoie les arborescences du ou des paquets source spécifiés. Les options --location ou --here (ici) peuvent être employées pour ne nettoyer que les paquets du répertoire indiqué. =item import Permet d'informer apt-src de l'existence d'une arborescence source préalablement dépaquetée. En plus du nom sous lequel elle doit être importée, vous devez indiquer l'emplacement de cette arborescence source (avec --location). Vous pouvez avoir besoin de spécifier la version de la source (avec --version). N'espérez pas que la commande build fonctionne avec cette source, à moins qu'elle ne possède un répertoire debian/ =item list Sans autre paramètre, cette commande énumère tous les paquets source installés et indique leur état ainsi que le répertoire où ils sont installés. Si le nom d'un paquet est spécifié, la commande affichera seulement les occurrences installées de ce paquet source. Si les options --location ou --here sont employées, elles limiteront la liste aux paquets du répertoire indiqué. =item location N'accepte qu'un seul S Le nom du paquet source. Si le paquet est installé, la commande renvoie le chemin de la racine de l'arborescence du paquet source. Cette commande peut être employée quand vous devez inclure des fichiers provenant d'un autre paquet source, ou quelque chose comme ça. Par S I =item version N'accepte qu'un seul S le nom du paquet source. Si le paquet est installé, sa version est retournée. =item name N'accepte qu'un seul S le nom d'un paquet source (une expression rationnelle peut être utilisée). Renvoie le nom du paquet source installé, correspondant au paramètre spécifié. S<(NdT : Utile> en cas d'utilisation d'expression rationnelle.) =back =head1 OPTIONS Toutes les options en ligne de commande peuvent être réglées par l'intermédiaire du fichier de configuration. Les descriptions indiquent l'option de configuration à régler. Pour les options booléennes vous pouvez surcharger les valeurs par défaut du fichier en employant quelque chose comme -f-, --no-f, -f=no ou d'autres variantes. =over 4 =item B<-h>, B<--help> Affiche ce fichier d'aide. =item B<-b>, B<--build>, B<--compile> Construit les paquets source après les avoir installés ou mis à jour. Paramètre de S APT::Src::Compile =item B<-i>, B<--installdebs> Installe les paquets après avoir construit les sources. Implique l'usage de --build. Paramètre de S APT::Src::InstallDebs Notez que si des paquets multiples sont produits à partir d'un paquet source unique, ils seront tous installés. =item B<-p>, B<--patch> Tente de réimplanter les changements locaux dans la nouvelle arborescence après la mise à jour. Cette option est prise par défaut. Employer --no-p pour ignorer cette action. Paramètre de S APT::Src::Patch =item B<-l>, B<--location> Spécifie un répertoire. Limite l'action aux paquets du répertoire spécifié. Paramètre de S APT::Src::Location =item B<-c>, B<--cwd>, B<--here> Limite l'action aux paquets du répertoire courant. Paramètre de S APT::Src::Here =item B<--upstream-version> Utilisable seulement avec la commande version. Permet de ne pas afficher le numéro de version debian de la version du paquet. =item B<-k>, B<--keep-built> Conserve les .debs et les autres fichiers construits, après leur installation, lors de l'usage de l'option --installdebs. Paramètre de S APT::Src::KeepBuilt =item B<-n>, B<--no-delete-source> Conserve les fichiers source lors de la desinstallation d'un paquet source. Paramètre de S APT::Src:NoDeleteSource =item B<--version> Spécifie une version de l'arborescence de la source. À utiliser avec la commande d'importation. =item B<-q>, B<--quiet> Redirige toutes les sorties vers /dev/null à moins qu'une commande ne fonctionne pas comme prévu. Paramètre de S APT::Src::Quiet =item B<-t>, B<--trace> Affiche chaque commande telle qu'elle est lancée. Paramètre de S APT::Src::Trace =back En plus des options ci-dessus, il existe quelques éléments de configuration moins utilisés. Ils ne peuvent être indiqués que dans les fichiers de configuration /etc/apt/apt.conf et ~/.apt-src/config Il s'agit S =over 4 =item APT::Src::BuildCommand Indique la commande à employer pour construire le paquet. Cette commande sera exécutée à partir de l'arborescence des sources. Par défaut S<« dpkg-buildpackage - b -us -uc »,> avec S<« -rfakeroot »> ajouté pour les utilisateurs autres que le superutilisateur. =item APT::Src::RootCommand Indique la commande à employer si un utilisateur autre que le superutilisateur doit devenir superutilisateur. Elle est employée pour, par exemple, satisfaire build-deps. sudo, la valeur par défaut, est un choix judicieux. Si vous voulez employer su, vous devez le faire sous la forme S<« su -c ».> =item APT::Src::BuildDeps Demande à apt-src d'installer les dépendances nécessaires au paquet source lors de son installation ou de sa mise à jour. Actif par défaut. Si vous désactivez cette option, certains paquets peuvent ne pas être construits en raison de dépendances manquantes. =back =head1 NOTE SUR LES NOMS Vous pouvez employer le nom du paquet binaire ou le nom du paquet source pour installer un nouveau paquet source. Par contre, pour travailler avec des paquets déjà installés, vous devez, actuellement, employer les noms des paquets source. (Cela pourrait changer plus tard). Toutefois, vous pouvez employer des expressions rationnelles pour spécifier les noms. =head1 ENVIRONNEMENT Ce programme définit APT_SRC_BUILD lorsqu'il construit un paquet. =head1 EXEMPLES Pour installer le paquet source S<« toto »> dans /usr/src, construire le paquet et installer les .debs S apt-src install --location=/usr/src -i toto Pour suivre les changements du paquet source S<« toto »> déjà implanté et installer les .debs à chaque fois qu'une nouvelle version est S apt-src install -i toto Pour installer une copie locale du paquet foo, et appliquer une rustine (patch) S apt-src install foo cd foo-version patch <~/my-foo-patch apt-src build --installdebs foo Pour mettre à niveau votre copie locale de foo, conserver votre rustine (patch), puis construire et installer les nouveaux S<.debs :> apt-src install -i foo Pour importer, dans apt-src, l'arborescence source que vous avez dépaquetée, par un tarball, dans /usr/src/linux, depuis ftp.kernel.org (ou depuis un paquet du kernel-source). Cette commande à pour but de renseigner apt-src au sujet du S apt-src import kernel --location=/usr/src/linux --version=2.4.18 Voici un exemple utilisé pour le paquet d'un module noyau dont le script debian/rules cherche à déterminer s'il est construit par apt-src, pour, dans ce cas, définir les variables KVERS, KSRC, et KDREV qui sont normalement fixées par S ifdef APT_SRC_BUILD KDREV=$(shell apt-src version kernel\(-source.\*\)\?) KSRC=$(shell apt-src location kernel\(-source.\*\)\?) KVERS=$(shell apt-src name kernel\(-source.\*\)\? | sed s/kernel-source-//) endif =head1 FICHIERS =over 4 =item /etc/apt/sources.list Emplacement des archives du système de distribution de paquets. =item ~/.apt-src/status Fichier d'état d'apt-src, qui liste les paquets installés. =item /etc/apt/apt.conf Fichier global de configuration pour apt-src (et apt). =item ~/.apt-src/config Fichier de configuration propre à l'utilisateur pour apt-src. =back =head1 VOIR AUSSI L, L, L =head1 AUTEUR Copyright 2002 Joey Hess Ceci est logiciel libre. Consultez la version 2 et suivantes de la Licence Publique Générale (GPL) de GNU pour les conditions de duplication. Ce logiciel est fourni sans AUCUNE garantie. =head1 TRADUCTION Valéry Perrin le 18 octobre 2004. L'équipe de traduction a fait le maximum pour réaliser une adaptation française de qualité. La version anglaise la plus à jour de ce document est toujours consultable via la commande S<« man -L en apt-src »>. N'hésitez pas à signaler à l'auteur ou au traducteur, selon le cas, toute erreur dans de cette page de manuel. =cut apt-src-0.25.1/Makefile.PL0000755000000000000000000000015707743127740012031 0ustar #!/usr/bin/perl use ExtUtils::MakeMaker; WriteMakefile( 'NAME' => 'apt-src', 'EXE_FILES' => ['apt-src'], ); apt-src-0.25.1/apt-src0000755000000000000000000003756010053652552011353 0ustar #!/usr/bin/perl use warnings; use strict; use lib $ENV{HOME}; use AptSrc; use AptPkg::Config '$_config'; =head1 NAME apt-src - manage debian source package trees =head1 SYNOPSIS B [S>] S> B [S>] S> pkg1 [pkg2 ...] B S> pkg =head1 DESCRIPTION apt-src is a command line interface for downloading, installing, upgrading, and tracking debian source packages. It can be run as a normal user, or as root. Unlike binary packages, source packages are not installed into a canonical location. Instead, they are "installed" by unpacking their source tree into a directory, which can be anywhere you wish. A source package can be installed multiple times, in different locations. This program manages source packages installed in this way, and provides querying facilities to help find where a source package is installed. Unless the -h or --help option is given one of the commands below must be present. =over 4 =item update Update the lists of available packages. Identical to apt-get update, really, and must be run as root in the default configuration. =item install Install the named source package or packages into the current directory. If a package in the current directory is already installed, it will attempt to upgrade it. This command will accept the names of binary packages, or source packages. Just like with apt-get install, you can prefix the name with =version or /release to specify what version to install or what release to take the source from. It will make sure that the build-dependencies of the source package are satisfied. If the --location option is given, the source package will be installed or upgraded into the given location instead of the current directory. If the --build option is given, each newly installed or upgraded package will be compiled. =item upgrade Upgrade all installed source packages, or, if the --location or --here options are used, update only source packages in the specified directory. If the --patch option is given (the default), apt-src will attempt to generate a patch containing any local changes made to the source package, and will apply this patch to the updated tree. This will allow your local changes to be preserved across package upgrades, but it may not always work, and you might sometimes have to merge in your changes by hand. If the --build option is given, each newly installed or upgraded package will be compiled. =item remove Remove the named source package or packages. The --location and --here options may be used to only remove packages in a particular directory. =item build Build the specified source or sources. If the source is not installed yet, it will first be installed. =item clean Clean the trees of the named source package or packages. The --location and --here options may be used to only clean packages in a particular directory. =item import Use this option to let apt-src know about an existing, unpacked source tree. Besides the name under which it should be imported, you must specify the location of the source tree (with --location), and you may need to tell the version of the source (with --version). Don't expect the build command to work on this source, unless it has a debian/ directory. =item list With no other parameters, it will list all installed source packages; their status, and the directory they are installed in. If a package's name is given, it will display only installed instances of that source package. If the --location or --here options are used, they will limit the list to packages in the specified directory. =item location Takes a single parameter; the name of a source package. If the package is installed, it will return the root of the package's source tree. This command can be used when you need to include files from another source package, or something like that. For example: -I`apt-src location pkg` =item version Takes a single parameter; the name of a source package. If the package is installed, it will return the version of the package that is installed. =item name Takes a single parameter; the name of a source package (may be specified with regexps). Returns the name of the source package installed matching that name, if any. =back =head1 OPTIONS All command line options may be set using the configuration file, the descriptions indicate the configuration option to set. For boolean options you can override the defaults file by using something like -f-,--no-f, -f=no or several other variations. =over 4 =item B<-h>, B<--help> Show this help text. =item B<-b>, B<--build>, B<--compile> Build source packages after installing or upgrading them. Configuration Item: APT::Src::Compile. =item B<-i>, B<--installdebs> Install packages after building sources. Implies --build. Configuration Item: APT::Src::InstallDebs Note that if multiple packages are generated from a single source package, they will all be installed. =item B<-p>, B<--patch> Try to patch local changes into new source tree when upgrading. On by default, use --no-p to disable. Configuration Item: APT::Src::Patch. =item B<-l>, B<--location> Specify a directory; only operate on packages in that directory. Configuration Item: APT::Src::Location. =item B<-c>, B<--cwd>, B<--here> Only operate on packages in the current directory. Configuration Item: APT::Src::Here. =item B<--upstream-version> Only of use with the version command; makes it omit the debian version number from the version of the package output. =item B<-k>, B<--keep-built> Do not delete .debs and other built files after installing them with the --installdebs option. Configuration Item: APT::Src::KeepBuilt =item B<-n>, B<--no-delete-source> Do not delete source files when removing source package. Configuration Item: APT::Src:NoDeleteSource =item B<--version> Specify a source tree version. Of use with the import command. =item B<-q>, B<--quiet> Direct all command output to /dev/null unless a command fails to run as expected. Configuration item: APT::Src::Quiet =item B<-t>, B<--trace> Output each command as it is run. Configuration item: APT::Src::Trace =back In addition to the above options, some less-used configuration items may only be specified in the config files, /etc/apt/apt.conf and ~/.apt-src/config. They are: =over 4 =item APT::Src::BuildCommand The command to use to build a tree. Run in the tree to build, it defaults to "dpkg-buildpackage -b -us -uc", with "-rfakeroot" appended for non-root users. =item APT::Src::RootCommand The command to use if a non-root user needs to become root. This is used for, example, to satisfy build-deps. sudo is a good choice and the default. If you want to use su, you'll need to set it to "su -c". =item APT::Src::BuildDeps Controls whether apt-src makes sure a source package's build dependencies are installed when installing or upgrading it. Defaults to true, if you turn it off, packages may fail to build due to missing build dependencies. =back =cut $SIG{INT}=sub { AptSrc->error("Exiting on interrupt"); exit(1); }; sub help { print <init; $_config->read_file(AptSrc->statusdir."/config") if -e AptSrc->statusdir."/config"; @ARGV = $_config->parse_cmdline([ ['h', 'help', 'help'], ['b', 'build', 'APT::Src::Compile'], ['', 'compile', 'APT::Src::Compile'], ['i', 'installdebs', 'APT::Src::InstallDebs'], ['p', 'patch', 'APT::Src::Patch'], ['l', 'location', 'APT::Src::Location', 'has_arg'], ['c', 'cwd', 'APT::Src::Here'], ['', 'here', 'APT::Src::Here'], ['', 'upstream-version', 'APT::Src::UpstreamVersion'], ['', 'version', 'APT::Src::Version', 'has_arg'], ['k', 'keep-built', 'APT::Src::KeepBuilt'], ['q', 'quiet', 'APT::Src::Quiet'], ['t', 'trace', 'APT::Src::Trace'], ['n', 'no-delete-source', 'APT::Src::NoDeleteSource'], ], @ARGV); AptSrc->config($_config); if ($_config->get_bool('help')) { help(); } my $location; if ($_config->get_bool('APT::Src::Here')) { AptSrc->loclimit('.'); } elsif ($_config->exists('APT::Src::Location')) { AptSrc->loclimit($_config->get('APT::Src::Location')); } my @tobuild; # This hash holds commands and the number of additional arguments each # expects (or undef for any number). A negative number means at least the # absolute value of that number arguments; and maybe more. Following the # number of arguments is the function to call for the command, and then # either 0 if this command is just a querier, and 1 if it can modify the # status file. my %commands = ( install => [ -1, \&install, 1 ], import => [ 1, \&import, 1 ], upgrade => [ 0, \&upgrade, 1 ], update => [ 0, \&update, 0 ], remove => [ -1, \&remove, 1 ], clean => [ -1, \&clean, 0 ], build => [ -1, \&build, 0 ], list => [ undef,\&list, 0 ], location => [ 1, \&location, 0 ], version => [ 1, \&version, 0 ], name => [ 1, \&name, 0 ], help => [ 1, \&help, 0 ], ); my $command=shift || help(); # Check args. AptSrc->error("Invalid operation $command") unless exists $commands{$command}; my $numargs=$commands{$command}->[0]; if (defined $numargs) { if ($numargs < 0) { $numargs *= -1; unless (@ARGV >= $numargs) { AptSrc->error("The $command command requires at least ". $numargs." argument". ($numargs == 1 ? '' : 's')); } } else { unless (@ARGV == $numargs) { AptSrc->error("The $command command requires exactly ". $numargs." argument". ($numargs == 1 ? "" : 's')); } } } # Status file reading and locking. if ($commands{$command}->[2]) { AptSrc->readstatus(1); } else { AptSrc->readstatus(0); } # Command dispatch. $commands{$command}->[1]->(@ARGV); # Build items that were upgraded or installed. if (@tobuild && ($_config->get_bool('APT::Src::Compile') || $_config->get_bool('APT::Src::InstallDebs'))) { $_->build foreach @tobuild; if ($_config->get_bool('APT::Src::InstallDebs')) { $_->installdebs foreach @tobuild; } } # The commands make up the rest of this program. Each is its own # subroutine. sub install { my @pkgs=@_; push @tobuild, AptSrc->install($_) foreach @pkgs; } sub upgrade { push @tobuild, $_->upgrade foreach AptSrc->installed(), AptSrc->unpacked; } sub update { if (AptSrc->do_root("apt-get", "update") != 0) { AptSrc->error("Update failed"); } } sub remove { my @pkgs=@_; $_->remove foreach AptSrc->match(@pkgs); } sub clean { my @pkgs=@_; $_->clean foreach AptSrc->match(@pkgs); } sub build { my @pkgs=@_; # Really does nothing, just enables building, and queues it. $_config->set("APT::Src::Compile", "true"); my @matches = AptSrc->match(@pkgs) || AptSrc->error("Not installed"); push @tobuild, AptSrc->match(@pkgs); } sub list { my @sources; if (! @_) { @sources=AptSrc->all(); if (! @sources) { print "Nothing is installed\n"; exit; } } else { @sources=AptSrc->match(@_); if (! @sources) { AptSrc->error("No matches"); } } foreach my $source (@sources) { printf("%-3s %-14s %-14s %-45s\n", $source->shortstatus, substr($source->source, 0, 14), substr($source->version, 0, 14), $source->location); } } sub location { my $name=shift; my @sources=grep { $_->status eq 'installed' } AptSrc->match($name); if (! @sources) { AptSrc->error("Source $name is not installed"); } else { print $sources[0]->location."\n"; } } sub version { my $name=shift; my @sources=grep { $_->status eq 'installed' } AptSrc->match($name); if (! @sources) { AptSrc->error("Source $name is not installed"); } elsif ($_config->get_bool('APT::Src::UpstreamVersion')) { print $sources[0]->upstreamversion."\n"; } else { print $sources[0]->version."\n"; } } sub name { my $name=shift; my @sources=grep { $_->status eq 'installed' } AptSrc->match($name); if (! @sources) { AptSrc->error("Source $name is not installed"); } print $sources[0]->source."\n"; } sub import { my $name=shift; my $location=AptSrc->loclimit; if (! defined $location || ! length $location) { AptSrc->error("The import command requires the --location (or --here) option"); } if (! -d $location) { AptSrc->error("Specified location, $location, is not a directory"); } my $version=$_config->get('APT::Src::Version'); if (! defined $version || ! length $version) { $version=AptSrc->guessversion($location); if (! defined $version || ! length $version) { AptSrc->error("The version of the tree at $location cannot be guessed; you must use --version to tell what it is"); } } my ($basedir) = $location =~ m!(.*)\/[^\/]+!; push @tobuild, AptSrc->new( source => $name, version => $version, location => $location, basedir => $basedir, status => 'installed', # Note I could introduce a held flag here, and mark it # held.. ); } =head1 NOTE ON NAMES You can use either binary package names, or source package names when installing a new source package. The rest of the time, when dealing with already installed packages, you currently have to use the source package names (this may later changes). However, you may use regexps as part of the names. =head1 ENVIRONMENT This program sets APT_SRC_BUILD when it is building a package. =head1 EXAMPLES To install the source to pine to /usr/src, build it, and install the resulting debs: apt-src install --location=/usr/src -i pine To track changes to said installed pine source package, and install debs whenever a new version comes out: apt-src install -i pine To install a local copy of package foo, which you are going to apply a local patch to: apt-src install foo cd foo-version patch <~/my-foo-patch apt-src build --installdebs foo To upgrade your local copy of foo, bringing your patch forward, and building and installing new debs: apt-src install -i foo To import the source tree in /usr/src/linux, which you unpacked from a ftp.kernel.org tarball (or from the kernel-source package) into apt-src, so it knows about it: apt-src import kernel --location=/usr/src/linux --version=2.4.18 In a debian/rules of a kernel module package that needs to figure out if it is being built by apt-src, and if so set the KVERS, KSRC. and KDREV variables that make-kpkg normally sets: ifdef APT_SRC_BUILD KDREV=$(shell apt-src version kernel\(-source.\*\)\?) KSRC=$(shell apt-src location kernel\(-source.\*\)\?) KVERS=$(shell apt-src name kernel\(-source.\*\)\? | sed s/kernel-source-//) endif =head1 FILES =over 4 =item /etc/apt/sources.list Locations to fetch packages from. =item ~/.apt-src/status apt-src's status file, lists installed packages. =item /etc/apt/apt.conf Global config file for apt-src (and apt). =item ~/.apt-src/config Per-user config file for apt-src. =back =head1 SEE ALSO L, L, L =head1 AUTHOR Copyright 2002 Joey Hess This is free software; see the GNU General Public Licence version 2 or later for copying conditions. There is NO warranty. =cut apt-src-0.25.1/config0000644000000000000000000000241210053652552011230 0ustar /* This file is a sample configuration file for apt-src that contains most apt-src options. These examples can be copied out to /etc/apt/apt.conf (shared with apt), or ~/.apt-src/config */ /* Auto-build source packages after installing or upgrading them. */ //APT::Src::Compile "true"; /* Auto-install binary packages after building. */ //APT::Src::Install "true"; /* Try to patch local changes into new source tree when upgrading. (Defaults to on.) */ APT::Src::Patch "true"; /* Specify a directory; only operate on packages in that directory. */ //APT::Src::Location "/usr/src/"; /* Do not delete .debs and other built files after autoinstalling them */ //APT::Src::KeepBuilt "true"; /* Do not delete the source files when removing the package */ //APT::Src::NoDeleteSource "false"; /* Direct build logs to /dev/null unless there is an error. */ //APT::Src::Quiet "true"; /* Output each command as it is run. */ //APT::Src::Trace "true"; /* A command to use to build a tree. -rfakeroot is appended for non-root * users. */ //APT::Src::BuildCommand "dpkg-buildpackage -b -us -uc"; /* The command to use in a non-root user needs to become root for some operation. Note that su will not work due to the way parameters are passed. */ //APT::Src::RootCommand "sudo";