Remove rest of 'pmbootstrap challenge' left overs (#1173)

Follow up to #1162.

* `pmb.build.buildinfo()`: Used to record the build environment. It is
  flawed because it scans the repo APKINDEX files instead of using the
  actually installed packages list. When it was implemented we were not
  able to do the latter. After this is removed, `pmb.parse.depends` can
  be simplified (it needs to be rewritten for #1122).
* `pmb.helpers.repo.diff()` and `pmb.helpers.repo.files()`: These were
  used exclusively by `pmb.build.buildinfo()`, to learn about which
  files have been changed in the local repository folder after a
  package was built. The idea was, that we could find subpackages that
  way. But this information is present in the installed package list as
  well, which is a much cleaner approach.
This commit is contained in:
Oliver Smith 2018-02-01 22:03:21 +00:00 committed by GitHub
parent 987ec7a00a
commit e8c27795a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 5 additions and 216 deletions

View file

@ -16,7 +16,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import glob
import os
import hashlib
import logging
@ -24,52 +23,6 @@ import pmb.helpers.http
import pmb.helpers.run
def files(args):
"""
Returns all files (apk/buildinfo) with their last modification timestamp
inside the package repository, sorted by architecture.
:returns: {"x86_64": {"first.apk": last_modified_timestamp, ... }, ... }
"""
ret = {}
for arch_folder in glob.glob(args.work + "/packages/*"):
arch = os.path.basename(arch_folder)
ret[arch] = {}
for file in glob.glob(arch_folder + "/*"):
basename = os.path.basename(file)
ret[arch][basename] = os.path.getmtime(file)
return ret
def diff(args, files_a, files_b=None):
"""
Returns a list of files, that have been added or modified inside the
package repository.
:param files_a: return value from pmb.helpers.repo.files()
:param files_b: defaults to creating a new list
:returns: ["x86_64/APKINDEX.tar.gz", "x86_64/package.apk",
"x86_64/package.buildinfo", ...]
"""
if not files_b:
files_b = files(args)
ret = []
for arch in files_b.keys():
for file, timestamp in files_b[arch].items():
add = False
if arch not in files_a:
add = True
elif file not in files_a[arch]:
add = True
elif timestamp != files_a[arch][file]:
add = True
if add:
ret.append(arch + "/" + file)
return sorted(ret)
def hash(url, length=8):
"""
Generate the hash, that APK adds to the APKINDEX and apk packages