| Index: src/platform/dev/buildutil.py
|
| diff --git a/src/platform/dev/buildutil.py b/src/platform/dev/buildutil.py
|
| index ade5428493a908553ef2c916eb3a81864895b438..66d3630fb68a6386a2579dc9090a00ce1bbeb4bd 100644
|
| --- a/src/platform/dev/buildutil.py
|
| +++ b/src/platform/dev/buildutil.py
|
| @@ -24,104 +24,3 @@ class BuildObject:
|
| """
|
| if err != 0:
|
| raise Exception("%s failed to execute" % cmd)
|
| -
|
| -
|
| -class BuildUtil(BuildObject):
|
| -
|
| - def GetPackageName(self, pkg_path):
|
| - cmd = "cat %s/debian/control | grep Package: | cut -d \" \" -f 2-" % pkg_path
|
| - return os.popen(cmd).read().strip()
|
| -
|
| - def GetLastBuildTime(self, pkg_name):
|
| - # TODO(rtc): convert this to local time.
|
| - cmd = "stat -c %s %s/%s*" % ("%Y", self.x86_pkg_dir, pkg_name)
|
| - utc_time = os.popen(cmd).read().strip()
|
| - return datetime.fromtimestamp(int(utc_time))
|
| -
|
| - def GetPackageBuildPath(self, pkg_name):
|
| - cmd = "stat -c %s %s/%s*" % ("%n", self.x86_pkg_dir, pkg_name)
|
| - return os.popen(cmd).read().strip()
|
| -
|
| - def GetPackageBuildFile(self, build_path):
|
| - return build_path.replace(self.x86_pkg_dir + "/", "")
|
| -
|
| - def BuildPackage(self, pkg="all"):
|
| - """
|
| - Builds the given package and copies the output to the static dir so that
|
| - it can be downloaded.
|
| -
|
| - If pkg=all is specified then the kernel and all platform packages
|
| - will be built. A new system image will also be created.
|
| -
|
| - If pkg=packages is specified then all platform packages
|
| - will be built and a new system image will be created.
|
| - """
|
| - if pkg == "all":
|
| - err = os.system("%s/build_all.sh" % self.scripts_dir)
|
| - self.AssertSystemCallSuccess(err)
|
| - return None
|
| -
|
| - if pkg == "packages":
|
| - err = os.system("%s/build_platform_packages.sh" % self.scripts_dir)
|
| - self.AssertSystemCallSuccess(err)
|
| - err = os.system("%s/build_image.sh" % self.scripts_dir)
|
| - self.AssertSystemCallSuccess(err)
|
| - return None
|
| -
|
| - pkg_properties = self.GetPackages().get(pkg, None)
|
| - if pkg_properties == None:
|
| - raise Exception("Unknown package name %s" % pkg)
|
| -
|
| - cmd = "(cd %s; ./make_pkg.sh)" % pkg_properties.get("source_path")
|
| - err = os.system(cmd)
|
| - self.AssertSystemCallSuccess(err, cmd)
|
| -
|
| - # Reset pkg_properties after building so that output_path and
|
| - # output_file_name are set up properly.
|
| - pkg_properties = self.GetPackages().get(pkg, None)
|
| -
|
| - cmd = "cp %s %s" % (pkg_properties.get("output_path"), self.static_dir)
|
| - err = os.system(cmd)
|
| - self.AssertSystemCallSuccess(err, cmd)
|
| -
|
| - return pkg_properties.get("output_file_name")
|
| -
|
| -
|
| - def GetPackages(self):
|
| - """
|
| - Lists all of the packages that can be built with a make_pkg.sh script.
|
| -
|
| - Returns a dictionary with the following keys
|
| - name: the name of the package.
|
| - build_time: the time the package was last built (in UTC).
|
| - source_path: the path to the package in the source tree.
|
| - output_path: the path to the deb created by make_pkg.sh.
|
| - output_file_name: the name of the deb created by make_pkg.sh
|
| - """
|
| - pkgs = {}
|
| - cli = os.popen("find %s -name make_pkg.sh" % self.root_dir).read().split('\n')
|
| - for pkg in cli:
|
| - if pkg == "":
|
| - continue
|
| - pkg_path = pkg.replace("/make_pkg.sh", "", 1)
|
| - pkg_name = self.GetPackageName(pkg_path)
|
| - if pkg_name == "":
|
| - web.debug("unable to find a package info for %s" % pkg_path)
|
| - continue
|
| -
|
| - build_path = self.GetPackageBuildPath(pkg_name)
|
| -
|
| - build_time = None
|
| - build_file = None
|
| - if build_path != "":
|
| - build_time = self.GetLastBuildTime(pkg_name)
|
| - build_file = self.GetPackageBuildFile(build_path)
|
| -
|
| - pkgs[pkg_name] = {
|
| - "name": pkg_name,
|
| - "build_time": build_time,
|
| - "source_path": pkg_path,
|
| - "output_path": build_path,
|
| - "output_file_name": build_file
|
| - }
|
| - return pkgs
|
|
|