diff --git a/libraries/entropy.py b/libraries/entropy.py index fde391f15..22541b791 100644 --- a/libraries/entropy.py +++ b/libraries/entropy.py @@ -4006,6 +4006,17 @@ class EquoInterface(TextInterface): return pkg_links + def _extract_pkg_metadata_ebuild_entropy_tag(self, ebuild): + search_tag = etpConst['spm']['ebuild_pkg_tag_var'] + ebuild_tag = '' + f = open(ebuild,"r") + tags = [x.strip() for x in f.readlines() if x.strip() and x.strip().startswith(search_tag)] + f.close() + if not tags: return ebuild_tag + tag = tags[-1] + tag = tag.split("=")[-1].strip('"').strip("'").strip() + return tag + # This function extracts all the info from a .tbz2 file and returns them def extract_pkg_metadata(self, package, etpBranch = etpConst['branch'], silent = False, inject = False): @@ -4121,6 +4132,14 @@ class EquoInterface(TextInterface): # you must change "reagent update" # and "equo database gentoosync" consequentially + file_ext = etpConst['spm']['ebuild_file_extension'] + ebuilds_in_path = [x for x in os.listdir(tbz2TmpDir) if x.endswith(".%s" % (file_ext,))] + if not data['versiontag'] and ebuilds_in_path: + # has the user specified a custom package tag inside the ebuild + ebuild_path = os.path.join(tbz2TmpDir,ebuilds_in_path[0]) + data['versiontag'] = self._extract_pkg_metadata_ebuild_entropy_tag(ebuild_path) + + data['download'] = etpConst['packagesrelativepath'] + data['branch'] + "/" data['download'] += self.entropyTools.create_package_filename(data['category'], data['name'], data['version'], data['versiontag']) diff --git a/libraries/entropyConstants.py b/libraries/entropyConstants.py index 6baf87e4d..056ecd459 100644 --- a/libraries/entropyConstants.py +++ b/libraries/entropyConstants.py @@ -686,6 +686,8 @@ def const_defaultSettings(rootdir): 'server_treeupdatescalled': set(), 'client_treeupdatescalled': set(), 'spm': { + 'ebuild_file_extension': "ebuild", + 'ebuild_pkg_tag_var': "ENTROPY_PROJECT_TAG", 'global_make_conf': rootdir+"/etc/make.conf", 'global_package_keywords': rootdir+"/etc/portage/package.keywords", 'global_package_use': rootdir+"/etc/portage/package.use",