লিনাক্স ডেস্কটপের জন্য প্যাকেজ ".deb" হিসাবে প্যাকেজ পিইজিওজেক্ট অ্যাপ্লিকেশন এবং প্রোগ্রাম - অংশ 4


আমরা আপনার সাথে লিনাক্স ডেস্কটপে পাইগোবজেক্ট প্রোগ্রামিং সিরিজটি চালিয়ে যাচ্ছি, সিরিজের ৪ র্থ অংশে আমরা কীভাবে আমাদের তৈরি করা প্রোগ্রাম এবং অ্যাপ্লিকেশনগুলিকে প্যাকেজ করব তা ব্যাখ্যা করব the লিনাক্স ডেস্কটপ পিজোগোবজেক্টকে ডেবিয়ান প্যাকেজ হিসাবে ব্যবহার করে।

লিনাক্সের অধীনে প্রোগ্রামগুলি ইনস্টল করার জন্য ডেবিয়ান প্যাকেজগুলি ( .দেব ) সর্বাধিক ব্যবহৃত ফর্ম্যাট, << .deb প্যাকেজগুলির সাথে সম্পর্কিত "<< dpkg " সিস্টেমটি হ'ল উবুন্টু এবং লিনাক্স মিন্টের মতো সমস্ত দেবিয়ান-ভিত্তিক লিনাক্স বিতরণে ডিফল্ট। এজন্য আমরা কেবলমাত্র দেবিয়ানদের জন্য কীভাবে আমাদের প্রোগ্রামগুলি প্যাকেজ করব তা ব্যাখ্যা করব।

আপনার পাইজিওজেক্ট অ্যাপ্লিকেশন থেকে একটি ডেবিয়ান প্যাকেজ তৈরি করুন

প্রথমত, আপনার দেবিয়ান প্যাকেজ তৈরি সম্পর্কে কিছু প্রাথমিক জ্ঞান থাকা উচিত, নিম্নলিখিত গাইডটি আপনাকে অনেক সহায়তা করবে।

  1. দেবিয়ান প্যাকেজিংয়ের পরিচিতি

সংক্ষেপে, আপনার যদি " মাইপোগ্রাম " নামক প্রকল্প রয়েছে তবে এতে অবশ্যই নিম্নলিখিত ফাইল এবং ফোল্ডার থাকতে হবে যাতে আপনি এটি প্যাকেজ করতে পারেন।

  1. ডেবিয়ান (ফোল্ডার): এই ফোল্ডারে অনেকগুলি সাব-ফাইলে বিভক্ত দেবিয়ান প্যাকেজ সম্পর্কিত সমস্ত তথ্য রয়েছে
  2. পো (ফোল্ডার): পো ফোল্ডারে প্রোগ্রামটির জন্য অনুবাদ ফাইলগুলি অন্তর্ভুক্ত থাকে (আমরা এটি অংশ 5 তে ব্যাখ্যা করব)
  3. মাইপোগ্রাম (ফাইল): এটি পাইগনজেক্ট ব্যবহার করে আমরা তৈরি পাইথন ফাইল এটি প্রকল্পের মূল ফাইল
  4. ui.glade (ফাইল): গ্রাফিকাল ইউজার ইন্টারফেস ফাইল .. আপনি যদি গ্ল্যাড ব্যবহার করে অ্যাপ্লিকেশনটির ইন্টারফেস তৈরি করেন তবে আপনাকে অবশ্যই এই ফাইলটি অন্তর্ভুক্ত করতে হবে
    আপনার প্রকল্প।
  5. বি মাইক্রোগ্রাম.ডেস্কটপ (ফাইল): অ্যাপ্লিকেশন মেনুতে অ্যাপ্লিকেশনটি দেখানোর জন্য এটি দায়ী ফাইল
  6. সেটআপ.পি (ফাইল): এই ফাইলটি স্থানীয় সিস্টেমে যে কোনও পাইথন প্রোগ্রাম ইনস্টল করার জন্য দায়ী, এটি কোনও পাইথন প্রোগ্রামে খুব গুরুত্বপূর্ণ, এর ব্যবহারের অন্যান্য অনেকগুলি উপায় রয়েছে।

অবশ্যই .. এমন অনেকগুলি ফাইল এবং ফোল্ডার রয়েছে যা আপনি আপনার প্রকল্পে অন্তর্ভুক্ত করতে পারেন (বাস্তবে আপনি যা কিছু চান তা অন্তর্ভুক্ত করতে পারেন) তবে সেগুলি মূলগুলি।

এখন, একটি প্রকল্পের প্যাকেজিং শুরু করি। “ মাইপোগ্রাম ” নামে একটি নতুন ফোল্ডার তৈরি করুন, “ মাইপোগ্রাম ” নামে একটি ফাইল তৈরি করুন এবং এতে নিম্নলিখিত কোড যুক্ত করুন।

#!/usr/bin/python 
# -*- coding: utf-8 -*- 

## Replace your name and email. 
# My Name <[email > 

## Here you must add the license of the file, replace "MyProgram" with your program name. 
# License: 
#    MyProgram is free software: you can redistribute it and/or modify 
#    it under the terms of the GNU General Public License as published by 
#    the Free Software Foundation, either version 3 of the License, or 
#    (at your option) any later version. 
# 
#    MyProgram is distributed in the hope that it will be useful, 
#    but WITHOUT ANY WARRANTY; without even the implied warranty of 
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
#    GNU General Public License for more details. 
# 
#    You should have received a copy of the GNU General Public License 
#    along with MyProgram.  If not, see <http://www.gnu.org/licenses/>. 

from gi.repository import Gtk 
import os 

class Handler: 
  
  def openterminal(self, button): 
    ## When the user clicks on the first button, the terminal will be opened. 
    os.system("x-terminal-emulator ") 
  
  def closeprogram(self, button): 
    Gtk.main_quit() 
    
# Nothing new here.. We just imported the 'ui.glade' file. 
builder = Gtk.Builder() 
builder.add_from_file("/usr/lib/myprogram/ui.glade") 
builder.connect_signals(Handler()) 
window = builder.get_object("window1") 
window.connect("delete-event", Gtk.main_quit) 
window.show_all() 
Gtk.main()

একটি ui.glade ফাইল তৈরি করুন এবং এই কোডটি পূরণ করুন।

<?xml version="1.0" encoding="UTF-8"?> 
<!-- Generated with glade 3.16.1 --> 
<interface> 
  <requires lib="gtk+" version="3.10"/> 
  <object class="GtkWindow" id="window1"> 
    <property name="can_focus">False</property> 
    <property name="title" translatable="yes">My Program</property> 
    <property name="window_position">center</property> 
    <property name="icon_name">applications-utilities</property> 
    <property name="gravity">center</property> 
    <child> 
      <object class="GtkBox" id="box1"> 
        <property name="visible">True</property> 
        <property name="can_focus">False</property> 
        <property name="margin_left">5</property> 
        <property name="margin_right">5</property> 
        <property name="margin_top">5</property> 
        <property name="margin_bottom">5</property> 
        <property name="orientation">vertical</property> 
        <property name="homogeneous">True</property> 
        <child> 
          <object class="GtkLabel" id="label1"> 
            <property name="visible">True</property> 
            <property name="can_focus">False</property> 
            <property name="label" translatable="yes">Welcome to this Test Program !</property> 
          </object> 
          <packing> 
            <property name="expand">False</property> 
            <property name="fill">True</property> 
            <property name="position">0</property> 
          </packing> 
        </child> 
        <child> 
          <object class="GtkButton" id="button2"> 
            <property name="label" translatable="yes">Click on me to open the Terminal</property> 
            <property name="visible">True</property> 
            <property name="can_focus">True</property> 
            <property name="receives_default">True</property> 
            <signal name="clicked" handler="openterminal" swapped="no"/> 
          </object> 
          <packing> 
            <property name="expand">False</property> 
            <property name="fill">True</property> 
            <property name="position">1</property> 
          </packing> 
        </child> 
        <child> 
          <object class="GtkButton" id="button3"> 
            <property name="label">gtk-preferences</property> 
            <property name="visible">True</property> 
            <property name="can_focus">True</property> 
            <property name="receives_default">True</property> 
            <property name="use_stock">True</property> 
          </object> 
          <packing> 
            <property name="expand">False</property> 
            <property name="fill">True</property> 
            <property name="position">2</property> 
          </packing> 
        </child> 
        <child> 
          <object class="GtkButton" id="button4"> 
            <property name="label">gtk-about</property> 
            <property name="visible">True</property> 
            <property name="can_focus">True</property> 
            <property name="receives_default">True</property> 
            <property name="use_stock">True</property> 
          </object> 
          <packing> 
            <property name="expand">False</property> 
            <property name="fill">True</property> 
            <property name="position">3</property> 
          </packing> 
        </child> 
        <child> 
          <object class="GtkButton" id="button1"> 
            <property name="label">gtk-close</property> 
            <property name="visible">True</property> 
            <property name="can_focus">True</property> 
            <property name="receives_default">True</property> 
            <property name="use_stock">True</property> 
            <signal name="clicked" handler="closeprogram" swapped="no"/> 
          </object> 
          <packing> 
            <property name="expand">False</property> 
            <property name="fill">True</property> 
            <property name="position">4</property> 
          </packing> 
        </child> 
      </object> 
    </child> 
  </object> 
</interface>

এখনও অবধি নতুন কিছু নেই .. আমরা কেবল একটি পাইথন ফাইল এবং এর ইন্টারফেস ফাইল তৈরি করেছি। এখন একই ফোল্ডারে একটি " সেটআপ.পি " ফাইল তৈরি করুন এবং এতে নিম্নলিখিত কোড যুক্ত করুন, প্রতিটি লাইনের মন্তব্যে ব্যাখ্যা করা হয়েছে।

# Here we imported the 'setup' module which allows us to install Python scripts to the local system beside performing some other tasks, you can find the documentation here: https://docs.python.org/2/distutils/apiref.html 
from distutils.core import setup 

setup(name = "myprogram", # Name of the program. 
      version = "1.0", # Version of the program. 
      description = "An easy-to-use web interface to create & share pastes easily", # You don't need any help here. 
      author = "TecMint", # Nor here. 
      author_email = "[email ",# Nor here :D 
      url = "http://example.com", # If you have a website for you program.. put it here. 
      license='GPLv3', # The license of the program. 
      scripts=['myprogram'], # This is the name of the main Python script file, in our case it's "myprogram", it's the file that we added under the "myprogram" folder. 

# Here you can choose where do you want to install your files on the local system, the "myprogram" file will be automatically installed in its correct place later, so you have only to choose where do you want to install the optional files that you shape with the Python script 
      data_files = [ ("lib/myprogram", ["ui.glade"]), # This is going to install the "ui.glade" file under the /usr/lib/myprogram path. 
                     ("share/applications", ["myprogram.desktop"]) ] ) # And this is going to install the .desktop file under the /usr/share/applications folder, all the folder are automatically installed under the /usr folder in your root partition, you don't need to add "/usr/ to the path. 

এখন একই ফোল্ডারে একটি " মাইপোগ্রাম.ডেস্কটপ " ফাইল তৈরি করুন এবং নিম্নলিখিত কোড যুক্ত করুন, এটি মন্তব্যেও ব্যাখ্যা করা হয়েছে।

# This is the .desktop file, this file is the responsible file about showing your application in the applications menu in any desktop interface, it's important to add this file to your project, you can view more details about this file from here: https://developer.gnome.org/integration-guide/stable/desktop-files.html.en 
[Desktop Entry] 
# The default name of the program. 
Name=My Program 
# The name of the program in the Arabic language, this name will be used to display the application under the applications menu when the default language of the system is Arabic, use the languages codes to change the name for each language. 
Name[ar]=برنامجي 
# Description of the file. 
Comment=A simple test program developed by me. 
# Description of the file in Arabic. 
Comment[ar]=برنامج تجريبي بسيط تم تطويره بواسطتي. 
# The command that's going to be executed when the application is launched from the applications menu, you can enter the name of the Python script or the full path if you want like /usr/bin/myprogram 
Exec=myprogram 
# Do you want to run your program from the terminal? 
Terminal=false 
# Leave this like that. 
Type=Application 
# Enter the name of the icon you want to use for the application, you can enter a path for the icon as well like /usr/share/pixmaps/icon.png but make sure to include the icon.png file in your project folder first and in the setup.py file as well. Here we'll use the "system" icon for now. 
Icon=system 
# The category of the file, you can view the available categories from the freedesktop website.
Categories=GNOME;GTK;Utility; 
StartupNotify=false 

আমরা এখনই এখানে প্রায় সম্পন্ন হয়েছি .. " ডিপি কেজি " এর জন্য আমাদের প্যাকেজ সম্পর্কে তথ্য সরবরাহ করার জন্য আমাদের " ডেবিয়ান " ফোল্ডারের নীচে কিছু ছোট ফাইল তৈরি করতে হবে পদ্ধতি.

ডেবিয়ান ফোল্ডারটি খুলুন এবং নিম্নলিখিত ফাইলগুলি তৈরি করুন।

control
compat
changelog
rules

নিয়ন্ত্রণ : এই ফাইলটি ডেবিয়ান প্যাকেজ সম্পর্কে প্রাথমিক তথ্য সরবরাহ করে, আরও তথ্যের জন্য, দয়া করে ডেবিয়ান প্যাকেজ নিয়ন্ত্রণ ক্ষেত্রগুলি দেখুন visit

Source: myprogram
Maintainer: My Name <[email > 
Section: utils 
Priority: optional 
Standards-Version: 3.9.2 
Build-Depends: debhelper (>= 9), python2.7 

Package: myprogram 
Architecture: all 
Depends: python-gi 
Description: My Program 
Here you can add a short description about your program.

কমপ্যাট : এটি ডিপি কেজি সিস্টেমের জন্য কেবল একটি গুরুত্বপূর্ণ ফাইল, এটিতে কেবল theন্দ্রজালিক 9 নম্বর অন্তর্ভুক্ত রয়েছে, এটি ছেড়ে দিন।

9

চেঞ্জলগ : এখানে আপনি আপনার প্রোগ্রামে করা পরিবর্তনগুলি যুক্ত করতে সক্ষম হবেন, আরও তথ্যের জন্য, দয়া করে ডেবিয়ান প্যাকেজ চেঞ্জলগ উত্সটি দেখুন।

myprogram (1.0) trusty; urgency=medium 

  * Add the new features here. 
  * Continue adding new changes here. 
  * And here. 

 -- My Name Here <[email >  Sat, 27 Dec 2014 21:36:33 +0200

বিধি : এই ফাইলটি প্যাকেজটি ইনস্টল করতে স্থানীয় মেশিনে ইনস্টলেশন প্রক্রিয়া চালনার জন্য দায়ী, আপনি আরও তথ্য দেখতে পারবেন
এখান থেকে এই ফাইলটি সম্পর্কে: দেবিয়ান প্যাকেজ ডিফল্ট বিধিগুলি।

যদিও আপনার পাইথন প্রোগ্রামের জন্য আপনার আর কোনও প্রয়োজন হবে না।

#!/usr/bin/make -f 
# This file is responsible about running the installation process on the local machine to install the package, you can view more information about this file from here: https://www.debian.org/doc/manuals/maint-guide/dreq.en.html#defaultrules Though you won't need anything more for your Python program. 
%: 
    dh [email  
override_dh_auto_install: 
    python setup.py install --root=debian/myprogram --install-layout=deb --install-scripts=/usr/bin/ # This is going to run the setup.py file to install the program as a Python script on the system, it's also going to install the "myprogram" script under /usr/bin/ using the --install-scripts option, DON'T FORGET TO REPLACE "myprogram" WITH YOUR PROGRAM NAME. 
override_dh_auto_build:

এখন আমরা সফলভাবে আমাদের প্রোগ্রামের জন্য প্রয়োজনীয় সমস্ত ফাইল তৈরি করেছি, এখন এটি প্যাকেজিং শুরু করি। প্রথমে নিশ্চিত হয়ে নিন যে আপনি শুরু করার আগে বিল্ড প্রক্রিয়াটির জন্য কিছু নির্ভরতা ইনস্টল করে রেখেছেন।

$ sudo apt-get update
$ sudo apt-get install devscripts

এখন কল্পনা করুন যে " মাইপোগ্রাম " ফোল্ডারটি আপনার হোম ফোল্ডারে (/হোম/ব্যবহারকারী/মাইপোগ্রাম ) এ এটি একটি ডেবিয়ান প্যাকেজ হিসাবে প্যাকেজ করতে, নীচের কমান্ডগুলি চালান।

$ cd /home/user/myprogram
$ debuild -us -uc
[email :~/Projects/myprogram$
debuild -us -uc dpkg-buildpackage -rfakeroot -D -us -uc
dpkg-buildpackage: source package myprogram
dpkg-buildpackage: source version 1.0
dpkg-buildpackage: source distribution trusty
dpkg-buildpackage: source changed by My Name Here
<[email >
dpkg-source --before-build myprogram
dpkg-buildpackage: host architecture i386
fakeroot debian/rules clean
dh clean
dh_testdir
dh_auto_clean
....
.....
Finished running lintian.

এবং এটাই ! আপনার ডেবিয়ান প্যাকেজটি সফলভাবে তৈরি করা হয়েছিল:

এটি কোনও ডেবিয়ান-ভিত্তিক বিতরণে ইনস্টল করার জন্য, চালান।

$ sudo dpkg -i myprogram_1.0_all.deb

প্যাকেজের নামের সাথে উপরের ফাইলটি প্রতিস্থাপন করতে ভুলবেন না .. এখন আপনি প্যাকেজটি ইনস্টল করার পরে আপনি অ্যাপ্লিকেশন মেনু থেকে প্রোগ্রামটি চালাতে পারবেন।

এবং এটি কাজ করবে ..

পাইগোবজেক্ট সম্পর্কে আমাদের সিরিজের চতুর্থ অংশটি এখানেই শেষ হয়েছে ... পরের পাঠে আমরা কীভাবে সহজেই পিজিওজেক্ট অ্যাপ্লিকেশনকে স্থানীয়করণ করব তা ব্যাখ্যা করব, ততক্ষণ এটির জন্যই থাকুন…