@@ -1514,7 +1514,7 @@ def setter(args):
1514
1514
Bool_SetUpgrade = True
1515
1515
1516
1516
class AptManip :
1517
- def __init__ (self , OutputFile , Simulate = False , AptType = "python- apt" ):
1517
+ def __init__ (self , OutputFile , Simulate = False , AptType = "apt" ):
1518
1518
1519
1519
self .WriteTo = OutputFile
1520
1520
self .Simulate = Simulate
@@ -1664,8 +1664,6 @@ def __PythonAptUpdate(self):
1664
1664
writeFH .close ()
1665
1665
1666
1666
def __PythonAptUpgrade (self , UpgradeType = "upgrade" , ReleaseType = None ):
1667
- # THis doesn't work as expected. In fact, the code fails.
1668
-
1669
1667
1670
1668
log .verbose ("Open file %s for write" % self .WriteTo )
1671
1669
try :
@@ -1836,38 +1834,7 @@ def __AptInstallSrcPackages(self, SrcPackageList=None, ReleaseType=None, BuildDe
1836
1834
sys .exit (1 )
1837
1835
#TODO: Use a more Pythonic way for it
1838
1836
if Str_SetUpgradeType == "upgrade" :
1839
- if PythonApt is True :
1840
- #FIXME: Adapt the new python-apt. Ideas from debdelta
1841
- log .verbose ("Using the python-apt library to generate the database.\n " )
1842
- PythonAptQuery = AptPython ()
1843
- try :
1844
- install_file = open ( Str_SetArg , 'a' )
1845
- except IOError :
1846
- log .err ( "Cannot create file %s.\n " % (Str_SetArg ) )
1847
- sys .exit ( 1 )
1848
- upgradable = filter ( lambda p : p .isUpgradable , PythonAptQuery .cache )
1849
- log .msg ( "\n Generating database of files that are needed for an upgrade.\n " )
1850
-
1851
- dup_records = []
1852
- for pkg in upgradable :
1853
- pkg ._lookupRecord ( True )
1854
- dpkg_params = apt_pkg .ParseSection (pkg ._records .Record )
1855
- arch = dpkg_params ['Architecture' ]
1856
- path = dpkg_params ['Filename' ]
1857
- checksum = dpkg_params ['SHA256' ] #FIXME: There can be multiple checksum types
1858
- size = dpkg_params ['Size' ]
1859
- cand = pkg ._depcache .GetCandidateVer ( pkg ._pkg )
1860
- for ( packagefile , i ) in cand .FileList :
1861
- indexfile = PythonAptQuery .cache ._list .FindIndex ( packagefile )
1862
- if indexfile :
1863
- uri = indexfile .ArchiveURI ( path )
1864
- localFile = uri .split ( '/' )[ - 1 ]
1865
- if checksum .__str__ () in dup_records :
1866
- continue
1867
- install_file .write ( uri + ' ' + localFile + ' ' + size + ' ' + checksum + "\n " )
1868
- dup_records .append ( checksum .__str__ () )
1869
- else :
1870
- AptInst .Upgrade ("upgrade" , ReleaseType = Str_SetInstallRelease )
1837
+ AptInst .Upgrade ("upgrade" , ReleaseType = Str_SetInstallRelease )
1871
1838
elif Str_SetUpgradeType == "dist-upgrade" :
1872
1839
AptInst .Upgrade ("dist-upgrade" , ReleaseType = Str_SetInstallRelease )
1873
1840
elif Str_SetUpgradeType == "dselect-upgrade" :
@@ -1896,11 +1863,6 @@ def __AptInstallSrcPackages(self, SrcPackageList=None, ReleaseType=None, BuildDe
1896
1863
log .err ( "This argument is supported only on Unix like systems with apt installed\n " )
1897
1864
sys .exit ( 1 )
1898
1865
1899
- class AptPython :
1900
- def __init__ ( self ):
1901
- if PythonApt :
1902
- self .cache = apt .Cache ()
1903
-
1904
1866
def main ():
1905
1867
'''Here we basically do the sanity checks, some validations
1906
1868
and then accordingly call the corresponding functions.
0 commit comments