def create_watch(self): args = {} args['debian_name'] = self.debian_name args['dversionmangle'] = 'auto' args['url'] = self.upstream_repo_url args['module'] = self.name args['remodule'] = _re.sub(r'\@', r'\@', self.name) args['modulename'] = _re.sub(r'.*/', r'', self.name) try: if self.upstream_repo_url.find('github') >= 0: utils.debug(1, 'Found GitHub url') content = utils.get_watch('github') % args elif self.upstream_repo_url.find('gitlab') >= 0: utils.debug(1, 'Found GitLab url') content = utils.get_watch('gitlab') % args else: # if not supported, got to npmregistry raise ValueError utils.create_debian_file('watch', content) # test watch with uscan, raise exception if status is not 0 uscan_info = self.test_uscan() if uscan_info[0] != 0: utils.debug(1, 'Uscan failed, switching to npmregistry') raise ValueError except ValueError: self.upstream_watch = True content = utils.get_watch('npmregistry') % args utils.create_debian_file('watch', content)
def create_watch(self): args = {} args['debian_name'] = self.debian_name args['dversionmangle'] = 's/\+(debian|dfsg|ds|deb)(\.\d+)?$//' args['url'] = self.upstream_repo_url args['module'] = self.name try: if self.upstream_repo_url.find('github') >= 0: content = utils.get_watch('github') % args else: # if not supported, got to fakeupstream raise ValueError utils.create_debian_file('watch', content) # test watch with uscan, raise exception if status is not 0 info = _getstatusoutput('uscan --watchfile "debian/watch" ' '--package "{}" ' '--upstream-version 0 --no-download' .format(self.debian_name)) if info[0] != 0: raise ValueError except ValueError: content = utils.get_watch('fakeupstream') % args utils.create_debian_file('watch', content)
def create_watch(self): args = {} args['debian_name'] = self.debian_name args['dversionmangle'] = 's/\+(debian|dfsg|ds|deb)(\.\d+)?$//' args['url'] = self.upstream_repo_url args['module'] = self.name try: if self.upstream_repo_url.find('github') >= 0: content = utils.get_watch('github') % args else: # if not supported, got to fakeupstream raise ValueError utils.create_debian_file('watch', content) # test watch with uscan, raise exception if status is not 0 info = _getstatusoutput( 'uscan --watchfile "debian/watch" ' '--package "{}" ' '--upstream-version 0 --no-download'.format(self.debian_name)) if info[0] != 0: raise ValueError except ValueError: content = utils.get_watch('fakeupstream') % args utils.create_debian_file('watch', content)
def create_manpages(self): if 'man' not in self.json: return mans = self.json['man'] if not isinstance(mans, (list, tuple)): mans = [mans] paths = [_os.path.normpath(manpath) for manpath in mans] utils.create_debian_file('manpages', "\n".join(paths))
def create_changelog(self): args = {} args['debian_author'] = self.debian_author args['debian_name'] = self.debian_name args['version'] = self.upstream_version args['date'] = self.date.strftime('%a, %d %b %Y %X %z') file_content = templates.CHANGELOG % args utils.create_debian_file("changelog", file_content)
def create_changelog(self): args = {} args["debian_author"] = self.debian_author args["debian_name"] = self.debian_name args["version"] = self.upstream_version args["date"] = self.date.strftime("%a, %d %b %Y %X %z") file_content = templates.CHANGELOG % args utils.create_debian_file("changelog", file_content)
def create_tests(self): utils.create_dir("debian/tests") args = {} args['name'] = self.name args['debian_name'] = self.debian_name control = utils.get_template('tests/control') % args utils.create_debian_file("tests/control", control) require = utils.get_template("tests/require") % args utils.create_debian_file("tests/require", require)
def create_links(self): links = [] dest = self.debian_dest if os.path.isdir("bin"): for script in os.listdir("bin"): links.append("%s/bin/%s usr/bin/%s" % (dest, script, script.replace(".js", ""))) if len(links) > 0: content = "\n".join(links) utils.create_debian_file("links", content)
def create_install(self): content = '' libs = _os.listdir() # remove debian directory libs.remove('debian') for filename in libs: content += "%s %s/\n" % (filename, self.debian_dest) utils.create_debian_file('install', content)
def create_links(self): links = [] dest = self.debian_dest if 'bin' in self.json: for script in self.json['bin']: orig = _os.path.normpath(self.json['bin'][script]) links.append("%s/%s usr/bin/%s" % (dest, orig, script)) if len(links) > 0: content = '\n'.join(links) utils.create_debian_file('links', content)
def create_install(self): content = '' libs = _os.listdir() # remove debian directory libs.remove('debian') for filename in libs: if not utils.is_ignored(filename): content += "%s %s/\n" % (filename, self.debian_dest) utils.create_debian_file('install', content)
def create_links(self): links = [] dest = self.debian_dest if os.path.isdir('bin'): for script in os.listdir('bin'): links.append("%s/bin/%s usr/bin/%s" % \ (dest, script, script.replace('.js', ''))) if len(links) > 0: content = '\n'.join(links) utils.create_debian_file('links', content)
def create_rules(self): args = {} args["overrides"] = "" for filename in os.listdir("."): if filename.lower().startswith("history"): args["overrides"] += "override_dh_installchangelogs:\n" + "\tdh_installchangelogs -k %s\n" % filename break content = utils.get_template("rules") % args utils.create_debian_file("rules", content) os.system("chmod +x debian/rules")
def create_rules(self): args = {} args['overrides'] = '' for filename in _os.listdir('.'): if filename.lower().startswith('history'): args['overrides'] += "override_dh_installchangelogs:\n" + \ "\tdh_installchangelogs -k %s\n" % filename break content = utils.get_template('rules') % args utils.create_debian_file("rules", content) _os.system('chmod +x debian/rules')
def create_docs(self): docs = [] if "readmeFilename" in self.json: docs.append(self.json["readmeFilename"]) else: for name in os.listdir("."): if name.lower().startswith("readme"): docs.append(name) break if len(docs) > 0: content = "\n".join(docs) utils.create_debian_file("docs", content)
def create_watch(self): args = {} if self.upstream_repo_url and \ self.upstream_repo_url.find('github') >= 0: args['homepage'] = self.upstream_repo_url args['debian_name'] = self.debian_name content = templates.WATCH_GITHUB % args else: content = "# FIX_ME Please take a look " \ "at https://wiki.debian.org/debian/watch/\n" \ "Homepage is %s\n" % self.homepage utils.create_debian_file('watch', content)
def create_docs(self): docs = [] if 'readmeFilename' in self.json and self.json['readmeFilename']: docs.append(self.json['readmeFilename']) else: for name in _os.listdir('.'): if name.lower().startswith('readme'): docs.append(name) break if len(docs) > 0: content = '\n'.join(docs) utils.create_debian_file('docs', content)
def create_upstream_metadata(self): args = {} args['url'] = _re.sub(r'^git\+', '', self.upstream_repo_url) args['module'] = self.name if self.upstream_repo_url.find('github') >= 0: content = utils.get_upstream_metadata('github') % args utils.create_dir("debian/upstream") utils.create_debian_file('upstream/metadata', content) elif self.upstream_repo_url.find('gitlab') >= 0: content = utils.get_upstream_metadata('gitlab') % args utils.create_dir("debian/upstream") utils.create_debian_file('upstream/metadata', content)
def create_watch(self): args = {} if self.upstream_repo_url and self.upstream_repo_url.find("github") >= 0: args["homepage"] = self.upstream_repo_url args["debian_name"] = self.debian_name content = templates.WATCH_GITHUB % args else: content = ( "# FIX_ME Please take a look " "at https://wiki.debian.org/debian/watch/\n" "Homepage is %s\n" % self.homepage ) utils.create_debian_file("watch", content)
def create_control(self): args = {} args["Source"] = self.debian_name args["Uploaders"] = self.debian_author args["debhelper"] = self.debian_debhelper args["Standards-Version"] = self.debian_standards args["Homepage"] = self.homepage args["Vcs-Git"] = "git://anonscm.debian.org/pkg-javascript/%s.git" % self.debian_name args["Vcs-Browser"] = "http://anonscm.debian.org/" + "gitweb/?p=pkg-javascript/%s.git" % self.debian_name args["Package"] = self.debian_name args["Depends"] = self._get_Depends() args["Description"] = self.description args["Description_Long"] = "FIX_ME long description" template = utils.get_template("control") utils.create_debian_file("control", template % args)
def create_install(self): content = '' libs = {'package.json'} if _os.path.isdir('bin'): libs.add('bin') if _os.path.isdir('lib'): libs.add('lib') # install files from directories field if 'directories' in self.json: directories = self.json['directories'] if 'bin' in directories: libs.add(directories['bin']) if 'lib' in directories: libs.add(directories['lib']) # install files from files field if 'files' in self.json: files = self.json['files'] # npm v1.4 returns string if files field has only one entry if isinstance(files, str): libs.add(files) else: libs = libs.union(files) # install main if not in a subpath if 'main' in self.json: main = self.json['main'] main = _os.path.normpath(main) if main == 'index': main = 'index.js' if not main.find('/') > 0: libs.add(_os.path.normpath(main)) else: if _os.path.exists('index.js'): libs.add('index.js') else: libs.add('*.js') # normalize filepaths libs = set(map(lambda x: _os.path.normpath(x), libs)) # sanitize by removing current directory from files list if '.' in libs: libs.remove('.') for filename in libs: content += "%s %s/\n" % (filename, self.debian_dest) utils.create_debian_file('install', content)
def create_control(self): args = {} args['Source'] = self.debian_name args['Uploaders'] = self.debian_author args['debhelper'] = self.debian_debhelper args['Standards-Version'] = self.debian_standards args['Homepage'] = self.homepage args['Vcs-Git'] = 'git://anonscm.debian.org/pkg-javascript/%s.git' \ % self.debian_name args['Vcs-Browser'] = 'http://anonscm.debian.org/' + \ 'gitweb/?p=pkg-javascript/%s.git' % self.debian_name args['Package'] = self.debian_name args['Depends'] = self._get_Depends() args['Description'] = self.description args['Description_Long'] = 'FIX_ME long description' template = utils.get_template('control') utils.create_debian_file('control', template % args)
def create_control(self): args = {} args['Source'] = self.debian_name args['Uploaders'] = self.debian_author args['debhelper'] = self.debian_debhelper args['Standards-Version'] = self.debian_standards args['Homepage'] = self.homepage args['Vcs-Git'] = 'git://anonscm.debian.org/pkg-javascript/%s.git' \ % self.debian_name args['Vcs-Browser'] = 'http://anonscm.debian.org/' + \ 'gitweb/?p=pkg-javascript/%s.git' \ % self.debian_name args['Package'] = self.debian_name args['Depends'] = self._get_Depends() args['Description'] = self.description args['Description_Long'] = 'FIX_ME long description' template = utils.get_template('control') utils.create_debian_file('control', template % args)
def create_control(self): args = {} args['Source'] = self.debian_name args['Uploaders'] = self.debian_author args['debhelper'] = self.debian_debhelper args['Standards-Version'] = self.debian_standards args['Homepage'] = self.homepage args['Vcs-Git'] = 'https://salsa.debian.org/' + \ 'js-team/%s.git' \ % self.debian_name args['Vcs-Browser'] = 'https://salsa.debian.org/' + \ 'js-team/%s' \ % self.debian_name args['Package'] = self.debian_name args['Depends'] = self._get_Depends() args['Description'] = 'FIX_ME write the Debian package description' args['upstream_description'] = self.upstream_description template = utils.get_template('control') utils.create_debian_file('control', template % args)
def create_copyright(self): args = {} args["upstream_name"] = self.name args["source"] = self.homepage args["upstream_date"] = self.date.year args["upstream_author"] = self.upstream_author args["upstream_contact"] = self.upstream_author if "bugs" in self.json and "url" in self.json["bugs"]: args["upstream_contact"] = self.json["bugs"]["url"] args["upstream_license_name"] = self.upstream_license if self.debian_license and self.upstream_license != self.debian_license: args["upstream_license"] = "\nLicense: %s" % utils.get_license(self.upstream_license) else: args["upstream_license"] = "" # do not insert same license twice args["debian_date"] = self.date.year args["debian_author"] = self.debian_author args["debian_license_name"] = self.debian_license args["debian_license"] = "License: %s" % utils.get_license(self.debian_license) template = utils.get_template("copyright") utils.create_debian_file("copyright", template % args)
def create_copyright(self): args = {} args['upstream_name'] = self.name args['source'] = self.homepage args['upstream_date'] = self.date.year args['upstream_author'] = self.upstream_author args['upstream_contact'] = self.upstream_author if 'bugs' in self.json and 'url' in self.json['bugs']: args['upstream_contact'] = self.json['bugs']['url'] args['upstream_license_name'] = self.upstream_license if self.debian_license and \ self.upstream_license != self.debian_license: args['upstream_license'] = "\nLicense: %s" % \ utils.get_license(self.upstream_license) else: args['upstream_license'] = '' # do not insert same license twice args['debian_date'] = self.date.year args['debian_author'] = self.debian_author args['debian_license_name'] = self.debian_license args['debian_license'] = "License: %s" % \ utils.get_license(self.debian_license) template = utils.get_template('copyright') utils.create_debian_file('copyright', template % args)
def create_install(self): content = '' libs = ['package.json'] if _os.path.isdir('bin'): libs.append('bin') if _os.path.isdir('lib'): libs.append('lib') # install main if not in a subpath if 'main' in self.json: main = self.json['main'] main = _os.path.normpath(main) if main == 'index': main = 'index.js' if not main.find('/') > 0: libs.append(_os.path.normpath(main)) else: if _os.path.exists('index.js'): libs.append('index.js') else: libs.append('*.js') for filename in libs: content += "%s %s/\n" % (filename, self.debian_dest) utils.create_debian_file('install', content)
def create_install(self): content = "" libs = ["package.json"] if os.path.isdir("bin"): libs.append("bin") if os.path.isdir("lib"): libs.append("lib") # install main if not in a subpath if "main" in self.json: main = self.json["main"] main = os.path.normpath(main) if main == "index": main = "index.js" if not main.find("/") > 0: libs.append(os.path.normpath(main)) else: if os.path.exists("index.js"): libs.append("index.js") else: libs.append("*.js") for filename in libs: content += "%s %s/\n" % (filename, self.debian_dest) utils.create_debian_file("install", content)
def create_install(self): content = '' libs = ['package.json'] if os.path.isdir('bin'): libs.append('bin') if os.path.isdir('lib'): libs.append('lib') # install main if not in a subpath if 'main' in self.json: main = self.json['main'] main = os.path.normpath(main) if main == 'index': main = 'index.js' if not main.find('/') > 0: libs.append(os.path.normpath(main)) else: if os.path.exists('index.js'): libs.append('index.js') else: libs.append('*.js') for filename in libs: content += "%s %s/\n" % (filename, self.debian_dest) utils.create_debian_file('install', content)
def create_watch(self): args = {} args['debian_name'] = self.debian_name args['dversionmangle'] = 's/\+(debian|dfsg|ds|deb)(\.\d+)?$//' args['url'] = self.upstream_repo_url args['module'] = self.name try: if self.upstream_repo_url.find('github') >= 0: content = utils.get_watch('github') % args else: # if not supported, got to fakeupstream raise ValueError utils.create_debian_file('watch', content) # test watch with uscan, raise exception if status is not 0 uscan_info = self.test_uscan() if uscan_info[0] != 0: raise ValueError except ValueError: self.upstream_watch = True content = utils.get_watch('fakeupstream') % args utils.create_debian_file('watch', content)
def create_base_debian(self): utils.debug(1, "creating debian files") utils.create_dir("debian") utils.create_dir("debian/source") utils.create_debian_file("source/format", "3.0 (quilt)\n")
def create_gbp_conf(self): content = utils.get_gbp_conf() utils.create_debian_file('gbp.conf', content)
def create_manpages(self): if 'man' in self.json: content = _os.path.normpath(self.json['man']) utils.create_debian_file('manpages', content)
def create_examples(self): if _os.path.isdir('examples'): content = 'examples/*' utils.create_debian_file('examples', content)
def create_dirs(self): if _os.path.isdir('bin'): content = 'usr/bin' utils.create_debian_file('dirs', content)
def create_examples(self): if os.path.isdir("examples"): content = "examples/*" utils.create_debian_file("examples", content)
def create_dirs(self): if os.path.isdir("bin"): content = "usr/bin" utils.create_debian_file("dirs", content)
def create_base_debian(self): utils.debug(1, "creating debian files") utils.create_dir("debian") utils.create_dir("debian/source") utils.create_debian_file("source/format", "3.0 (quilt)\n") utils.create_debian_file("compat", self.debian_debhelper)