Hello community, here is the log from the commit of package opi for openSUSE:Factory checked in at 2019-05-05 21:21:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/opi (Old) and /work/SRC/openSUSE:Factory/.opi.new.5148 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "opi" Sun May 5 21:21:22 2019 rev:2 rq:700365 version:0.2.0 Changes: -------- --- /work/SRC/openSUSE:Factory/opi/opi.changes 2019-04-30 13:06:43.741553098 +0200 +++ /work/SRC/openSUSE:Factory/.opi.new.5148/opi.changes 2019-05-05 21:21:27.637283931 +0200 @@ -1,0 +2,9 @@ +Fri May 3 11:10:35 UTC 2019 - Yunhe Guo <i...@guoyunhe.me> + +- Version 0.2.0 + * Added + - Install Packman Codecs with `opi packman` or `opi codecs` + - Install Skype with `opi skype` + - Install VS Code with `opi vs code` + +------------------------------------------------------------------- Old: ---- opi-0.1.2.tar.gz New: ---- opi-0.2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ opi.spec ++++++ --- /var/tmp/diff_new_pack.B3hqk9/_old 2019-05-05 21:21:28.205285478 +0200 +++ /var/tmp/diff_new_pack.B3hqk9/_new 2019-05-05 21:21:28.205285478 +0200 @@ -17,7 +17,7 @@ Name: opi -Version: 0.1.2 +Version: 0.2.0 Release: 0 Summary: OBS Package Installer (CLI) License: GPL-3.0 ++++++ opi-0.1.2.tar.gz -> opi-0.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/opi-0.1.2/CHANGELOG.md new/opi-0.2.0/CHANGELOG.md --- old/opi-0.1.2/CHANGELOG.md 2019-04-29 20:35:48.000000000 +0200 +++ new/opi-0.2.0/CHANGELOG.md 2019-05-03 13:08:23.000000000 +0200 @@ -7,6 +7,14 @@ ## [Unreleased] +## [0.2.0] + +### Added + +- Install Packman Codecs with `opi packman` or `opi codecs` [#6](https://github.com/openSUSE-zh/opi/issues/6) +- Install Skype with `opi skype` [#6](https://github.com/openSUSE-zh/opi/issues/6) +- Install VS Code with `opi vs code` [#6](https://github.com/openSUSE-zh/opi/issues/6) + ## [0.1.2] ### Fixed @@ -30,7 +38,8 @@ - Choose package and install - Keep or remove repository after installation -[Unreleased]: https://github.com/openSUSE-zh/opi/compare/v0.1.2...HEAD +[Unreleased]: https://github.com/openSUSE-zh/opi/compare/v0.2.0...HEAD +[0.1.2]: https://github.com/openSUSE-zh/opi/compare/v0.1.2...v0.2.0 [0.1.2]: https://github.com/openSUSE-zh/opi/compare/v0.1.1...v0.1.2 [0.1.1]: https://github.com/openSUSE-zh/opi/compare/v0.1.0...v0.1.1 [0.1.0]: https://github.com/openSUSE-zh/opi/releases/tag/v0.1.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/opi-0.1.2/README.md new/opi-0.2.0/README.md --- old/opi-0.1.2/README.md 2019-04-29 20:35:48.000000000 +0200 +++ new/opi-0.2.0/README.md 2019-05-03 13:08:23.000000000 +0200 @@ -30,3 +30,27 @@ Output: ![Screenshot](screenshot.png) + +### Packages from Other Repositories + +**Packman Codecs** (enable you to play MP4 videos and YouTube) + +``` +opi packman + +# or + +opi codecs +``` + +**Skype** + +``` +opi skype +``` + +**Visual Studio Code** + +``` +opi vs code +``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/opi-0.1.2/opi new/opi-0.2.0/opi --- old/opi-0.1.2/opi 2019-04-29 20:35:48.000000000 +0200 +++ new/opi-0.2.0/opi 2019-05-03 13:08:23.000000000 +0200 @@ -6,9 +6,6 @@ # Author: Guo Yunhe # Website: https://github.com/openSUSE-zh/opi # License: GPL-3.0 -# -# Created at: 2019-04-25 -# Updated at: 2019-04-29 use strict; use warnings; @@ -17,6 +14,7 @@ use URI::Escape; use Config; use Config::Tiny; +use File::Temp qw/ tempfile tempdir /; use Term::ANSIColor; @@ -29,6 +27,29 @@ exit 1; } +# +# Check for packages not from OBS +# +my $serialized_query = lc(join('', @ARGV)); + +# Check Packman Codecs +if ( $serialized_query =~ m/(packman|codec)/ ) { + install_packman_codecs(); + exit; +} + +# Check VS Code +if ( $serialized_query =~ m/(visualstudiocode|vscode|vsc)/ ) { + install_vs_code(); + exit; +} + +# Check Skype +if ($serialized_query =~ m/skype/ ) { + install_skype(); + exit; +} + # # API configuration @@ -242,7 +263,7 @@ } else { if ($resp->code == 413) { - print "Please use different search keywords. Some short keywords cause OBS timeout."; + print "Please use different search keywords. Some short keywords cause OBS timeout.\n"; } else { print "Network error. Please try later. (Error message: ", $resp->message, ")\n"; } @@ -318,6 +339,34 @@ return @filtered_binary_list; } + +sub ask_yes_or_no { + print $_[0]; + + if (lc($_[1]) eq 'y') { + print '(Y/n) '; + } else { + print '(y/N) '; + } + + my $yes_no = <STDIN>; + chomp $yes_no; + $yes_no = lc(substr($yes_no, 0, 1)); + + if (lc($_[1]) eq 'y') { + return $yes_no ne 'n'; + } else { + return $yes_no eq 'y'; + } +} + +sub ask_keep_repo { + my $repo = $_[0]; + unless ( ask_yes_or_no("Do you want to keep these repositories? ", 'y') ) { + system "sudo zypper removerepo $repo"; + } +} + sub install_binary { my $binary = $_[0]; my $name = $binary->{name}; @@ -339,12 +388,80 @@ $project =~ s/:/_/ig; system "sudo zypper install $install_options --repo $project $name.$arch"; - print "Do you want to keep these repositories(Y/n)? "; - my $yes_no = <STDIN>; - chomp $yes_no; - $yes_no = lc(substr($yes_no, 0, 1)); - if ($yes_no eq 'n') { - system "sudo zypper removerepo $project"; - } + ask_keep_repo( $project ); } } + +sub install_packman_codecs { + unless ( ask_yes_or_no("Do you want install codecs from Packman reposiroty? ", 'y') ) { + return; + } + + add_packman_essentials_repo(); + + install_packman_essentials_packages( + 'ffmpeg', + 'gstreamer-plugins-bad', + 'gstreamer-plugins-libav', + 'gstreamer-plugins-ugly', + 'libavcodec58', + 'libavdevice58', + 'libavfilter7', + 'libavformat58', + 'libavresample4', + 'libavutil56', + 'vlc-codecs', + ); + + exit; +} + +sub add_packman_essentials_repo { + + my $prefix = get_distribution(); + $prefix =~ s/:/_/ig; + + if ($prefix eq 'openSUSE_Factory') { + $prefix = 'openSUSE_Tumbleweed'; + } + + system "sudo zypper addrepo --refresh --priority 90 https://ftp.gwdg.de/pub/linux/misc/packman/suse/$prefix/Essentials/packman-essentials.repo"; + system "sudo zypper refresh"; + system "sudo zypper dist-upgrade --from packman-essentials --allow-downgrade --allow-vendor-change"; +} + +sub install_packman_essentials_packages { + my $packages = join ' ', @_; + system "sudo zypper install --repo packman-essentials $packages"; +} + +sub install_vs_code { + unless ( ask_yes_or_no("Do you want install VS Code from Microsoft reposiroty? ", 'y') ) { + return; + } + + my $tmp_fh = new File::Temp( UNLINK => 1 ); + print $tmp_fh "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ntype=rpm-md\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc\n"; + system "sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc"; + system "sudo mv $tmp_fh /etc/zypp/repos.d/vscode.repo"; + system "sudo zypper refresh"; + system "sudo zypper install code"; + + ask_keep_repo( 'code' ); + + exit; +} + +sub install_skype { + unless ( ask_yes_or_no("Do you want install Skype from Microsoft reposiroty? ", 'y') ) { + return; + } + + system "sudo zypper addrepo --refresh https://repo.skype.com/rpm/stable/skype-stable.repo"; + system "sudo zypper refresh"; + system "sudo zypper install skypeforlinux"; + + ask_keep_repo( 'skype-stable' ); + + exit; +}