def filelists_from_spec(spec, specpath): res = Tree() for pkg in spec.packages: name = "%s.install.in" % mappkgname.map_package_name(pkg.header) res.append("debian/%s" % name, files_from_pkg(spec.sourceHeader['name'], pkg, specpath)) return res
def binary_deb_from_spec(spec, tree): res = "" res += "Package: %s\n" % mappkgname.map_package_name(spec.header) if spec.header['arch'] in ["x86_64", "i686", "armhf", "armv7l"]: res += "Architecture: any\n" else: res += "Architecture: all\n" res += "Depends:\n" depends = ["${ocaml:Depends}", "${shlibs:Depends}", "${misc:Depends}"] for pkg, version in zip(spec.header['requires'], spec.header['requireVersion']): deps = mappkgname.map_package(pkg) for dep in deps: if version: dep += " (>= %s)" % version depends.append(dep) res += ",\n".join([" %s" % d for d in depends]) res += "\n" # XXX These lines should only be added for ocaml packages res += "Provides: ${ocaml:Provides}\n" res += "Recommends: ocaml-findlib\n" res += "Description: %s\n" % spec.header['summary'] res += format_description(spec.header['description']) res += "\n\n" tree.append('debian/control', res)
def binary_deb_from_spec(spec, tree): res = "" res += "Package: %s\n" % mappkgname.map_package_name(spec.header) if spec.header['arch'] in ["x86_64", "i686"]: res += "Architecture: any\n" else: res += "Architecture: all\n" res += "Depends:\n" depends = ["${ocaml:Depends}", "${shlibs:Depends}", "${misc:Depends}"] for pkg, version in zip(spec.header['requires'], spec.header['requireVersion']): deps = mappkgname.map_package(pkg) for dep in deps: if version: dep += " (>= %s)" % version depends.append(dep) res += ",\n".join([" %s" % d for d in depends]) res += "\n" # XXX These lines should only be added for ocaml packages res += "Provides: ${ocaml:Provides}\n" res += "Recommends: ocaml-findlib\n" res += "Description: %s\n" % spec.header['summary'] res += format_description(spec.header['description']) res += "\n\n" tree.append('debian/control', res)
def conffiles_from_spec(spec, specpath): # Configuration files, not to be overwritten on upgrade. # Files in /etc are automatically marked as config files, # so we only need to list files here if they are in a # different place. res = Tree() pkgname = mappkgname.map_package_name(spec.sourceHeader) files = rpmextra.files_from_spec(pkgname, specpath) if files.has_key( pkgname + "-%config" ): for filename in files[pkgname + "-%config"]: res.append('debian/conffiles', "%s\n" % filename) return res
def rules_dh_install_from_spec(spec, tree, specpath): rule = ".PHONY: override_dh_install\n" rule += "override_dh_install:\n" rule += "\tdh_install\n" pkgname = mappkgname.map_package_name(spec.sourceHeader) files = rpmextra.files_from_spec(pkgname, specpath) if files.has_key(pkgname + "-%exclude"): for pat in files[pkgname + "-%exclude"]: path = "\trm -f debian/%s/%s\n" % (pkgname, rpm.expandMacro(pat)) rule += os.path.normpath(path) rule += "\n" tree.append('debian/rules', rule)
def rules_dh_install_from_spec(spec, tree, specpath): rule = ".PHONY: override_dh_install\n" rule += "override_dh_install:\n" rule += "\tdh_install\n" pkgname = mappkgname.map_package_name(spec.sourceHeader) files = rpmextra.files_from_spec(pkgname, specpath) if files.has_key( pkgname + "-%exclude" ): for pat in files[pkgname + "-%exclude"]: path = "\trm -f debian/%s/%s\n" % (pkgname, rpm.expandMacro(pat)) rule += os.path.normpath(path) rule += "\n" tree.append('debian/rules', rule)
def rpmNameFromHeader( h ): if buildType() == "rpm": rpm.addMacro( 'NAME', h['name'] ) else: rpm.addMacro( 'NAME', mappkgname.map_package_name(h) ) rpm.addMacro( 'VERSION', h['version'] ) rpm.addMacro( 'RELEASE', h['release'] ) if buildType() == "rpm": rpm.addMacro( 'ARCH', h['arch'] ) else: rpm.addMacro( 'ARCH', "amd64" if h['arch'] == "x86_64" else "all" if h['arch'] == "noarch" else h['arch']) rpmname = rpm.expandMacro( rpmfilenamepat ) rpm.delMacro( 'NAME' ) rpm.delMacro( 'VERSION' ) rpm.delMacro( 'RELEASE' ) rpm.delMacro( 'ARCH' ) return rpmname