summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-get.cc20
-rwxr-xr-xcmdline/apt-mark26
2 files changed, 33 insertions, 13 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 4596c3d61..7875ae20f 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -1109,7 +1109,17 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
Pkg.FullName(true).c_str());
return true;
}
-
+
+ // Ignore request for install if package would be new
+ if (_config->FindB("APT::Get::Only-Upgrade", false) == true &&
+ Pkg->CurrentVer == 0)
+ {
+ if (AllowFail == true)
+ ioprintf(c1out,_("Skipping %s, it is not installed and only upgrades are requested.\n"),
+ Pkg.Name());
+ return true;
+ }
+
// Check if there is something at all to install
pkgDepCache::StateCache &State = Cache[Pkg];
if (Remove == true && Pkg->CurrentVer == 0)
@@ -1790,6 +1800,7 @@ bool DoInstall(CommandLine &CmdL)
Cache[Pkg].Install() == false &&
(Cache[Pkg].Flags & pkgCache::Flag::Auto) &&
_config->FindB("APT::Get::ReInstall",false) == false &&
+ _config->FindB("APT::Get::Only-Upgrade",false) == false &&
_config->FindB("APT::Get::Download-Only",false) == false)
{
ioprintf(c1out,_("%s set to manually installed.\n"),
@@ -2299,6 +2310,7 @@ bool DoSource(CommandLine &CmdL)
{
for (unsigned I = 0; I != J; I++)
ioprintf(cout,_("Fetch source %s\n"),Dsc[I].Package.c_str());
+ delete[] Dsc;
return true;
}
@@ -2309,6 +2321,7 @@ bool DoSource(CommandLine &CmdL)
for (; I != Fetcher.UriEnd(); I++)
cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' <<
I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl;
+ delete[] Dsc;
return true;
}
@@ -2334,6 +2347,7 @@ bool DoSource(CommandLine &CmdL)
if (_config->FindB("APT::Get::Download-only",false) == true)
{
c1out << _("Download complete and in download only mode") << endl;
+ delete[] Dsc;
return true;
}
@@ -2395,7 +2409,8 @@ bool DoSource(CommandLine &CmdL)
_exit(0);
}
-
+ delete[] Dsc;
+
// Wait for the subprocess
int Status = 0;
while (waitpid(Process,&Status,0) != Process)
@@ -2831,6 +2846,7 @@ int main(int argc,const char *argv[]) /*{{{*/
{0,"fix-missing","APT::Get::Fix-Missing",0},
{0,"ignore-hold","APT::Ignore-Hold",0},
{0,"upgrade","APT::Get::upgrade",0},
+ {0,"only-upgrade","APT::Get::Only-Upgrade",0},
{0,"force-yes","APT::Get::force-yes",0},
{0,"print-uris","APT::Get::Print-URIs",0},
{0,"diff-only","APT::Get::Diff-Only",0},
diff --git a/cmdline/apt-mark b/cmdline/apt-mark
index 2326ece38..18552177c 100755
--- a/cmdline/apt-mark
+++ b/cmdline/apt-mark
@@ -19,10 +19,10 @@ def show_automatic(filename):
if not os.path.exists(STATE_FILE):
return
auto = set()
- tagfile = apt_pkg.ParseTagFile(open(STATE_FILE))
- while tagfile.Step():
- pkgname = tagfile.Section.get("Package")
- autoInst = tagfile.Section.get("Auto-Installed")
+ tagfile = apt_pkg.TagFile(open(STATE_FILE))
+ for section in tagfile:
+ pkgname = section.get("Package")
+ autoInst = section.get("Auto-Installed")
if int(autoInst):
auto.add(pkgname)
print "\n".join(sorted(auto))
@@ -33,24 +33,24 @@ def mark_unmark_automatic(filename, action, pkgs):
# open the statefile
if os.path.exists(STATE_FILE):
try:
- tagfile = apt_pkg.ParseTagFile(open(STATE_FILE))
+ tagfile = apt_pkg.TagFile(open(STATE_FILE))
outfile = open(STATE_FILE+".tmp","w")
except IOError, msg:
print "%s, are you root?" % (msg)
sys.exit(1)
- while tagfile.Step():
- pkgname = tagfile.Section.get("Package")
- autoInst = tagfile.Section.get("Auto-Installed")
+ for section in tagfile:
+ pkgname = section.get("Package")
+ autoInst = section.get("Auto-Installed")
if pkgname in pkgs:
if options.verbose:
print "changing %s to %s" % (pkgname,action)
- newsec = apt_pkg.RewriteSection(tagfile.Section,
+ newsec = apt_pkg.rewrite_section(section,
[],
[ ("Auto-Installed",str(action)) ])
pkgs.remove(pkgname)
outfile.write(newsec+"\n")
else:
- outfile.write(str(tagfile.Section)+"\n")
+ outfile.write(str(section)+"\n")
if action == 1:
for pkgname in pkgs:
if options.verbose:
@@ -76,9 +76,13 @@ if __name__ == "__main__":
help="print verbose status messages to stdout")
(options, args) = parser.parse_args()
+ if not args:
+ parser.print_help()
+ sys.exit(1)
+
# get the state-file
if not options.filename:
- STATE_FILE = apt_pkg.Config.FindDir("Dir::State") + "extended_states"
+ STATE_FILE = apt_pkg.config.find_dir("Dir::State") + "extended_states"
else:
STATE_FILE=options.filename